[LLVMdev] enabling Debian x86_64 for llvm 1.7
Chris Lattner
sabre at nondot.org
Mon Jul 10 16:17:18 PDT 2006
On Mon, 10 Jul 2006, Al Stone wrote:
> In trying to package up LLVM for Debian, it appears that x86_64 is no
> longer a supported architecture -- so, my first question is, is that
> correct?
Yes and no :(. It's not that it is unsupported, it is just that noone
has tested it and made it work.
> Best I can tell, the only thing that's supposed to work for
> x86_64 is the C backend.
Right. This isn't something new unfortunately, the X86 backend doesn't
support x86-64 yet.
> For Debian, I need to build everything from scratch. When trying to
> build llvm-gcc4 from source, though, I get part way through the build
> and am told that x86_64-unknown-linux-pc is an unsupported architecture.
> What I have tried so far is this quick and dirty patch to
> gcc/Makefile.in:
This makes sense.
> Yes, it is a hack, but it does let me get further. I can get to this
> point in compiling the C front-end:
> Writer.cpp:(.text+0x379): undefined reference to
> `llvm::FindUsedTypes::stub()'
> /home/ahs3/tmp/llvm-1.7/llvm/Release/lib/LLVMCBackend.o: In function
Okay, there are two problems with this.
1. llvm-gcc4, as of llvm-1.7, hardcoded in a list of libraries to link in,
which apparently don't satisfy the dependencies needed by the C
backend. This is easily solvable. If you use current llvm-gcc4 from
svn, available here: http://llvm.org/docs/CFEBuildInstrs.html, a
similar patch to the makefile will work better. The makefile will
automatically infer that an extra lib is needed and link it in.
2. More seriously, this will cause 'llvm-gcc x.c -S -o x.s' to put C code
into x.s, which will cause the assembler to barf (e.g. when -c is
used). OTOH, "llvm-gcc -emit-llvm x.c -S -o x.ll" will work.
Unfortunately, the former is used by the GCC build process.
I don't know if the workarounds for #2 are really worth it at this point.
> My first question is: should I even attempt to get things working
> for x86_64, or has it been tried and abandoned? The second question
> is, is this even a reasonable approach? (I have to claim an apparent
> lack of detailed understanding of the build system, at this point).
> I'm more than willing to believe I've started going about this all
> wrong...
My only suggestion is that it might be worth trying to map x86_64 to the
X86 backend. It would "fix" #2 (x86 assembly would end up in .s files,
though it probably won't work right because it is 32-bit). Some minor
hacks might be needed in the x86 backend to accept the x86_64 target
triple, but that would probably be easier.
We're currently in crunch mode right now, but I'd like to build a proper
x86-64 backend for LLVM one day when time permits. Perhaps in a couple of
months I'll have more time to work on it. In the meantime, it would be
quite reasonable to use llvm-gcc3 for the llvm1.7 debian package.
Thanks Al!
-Chris
--
http://nondot.org/sabre/
http://llvm.org/
More information about the llvm-dev
mailing list