[LLVMdev] Problems compiling llvm-gcc4 frontend on x86_64

Warren Armstrong warren.armstrong at anu.edu.au
Sun May 27 06:23:43 PDT 2007


Hi Bill,

I didn't explicitly set -m32, but I tried redoing things with -m64, and
everything works fine.

The reason I was using the source version is that I was running into the
same sort of error when trying to compile C code - my simple Hello World
C program was failing to compile, with error messages from the assembler
similar to those reported below.  When I passed -v to llvm-gcc, it
reported that it was configured for x86, but the local assembler (gnu
as) was configured for x86_64 - I thought there might be a mismatch
there.  Hence I decided to try with a copy of llvm-gcc configured for
x86_64.

Cheers,
Warren


Bill Wendling wrote:
> Hi Warren,
> 
> You have the -m32 flag set, but it's still giving you this:
> 
>> Warning: Generation of 64-bit code for a 32-bit processor requested.
>> Warning: 64-bit processors all have at least SSE2.
> 
> But are you sure you want to compile the LLVM-GCC source? You should  
> use the binaries unless absolutely necessary.
> 
> -bw
> 
> On May 24, 2007, at 10:34 PM, Warren Armstrong wrote:
> 
>> Hi all,
>>
>> I've run into problems compiling the llvm-gcc frontend on x86_64.   
>> Is this
>> not supported, or am I making an error somewhere?
>>
>> The procedure I followed was:
>>
>> 1. Download LLVM 2.0 source as a tarball (from a few days ago, during
>> the testing phase).
>> 2. Download the llvm-gcc4 source today, as a tarball.
>> 3. Extract both.
>>
>> 4. Configure LLVM as: ../src/configure --prefix=`pwd`../install
>> --enable-optimized --enable-jit --enable-targets=host-only
>> (There is no llvm-gcc in the path)
>> 5. make ENABLE_OPTIMIZED=1
>>
>> 6. Configure the frontend as:
>> ../llvm-gcc4-2.0.source/configure --prefix=`pwd`../install
>> --program-prefix=llvm- --enable-llvm=/home/warren/llvm/obj/
>> --enable-languages=c,c++ --disable-shared
>>
>> 7. make LLVM_VERSION_INFO=2.0
>>
>> This produced errors from the assembler.  I reran the failing command
>> with -v, and got the output below.
>> I then changed the command to use -S instead of -c, the resulting
>> assembler is attached.
>>
>> Any advice gratefully received.
>>
>> Cheers,
>> Warren
>>
>> --------------
>>
>> Failing command:
>>
>>
>> warren at sunnyvale:~/llvm-gcc/obj/gcc> /home/warren/llvm-gcc/obj/gcc/ 
>> xgcc
>> -v -B/home/warren/llvm-gcc/obj/gcc/
>> -B/home/warren/llvm-gcc/obj../install/x86_64-unknown-linux-gnu/bin/
>> -B/home/warren/llvm-gcc/obj../install/x86_64-unknown-linux-gnu/lib/
>> -isystem
>> /home/warren/llvm-gcc/obj../install/x86_64-unknown-linux-gnu/include
>> -isystem
>> /home/warren/llvm-gcc/obj../install/x86_64-unknown-linux-gnu/sys- 
>> include
>> -O2 -DIN_GCC    -W -Wall -Wwrite-strings -Wstrict-prototypes
>> -Wmissing-prototypes -Wold-style-definition  -isystem ./include  -I.
>> -I32 -I../../llvm-gcc4-2.0.source/gcc
>> -I../../llvm-gcc4-2.0.source/gcc/32
>> -I../../llvm-gcc4-2.0.source/gcc/../include
>> -I../../llvm-gcc4-2.0.source/gcc/../libcpp/include
>> -I/home/warren/llvm/llvm-2.0/include -I/home/warren/llvm/obj//include
>> -m32 -g0 -finhibit-size-directive -fno-inline-functions -fno- 
>> exceptions
>> -fno-zero-initialized-in-bss -fno-unit-at-a-time -fno-omit-frame- 
>> pointer
>> -fno-asynchronous-unwind-tables    -c
>> ../../llvm-gcc4-2.0.source/gcc/crtstuff.c -DCRT_BEGIN   -o 32/ 
>> crtbegin.o
>> Reading specs from /home/warren/llvm-gcc/obj/gcc/specs
>> Target: x86_64-unknown-linux-gnu
>> Configured with: ../llvm-gcc4-2.0.source/configure
>> --prefix=/home/warren/llvm-gcc/obj../install --program-prefix=llvm-
>> --enable-llvm=/home/warren/llvm/obj/ --enable-languages=c,c++
>> --disable-shared
>> Thread model: posix
>> gcc version 4.0.1 LLVM (Apple Computer, Inc. build 2.0)
>>  /home/warren/llvm-gcc/obj/gcc/cc1 -quiet -v -I. -I32
>> -I../../llvm-gcc4-2.0.source/gcc -I../../llvm-gcc4-2.0.source/gcc/32
>> -I../../llvm-gcc4-2.0.source/gcc/../include
>> -I../../llvm-gcc4-2.0.source/gcc/../libcpp/include
>> -I/home/warren/llvm/llvm-2.0/include -I/home/warren/llvm/obj//include
>> -iprefix
>> /home/warren/llvm-gcc/obj/gcc/../lib/gcc/x86_64-unknown-linux-gnu/ 
>> 4.0.1/
>> -isystem /home/warren/llvm-gcc/obj/gcc/include -DIN_GCC -DCRT_BEGIN
>> -isystem
>> /home/warren/llvm-gcc/obj../install/x86_64-unknown-linux-gnu/include
>> -isystem
>> /home/warren/llvm-gcc/obj../install/x86_64-unknown-linux-gnu/sys- 
>> include
>> -isystem ./include ../../llvm-gcc4-2.0.source/gcc/crtstuff.c -quiet
>> -dumpbase crtstuff.c -m32 -mtune=generic -auxbase-strip 32/crtbegin.o
>> -g0 -O2 -W -Wall -Wwrite-strings -Wstrict-prototypes
>> -Wmissing-prototypes -Wold-style-definition -version
>> -finhibit-size-directive -fno-inline-functions -fno-exceptions
>> -fno-zero-initialized-in-bss -fno-unit-at-a-time -fno-omit-frame- 
>> pointer
>> -fno-asynchronous-unwind-tables -o /tmp/ccBy56Wo.s
>> ignoring nonexistent directory
>> "/home/warren/llvm-gcc/obj../install/x86_64-unknown-linux-gnu/include"
>> ignoring nonexistent directory
>> "/home/warren/llvm-gcc/obj../install/x86_64-unknown-linux-gnu/sys- 
>> include"
>> ignoring duplicate directory "./include"
>> ignoring nonexistent directory
>> "/home/warren/llvm-gcc/obj/gcc/../lib/gcc/x86_64-unknown-linux-gnu/ 
>> 4.0.1/include"
>> ignoring nonexistent directory
>> "/home/warren/llvm-gcc/obj/gcc/../lib/gcc/x86_64-unknown-linux-gnu/ 
>> 4.0.1/../../../../x86_64-unknown-linux-gnu/include"
>> ignoring nonexistent directory "/home/warren/llvm-gcc/obj../install/ 
>> include"
>> ignoring nonexistent directory
>> "/home/warren/llvm-gcc/obj../install/lib/gcc/x86_64-unknown-linux- 
>> gnu/4.0.1/include"
>> ignoring nonexistent directory
>> "/home/warren/llvm-gcc/obj../install/x86_64-unknown-linux-gnu/include"
>> ignoring nonexistent directory "../../llvm-gcc4-2.0.source/gcc/32"
>> #include "..." search starts here:
>> #include <...> search starts here:
>>  .
>>  32
>>  ../../llvm-gcc4-2.0.source/gcc
>>  ../../llvm-gcc4-2.0.source/gcc/../include
>>  ../../llvm-gcc4-2.0.source/gcc/../libcpp/include
>>  /home/warren/llvm/llvm-2.0/include
>>  /home/warren/llvm/obj//include
>>  /home/warren/llvm-gcc/obj/gcc/include
>>  /usr/local/include
>>  /usr/include
>> End of search list.
>> GNU C version 4.0.1 LLVM (Apple Computer, Inc. build 2.0)
>> (x86_64-unknown-linux-gnu)
>>         compiled by GNU C version 4.0.2 20050901 (prerelease) (SUSE  
>> Linux).
>> GGC heuristics: --param ggc-min-expand=100 --param ggc-min- 
>> heapsize=131072
>> Warning: Generation of 64-bit code for a 32-bit processor requested.
>> Warning: 64-bit processors all have at least SSE2.
>> Compiler executable checksum: efa2a522e5a08a9a5e39009754b845ec
>>  as --traditional-format -V -Qy --32 -o 32/crtbegin.o /tmp/ccBy56Wo.s
>> GNU assembler version 2.16.91.0.2 (x86_64-suse-linux) using BFD  
>> version
>> 2.16.91.0.2 20050720 (SuSE Linux)
>> /tmp/ccBy56Wo.s: Assembler messages:
>> /tmp/ccBy56Wo.s:15: Error: bad register name `%rsp'
>> /tmp/ccBy56Wo.s:16: Error: bad register name `%rbp'
>> /tmp/ccBy56Wo.s:17: Error: bad register name `%rsp'
>> /tmp/ccBy56Wo.s:18: Error: `completed.4705(%rip)' is not a valid
>> base/index expression
>> /tmp/ccBy56Wo.s:21: Error: `p.4704(%rip)' is not a valid base/index
>> expression
>> /tmp/ccBy56Wo.s:22: Error: bad register name `%rax)'
>> /tmp/ccBy56Wo.s:23: Error: bad register name `%rax'
>> /tmp/ccBy56Wo.s:26: Error: `p.4704(%rip)' is not a valid base/index
>> expression
>> /tmp/ccBy56Wo.s:27: Error: bad register name `%rax'
>> /tmp/ccBy56Wo.s:28: Error: `p.4704(%rip)' is not a valid base/index
>> expression
>> /tmp/ccBy56Wo.s:29: Error: bad register name `%rax)'
>> /tmp/ccBy56Wo.s:30: Error: bad register name `%rax'
>> /tmp/ccBy56Wo.s:33: Error: `completed.4705(%rip)' is not a valid
>> base/index expression
>> /tmp/ccBy56Wo.s:34: Error: bad register name `%rbp'
>> /tmp/ccBy56Wo.s:35: Error: bad register name `%rbp'
>> /tmp/ccBy56Wo.s:38: Error: bad register name `%rbp'
>> /tmp/ccBy56Wo.s:39: Error: bad register name `%rbp'
>> /tmp/ccBy56Wo.s:47: Error: bad register name `%rsp'
>> /tmp/ccBy56Wo.s:48: Error: bad register name `%rbp'
>> /tmp/ccBy56Wo.s:49: Error: bad register name `%rsp'
>> /tmp/ccBy56Wo.s:50: Error: `__JCR_LIST__(%rip)' is not a valid
>> base/index expression
>> /tmp/ccBy56Wo.s:53: Error: `_Jv_RegisterClasses(%rip)' is not a valid
>> base/index expression
>> /tmp/ccBy56Wo.s:55: Error: bad register name `%rax'
>> /tmp/ccBy56Wo.s:58: Error: `__JCR_LIST__(%rip)' is not a valid
>> base/index expression
>> /tmp/ccBy56Wo.s:59: Error: bad register name `%rax'
>> /tmp/ccBy56Wo.s:60: Error: bad register name `%rbp'
>> /tmp/ccBy56Wo.s:61: Error: bad register name `%rbp'
>> /tmp/ccBy56Wo.s:64: Error: bad register name `%rbp'
>> /tmp/ccBy56Wo.s:65: Error: bad register name `%rbp'
>>
>> # Start of file scope inline assembly
>> 	.section	.fini
>> 	call __do_global_dtors_aux
>> 	.text
>> 	.section	.init
>> 	call frame_dummy
>> 	.text
>> # End of file scope inline assembly
>>
>>
>> 	.text
>> 	.align	16
>> 	.type __do_global_dtors_aux, at function
>> __do_global_dtors_aux:
>> 	subq $8, %rsp
>> 	movq %rbp, (%rsp)
>> 	movq %rsp, %rbp
>> 	cmpb $0, completed.4705(%rip)
>> 	jne .LBB1_4	#UnifiedReturnBlock
>> .LBB1_1:	#bb9.preheader
>> 	movq p.4704(%rip), %rax
>> 	movq (%rax), %rax
>> 	cmpq $0, %rax
>> 	je .LBB1_3	#bb16
>> .LBB1_2:	#bb
>> 	addq $4, p.4704(%rip)
>> 	call *%rax
>> 	movq p.4704(%rip), %rax
>> 	movq (%rax), %rax
>> 	cmpq $0, %rax
>> 	jne .LBB1_2	#bb
>> .LBB1_3:	#bb16
>> 	movb $1, completed.4705(%rip)
>> 	movq %rbp, %rsp
>> 	popq %rbp
>> 	ret
>> .LBB1_4:	#UnifiedReturnBlock
>> 	movq %rbp, %rsp
>> 	popq %rbp
>> 	ret
>> 	.size __do_global_dtors_aux, .-__do_global_dtors_aux
>>
>>
>> 	.align	16
>> 	.type frame_dummy, at function
>> frame_dummy:
>> 	subq $8, %rsp
>> 	movq %rbp, (%rsp)
>> 	movq %rsp, %rbp
>> 	cmpq $0, __JCR_LIST__(%rip)
>> 	je .LBB2_3	#UnifiedReturnBlock
>> .LBB2_1:	#cond_true
>> 	leaq _Jv_RegisterClasses(%rip), %rax
>> 	
>> 	cmpq $0, %rax
>> 	je .LBB2_3	#UnifiedReturnBlock
>> .LBB2_2:	#cond_true10
>> 	leaq __JCR_LIST__(%rip), %rdi
>> 	call *%rax
>> 	movq %rbp, %rsp
>> 	popq %rbp
>> 	ret
>> .LBB2_3:	#UnifiedReturnBlock
>> 	movq %rbp, %rsp
>> 	popq %rbp
>> 	ret
>> 	.size frame_dummy, .-frame_dummy
>> 	.type __CTOR_LIST__, at object
>> .section .ctors,"aw", at progbits
>> 	.align	8
>> __CTOR_LIST__:				# __CTOR_LIST__
>> 	.size __CTOR_LIST__, 8
>> 	.quad	4294967295
>>
>> 	.type __DTOR_LIST__, at object
>> .section .dtors,"aw", at progbits
>> 	.align	8
>> __DTOR_LIST__:				# __DTOR_LIST__
>> 	.size __DTOR_LIST__, 8
>> 	.quad	4294967295
>>
>> 	.type __JCR_LIST__, at object
>> 	.section	.jcr
>> 	.align	8
>> __JCR_LIST__:				# __JCR_LIST__
>> 	.size __JCR_LIST__, 0
>>
>> 	.hidden	__dso_handle
>> 	.type __dso_handle, at object
>> 	.globl __dso_handle
>> 	.data
>> 	.align	8
>> __dso_handle:				# __dso_handle
>> 	.size __dso_handle, 8
>> 	.zero	8
>>
>> 	.type p.4704, at object
>> 	.align	8
>> p.4704:				# p.4704
>> 	.size p.4704, 8
>> 	.quad	(__DTOR_LIST__) + 8
>>
>> 	.type completed.4705, at object
>> 	.local	completed.4705
>> 	.comm	completed.4705,1,1		# completed.4705
>> 	.weak	_Jv_RegisterClasses
>>
>> 	.ident	"GCC: (GNU) 4.0.1 LLVM (Apple Computer, Inc. build 2.0)"
>> _______________________________________________
>> LLVM Developers mailing list
>> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
> 
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev




More information about the llvm-dev mailing list