dzan
dzan

Reputation: 425

XCode Clang; how to pass custom arguments

Since Xcode 5, it seems that Apple considers all unknown arguments to clang as errors (info). I wrote some LLVM passes which take some custom arguments. I can't pass them however because of this. Does anyone know if there is a workaround / official way to do this? The method proposed in the link no longer works.

I have an LTO plugin so I pass arguments to it with -Xlinker -Xlinker -mllvm -Xlinker -argument. I tried different approaches but can't get Apple clang to accept my argument and pass it on.

Clang -> ld64 -> libLTO.dylib : so I would need a way to bypass Clang checking my argument.

PS. I don't want to ship my own Clang because Apple's takes some extra arguments used by Xcode. I can't build their latest because it still hasn't been open sourced yet! (7.0)

Upvotes: 0

Views: 779

Answers (1)

Joky
Joky

Reputation: 1628

Repeat -Xlinker before each linker argument, example:

echo "int main() {}" | clang -x c -flto - -Xlinker -mllvm -Xlinker --print-after-all

Upvotes: 1

Related Questions