public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: "H.J. Lu" <hjl.tools@gmail.com>
To: GCC Mailing List <gcc@gcc.gnu.org>
Subject: Re: Building an x86_64-linux-gnux32 (x32) gcc wiki page
Date: Fri, 20 Feb 2015 14:36:00 -0000	[thread overview]
Message-ID: <CAMe9rOqjghNuv2o3bEFCs97z34ndVHhJU4gYdB2WL5ugHD30mQ@mail.gmail.com> (raw)
In-Reply-To: <20150220135117.GB21948@virgil.suse>

On Fri, Feb 20, 2015 at 5:51 AM, Martin Jambor <mjambor@suse.cz> wrote:
> Hi,
>
> I have spent quite some time trying to build an x32 gcc to debug a PR
> this week before I finally found the configure switch that made
> everything work.  In order to share this possibly valuable knowledge,
> I have created a wiki mini-page detailing how I managed to get it
> finally working:
>
> https://gcc.gnu.org/wiki/SettingUpX32GCC
>
> I've linked it from the "Tutorials, HOWTOs" section of the
> GettingStarted page because I did not find a better place.  Of course,
> feel free to correct any mistakes I might have made.
>

Thanks for doing this.

X32 codegen is always enabled for Linux/x86-64 targets.  You just need
to compile x32 run-time to compile programs in x32.  There are 2 ways to
enable x32 run-time:

1.  Configure GCC with --with-multilib-list=m32,m64,mx32.  It will enable
x32 multilib:

[hjl@gnu-tools-1 gcc-x32]$ file build-x86_64-linux/gcc/cc1plus
build-x86_64-linux/gcc/cc1plus: ELF 64-bit LSB executable, x86-64,
version 1 (GNU/Linux), dynamically linked, interpreter
/lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.32,
BuildID[sha1]=7fb3d0574eda3475dfb2247640524bb1099c9751, not stripped
[hjl@gnu-tools-1 gcc-x32]$ ./build-x86_64-linux/gcc/xgcc -v
Using built-in specs.
COLLECT_GCC=./build-x86_64-linux/gcc/xgcc
Target: x86_64-unknown-linux-gnu
Configured with: /export/gnu/import/git/gcc/configure
--enable-clocale=gnu --with-system-zlib --with-demangler-in-ld
--enable-languages=c,c++,fortran,java,lto,objc,obj-c++,go
--prefix=/usr/gcc-5.0.0-x32 --with-local-prefix=/usr/local
--enable-gnu-indirect-function --with-multilib-list=m32,m64,mx32
--enable-linker-build-id --enable-gnu-unique-object --with-fpmath=sse
Thread model: posix
gcc version 5.0.0 20141231 (experimental) (GCC)

[hjl@gnu-tools-1 gcc-x32]$

2.  Configure GCC with --with-abi=mx32.  It will bootstrap GCC into
x32 format with x32 run-time enabled:

[hjl@gnu-tools-1 gcc-x32-mx32]$ file build-x86_64-linux/gcc/cc1plus
build-x86_64-linux/gcc/cc1plus: ELF 32-bit LSB executable, x86-64,
version 1 (GNU/Linux), dynamically linked, interpreter
/libx32/ld-linux-x32.so.2, for GNU/Linux 3.4.0,
BuildID[sha1]=b44082efbfec9ec5e7309445110f266d6f43cbfe, not stripped
[hjl@gnu-tools-1 gcc-x32-mx32]$ ./build-x86_64-linux/gcc/xgcc -v
Using built-in specs.
COLLECT_GCC=./build-x86_64-linux/gcc/xgcc
Target: x86_64-unknown-linux-gnu
Configured with: /export/gnu/import/git/sources/gcc/configure
--enable-languages=c,c++ --disable-bootstrap
--prefix=/usr/gcc-5.0.0-mx32 --with-local-prefix=/usr/local
--enable-gnu-indirect-function --with-multilib-list=m32,m64,mx32
--enable-linker-build-id --enable-gnu-unique-object --with-abi=mx32
--with-fpmath=sse
Thread model: posix
gcc version 5.0.0 20150122 (experimental) (GCC)
[hjl@gnu-tools-1 gcc-x32-mx32]$

Either will produce GCC which support -mx32. x86_64-linux-gnux32 isn't
required to configure
GCC.


-- 
H.J.

      reply	other threads:[~2015-02-20 14:36 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-20 13:51 Martin Jambor
2015-02-20 14:36 ` H.J. Lu [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAMe9rOqjghNuv2o3bEFCs97z34ndVHhJU4gYdB2WL5ugHD30mQ@mail.gmail.com \
    --to=hjl.tools@gmail.com \
    --cc=gcc@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).