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

Rafael Auler via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 9 14:24:14 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) {
----------------
rafaelauler wrote:

Oh I see, these symbols are LOCAL and the other lambda inserts WEAK syms.

I don't think these symbols need to be weak to be honest. But I don't quite remember why they are set as weak. But maybe you can try using the same lambda with one extra parameter:  binding ? So in one callsite you set the parameter to local, and in the other callsite you set it to weak.

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


More information about the llvm-commits mailing list