Building ModulePass independiently on win32

Hi,

I have written a ModulePass (c++ code) that does transformation to LLVM bytecode. How do I build,compile and run it on windows.

a) I need Win32 LLVM tools. (so I downloaded)
b) How do I build the dll( modulepass) so that I can pass it to optimizer or other llvm tool.
c) To test, I need to compile a test C code, emit llvm intermediate code and pass it to optimizer so that it can run my transformation on it.

I am using windows. Any suggestion of cmdline steps\tools for the above steps will be appreciated.

Thanks

Loadable modules are not currently supported on Windows, unfortunately. If you directly add your pass to llvm/lib/Transforms/IPO and rebuild opt, you will probably get further faster.

I just had an old project with llvm1.6.

I tried to compile it on the ubuntu 14…

First, I copied cfrontend, called ./fixheaders and then did configure.

Everything worked well. It required g++/bison/flex, which I installed.

Then I tried to use make ( no gmake). It gave these errors…

Any wonder…how to fix this.

ubuntu@ubuntu:~/build1.6$ make
make[1]: Entering directory /home/ubuntu/build1.6/lib/System' llvm[1]: Compiling Path.cpp for Debug build In file included from /home/ubuntu/build1.6/../llvm/lib/System/Path.cpp:14:0: /home/ubuntu/build1.6/../llvm/include/llvm/System/Path.h:250:33: warning: type qualifiers ignored on function return type [-Wignored-qualifiers] const char* const c_str() const { return path.c_str(); } ^ /home/ubuntu/build1.6/../llvm/lib/System/Path.cpp: In function ‘llvm::sys::LLVMFileType llvm::sys::IdentifyFileType(const char*, unsigned int)’: /home/ubuntu/build1.6/../llvm/lib/System/Path.cpp:52:39: error: ‘memcmp’ was not declared in this scope if (memcmp(magic,"!<arch>\n",8) == 0) ^ make[1]: *** [/home/ubuntu/build1.6/lib/System/Debug/Path.o] Error 1 make[1]: Leaving directory /home/ubuntu/build1.6/lib/System’
make: *** [all] Error 1
ubuntu@ubuntu:~/build1.6$

I have not seen my message posted. Can you let me know what’s the issue.

Hi Muhammad,

Isn’t it this one: http://lists.llvm.org/pipermail/llvm-dev/2016-April/098026.html

I just had an old project with llvm1.6.

I tried to compile it on the ubuntu 14..

First, I copied cfrontend, called ./fixheaders and then did configure.

Everything worked well. It required g++/bison/flex, which I installed.

Then I tried to use make ( no gmake). It gave these errors...

Any wonder..how to fix this.

ubuntu@ubuntu:~/build1.6$ make
make[1]: Entering directory `/home/ubuntu/build1.6/lib/System'
llvm[1]: Compiling Path.cpp for Debug build
In file included from
/home/ubuntu/build1.6/../llvm/lib/System/Path.cpp:14:0:
/home/ubuntu/build1.6/../llvm/include/llvm/System/Path.h:250:33: warning:
type qualifiers ignored on function return type [-Wignored-qualifiers]
       const char* const c_str() const { return path.c_str(); }

Probably harmless... Maybe remove the extra const - it makes little or no
difference.

                                 ^
/home/ubuntu/build1.6/../llvm/lib/System/Path.cpp: In function
‘llvm::sys::LLVMFileType llvm::sys::IdentifyFileType(const char*, unsigned
int)’:
/home/ubuntu/build1.6/../llvm/lib/System/Path.cpp:52:39: error: ‘memcmp’
was not declared in this scope
         if (memcmp(magic,"!<arch>\n",8) == 0)

Looks like the typical case of "something used to drag in a header file
that some code depends on, and now it doesn't" - add #include <cstring> to
the list of #includes in Path.cpp.

Since 1.6 is 11 years old, it's not entirely surprising that there will be
warnings and errors because of changes in the compilers and header files in
between.