[olsr-dev] [PATCH] Make olsrd almost compile on x86_64

Bernd Petrovitsch (spam-protected)
Sat Nov 19 00:00:48 CET 2005

The attached patch kills warnings and errors on Linux x86_64 with
gcc-4.0.2. It further kills other warnings.
The main problems were:
- pointer do not fit in ints/unsigned ints. We need long
  ints/unsigned long ints there.
- sizeof() is of type "unsigned long" which needs a different format in
  printf() or the supplied cast to "int" fitting to the format string.
- The patch declares "fromlen" variables correctly as "socklen_t" (and
  no longer as "size_t").
- x86_64 seems to need -fPIC everywhere, not just on the plugins.
- The patch adds parentheses around the GET_TIMESTAMP macro to avoid
  nasty bugs on e.g. "8 * GET_TIMESTAMP(xx)"
- The patch uses pointer arithmetic instead of cast to int, calculate
  and cast back to a pointer.

sizeof(char) = 1
sizeof(short int) = 2
sizeof(int) = 4
sizeof(long int) = 8
sizeof(long long int) = 8
sizeof(float) = 4
sizeof(double) = 8
sizeof(void *) = 8
on Linux/x86_64.
x86 is the same except:
sizeof(long int) = 4
sizeof(void *) = 4

Firmix Software GmbH                   http://www.firmix.at/
mobil: +43 664 4416156                 fax: +43 1 7890849-55
          Embedded Linux Development and Services

-------------- next part --------------
A non-text attachment was scrubbed...
Name: x86_64.patch
Type: text/x-patch
Size: 2923 bytes
Desc: not available
URL: <http://lists.olsr.org/pipermail/olsr-dev/attachments/20051119/0532f0d3/attachment.bin>

More information about the Olsr-dev mailing list