build broken on linux/amd64

Compiling llvm on a linux/amd64 box produces:

home/rafael/dev/llvm/build/Debug/lib/LLVMX86.o: In function
`_X86CompilationCallback':
(.text+0x316fe): undefined reference to `_X86CompilationCallback2'
/home/rafael/dev/llvm/build/Debug/lib/LLVMX86.o: In function
`llvm::X86JITInfo::getLazyResolverFunction(void* (*)(void*))':
/home/rafael/dev/llvm/cvs/lib/Target/X86/X86JITInfo.cpp:219: undefined
reference to `X86CompilationCallback'
/home/rafael/dev/llvm/build/Debug/lib/LLVMX86.o: In function
`llvm::X86JITInfo::emitFunctionStub(void*,
llvm::MachineCodeEmitter&)':
/home/rafael/dev/llvm/cvs/lib/Target/X86/X86JITInfo.cpp:225: undefined
reference to `X86CompilationCallback'

    68: 0000000000000000 0 NOTYPE GLOBAL DEFAULT 21
_X86CompilationCallback
    69: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND
_X86CompilationCallback2
    77: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND
X86CompilationCallback
    93: 00000000000002da 209 FUNC GLOBAL DEFAULT 21
X86CompilationCallback2

Best Regards,
Rafael

I am not sure if it is the correct solution, but the attached patch
fixes the problem.

The build now fails when linking lto:

relocation R_X86_64_32 against `(anonymous namespace)::EmittedInsts'

Rafael

amd64.patch (1.15 KB)

I am not sure if it is the correct solution, but the attached patch
fixes the problem.

Your solution is correct, in that it will work and follows with the current ifdef approach. I applied this patch though, which doesn't use the ifdefs, hopefully it is more robust:
http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20060904/037632.html

Please lemme know if it works.

The build now fails when linking lto:

relocation R_X86_64_32 against `(anonymous namespace)::EmittedInsts'

I don't know what that is :frowning:

-Chris

Please lemme know if it works.

It does. Thanks.

I don't know what that is :frowning:

I believe that code compiled without -fpic is going into a DSO. This
creates text relocations that are not supported on linux/amd64
(http://people.redhat.com/drepper/dsohowto.pdf).

-Chris

Rafael

Please lemme know if it works.

It does. Thanks.

Great!

I don't know what that is :frowning:

I believe that code compiled without -fpic is going into a DSO. This
creates text relocations that are not supported on linux/amd64
(http://people.redhat.com/drepper/dsohowto.pdf).

Okay, Anton just committed a patch to exclude liblto on non-darwin platforms for the time being. That should fix it.

-Chris