After looking through the README for the llvm gcc frontend, it says:
-----------------------------------------------------------------------
X86-64/AMD-64/EM64-T for any OS other than Darwin/Mac OS X:
When targeting non-darwin X86-64/AMD-64/EM64-T, configure with
--disable-shared. The LLVM X86-64 backend doesn't support PIC codegen on
non-darwin systems yet. If you get a build error, try configuring with
--disable-multilib.
-----------------------------------------------------------------------
Indeed, when I built the frontend I had to use the --disable-shared
option. So, I guess that is my problem. The excerpt above seams to
indicate that llvm does not support PIC generation on 64 bit linux. If
I'm missing something, please let me know.
Regards,
Ryan
Ryan M. Lefever wrote:> On my 32 bit linux box, things seam to work find, but on my 64 bit linux
> box I am getting problems.
>
> I have the following c file (lib.c):
> --------------------------------
> #include <stdio.h>
>
> void libmethod(){
> printf("libmethod()\n");
> }
> -------------------------------
>
> I tried to get a shared library using the following commands:
>
> llvm-gcc -emit-llvm -Wall -fPIC -c -o lib.opt.bc lib.c -O3
>
> llvm-ld -native -Xlinker=-shared -Xlinker=-Wl,-soname,libmylb.so -o
> libmylb.so lib.opt.bc
>
> The llvm-ld command fails with the following message:
>
> /usr/bin/ld: /tmp/ccWOiWYc.o: relocation R_X86_64_32S against `a local
> symbol' can not be used when making a shared object; recompile with
-fPIC
> /tmp/ccWOiWYc.o: could not read symbols: Bad value
> collect2: ld returned 1 exit status
> llvm-ld:
>
> Does anyone know what is going on? Do I need to specify different options?
>
> Thanks,
> Ryan
>
> Bill Wendling wrote:
>> Yup!
>>
>> -bw
>>
>> On Nov 3, 2008, at 7:39 PM, Ryan M. Lefever wrote:
>>
>>> Does llvm-gcc support the -fPIC option? I am using LLVM on both 32
>>> bit
>>> linux and 64 bit linux, if that matters.
>>>
>>> Regards,
>>> Ryan
>>>
>>> --
>>> Ryan M. Lefever [http://www.crhc.uiuc.edu/~lefever/index.html]
>>> _______________________________________________
>>> 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