- #!/bin/bash
- # 获取脚本所在目录
- SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
- # 切换到项目根目录
- cd "$SCRIPT_DIR/.."
- clang -S -emit-llvm data/projectA.c -o combine_output/projectA.ll -Dmain=projectA_main
- clang -S -emit-llvm data/projectB.c -o combine_output/projectB.ll -Dmain=projectB_main
- llvm-as combine_output/projectA.ll -o combine_output/projectA.bc
- llvm-as combine_output/projectB.ll -o combine_output/projectB.bc
- llvm-link combine_output/projectA.bc combine_output/projectB.bc -o combine_output/combined.bc
- llvm-dis combine_output/combined.bc -o combine_output/combined.ll
|