[compiler-rt] e305dcc - Do not link asan_rtl_x86_64.S for non x86_64 platforms.

Daniel Kiss via llvm-commits llvm-commits at lists.llvm.org
Tue May 9 11:12:38 PDT 2023


Author: Casey Smalley
Date: 2023-05-09T20:12:32+02:00
New Revision: e305dcc6fdc7e0efc0de4091a49386923e3845b4

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

LOG: Do not link asan_rtl_x86_64.S for non x86_64 platforms.

Do not link asan_rtl_x86_64.S for non x86_64 platforms.

Prior to this CL asan_rtl_x86_64.S would be always be linked when
building compiler-rt for non x86_64 platforms, this normally isn't an
issue since at that link time is an empty file anyway.

When attempting to link a Aarch64 program with branch protection enabled
with the address sanitizer.

E.g.
```
clang --target=aarch64 \
      -fsanitize=address \
      -mbranch-protection=standard \
      -Wl,-z,force-bti
      -o test \
      test.cc
```

Results in the linking error from the sections generated from the empty
asan_rtl_x86_64.S owed to missing a .note.gnu.property

Also see [[ https://bugs.chromium.org/p/chromium/issues/detail?id=1427165 | https://bugs.chromium.org/p/chromium/issues/detail?id=1427165 ]]

Reviewed By: vitalybuka

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

Added: 
    

Modified: 
    compiler-rt/lib/asan/CMakeLists.txt

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/asan/CMakeLists.txt b/compiler-rt/lib/asan/CMakeLists.txt
index 08fd68ab7acbc..1bfc6f0c5e37d 100644
--- a/compiler-rt/lib/asan/CMakeLists.txt
+++ b/compiler-rt/lib/asan/CMakeLists.txt
@@ -46,7 +46,7 @@ set(ASAN_STATIC_SOURCES
   asan_rtl_static.cpp
   )
 
-if (NOT WIN32 AND NOT APPLE)
+if (ASAN_SUPPORTED_ARCH STREQUAL "x86_64" AND NOT WIN32 AND NOT APPLE)
   list(APPEND ASAN_STATIC_SOURCES
     asan_rtl_x86_64.S
   )


        


More information about the llvm-commits mailing list