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

X-Spam-Check-By: sourceware.org
Date: Mon, 18 Sep 2006 10:04:45 +1200
From: Danny Smith <dannysmith AT clear DOT net DOT nz>
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
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


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

- Raw text -


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