compor / llvm-ir-cmake-utils

LLVM IR CMake utils for bitcode file manipulation by opt and friends
GNU Lesser General Public License v2.1
68 stars 12 forks source link

llc only supports one input file #36

Open otsmr opened 11 months ago

otsmr commented 11 months ago

When the target library is compiled to a static library with the following CMAKE options:

add_library(testbase STATIC ${SOURCE_FILES})
llvmir_attach_bc_target(testbase_bc testbase)
llvmir_attach_opt_pass_target(testbase_opt testbase_bc -load-pass-plugin=${LLVM_PASS_CTRACE} -passes=ctrace)
llvmir_attach_obj_target(testbase_obj testbase_opt)
llvmir_attach_library(testbase_instrumented testbase_obj STATIC)

I got the following error message:

FAILED: llvm-ir/testbase_obj/testbase_obj.o /[...]/build/llvm-ir/testbase_obj/testbase_obj.o
cd /[...]/build && llc -filetype=obj -o /[...]/build/llvm-ir/testbase_obj/testbase_obj.o /[...]/build/llvm-ir/testbase_opt/Test1.bc /[...]/build/llvm-ir/testbase_opt/Test2.bc /[...]/build/llvm-ir/testbase_opt/Test3.bc /[...]/build/llvm-ir/testbase_opt/Test4.bc
llc: Too many positional arguments specified!
Can specify at most 1 positional arguments: See: llc --help
ninja: build stopped: subcommand failed.

The problem is that LLC only supports one input file. This PR fixes this issue by going over each bc file separately.