[libunwind] 2d2ef38 - [libunwind] Only include cet.h if __CET__ defined

Nikita Popov via cfe-commits cfe-commits at lists.llvm.org
Wed Feb 16 00:47:27 PST 2022


Author: Nikita Popov
Date: 2022-02-16T09:45:54+01:00
New Revision: 2d2ef384b2f6e723edb793d08f52e7f4dc94ba3a

URL: https://github.com/llvm/llvm-project/commit/2d2ef384b2f6e723edb793d08f52e7f4dc94ba3a
DIFF: https://github.com/llvm/llvm-project/commit/2d2ef384b2f6e723edb793d08f52e7f4dc94ba3a.diff

LOG: [libunwind] Only include cet.h if __CET__ defined

We should not assume that the cet.h header exists just because
we're on x86 linux. Only include it if __CET__ is defined. This
makes the code more similar to what compiler-rt does in
https://github.com/llvm/llvm-project/blob/ee423d93ead39e94c2970b3cc7ef6e6faa75d10b/compiler-rt/lib/builtins/assembly.h#L17
(though that one also has a __has_include() check -- I've not found
that to be necessary).

Differential Revision: https://reviews.llvm.org/D119697

Added: 
    

Modified: 
    libunwind/src/assembly.h

Removed: 
    


################################################################################
diff  --git a/libunwind/src/assembly.h b/libunwind/src/assembly.h
index 978f6bd619bd3..89293a555bfc4 100644
--- a/libunwind/src/assembly.h
+++ b/libunwind/src/assembly.h
@@ -15,7 +15,7 @@
 #ifndef UNWIND_ASSEMBLY_H
 #define UNWIND_ASSEMBLY_H
 
-#if (defined(__i386__) || defined(__x86_64__)) && defined(__linux__)
+#if defined(__linux__) && defined(__CET__)
 #include <cet.h>
 #define _LIBUNWIND_CET_ENDBR _CET_ENDBR
 #else


        


More information about the cfe-commits mailing list