forked from OSchip/llvm-project
[ELF] Fix nullptr dereference when creating an error message for a synthetic section.
Differential Revision: https://reviews.llvm.org/D34752 llvm-svn: 307162
This commit is contained in:
parent
ef7aff507b
commit
d54759b236
|
@ -276,7 +276,9 @@ template <class ELFT> std::string InputSectionBase::getSrcMsg(uint64_t Offset) {
|
|||
template <class ELFT> std::string InputSectionBase::getObjMsg(uint64_t Off) {
|
||||
// Synthetic sections don't have input files.
|
||||
elf::ObjectFile<ELFT> *File = getFile<ELFT>();
|
||||
std::string Filename = File ? File->getName() : "(internal)";
|
||||
if (!File)
|
||||
return ("(internal):(" + Name + "+0x" + utohexstr(Off) + ")").str();
|
||||
std::string Filename = File->getName();
|
||||
|
||||
std::string Archive;
|
||||
if (!File->ArchiveName.empty())
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o
|
||||
// RUN: cd %S
|
||||
// RUN: not ld.lld %t.o --format=binary duplicated-synthetic-sym.s -o %t.elf 2>&1 | FileCheck %s
|
||||
|
||||
// CHECK: duplicate symbol: _binary_duplicated_synthetic_sym_s_start
|
||||
// CHECK: defined at (internal):(.data+0x0)
|
||||
|
||||
.globl _binary_duplicated_synthetic_sym_s_start
|
||||
_binary_duplicated_synthetic_sym_s_start:
|
||||
.long 0
|
Loading…
Reference in New Issue