[compiler-rt] [sanitizer] Lift AsanDoesNotSupportStaticLinkage to sanitizer_common.h. NFC (PR #80948)

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 7 14:07:09 PST 2024


================
@@ -290,6 +290,17 @@ bool SetEnv(const char *name, const char *value);
 
 u32 GetUid();
 void ReExec();
+
+#if defined(__ELF__) && !SANITIZER_FUCHSIA
+extern uptr kDynamic[] asm("_DYNAMIC");
+inline void DoesNotSupportStaticLinking() {
+  // This will fail to link with -static. However, -static-pie is not detected.
----------------
MaskRay wrote:

I've clarified that we are unable to detect `-static-pie` at link time. 

This is not a TODO, since there is no way to statically detect `-static-pie`.

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


More information about the llvm-commits mailing list