[LLVMdev] Adding an object to llc

Reid Spencer reid at x10sys.com
Tue May 30 08:49:17 PDT 2006

On Tue, 2006-05-30 at 14:48 +0200, Silken Tiger wrote:
> Hi
> Thanks for all your feedback. I just found the reason for the compile failure 
> for my analysis pass: I had to add my object to the namespace llvm instead of 
> anonymous. This took me some time since i was looking for an linking 
> failure... but as errors go i should have looked at the error message a 
> little closer.

One would expect this, its a facility of the C++ language. The anonymous
namespace is, essentially, the same as declaring everything in it
static. That is, the symbols are not exported and not available for

> So for all those trying to add an analysis path:
> * add the object name to the USEDLIBS variable in the tools/llc/Makefile
> * use the llvm namespace instead of anonyous

These statements are only true if you're adding an analysis pass to
LLVM. If the pass is for use outside of LLVM then you want to:

* use the SHARED_LIBRARY=1 flag in your makefile
* use the --load option on llc to load your shared library
* use any namespace other than llvm or anonymous for declaring those
symbols that need
  to be linked.

> This mail is intended as references for people using the search engines, prior 
> to asking questions :-). But maybe this information could also be added to
> http://llvm.org/docs/WritingAnLLVMPass.html?

Such a patch would be readily accepted.



> Thanks
> ST
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20060530/16ed59ec/attachment.sig>

More information about the llvm-dev mailing list