X-Spam-Check-By: sourceware.org Date: Mon, 18 Sep 2006 10:04:45 +1200 From: Danny Smith Subject: RE: -fno-inline -O1 breaks ntohs() In-reply-to: <20060917201127.GA29813@hello-penguin.com> To: cygwin AT cygwin DOT com Cc: pcg AT goof DOT com Message-id: <000001c6daa5$4a3c4280$e64861cb@anykey> MIME-version: 1.0 X-Mailer: Microsoft Outlook, Build 10.0.2627 Content-type: text/plain; charset=windows-1250 Content-transfer-encoding: 7bit Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com > Testcase: > ------------------------------ > #include > > int main() > { > volatile short s = 33, t; > > t = ntohs(s); > return 0; > } > ------------------------------ > > > i686-pc-cygwin-gcc -fno-inline -o test test.c > i686-pc-cygwin-gcc -O1 > > -fno-inline -o test test.c > /tmp/ccswmuY9.o:test.c:(.text+0x27): undefined reference to `___ntohs' > collect2: ld returned 1 exit status > > Try the obvious patch to include/asm/byteorder.h *** byteorder.h.bak Wed May 17 19:41:51 2006 --- byteorder.h Mon Sep 18 09:58:37 2006 *************** __ntohs(uint16_t x) *** 70,76 **** #define __constant_htonl(x) __constant_ntohl(x) #define __constant_htons(x) __constant_ntohs(x) ! #ifdef __OPTIMIZE__ # define ntohl(x) \ (__builtin_constant_p((long)(x)) ? \ __constant_ntohl((x)) : \ --- 70,76 ---- #define __constant_htonl(x) __constant_ntohl(x) #define __constant_htons(x) __constant_ntohs(x) ! #if defined __OPTIMIZE__ && !defined __NO_NOINLINE__ # define ntohl(x) \ (__builtin_constant_p((long)(x)) ? \ __constant_ntohl((x)) : \ -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/