Re: How to compile and link 32 bit c code with 64 bit c code‏

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

 



On 01/06/2010 06:29 AM, Qing Wang wrote:

> I noticed that if some c files are compiled as 32 bit code by -m32,
> and others are compiled as 64 bit code by -m64, they will not work
> together.

> But can I add something in the c files (say asm(".code64")) and
> compile all of c files by -m32, and then when the program switches
> into 64 bit mode from 32 bit mode, those ".code64" code can work
> properly (i.e. access the memory above 64G)?

This is impossible for lots of reasons, even if you could change the
processor ito 64-bit mode.  You'll only be linking against one libgcc,
and it'll be either the 32- or 64-bit one.  The shared library loader
will expect either 32- or 64-bit code, and so on.  It's easy to
communicate between 32- and 64-bit processes with pipes or shared
memory.

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