[LLVMdev] global symbols converted to local symbols

Chris Lattner clattner at apple.com
Wed Oct 29 20:16:56 PDT 2008


On Oct 29, 2008, at 7:42 PM, Ryan M. Lefever wrote:

> As a follow up, if I first convert x.bc to a c file using llc -march=c
> -o x.c x.bc, and then I use normal gcc to convert x.c to an  
> executable,
> f() remains a global symbol.  Is llvm-nm incorrectly converting the
> global symbols to local symbols?

By default, llvm-ld converts all symbols to internal/static.  Use  - 
disable-internalize if you don't want this.  Note that this will  
disable a lot of optimization.

-Chris

>
>
> Ryan M. Lefever wrote:
>> I have a bitcode file x.bc.  When I run llmv-nm on x.bc, it shows  
>> that a
>> function f(), that I've written, is defined as a global function  
>> (text)
>> object, i.e., llvm-nm shows it marked with a 'T'.  I have converted  
>> x.bc
>> to an executable with the following command:  llvm-ld -native -o  
>> x.exe
>> x.bc  When I run nm on x.exe, it shows that f is now a local function
>> (text) object, i.e., nm shows it marked with a 't'.  Why is llvm-ld
>> converting f() from a global function object to a local function  
>> object.
>>
>> I believe that I need f() to be a global function object because I  
>> use
>> LD_PRELOAD to load a library that make use of f().
>>
>> Thanks,
>> Ryan
>>
>> _______________________________________________
>> LLVM Developers mailing list
>> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>
> -- 
> 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




More information about the llvm-dev mailing list