[cfe-dev] [RFC][Preprocessor] Add a macro for -fno-gnu-inline-asm

Bruno Cardoso Lopes via cfe-dev cfe-dev at lists.llvm.org
Thu Aug 25 10:07:49 PDT 2016

Hi Elad,

On Thu, Aug 25, 2016 at 7:44 AM, Cohen, Elad2 <elad2.cohen at intel.com> wrote:
> Hi Bruno,
> I actually came across a similar issue- when building with -ffreestanding and -fmodules, the compilation might fail while building _Builtin_intrinsics because mm_malloc.h tries to include stdlib.h (which might be absent in a freestanding environment).
> An alternative fix I can think of for this kind of issues could be marking such header files with the 'textual header' property in the modulemap file (They will be compiled only if included explicitly if I understand correctly).

I thought about this but it didn't seem like the most clean solution
in the long term.

> However, since 'gnu-inline-asm' and 'freestanding' are language options, a better solution in my opinion (that other cases could benefit from as well) will be to extend the modules 'requires-declaration' feature-list with 'freestanding' and 'gnuasm' keywords. (And of course mark their submodules with these requirements in the modulemap).
> A patch I uploaded specifically for the 'freestanding' issue a short while ago: https://reviews.llvm.org/D23871
> Does this sounds reasonable?

I like this idea even better. Gonna try this out!


Bruno Cardoso Lopes

More information about the cfe-dev mailing list