[PATCH] D101217: Add LLVM_ATTRIBUTE_USED to fix problems which could be exposed by aggressive global pointer variable removal

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 26 13:31:45 PDT 2021


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGb81244fa4ff9: Add LLVM_ATTRIBUTE_USED to fix problems which could be exposed by aggressive… (authored by MaskRay).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D101217

Files:
  llvm/lib/Support/BuryPointer.cpp
  llvm/lib/Support/Unix/Signals.inc


Index: llvm/lib/Support/Unix/Signals.inc
===================================================================
--- llvm/lib/Support/Unix/Signals.inc
+++ llvm/lib/Support/Unix/Signals.inc
@@ -255,7 +255,7 @@
 // stack if we remove our signal handlers; that can't be done reliably if
 // someone else is also trying to do the same thing.
 static stack_t OldAltStack;
-static void* NewAltStackPointer;
+LLVM_ATTRIBUTE_USED static void *NewAltStackPointer;
 
 static void CreateSigAltStack() {
   const size_t AltStackSize = MINSIGSTKSZ + 64 * 1024;
Index: llvm/lib/Support/BuryPointer.cpp
===================================================================
--- llvm/lib/Support/BuryPointer.cpp
+++ llvm/lib/Support/BuryPointer.cpp
@@ -19,7 +19,7 @@
   // will not be properly buried and a leak detector will report a leak, which
   // is what we want in such case.
   static const size_t kGraveYardMaxSize = 16;
-  LLVM_ATTRIBUTE_UNUSED static const void *GraveYard[kGraveYardMaxSize];
+  LLVM_ATTRIBUTE_USED static const void *GraveYard[kGraveYardMaxSize];
   static std::atomic<unsigned> GraveYardSize;
   unsigned Idx = GraveYardSize++;
   if (Idx >= kGraveYardMaxSize)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D101217.340628.patch
Type: text/x-patch
Size: 1168 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210426/f946f2b7/attachment.bin>


More information about the llvm-commits mailing list