[LLVMdev] opt -load error on Darwin

Reid Spencer rspencer at reidspencer.com
Sun Aug 27 23:26:19 PDT 2006


On Mon, 2006-08-28 at 00:00 -0500, Jing Yu wrote:
> Thank you, Reid. 
> 
> I have applied tha patch to ltdl.c ltdl.h. The problem still exists.  

Okay, I guess that wasn't it.

> I looked up the symbol on libLLVMCore.a, and found three U-entries and
> one T-entry.  However, the Darwin linker is not able to find the
> T-entry. Any idea?

Nope. I think you're going to have to get some Darwin specific help on
this one. I don't have a Mac so I can't replicate your situation.  The
Apple guys will be working tomorrow, so hopefully they can take a look
at it.

> pollux:~/test jingyu$ opt
> -load /Users/jingyu/tools/build-ppc/Release/lib/LLVMHello.so -help
> Error opening
> '/Users/jingyu/tools/build-ppc/Release/lib/LLVMHello.so': Can't
> open :/Users/jingyu/tools/build-ppc/Release/lib/LLVMHello.so:
> dlopen(/Users/jingyu/tools/build-ppc/Release/lib/LLVMHello.so, 9):
> Symbol not
> found:__ZN4llvm12FunctionPass16addToPassManagerEPNS_20FunctionPassManagerTERNS_13AnalysisUsageE
>   Referenced
> from: /Users/jingyu/tools/build-ppc/Release/lib/LLVMHello.so
>   Expected in: flat namespace

Oh, one other thing you could try. Add LLVMCore.a to the USED_LIBS line
in the lib/Transforms/Hello/Makefile file. This should link the
addToPassManager method into the shared object, which might allow the
pass to register.

> pollux:~/tools/build-ppc/Release/lib jingyu$ nm libLLVMCore.a | grep
> __ZN4llvm12FunctionPass16addToPassManagerEPNS_20FunctionPassManagerTERNS_13AnalysisUsageE
>          U
> __ZN4llvm12FunctionPass16addToPassManagerEPNS_20FunctionPassManagerTERNS_13AnalysisUsageE
>          U
> __ZN4llvm12FunctionPass16addToPassManagerEPNS_20FunctionPassManagerTERNS_13AnalysisUsageE
> 00004100 T
> __ZN4llvm12FunctionPass16addToPassManagerEPNS_20FunctionPassManagerTERNS_13AnalysisUsageE

Yes, this is the definition of the symbol. Not sure why the linker can't
find it. I think on Darwin the runtime loader can't open the executable.
But, I thought that problem was resolved with the ltdl.{c,h} change that
you already implemented.  As I said before, you're going to need some
help from someone that knows Darwin better than I do.

> 000197d8 S
> __ZN4llvm12FunctionPass16addToPassManagerEPNS_20FunctionPassManagerTERNS_13AnalysisUsageE.eh
>          U
> __ZN4llvm12FunctionPass16addToPassManagerEPNS_20FunctionPassManagerTERNS_13AnalysisUsageE
> 
> 
> Jing 

Reid.




More information about the llvm-dev mailing list