[PATCH] D23690: [ELF] Improve error reporting for relocations

Petr Hosek via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 18 12:52:19 PDT 2016


phosek added inline comments.

================
Comment at: ELF/Relocations.cpp:425-430
@@ -424,4 +424,8 @@
   if (Config->Shared || (Config->Pic && !isRelExpr(Expr))) {
-    error("can't create dynamic relocation " + getRelName(Type) +
-          " against readonly segment");
+    if (!Body.isLocal())
+      error("can't create dynamic relocation " + getRelName(Type) +
+            " against symbol " + Body.getName());
+    else
+      error("can't create dynamic relocation " + getRelName(Type) +
+            " against readonly segment");
     return Expr;
----------------
ruiu wrote:
> You can call getName() on a local symbol, can't you?
There is an `assert(!isLocal())` in `SymbolBody::getName()`. The name for local symbols is empty, but it I could use the name offset and find name in the File string table (if it's there), does that sound fine to you?


https://reviews.llvm.org/D23690





More information about the llvm-commits mailing list