CombineScript.sh 613 B

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