[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 10:36:29 PST 2015
ikudrin created this revision.
ikudrin added a reviewer: ruiu.
ikudrin added a subscriber: llvm-commits.
ikudrin added a project: lld.
http://reviews.llvm.org/D14832
Files:
ELF/SymbolTable.cpp
test/ELF/duplicate-internal.s
Index: test/ELF/duplicate-internal.s
===================================================================
--- /dev/null
+++ test/ELF/duplicate-internal.s
@@ -0,0 +1,11 @@
+# Should not SEGFAULT if there is a conflict with internal 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: ELF/SymbolTable.cpp
===================================================================
--- ELF/SymbolTable.cpp
+++ 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.40676.patch
Type: text/x-patch
Size: 1008 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20151119/1e3b6612/attachment.bin>
More information about the llvm-commits
mailing list