0

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)

Machavity
  • 30,841
  • 27
  • 92
  • 100
dzan
  • 425
  • 3
  • 14

1 Answers1

1

Repeat -Xlinker before each linker argument, example:

echo "int main() {}" | clang -x c -flto - -Xlinker -mllvm -Xlinker --print-after-all
Joky
  • 1,608
  • 11
  • 15
  • Sorry my initial post was wrong, I did in fact repeat `-Xlinker` as I should. I think Apple's `-Wno-error=unused-command-line-argument-hard-error-in-future ` no longer works (from my tests). – dzan Jan 04 '16 at 23:45
  • It was an error in my buildscripts after all.. Your quick test helped a lot! – dzan Jan 04 '16 at 23:51