This is the mail archive of the gdb@sourceware.cygnus.com mailing list for the GDB project.


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

Re: wrong htons() used?


   Date: Thu, 21 Oct 1999 16:57:02 -0500
   From: Grant.Edwards@comtrol.com

   I'm confused.  I ran the source file through gcc -E, and all
   looked well.  There was an extern decl for htons, and calls
   to htons in the right places.

   I built it with -Wl,-Map,gdb.map and htons shows up in the map
   file, and everything works.

   I don't know what I did to fix it, so I take out
   -Wl,-Map,gdb.map and rebuild it without generating the map
   file, and it doesn't work.

   I put the -Wl,-Map,gdb.map back in, and this time htons
   _doesn't_ show up in the map file and the binary doesn't work.

   I can't figure out what I did to make it work that one time...

You probably disabled optimization, and renabled it later on.  On my
system, which uses glibc-2.1, if you compile with optimization htons
is an optimizing macro that uses inline assembly to do the conversion (see
/usr/include/netinet/in.h and /usr/include/bits/byteswap.h).  Somehow
you are using ARM headers to compile i386 code or the other way
around.  As a workaround you could try to compile without
optimization, but that doesn't really solve your problem.  If you're
using GCC you could use the `-v' compiler option to see what headers
are used.

Mark

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