[llvm-dev] How to link against specific targets? (Porting ShadowCallStack to new PM)

Leonard Chan via llvm-dev llvm-dev at lists.llvm.org
Tue Jan 8 10:29:51 PST 2019

Hi all,

I'm in the process of trying to port ShadowCallStack from the legacy
pass manager to the new one. I ran into an issue though where it seems
I cannot link against anything I added in ShadowCallStack.cpp when
trying to build c-index-test (via just running ninja check-all). I
think the reason for this is because nothing under lib/Target/X86/ is
a part of any library compiled with c-index-test (if I'm reading the
CMake correctly). I imagine this would also mean I wouldn't be able to
successfully build other binaries like clang.

What I want to know is if there is a proper way to link against code
under lib/Target/X86/ (as a part of some shared library or through
some other means) such that i could use it with the new pass manager.

These are some other thoughts I had attempting to find a possible solution:
- I could not find an instance of classes under lib/Target/X86/ (or
any other target for that matter) that are used or exposed by anything
outside of lib/Target/
- The only things that seem exposed under lib/Target/ are a few files
packed into libLLVMTarget.a and none of it is linked against source
files under llvm/Target/<TARGET>
- If ShadowCallStack is meant to be a pass that should eventually work
for any target, at some point it could be pulled out from the X86
directory and also be included in libLLVMTarget.a, but I'm not sure
how the CMake dependency hierarchy would support this.


More information about the llvm-dev mailing list