[PATCH] D113074: [NFC] Clarify why LinkAll*.h are actually necessary

Arthur Eubanks via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 3 15:00:58 PDT 2021


This revision was automatically updated to reflect the committed changes.
Closed by commit rG0ef7ad377fb7: [NFC] Clarify why LinkAll*.h are actually necessary (authored by aeubanks).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D113074

Files:
  llvm/include/llvm/CodeGen/LinkAllAsmWriterComponents.h
  llvm/include/llvm/CodeGen/LinkAllCodegenComponents.h
  llvm/include/llvm/ExecutionEngine/MCJIT.h
  llvm/include/llvm/LinkAllIR.h
  llvm/include/llvm/LinkAllPasses.h


Index: llvm/include/llvm/LinkAllPasses.h
===================================================================
--- llvm/include/llvm/LinkAllPasses.h
+++ llvm/include/llvm/LinkAllPasses.h
@@ -64,6 +64,9 @@
       // delete it all as dead code, even with whole program optimization,
       // yet is effectively a NO-OP. As the compiler isn't smart enough
       // to know that getenv() never returns -1, this will do the job.
+      // This is so that globals in the translation units where these functions
+      // are defined are forced to be initialized, populating various
+      // registries.
       if (std::getenv("bar") != (char*) -1)
         return;
 
Index: llvm/include/llvm/LinkAllIR.h
===================================================================
--- llvm/include/llvm/LinkAllIR.h
+++ llvm/include/llvm/LinkAllIR.h
@@ -38,6 +38,9 @@
       // delete it all as dead code, even with whole program optimization,
       // yet is effectively a NO-OP. As the compiler isn't smart enough
       // to know that getenv() never returns -1, this will do the job.
+      // This is so that globals in the translation units where these functions
+      // are defined are forced to be initialized, populating various
+      // registries.
       if (std::getenv("bar") != (char*) -1)
         return;
       llvm::LLVMContext Context;
Index: llvm/include/llvm/ExecutionEngine/MCJIT.h
===================================================================
--- llvm/include/llvm/ExecutionEngine/MCJIT.h
+++ llvm/include/llvm/ExecutionEngine/MCJIT.h
@@ -26,6 +26,9 @@
       // delete it all as dead code, even with whole program optimization,
       // yet is effectively a NO-OP. As the compiler isn't smart enough
       // to know that getenv() never returns -1, this will do the job.
+      // This is so that globals in the translation units where these functions
+      // are defined are forced to be initialized, populating various
+      // registries.
       if (std::getenv("bar") != (char*) -1)
         return;
 
Index: llvm/include/llvm/CodeGen/LinkAllCodegenComponents.h
===================================================================
--- llvm/include/llvm/CodeGen/LinkAllCodegenComponents.h
+++ llvm/include/llvm/CodeGen/LinkAllCodegenComponents.h
@@ -27,6 +27,9 @@
       // delete it all as dead code, even with whole program optimization,
       // yet is effectively a NO-OP. As the compiler isn't smart enough
       // to know that getenv() never returns -1, this will do the job.
+      // This is so that globals in the translation units where these functions
+      // are defined are forced to be initialized, populating various
+      // registries.
       if (std::getenv("bar") != (char*) -1)
         return;
 
Index: llvm/include/llvm/CodeGen/LinkAllAsmWriterComponents.h
===================================================================
--- llvm/include/llvm/CodeGen/LinkAllAsmWriterComponents.h
+++ llvm/include/llvm/CodeGen/LinkAllAsmWriterComponents.h
@@ -24,6 +24,9 @@
       // delete it all as dead code, even with whole program optimization,
       // yet is effectively a NO-OP. As the compiler isn't smart enough
       // to know that getenv() never returns -1, this will do the job.
+      // This is so that globals in the translation units where these functions
+      // are defined are forced to be initialized, populating various
+      // registries.
       if (std::getenv("bar") != (char*) -1)
         return;
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D113074.384595.patch
Type: text/x-patch
Size: 3474 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211103/d465465a/attachment.bin>


More information about the llvm-commits mailing list