Automake Assembler Assumptions with LLVM-MC

All, we recently had a user report an issue associated with utilizing LLVM-MC as the desired assembler in place of GNU’s GAS. They are utilizing a tangled mess of automake scripts to build this respective software package and have decided to manually override the “CCAS” macro to point directly to LLVM-MC (rather than using Clang). Apparently, automake assumes that whatever “compiler” (as it is referenced in the automake documentation) is used for assembling files must accept the “-c” and “-o” options. LLVM-MC correctly yells at the user given that “-c” is not a valid option (as it should). However, GAS does not. It happily accepts “-c” as a valid option. We peered into the Bintutils 2.24 source and there is no explicit “-c” option support. This appears to be an option parsing bug in Binutils that either 1) collides with a known long option or 2) somehow wanders into the “-ac” parsing logic. Either way, its not a valid option that does anything.

Given that LLVM-MC has basic support for handling GNU GAS options, what’s the policy on being “bug for bug” compatible with GAS? My personal opinion is the user should fall back to using the compiler frontend to build their assembly options, but this is a valid question nonetheless. Thoughts?

Automake documentation on this topic is here:
https://www.gnu.org/software/automake/manual/html_node/Assembly-Support.html

- John D. Leidel

Hi,

It's my understanding that llvm-mc is intended to be a testing tool for LLVM developers rather than an assembler for end users. Users should be assembling with clang.

That's my understanding and position as well.

Joerg