How to build a 64-bit gcc on a hybrid 32-bit/64-bit (Intel) GNU/Linux system

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

 



Dear list,

I have a system running Debian GNU/Linux 8.7 (stable/jessie) on Intel
hardware that is capable of executing both 32-bit (=i686) and 64-bit
(=x86_64) code; it has a 64-bit kernel and a mostly 32-bit userland
(default personality is i686), but a number of additional 64-bit
libraries (runtime and development) are installed.  The system gcc and
binutils are 32-bit binaries but are capable of compiling 64-bit code
with the -m64 switch (and the binaries will then run successfully).

I would like to use this system to compile a 64-bit binary of
gcc-4.9.4 (it should be able to compile both 32-bit and 64-bit code,
defaulting to 64-bit).  Ideally, this gcc should be essentially
identical to a version compiled, and fully bootstrapped, with the
default options, on a 64-bit Debian system (having the same packages).

What would be the correct way to achieve this?

My first naïve attempt was to setarch x86_64 and provide gcc and g++
shell scripts which add the -m64 switch to the command line.  This
fails essentially because gcc tries to use a linker plugin (64-bit,
obviously) which is incompatible with the (32-bit) system ld.  I don't
know how to bootstrap my way around this.

I tried a number of other approaches, like trying to ignore the fact
that the system can already compile and execute 64-bit binaries and
attempting a full cross-compiler bootstrap (with and without
binutils), but everything failed so far.  I can give a detail account
of what failed, of course, but lest I flood this list with a
description of every stupid attempt I made, let me first ask how I
_should_ have proceeded.

Thanks for any help,

-- 
     David A. Madore
   ( http://www.madore.org/~david/ )



[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