[PATCH] D23731: [ELF] Only print symbol name when it is available

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Sat Aug 20 00:43:03 PDT 2016


ruiu added inline comments.

================
Comment at: ELF/Relocations.cpp:431
@@ -430,5 +430,3 @@
   if (Config->Shared || (Config->Pic && !isRelExpr(Expr))) {
-    StringRef Name = Body.isLocal() ? getLocalSymbolName(File, Body)
-                                    : Body.getName();
-    error("can't create dynamic relocation " + getRelName(Type) +
-          " against symbol " + Name);
+    error("can't create dynamic relocation " + getRelName(Type) + " against " +
+          (Body.isLocal() && !Body.getNameOffset() ? "readonly segment" :
----------------
This is a bit scattered. What we want to do here is (1) to get a symbol name, and (2) if it fails use "readonly sement" instead. So how about defining `StringRef getSymbolName(elf::ObjectFile<ELFT> &File, SymbolBody &Body)` which returns the symbol name or the empty string?



https://reviews.llvm.org/D23731





More information about the llvm-commits mailing list