cache
cache

Reputation: 1319

How to generate a single LLVM IR from multiple sources

Compiling .c files to a single LLVM IR and link multiple libraries during the compilation.

An example here with gcc:

gcc -c -Wall -g3 -DVERSION=\"1.1.2\" ssl_proxy.c -o ssl_proxy.o
gcc -o ssl_proxy ssl_proxy.o  -lssl -lcrypto

Now, I want to compile the ssl_proxy.c to ssl_proxy.ll, simply using llvm-gcc -S -emit-llvm won't work as it will not let me link -lssl -lcrypto libraries.

Through this example I hope people can explain a bit more details about compilation with llvm-gcc (not clang), so that all visitors can learn from it and know how to compile complex multiple sources into one LLVM IR.

Upvotes: 0

Views: 857

Answers (1)

Oak
Oak

Reputation: 26868

Compiling source files into LLVM IR does not perform linking, so it does not require any libraries - it just needs the headers.

Upvotes: 1

Related Questions