[LLVMdev] problems compiling gcc frontend: Error: bad register name `%rbp'

Dale Johannesen dalej at apple.com
Thu May 29 09:55:44 PDT 2008


On May 28, 2008, at 6:49 PM, robert muth wrote:

> Dale:
>
> Yes, there were a number of postings in March. The issue seemed to not
> have been fully resolved but
> I added "i686-pc-linux-gnu" to the end of my command line
> and now the whole thing compiles.
>
> I cannot find a llvm-gcc binary in my install directory, all I have is
> gcc which reports:
> ../export/bin/gcc -dumpmachine
> i686-pc-linux-gnu
>
> It turns out I can generate llvm assembler output using "-S -emit- 
> llvm"
> but using just -emit-llvm does not work
> ./gcc  -emit-llvm  /home/robertm/hello.c
> /tmp/cc3X2m5t.o: file not recognized: File format not recognized
> collect2: ld returned 1 exit status
>
> Is this expected?
>
> Robert

Yes, that gets you the binary form of llvm IR.  Linkers won't  
understand it unless they've been modified to do so.
Read about llvm-as and llvm-dis in the docs.

> On Wed, May 28, 2008 at 8:53 PM, Dale Johannesen <dalej at apple.com>  
> wrote:
>>
>> On May 28, 2008, at 5:22 PM, robert muth wrote:
>>
>>> I have problem compiling the gcc frontend.
>>> Almost everything seems to compile but at the very end
>>> when crt startup files are compiled, the assembler complains
>>> about bad registers.
>>> Any idea what I am doing wrong?
>>> Thanks,
>>> Robert
>>
>> It looks like your assembler is being invoked in 32-bit mode.  Other
>> people have had that problem, but I don't recall how it was fixed
>> (doesn't affect my platform).  Try the mailing list archives around
>> 2-3 months back.
>>
>>> HOST:
>>> os: ubuntu 2.6.18 kernel  x86_64 GNU/Linux
>>> compiler:            gcc (GCC) 4.0.3 (Ubuntu 4.0.3-1ubuntu5)
>>>
>>> SOURCE:
>>> svn trunk  gcc4.2
>>>
>>> CONFIGURE:
>>> ../llvm-gcc-svn/configure --prefix=/home/robertm/Projects/llvm/
>>> --enable-llvm=$PWD/../llvm-objects --disable-shared
>>> --enable-languages=c
>>>
>>> SAMPLE ERROR:
>>> /home/robertm/Projects/llvm/llvm-gcc-objects/./gcc/xgcc
>>> -B/home/robertm/Projects/llvm/llvm-gcc-objects/./gcc/
>>> -B/home/robertm/Projects/llvm/export/x86_64-unknown-linux-gnu/bin/
>>> -B/home/robertm/Projects/llvm/export/x86_64-unknown-linux-gnu/lib/
>>> -isystem /home/robertm/Projects/llvm/export/x86_64-unknown-linux- 
>>> gnu/
>>> include
>>> -isystem /home/robertm/Projects/llvm/export/x86_64-unknown-linux- 
>>> gnu/
>>> sys-include
>>> -O2 -O2 -g -O2  -DIN_GCC    -W -Wall -Wwrite-strings
>>> -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition
>>> -isystem ./include  -I. -I. -I../../llvm-gcc-svn/gcc
>>> -I../../llvm-gcc-svn/gcc/. -I../../llvm-gcc-svn/gcc/../include
>>> -I../../llvm-gcc-svn/gcc/../libcpp/include
>>> -I../../llvm-gcc-svn/gcc/../libdecnumber -I../libdecnumber
>>> -I/home/robertm/Projects/llvm/llvm-gcc-objects/../llvm-objects/ 
>>> include
>>> -I/home/robertm/Projects/llvm/llvm-svn/include  -g0
>>> -finhibit-size-directive -fno-inline-functions -fno-exceptions
>>> -fno-zero-initialized-in-bss -fno-toplevel-reorder
>>> -fno-omit-frame-pointer -fno-asynchronous-unwind-tables \
>>>         -c ../../llvm-gcc-svn/gcc/crtstuff.c -DCRT_BEGIN \
>>>         -o crtbegin.o
>>> /tmp/ccW2TMKx.s: Assembler messages:
>>> /tmp/ccW2TMKx.s:15: Error: bad register name `%rbp'
>>> /tmp/ccW2TMKx.s:16: Error: bad register name `%rsp'
>>> /tmp/ccW2TMKx.s:22: Error: bad register name `%rax'
>>> /tmp/ccW2TMKx.s:23: Error: bad register name `%rax)'
>>> /tmp/ccW2TMKx.s:24: Error: bad register name `%rcx'
>>> /tmp/ccW2TMKx.s:29: Error: bad register name `%rbp'
>>> /tmp/ccW2TMKx.s:32: Error: bad register name `%rax'
>>> /tmp/ccW2TMKx.s:33: Error: bad register name `%rax'
>>> /tmp/ccW2TMKx.s:34: Error: bad register name `%rcx'
>>> /tmp/ccW2TMKx.s:42: Error: bad register name `%rbp'
>>> /tmp/ccW2TMKx.s:43: Error: bad register name `%rsp'
>>> /tmp/ccW2TMKx.s:44: Error: suffix or operands invalid for `cmp'
>>> /tmp/ccW2TMKx.s:47: Error: bad register name `%rax'
>>> /tmp/ccW2TMKx.s:50: Error: bad register name `%rax'
>>> /tmp/ccW2TMKx.s:53: Error: bad register name `%rdi'
>>> /tmp/ccW2TMKx.s:54: Error: bad register name `%rax'
>>> /tmp/ccW2TMKx.s:56: Error: bad register name `%rbp'
>>> make[3]: *** [crtbegin.o] Error 1
>>> _______________________________________________
>>> 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
>>
> _______________________________________________
> 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