(original) (raw)
Hello all,
Still, is it impossible to use the external llvm custom pass on windows?
I can build the 'mypass.dll' on windows using LLVM libraries. And, I use these 2 way to use my pass.
clang.exe -Xclang -load -Xclang mypass.dll -c test.c
opt.exe -load -Xclang mypass.dll -mypass test.bc -o optimized\_test.bc
But, Clang and opt didn't working well with my pass.
This mean, my pass can dump the llvm::Module in compilation time. and my pass can dump that on Linux. but, my pass didn't print anything on Windows.
Additionally, i already built the LLVM and Clang on Windows using CMake.
To avoid confusing, i'm writing my source code.
#include
using namespace std;
#include
#include
using namespace llvm;
class SampleIRModule : public llvm::ModulePass {
public:
static char ID;
SampleIRModule() : llvm::ModulePass(ID) {}
bool runOnModule(llvm::Module &M);
};
bool SampleIRModule::runOnModule(llvm::Module &M) {
M.dump();
return false;
}
char SampleIRModule::ID = 0;
static RegisterPass X("SampleIRModule", "SampleIRModule Pass");
And,here is my build command on windows.
cl /EHsc -ID:\\LLVM\\llvm-3.4.2\\build\_nmake\\output/include -D\_CRT\_SECURE\_NO\_DEPRECATE -D\_CRT\_SECURE\_NO\_WARNINGS -D\_CRT\_NONSTDC\_NO\_DEPRECATE -D\_CRT\_NONSTDC\_NO\_WARNINGS -D\_SCL\_SECURE\_NO\_DEPRECATE -D\_SCL\_SECURE\_NO\_WARNINGS -wd4146 -wd4180 -wd4244 -wd4267 -wd4345 -wd4351 -wd4355 -wd4503 -wd4624 -wd4800 -wd4291 -w14062 -we4238 -D\_\_STDC\_CONSTANT\_MACROS -D\_\_STDC\_FORMAT\_MACROS -D\_\_STDC\_LIMIT\_MACROS -c testpass.cpp
cl /D\_USRDLL /D\_WINDLL testpass.obj /link /DLL /OUT:testpass.dll D:\\LLVM\\llvm-3.4.2\\build\_nmake\\output\\lib\\LLVMCore.lib ... (including other LLVM libraries)
Thanks,
Seok Hong