delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2006/09/17/18:35:12

X-Spam-Check-By: sourceware.org
Date: Sun, 17 Sep 2006 18:35:03 -0400
From: Christopher Faylor <cgf-no-personal-reply-please AT cygwin DOT com>
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
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
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
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 <arpa/inet.h>
>> 
>> 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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019