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