This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: Intel 80386, version 1 (SYSV) vs Intel 80386, version 1 (GNU/Linux)
- From: Ian Lance Taylor <iant at google dot com>
- To: James Cloos <cloos at jhcloos dot com>
- Cc: gcc-help at gcc dot gnu dot org
- Date: Fri, 01 Oct 2010 08:41:28 -0700
- Subject: Re: Intel 80386, version 1 (SYSV) vs Intel 80386, version 1 (GNU/Linux)
- References: <m3tyl6fjpo.fsf@jhcloos.com>
James Cloos <cloos@jhcloos.com> writes:
> I tried compiling some stuff on my amd64 box for an ia32 box, using -m32
> and and appropriate -march. The resulting libraries worked fine when
> compiled static, but failed when compiled dynamic.
>
> The destination box's executables and libraryies report:
>
> foo: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV),
> dynamically linked (uses shared libs), for GNU/Linux 2.6.9,
> not stripped
>
> whereas the files generated by my amd64 box report:
>
> bar: ELF 32-bit LSB executable, Intel 80386, version 1 (GNU/Linux),
> dynamically linked (uses shared libs), for GNU/Linux 2.6.9,
> not stripped
>
> In readelf format, that is:
>
> OS/ABI: UNIX - System V
> vs:
> OS/ABI: UNIX - Linux
>
> I tried using -Wl,--hash-style=sysv, but the libraries and executables
> still say Linux rather than SYSV. (The .o files say SYSV.)
>
> How do I force the former os/abi?
It is very unlikely that this is your problem.
However, to answer your question, the OS/ABI field will be set to
GNU/Linux if your program has any symbols whose type is STT_GNU_IFUNC.
I assume you didn't add any such symbols yourself, so they almost
certainly come from glibc. There is nothing you can do to force the
OS/ABI field to be System V other than avoid using STT_GNU_IFUNC
symbols. (You could binary edit the field, of course, but it wouldn't
change the fact that you are using a GNU specific symbol type.)
This of course suggests that your problem is that you are building on a
system with a newer version of glibc than the system on which you want
to run the program. This doesn't work in general; glibc is backward
compatible but not forward compatible.
Ian