gcc 4.1* carashes compiling llvm-gcc

Hi,

I tried to compile the GCC front end of LLVM in a 16 CPU SMP machine
with 64bit intel xeon CPUs. I tried with (GCC 4.1.0, 4.1.1, 4.1.2
versions). The LLVM compiles perfectly but when compiling the gcc
front end the compiler crashes with a segmentation fault by reporting
for memory leakages. Probably this is for the GCC's mailing list, but
decided to ask if you know anything more about similar cases. By the
way, I compile it without problems in mu personal 32bit architecture
PC with the same version of compiler (4.1.2)

Regards,
Ferad

GCC 4.1.x series is known not to compile LLVM. Its is well documented, avoid GCC 4.1.

Aaron

Yes, you I read that in the docs. Do you have a preferred gcc version
that you would suggest me to work best. Unfortunately, version 3.4.2
that you suggest in your docs fails in compilation too.

Thanks,
Ferad

Hello, Ferad.

Yes, you I read that in the docs. Do you have a preferred gcc version
that you would suggest me to work best. Unfortunately, version 3.4.2
that you suggest in your docs fails in compilation too.

4.0.x series are known to compile LLVM well (at least 4.0.4).

Hi again,

When I compile LLVM (only) with version 3.4.* I get a link error like that

Linking Release executable opt (without symbols)

`.gnu.linkonce.t._ZN4llvm12SCEVExpander6expandEPNS_4SCEVE' referenced
in section `.rodata' of
/home/ferad/llvm/llvm-obj/Release/lib/libLLVMAnalysis.a(ScalarEvolutionExpander.o):
defined in discarded section
`.gnu.linkonce.t._ZN4llvm12SCEVExpander6expandEPNS_4SCEVE' of
/home/ferad/llvm/llvm-obj/Release/lib/libLLVMAnalysis.a(ScalarEvolutionExpander.o)

collect2: ld returned 1 exit status

Do you know why does it happens?

Thanks,
Ferad

Hello, Ferad.

`.gnu.linkonce.t._ZN4llvm12SCEVExpander6expandEPNS_4SCEVE' referenced
in section `.rodata' of
/home/ferad/llvm/llvm-obj/Release/lib/libLLVMAnalysis.a(ScalarEvolutionExpander.o):
defined in discarded section
`.gnu.linkonce.t._ZN4llvm12SCEVExpander6expandEPNS_4SCEVE' of
/home/ferad/llvm/llvm-obj/Release/lib/libLLVMAnalysis.a(ScalarEvolutionExpander.o)

collect2: ld returned 1 exit status

What's the version of binutils you're using? I've seen such messages
with 2.16 series, but they were only warnings...

Hi Anton,

What's the version of binutils you're using? I've seen such messages
with 2.16 series, but they were only warnings...

The version of binutils is 2.17

By the way. I will use the opportunity to ask you again :slight_smile: I tried to
compile with gcc 4.0.4. It successfully compile LLVM but fails
compiling LLVM's gcc front end. The problem is architectural 32 and 64
bit. The machine has intel xeon CPU that is physically 32 bit but has
64 extension x86_64 (or something like that, I am not exactly sure).
The error message that I get is bellow. I noticed also that the
compilation command specifies "-m32" flag which probably shouldn't be
passed.

/home/ferad/llvm/llvm-gcc-obj/gcc/xgcc
-B/home/ferad/llvm/llvm-gcc-obj/gcc/ -B/h
                ome/ferad/llvm/llvm-gcc/x86_64-unknown-linux-gnu/bin/
-B/home/ferad/llvm/llvm-gc
c/x86_64-unknown-linux-gnu/lib/ -isystem
/home/ferad/llvm/llvm-gcc/x86_64-unknow
              n-linux-gnu/include -isystem
/home/ferad/llvm/llvm-gcc/x86_64-unknown-linux-gnu/
                          sys-include -O2 -DIN_GCC -W -Wall
-Wwrite-strings -Wstrict-prototypes -Wmissi
                  ng-prototypes -Wold-style-definition -isystem
./include -I. -I32 -I../../llvm-
        gcc-src/gcc -I../../llvm-gcc-src/gcc/32
-I../../llvm-gcc-src/gcc/../include -I..
               /../llvm-gcc-src/gcc/../libcpp/include
-I/home/ferad/llvm/llvm-1.9/include -I/h
               ome/ferad/llvm/llvm-obj/include -m32 -g0
-finhibit-size-directive -fno-inline-fu
              nctions -fno-exceptions -fno-zero-initialized-in-bss
-fno-unit-at-a-time -fno-om
  it-frame-pointer -fno-asynchronous-unwind-tables \

   -c ../../llvm-gcc-src/gcc/crtstuff.c -DCRT_BEGIN \

  -o 32/crtbegin.o

Warning: Generation of 64-bit code for a 32-bit processor requested.

In file included from ../../llvm-gcc-src/gcc/crtstuff.c:67:

../../llvm-gcc-src/gcc/unwind-dw2-fde.h: In function âget_cieâ:

../../llvm-gcc-src/gcc/unwind-dw2-fde.h:163: warning: return from
incompatible p ointer
type

/tmp/ccCUQ9uX.s: Assembler messages:

/tmp/ccCUQ9uX.s:11: Error: `completed.4804(%rip)' is not a valid
base/index expr ession

/tmp/ccCUQ9uX.s:17: Error: `p.4803(%rip)' is not a valid base/index expression

/tmp/ccCUQ9uX.s:18: Error: bad register name `%rax'

/tmp/ccCUQ9uX.s:20: Error: `p.4803(%rip)' is not a valid base/index expression

/tmp/ccCUQ9uX.s:21: Error: bad register name `%rax)'

/tmp/ccCUQ9uX.s:22: Error: bad register name `%rax'

/tmp/ccCUQ9uX.s:25: Error: `completed.4804(%rip)' is not a valid
base/index expr ession

Thanks,
Ferad

Ferad Zyulkyarov wrote:

By the way. I will use the opportunity to ask you again :slight_smile: I tried to
compile with gcc 4.0.4. It successfully compile LLVM but fails
compiling LLVM's gcc front end. The problem is architectural 32 and 64
bit. The machine has intel xeon CPU that is physically 32 bit but has
64 extension x86_64 (or something like that, I am not exactly sure).
The error message that I get is bellow. I noticed also that the
compilation command specifies "-m32" flag which probably shouldn't be
passed.

i had the same errors. adding "--disable-multilib" to configure solved
the problem. but i guess this is not a general solution.

florian

i had the same errors. adding "--disable-multilib" to configure solved
the problem. but i guess this is not a general solution.

Thanks, that worked. Probably it would be good if this issue is
included in the readme file for gcc-front end.

Regards,
Ferad

> i had the same errors. adding "--disable-multilib" to configure solved
> the problem. but i guess this is not a general solution.

Thanks, that worked. Probably it would be good if this issue is
included in the readme file for gcc-front end.

The problem looked (to me) like an inline assembly issue. These messages
in particular:

/tmp/ccCUQ9uX.s:11: Error: `completed.4804(%rip)' is not a valid
base/index expression
/tmp/ccCUQ9uX.s:17: Error: `p.4803(%rip)' is not a valid base/index
expression
/tmp/ccCUQ9uX.s:18: Error: bad register name `%rax'
/tmp/ccCUQ9uX.s:20: Error: `p.4803(%rip)' is not a valid base/index
expression
/tmp/ccCUQ9uX.s:21: Error: bad register name `%rax)'
/tmp/ccCUQ9uX.s:22: Error: bad register name `%rax'
/tmp/ccCUQ9uX.s:25: Error: `completed.4804(%rip)' is not a valid
base/index expression

All of the quoted code looks like inline assembly. It is likely these
are coming from system header files. If not, they may be coming from the
GCC runtime code. In order to debug this, you'd need to provide the
pre-processed input that was trying to be compiled. It is also possible
that the "host" machine for your machine was calculated incorrectly and
you're attempting to compile assembly that doesn't match the machine.

Reid.