We're trying to run a 32bit app on 64bit CentOS5.2 (RHEL5) systems and
the 32bit version of a certain library is dying horribly because it
disagrees with the kernel module it's interfacing with about the layouts
of various structs.  I can't believe I'm the first person to deal with
this sort of problem but I've STFW and, so far, no luck.

The library in question is libraw1394 and when I compile it from source
in 64bit mode it works - the included test code as well as our own test
programs report success when attempting to talk to Firewire devices.
But those same programs fail when built with GCC's -m32 switch, and GDB
indicates that my locally-compiled library is failing at exactly the
same point that the "official" 32bit library supplied with the OS fails,
so it looks like this is genuine bug in that library.

When I added debug code to the library to dump the sizes and offsets of
the various structure members when built for 32bit and 64bit they're
different in ways that don't surprise me.  For example, in this sort
of situation:

   struct x {
       __u32 x1;
       __u32 x2;
       __u32 x3;
       __u64 x4;
   };

...x4 ends up at offset 12 (being sizeof(int) times 3) when compiled for
32bit but it ends up automatically padded out to offset 16 when compiled
for 64 bit.  I have been able to get the relevant section of library
code to work by padding out some structs with extra dummy members such
that the various members are nudged into positions that agree with the
layouts expected by the kernel's raw1394 module, but that sort of b0rken
hackery is not, of course, how I want to solve this.

I've been looking for something like a magic compiler switch to force
the desired 64bit-style alignments to our 32bit builds - anybody know
what the trick is in this case?
 
_______________________________________________
gnhlug-discuss mailing list
gnhlug-discuss@mail.gnhlug.org
http://mail.gnhlug.org/mailman/listinfo/gnhlug-discuss/

Reply via email to