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); 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