How to switch off LLVM's integrated assembler?

2019-01-18 21:31发布

问题:

I have a project involving hand-written assembly—AT&T syntax, works fine with GCC, but not done by me plus I know very little about assembly—which exhibits a weird problem when trying to build it with Clang.

LLVM documentation mentions that "most X86 targets" use LLVM's integrated assembler as opposed to the system assembler; as a possible workaround I would like to explicitly use the latter. I (well, Google) haven't been successful in finding information on how to do this.

Question: Is there a way to ask or rather force Clang / LLVM to use the system assembler instead of the integrated one?

(I know I could always go and Read The Source™, but I want to know whether there's a documented approach.)

回答1:

Turns out I completely missed this in the man page:

-integrated-as -no-integrated-as

Used to enable and disable, respectively, the use of the integrated assembler. Whether the integrated assembler is on by default is target dependent.

To disable it at compiler invocation:

clang -no-integrated-as -c foo.c

Or:

export CC="clang -no-integrated-as"
make