[llvm] [BOLT][runtime] Add start & fini symbols (PR #68505)

Vladislav Khmelevsky via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 9 02:50:46 PDT 2023


================
@@ -4568,6 +4568,26 @@ void RewriteInstance::updateELFSymbolTable(
     }
   }
 
+  // Add runtime library start and fini address symbols
+  if (RuntimeLibrary *RtLibrary = BC->getRuntimeLibrary()) {
+    auto AddSymbol = [&](StringRef Name, uint64_t Address) {
+      if (!Address)
+        return;
+
+      ELFSymTy NewSymbol;
+      NewSymbol.st_shndx = ELF::SHN_ABS;
----------------
yota9 wrote:

If you can suggest an easy way to do this without overcomplicating the code.. The hot/cold start symbols below are done like this, since it is just a label I don't really think there is a difference anyway

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


More information about the llvm-commits mailing list