[PATCH] D30485: Perform symbol binding for .symver versioned symbols

Peter Collingbourne via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 8 13:30:12 PST 2017


pcc accepted this revision.
pcc added a comment.
This revision is now accepted and ready to land.

LGTM with a few nits.



================
Comment at: lib/Object/ModuleSymbolTable.cpp:61
+static void handleSymverAliases(const Module &M, RecordStreamer &Streamer) {
+  // The name in the assembler will be mangled, but the name in the IR
+  // might not, so we first compute a mapping from mangled name to GV
----------------
`if (Streamer.symverAliases().empty()) return;`


================
Comment at: lib/Object/ModuleSymbolTable.cpp:74
+    Mang.getNameWithPrefix(MangledName, &GV, /*CannotUsePrivateLabel=*/false);
+    if (MangledName != GV.getName())
+      MangledNameMap[MangledName] = &GV;
----------------
You can make the code a little simpler by putting all globals in the map.


================
Comment at: lib/Object/RecordStreamer.h:26
+  // aliasee to its list of aliases.
+  DenseMap<const MCSymbol *, std::vector<MCSymbol *>> SymverAliasMap;
   void markDefined(const MCSymbol &Symbol);
----------------
Can just be a vector of (alias, aliasee) pairs.


================
Comment at: test/LTO/X86/symver-asm.ll:19
+; Local values used in inline assembly must be specified on the
+; llvm.compiler.used so they aren't incorrectly internalized.
+ at llvm.compiler.used = appending global [1 x i8*] [i8* bitcast (i32 ()* @io_cancel_local_0_4 to i8*)], section "llvm.metadata"
----------------
You mean so they aren't DCE'd?


https://reviews.llvm.org/D30485





More information about the llvm-commits mailing list