[PATCH] D14832: [ELF] Prevent SEGFAULT in case of conflict with an internally defined symbol.

Igor Kudrin via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 19 11:11:29 PST 2015


This revision was automatically updated to reflect the committed changes.
Closed by commit rL253588: [ELF] Prevent SEGFAULT in case of conflict with an internally defined symbol. (authored by ikudrin).

Changed prior to commit:
  http://reviews.llvm.org/D14832?vs=40676&id=40681#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D14832

Files:
  lld/trunk/ELF/SymbolTable.cpp
  lld/trunk/test/ELF/duplicate-internal.s

Index: lld/trunk/test/ELF/duplicate-internal.s
===================================================================
--- lld/trunk/test/ELF/duplicate-internal.s
+++ lld/trunk/test/ELF/duplicate-internal.s
@@ -0,0 +1,11 @@
+# Should print an expected message in case of conflict with an internally generated symbol.
+
+# RUN: llvm-mc -filetype=obj -triple=mips-unknown-linux %s -o %t.o
+# RUN: not ld.lld -shared %t.o -o %t.so 2>&1 | FileCheck %s
+
+# CHECK: duplicate symbol: _gp in (internal) and {{.*}}
+
+# REQUIRES: mips
+
+  .globl  _gp
+_gp = 0
Index: lld/trunk/ELF/SymbolTable.cpp
===================================================================
--- lld/trunk/ELF/SymbolTable.cpp
+++ lld/trunk/ELF/SymbolTable.cpp
@@ -139,7 +139,8 @@
   }
 
   std::string Msg = (Message + ": " + Old.getName() + " in " +
-                     OldFile->getName() + " and " + NewFile->getName())
+                     (OldFile ? OldFile->getName() : "(internal)") + " and " +
+                     (NewFile ? NewFile->getName() : "(internal)"))
                         .str();
   if (Warning)
     warning(Msg);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D14832.40681.patch
Type: text/x-patch
Size: 1103 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20151119/b363e8de/attachment.bin>


More information about the llvm-commits mailing list