Re: x86 32-bits compiler use on a 64-bits machine ?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Christophe LYON wrote:
> Hi Andrew,
> 
> Thanks for your answer.
> 
>>> The documentation only mentions the size of int and pointer types.
>>
>> The gcc documentation talks only about gcc; you're asking about the
>> system linker.
>>
> 
> I did not mean that.
> If I compile a.c with "gcc-x.x.x (32 bits)" on a Pentium 4 machine, and
> with "gcc-x.x.x (64 bits) -m32" on an Opteron, am I guaranteed that both
> a.o will have the same contents?

With the same compiler version and the same inputs to the compiler and
the same compiler options, yes.

You'll have to make sure that, for example, the 32-bit headers and libraries
are the *exact* same versions on both.

> Any risk that the file compiled on Opteron contains Opteron-only
> instructions for instance? Or references only 64 bits variants of some
> system structures?

Sub-arch specifications are controlled by the -march= option.  If you
say -march=i586 on both compiles, you won't get any instructions later
than i586.

> If I compile a.c with "gcc-x.x.x (32 bits)" on a Pentium 4 machine, and
> b.c with "gcc-x.x.x (64 bits) -m32" on an Opteron, I need to be able to
> link a.o and b.o together and that the result is actually meaningful on
> a Pentium 4.

With the correct -march= specification, yes.

Andrew.

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux