Compiling llvm-gcc on amd64 with 32 bits: assembler still carps

Hello, Joachim.

What's wrong?

Looks like, it uses 64-bit assembler. Could you please check installed
binutils?

Hello, Joachim.

> What's wrong?
Looks like, it uses 64-bit assembler.

That was my assumption as well.

Could you please check installed binutils?

$ llvm-as -version
Low Level Virtual Machine (http://llvm.org/):
  llvm version 2.3svn
  Optimized build with assertions.

$ as --version
GNU assembler (GNU Binutils for Ubuntu) 2.18
Copyright 2007 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms
of the GNU General Public License version 3 or later.
This program has absolutely no warranty.
This assembler was configured for a target of `x86_64-linux-gnu'.

I'm using --build=i686-pc-linux-gnu --host=i686-pc-linux-gnu
--target=i686-pc-linux-gnu as configure options though, so it *should*
assemble in 32-bit mode. (Unless configure or the makefiles got
something wrong and aren't determining the right options from
--build/host/target.)

Regards,
Jo

Hello, Joachim

This assembler was configured for a target of `x86_64-linux-gnu'.

Hrm, try to check, how 'as' is invoked by llvm-gcc, you need jut to run
the mentioned cmdline 'by hands':

./xgcc -B./ -B/home/jo/i686-pc-linux-gnu/bin/
-isystem /home/jo/i686-pc-linux-gnu/include
-isystem /home/jo/i686-pc-linux-gnu/sys-include
-L/home/jo/llvm-gcc-wrk/gcc/../ld -O2 -DIN_GCC -W -Wall
-Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes
-Wold-style-definition -isystem ./include -I. -I.
-I/home/jo/llvm-gcc-src/gcc -I/home/jo/llvm-gcc-src/gcc/.
-I/home/jo/llvm-gcc-src/gcc/../include
-I/home/jo/llvm-gcc-src/gcc/../libcpp/include
-I/home/jo/llvm-gcc-src/gcc/../libdecnumber -I../libdecnumber -g0
-finhibit-size-directive -fno-inline-functions -fno-exceptions
-fno-zero-initialized-in-bss -fno-toplevel-reorder
-fno-omit-frame-pointer \
          -c /home/jo/llvm-gcc-src/gcc/crtstuff.c -DCRT_BEGIN \
          -o crtbegin.o

plus, add '-v' option to see, what is really executed.

This *is* interesting. Turns out it's calling

  /home/jo/llvm-gcc-wrk/./gcc/as --traditional-format -V -Qy
  -o crtbegin.o /tmp/ccFNX5fN.s

... but the assembler is reporting

  GNU assembler version 2.18 (x86_64-linux-gnu) using BFD version (GNU
  Binutils for Ubuntu) 2.18

anyway, strange...
... ah, turns out /home/jo/llvm-gcc-wrk/./gcc/as is just a shell script
that execs /usr/bin/as, which of course is just the preinstalled 64-bit
as.
I still don't understand why it isn't getting a --32 or -m32 option,
somewhere in the configure-makefile-gcc chain there *should* be
something that's responsible for translating --build/host/target to one
of these options.

Now off to trying Tanya's approach :slight_smile:

Regards
Jo