statically linked passes

Hi,

I am trying to create a pass that should get statically linked into
opt (since I'm on both mac and native win32 and win32 does not support
LOADED_MODULEs, at least I get errors while trying to create one).

So I have it working with CMake on windows but when I try to run the
same code base on mac I get unresolved externals. Here is what I have
done so far in the build system:

Within lib/Transforms/MyPass I have:

Makefile:
LEVEL = ../../..
LIBRARYNAME = LLVMMyPass
BUILD_ARCHIVE = 1
include $(LEVEL)/Makefile.common

CMakeLists.txt
add_llvm_library(LLVMMyPass MyPass.cpp)

And within the Transforms directory I added my directory to the list
of PARALLEL_DIRS within the Makefile there.

In the root llvm directory's CMakeLists.txt I added a call to
add_subdirectory(lib/Transforms/MyPass)

And I added create functions to LinkAllPasses.h.

Now when I build visual studio projects with cmake I have to manually
set up dependencies in the generated projects. But I though, fine.

But when running configure + make on mac the dependencies are missing.

So to my big question: Where do I set up dependencies? I tried
searching and searching for the other libraries to see how they'd done
it, but didn't find anything...

You're saying that "opt -load ..." doesn't work on Windows? Is that a bug in opt, or is something wrong with your LLVM install?

Trevor

Good morning Theresia,

So to my big question: Where do I set up dependencies? I tried
searching and searching for the other libraries to see how they'd done
it, but didn't find anything...

I have no idea to your last question, excuse me.

On cygming(also msys + mingw), "configure --enable-shared" might give
you availability of loadable_module.
See also tools/bugpoint-passes.

You have to move the building order of your pass after building
tools/llvm-shlib.
Seek here with "llvmhello" or my name.

Cheers, ...Takumi