This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: -fno-inline -O1 breaks ntohs()



> 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)) : \


--
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/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]