[libc-commits] [libc] [libc] fortify jmp buffer for x86-64 (PR #112769)

Schrodinger ZHU Yifan via libc-commits libc-commits at lists.llvm.org
Mon Nov 18 10:56:42 PST 2024


================
@@ -1,3 +1,25 @@
+if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${LIBC_TARGET_OS})
+  add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/${LIBC_TARGET_OS})
+endif()
+
+if (LIBC_CONF_SETJMP_FORTIFICATION)
+  if (TARGET libc.src.setjmp.${LIBC_TARGET_OS}.checksum
+      AND LIBC_TARGET_ARCHITECTURE STREQUAL "x86_64")
+    add_object_library(
+      checksum
+      ALIAS
+      DEPENDS
+        .${LIBC_TARGET_OS}.checksum
+    )
+    set(fortification_deps libc.src.setjmp.checksum)
+    set(fortification_defs -DLIBC_COPT_SETJMP_FORTIFICATION=1)
+  else()
+    message(WARNING "Jmpbuf fortification is enabled but not supported for target ${LIBC_TARGET_ARCHITECTURE} ${LIBC_TARGET_OS}")
----------------
SchrodingerZhu wrote:

Fixed using arch override.

https://github.com/llvm/llvm-project/pull/112769


More information about the libc-commits mailing list