Configuring binutils for x32 default output

193 views
Skip to first unread message

Daniel Schepler

unread,
Jun 12, 2012, 6:58:24 PM6/12/12
to x32...@googlegroups.com
I just noticed that even building in an x32-only chroot, binutils 2.22 still ends up with the default target as elf_x86_64.  Therefore, a sequence like
  gcc -c file1.c
  gcc -c file2.c
  ld -r -o allmycode.o file1.o file2.o
doesn't work as it should (it gives an error regarding target mismatches).  Is there any way to configure binutils with the default target being elf32_x86_64?  Or will I have to patch bfd/config.bfd and ld/configure.tgt, or something else, to support that?
--
Daniel Schepler

H.J. Lu

unread,
Jun 12, 2012, 7:02:54 PM6/12/12
to x32...@googlegroups.com
Please get binutils 2.22.52.0.4 and configure binutils with x86_64-linux-gnux32.
You will get x32 binutils.


--
H.J.

Daniel Schepler

unread,
Jun 12, 2012, 7:08:41 PM6/12/12
to x32...@googlegroups.com
On Tuesday, June 12, 2012 4:02:54 PM UTC-7, H.J. wrote:
Please get binutils 2.22.52.0.4 and configure binutils with x86_64-linux-gnux32.
You will get x32 binutils.

OK, thanks.  Since that's what Debian is passing anyway on x32, that should work well.
--
Daniel Schepler

Mike Frysinger

unread,
Jun 12, 2012, 10:55:07 PM6/12/12
to x32...@googlegroups.com
On Tue, Jun 12, 2012 at 7:02 PM, H.J. Lu <hjl....@gmail.com> wrote:
> On Tue, Jun 12, 2012 at 3:58 PM, Daniel Schepler <dsch...@gmail.com> wrote:
>> I just noticed that even building in an x32-only chroot, binutils 2.22 still
>> ends up with the default target as elf_x86_64.  Therefore, a sequence like
>>   gcc -c file1.c
>>   gcc -c file2.c
>>   ld -r -o allmycode.o file1.o file2.o
>> doesn't work as it should (it gives an error regarding target mismatches).
>> Is there any way to configure binutils with the default target being
>> elf32_x86_64?  Or will I have to patch bfd/config.bfd and ld/configure.tgt,
>> or something else, to support that?
>
> Please get binutils 2.22.52.0.4 and configure binutils with x86_64-linux-gnux32.
> You will get x32 binutils.

it would still be nice if this were controllable, but maybe that
doesn't matter ... is this the recommended tuple that people will be
going with ? i started out with x86_64-x32-linux-gnu, but had to
abandon that because glibc will use the $vendor field in
auto-detecting ABI. so building with -m64/-m32 always fails because
the $vendor selects x32 ABI for me. i wasn't too keen on
x86_64-pc-linux-gnu due to the ambiguity with the -m64 ABI.
-mike

H.J. Lu

unread,
Jun 13, 2012, 12:08:48 AM6/13/12
to x32...@googlegroups.com
I have been using x86_64-linux-gnux32 as target with
CC="gcc -mx32" CXX="g++ -mx32".

--
H.J.
Reply all
Reply to author
Forward
0 new messages