[cfe-dev] [LLVMdev] RFC: Adding __INTEGRATED_ASSEMLER__ macro

David Chisnall David.Chisnall at cl.cam.ac.uk
Tue Feb 25 00:45:51 PST 2014


On 25 Feb 2014, at 03:29, Saleem Abdulrasool <compnerd at compnerd.org> wrote:

> Unfortunately, its not that simple.  The IAS is not a perfect drop in replacement.  As a concrete example, on ARM, the IAS does not support pre-UAL syntax (which the Linux kernel uses in some cases).  This is more of a philosophical limitation rather than technical AFAIK.
> 
> Having the ability to detect what assembler is being targeted is useful.  I might be overlooking something, but I dont see why this would be any more dangerous than exposing the size of long or long long via the preprocessor.

Because the size of long long doesn't change between versions.  If I have code that requires long long to be 128 bits now, it won't suddenly work later on a platform where it's 64 bits just because I upgrade my compiler.

The test you want is not 'is the assembler the LLVM integrated assembler', it's 'does the assembler support pre-UAL syntax'.  If LLVM 3.9 implements support for pre-UAL syntax, then your test would be wrong and you've added a dependency on an external assembler for no reason.  

The problem with exposing these as preprocessor macros at all is that, while it's easy for clang to know about the features of the LLVM integrated assembler, it has no knowledge at all of the behaviour of whatever tool it finds called as, other than that it accepts gas-compatible arguments.  The only way for it to find out would be to interrogate the assembler on startup.

If you depend on a particular feature like this, your best bet is to encode the logic in your build configuration system: try to compile a simple file containing pre-UAL syntax assembly and see if it works.  You'll need to encode the fall-back logic in your build system anyway.

David





More information about the cfe-dev mailing list