[libc-commits] [libc] [libc] fortify jmp buffer for x86-64 (PR #112769)
Nick Desaulniers via libc-commits
libc-commits at lists.llvm.org
Mon Nov 18 13:34:58 PST 2024
================
@@ -7,59 +7,15 @@
//===----------------------------------------------------------------------===//
#include "src/setjmp/longjmp.h"
-#include "include/llvm-libc-macros/offsetof-macro.h"
#include "src/__support/common.h"
#include "src/__support/macros/config.h"
-#if !defined(LIBC_TARGET_ARCH_IS_X86)
-#error "Invalid file include"
+#ifdef LIBC_TARGET_ARCH_IS_X86_64
+#if LIBC_COPT_SETJMP_FORTIFICATION
+#include "longjmp_64_fortified.cpp.inc"
+#else
+#include "longjmp_64.cpp.inc"
#endif
----------------
nickdesaulniers wrote:
Rather than being done one the preprocessor level, can this be done on the cmake level? i.e. cmake would look at `LIBC_COPT_SETJMP_FORTIFICATION` and decide whether to build longjmp.cpp vs longjmp_fortified.cpp?
Also, for splitting out i386, you should create an libc/src/setjmp/i386 folder, move the .cpp files there. Then we just have .cpp files, and no .inc files.
e083a33478b2d570c89d7a9d9f05328b9232c072 made it so that `LIBC_TARGET_ARCHITECTURE` is `"i386"`. You can test i386 somewhat by setting `-DLIBC_TARGET_TRIPLE=i386-linux-gnu` or `-DLIBC_TARGET_TRIPLE=i386-linux-android` to cmake.
https://github.com/llvm/llvm-project/pull/112769
More information about the libc-commits
mailing list