X-Spam-Check-By: sourceware.org Date: Sun, 17 Sep 2006 18:35:03 -0400 From: Christopher Faylor To: cygwin AT cygwin DOT com Subject: Re: -fno-inline -O1 breaks ntohs() Message-ID: <20060917223503.GA5644@trixie.casa.cgf.cx> Reply-To: cygwin AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com References: <20060917201127 DOT GA29813 AT hello-penguin DOT com> <000001c6daa5$4a3c4280$e64861cb AT anykey> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <000001c6daa5$4a3c4280$e64861cb@anykey> User-Agent: Mutt/1.5.11 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 On Mon, Sep 18, 2006 at 10:04:45AM +1200, Danny Smith wrote: > >> 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)) : \ Thanks, Danny. I'll check that in. cgf -- 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/