This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


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 Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]