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

Cohen, Elad2 via cfe-dev cfe-dev at lists.llvm.org
Thu Aug 25 07:44:10 PDT 2016


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).

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?

Thanks,
Elad

-----Original Message-----
From: cfe-dev [mailto:cfe-dev-bounces at lists.llvm.org] On Behalf Of Bruno Cardoso Lopes via cfe-dev
Sent: Thursday, August 25, 2016 03:14
To: via cfe-dev <cfe-dev at lists.llvm.org>
Cc: Richard Smith <richard at metafoo.co.uk>
Subject: [cfe-dev] [RFC][Preprocessor] Add a macro for -fno-gnu-inline-asm

Hi,

When building with -fno-gnu-inline-asm and -fmodules on Darwin, the compilation might fail if some of the implicit modules try to use gnu asm inline. For instance, it's an issue that happens when with LLVM installed headers, e.g., building _Builtin_intrinsics because of inline asm in cpuid.h

To solve that, and potential related issues, I propose to add the __CLANG_NO_GNU_INLINE_ASM macro when -fno-gnu-inline-asm is used, allowing the user to reason in the preprocessor level.

A simple patch that implement this is here: https://reviews.llvm.org/D23859

Suggestions? Alternative ideas?

--
Bruno Cardoso Lopes
http://www.brunocardoso.cc
_______________________________________________
cfe-dev mailing list
cfe-dev at lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
---------------------------------------------------------------------
Intel Israel (74) Limited

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.


More information about the cfe-dev mailing list