[PATCH] D142888: [compiler-rt] Fix building GWPASAN on ARM

Leandro Lupori via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 30 09:09:14 PST 2023


luporl updated this revision to Diff 493330.
luporl retitled this revision from "[compiler-rt] Fix build on ARM" to "[compiler-rt] Fix building GWPASAN on ARM".
luporl edited the summary of this revision.
luporl added a comment.
Herald added a reviewer: bollu.
Herald added a reviewer: alexander-shaposhnikov.

- Split ARM build fixes in 2 parts: this and D142906 <https://reviews.llvm.org/D142906>
- Add cmake command to commit message
- Explain why ARM must be linked against an unwind library in the modified CMakeLists.txt file


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D142888/new/

https://reviews.llvm.org/D142888

Files:
  compiler-rt/lib/scudo/standalone/CMakeLists.txt


Index: compiler-rt/lib/scudo/standalone/CMakeLists.txt
===================================================================
--- compiler-rt/lib/scudo/standalone/CMakeLists.txt
+++ compiler-rt/lib/scudo/standalone/CMakeLists.txt
@@ -38,7 +38,15 @@
 
 # We don't use the C++ standard library, so avoid including it by mistake.
 append_list_if(COMPILER_RT_HAS_NOSTDLIBXX_FLAG -nostdlib++ SCUDO_LINK_FLAGS)
-append_list_if(CXX_SUPPORTS_UNWINDLIB_NONE_FLAG --unwindlib=none SCUDO_LINK_FLAGS)
+# On ARM, we must link against default unwind lib when GWPAsan is used,
+# otherwise we get undefined references to __aeabi_unwind_cpp_pr* symbols.
+# This is because object files compiled with -funwind-tables end up referencing
+# these symbols on ARM, while on other architectures, such as x86_64 and
+# AArch64, only the .eh_frame section is added, but no references to an unwind
+# library are made.
+if(NOT COMPILER_RT_HAS_GWP_ASAN OR NOT "${LLVM_NATIVE_ARCH}" STREQUAL "ARM")
+  append_list_if(CXX_SUPPORTS_UNWINDLIB_NONE_FLAG --unwindlib=none SCUDO_LINK_FLAGS)
+endif()
 
 if(COMPILER_RT_SCUDO_STANDALONE_SYSROOT_PATH)
   list(APPEND SCUDO_CFLAGS "--sysroot=${COMPILER_RT_SCUDO_STANDALONE_SYSROOT_PATH}")


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D142888.493330.patch
Type: text/x-patch
Size: 1199 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230130/fa2e91d8/attachment.bin>


More information about the llvm-commits mailing list