Index: include/llvm/Object/ELF.h =================================================================== --- include/llvm/Object/ELF.h +++ include/llvm/Object/ELF.h @@ -21,6 +21,7 @@ #include "llvm/Object/Error.h" #include "llvm/Support/Endian.h" #include "llvm/Support/Error.h" +#include "llvm/Support/StringSaver.h" #include #include #include @@ -30,6 +31,9 @@ namespace llvm { namespace object { +extern llvm::BumpPtrAllocator ErrAlloc; +extern llvm::StringSaver ErrSaver; + StringRef getELFRelocationTypeName(uint32_t Machine, uint32_t Type); uint32_t getELFRelativeRelocationType(uint32_t Machine); StringRef getELFSectionTypeName(uint32_t Machine, uint32_t Type); @@ -48,6 +52,18 @@ return make_error(Err, object_error::parse_failed); } +template class ELFFile; + +template +static std::string getSecIndex(const ELFFile *Obj, + const typename ELFT::Shdr *Sec) { + auto TableOrErr = Obj->sections(); + if (TableOrErr) + return "[" + std::to_string(Sec - &(*TableOrErr).front()) + "]"; + llvm::consumeError(TableOrErr.takeError()); + return "[?]"; +} + template class ELFFile { public: @@ -162,11 +178,17 @@ /// Iterate over program header table. Expected program_headers() const { if (getHeader()->e_phnum && getHeader()->e_phentsize != sizeof(Elf_Phdr)) - return createError("invalid e_phentsize"); + return createError(ErrSaver.save("invalid e_phentsize: " + + Twine(getHeader()->e_phentsize))); if (getHeader()->e_phoff + (getHeader()->e_phnum * getHeader()->e_phentsize) > getBufSize()) - return createError("program headers longer than binary"); + return createError( + ErrSaver.save("program headers are longer than binary of size " + + Twine(getBufSize()) + ": e_phoff = 0x" + + Twine::utohexstr(getHeader()->e_phoff) + + ", e_phnum = " + Twine(getHeader()->e_phnum) + + ", e_phentsize = " + Twine(getHeader()->e_phentsize))); auto *Begin = reinterpret_cast(base() + getHeader()->e_phoff); return makeArrayRef(Begin, Begin + getHeader()->e_phnum); @@ -181,10 +203,12 @@ /// be checked after iteration ends. Elf_Note_Iterator notes_begin(const Elf_Phdr &Phdr, Error &Err) const { if (Phdr.p_type != ELF::PT_NOTE) { + // TODO: this error is untested. Err = createError("attempt to iterate notes of non-note program header"); return Elf_Note_Iterator(Err); } if (Phdr.p_offset + Phdr.p_filesz > getBufSize()) { + // TODO: this error is untested. Err = createError("invalid program header offset/size"); return Elf_Note_Iterator(Err); } @@ -200,10 +224,12 @@ /// be checked after iteration ends. Elf_Note_Iterator notes_begin(const Elf_Shdr &Shdr, Error &Err) const { if (Shdr.sh_type != ELF::SHT_NOTE) { + // TODO: this error is untested. Err = createError("attempt to iterate notes of non-note section"); return Elf_Note_Iterator(Err); } if (Shdr.sh_offset + Shdr.sh_size > getBufSize()) { + // TODO: this error is untested. Err = createError("invalid section offset/size"); return Elf_Note_Iterator(Err); } @@ -271,7 +297,7 @@ inline Expected getSection(typename ELFT::ShdrRange Sections, uint32_t Index) { if (Index >= Sections.size()) - return createError("invalid section index"); + return createError(ErrSaver.save("invalid section index: " + Twine(Index))); return &Sections[Index]; } @@ -283,7 +309,10 @@ assert(Sym->st_shndx == ELF::SHN_XINDEX); unsigned Index = Sym - FirstSym; if (Index >= ShndxTable.size()) - return createError("index past the end of the symbol table"); + return createError(ErrSaver.save( + "extended symbol index (" + Twine(Index) + + ") is past the end of the SHT_SYMTAB_SHNDX section of size " + + Twine(ShndxTable.size()))); // The size of the table was checked in getSHNDXTable. return ShndxTable[Index]; @@ -333,6 +362,7 @@ inline Expected getSymbol(typename ELFT::SymRange Symbols, uint32_t Index) { if (Index >= Symbols.size()) + // TODO: this error is untested. return createError("invalid symbol index"); return &Symbols[Index]; } @@ -351,18 +381,26 @@ Expected> ELFFile::getSectionContentsAsArray(const Elf_Shdr *Sec) const { if (Sec->sh_entsize != sizeof(T) && sizeof(T) != 1) - return createError("invalid sh_entsize"); + return createError( + ErrSaver.save("section " + getSecIndex(this, Sec) + + " has invalid sh_entsize: " + Twine(Sec->sh_entsize))); uintX_t Offset = Sec->sh_offset; uintX_t Size = Sec->sh_size; if (Size % sizeof(T)) - return createError("size is not a multiple of sh_entsize"); + return createError(ErrSaver.save("section " + getSecIndex(this, Sec) + + " has invalid sh_size (" + Twine(Size) + + "): is not a multiple of sh_entsize (" + + Twine(Sec->sh_entsize) + ")")); if ((std::numeric_limits::max() - Offset < Size) || Offset + Size > Buf.size()) - return createError("invalid section offset"); + return createError(ErrSaver.save( + "section " + getSecIndex(this, Sec) + " has invalid sh_offset (0x" + + Twine::utohexstr(Offset) + ") or sh_size (" + Twine(Size) + ")")); if (Offset % alignof(T)) + // TODO: this error is untested. return createError("unaligned data"); const T *Start = reinterpret_cast(base() + Offset); @@ -436,6 +474,7 @@ if (!Index) // no section string table. return ""; if (Index >= Sections.size()) + // TODO: this error is untested. return createError("invalid section index"); return getStringTable(&Sections[Index]); } @@ -445,7 +484,8 @@ template Expected> ELFFile::create(StringRef Object) { if (sizeof(Elf_Ehdr) > Object.size()) - return createError("Invalid buffer"); + return createError(ErrSaver.save("invalid buffer, size is too small: " + + Twine(Object.size()))); return ELFFile(Object); } @@ -456,16 +496,18 @@ return ArrayRef(); if (getHeader()->e_shentsize != sizeof(Elf_Shdr)) - return createError( - "invalid section header entry size (e_shentsize) in ELF header"); + return createError(ErrSaver.save("invalid e_shentsize in ELF header: " + + Twine(getHeader()->e_shentsize))); const uint64_t FileSize = Buf.size(); - if (SectionTableOffset + sizeof(Elf_Shdr) > FileSize) - return createError("section header table goes past the end of the file"); + return createError(ErrSaver.save( + "section header table goes past the end of the file: e_shoff = 0x" + + Twine::utohexstr(SectionTableOffset))); // Invalid address alignment of section headers if (SectionTableOffset & (alignof(Elf_Shdr) - 1)) + // TODO: this error is untested. return createError("invalid alignment of section headers"); const Elf_Shdr *First = @@ -476,6 +518,7 @@ NumSections = First->sh_size; if (NumSections > UINT64_MAX / sizeof(Elf_Shdr)) + // TODO: this error is untested. return createError("section table goes past the end of file"); const uint64_t SectionTableSize = NumSections * sizeof(Elf_Shdr); @@ -502,10 +545,14 @@ Expected ELFFile::getEntry(const Elf_Shdr *Section, uint32_t Entry) const { if (sizeof(T) != Section->sh_entsize) + // TODO: this error is untested. return createError("invalid sh_entsize"); size_t Pos = Section->sh_offset + Entry * sizeof(T); if (Pos + sizeof(T) > Buf.size()) - return createError("invalid section offset"); + return createError(ErrSaver.save("unable to access section " + + getSecIndex(this, Section) + + " data at 0x" + Twine::utohexstr(Pos) + + ": offset goes past the end of file")); return reinterpret_cast(base() + Pos); } @@ -531,6 +578,7 @@ if (*SecNameOrErr == SectionName) return &Sec; } + // TODO: this error is untested. return createError("invalid section name"); } @@ -538,15 +586,24 @@ Expected ELFFile::getStringTable(const Elf_Shdr *Section) const { if (Section->sh_type != ELF::SHT_STRTAB) - return createError("invalid sh_type for string table, expected SHT_STRTAB"); + return createError(ErrSaver.save( + "invalid sh_type for string table section " + + getSecIndex(this, Section) + ": expected SHT_STRTAB, but got " + + object::getELFSectionTypeName(getHeader()->e_machine, + Section->sh_type))); auto V = getSectionContentsAsArray(Section); if (!V) return V.takeError(); ArrayRef Data = *V; if (Data.empty()) + // TODO: this error is untested. return createError("empty string table"); if (Data.back() != '\0') - return createError("string table non-null terminated"); + return createError( + ErrSaver.save(object::getELFSectionTypeName(getHeader()->e_machine, + Section->sh_type) + + " string table section " + getSecIndex(this, Section) + + " is non-null terminated")); return StringRef(Data.begin(), Data.size()); } @@ -574,9 +631,12 @@ const Elf_Shdr &SymTable = **SymTableOrErr; if (SymTable.sh_type != ELF::SHT_SYMTAB && SymTable.sh_type != ELF::SHT_DYNSYM) + // TODO: this error is untested. return createError("invalid sh_type"); if (V.size() != (SymTable.sh_size / sizeof(Elf_Sym))) - return createError("invalid section contents size"); + return createError( + ErrSaver.save("SHT_SYMTAB_SHNDX section has invalid sh_size: " + + Twine(SymTable.sh_size))); return V; } @@ -595,6 +655,7 @@ Elf_Shdr_Range Sections) const { if (Sec.sh_type != ELF::SHT_SYMTAB && Sec.sh_type != ELF::SHT_DYNSYM) + // TODO: this error is untested. return createError( "invalid sh_type for symbol table, expected SHT_SYMTAB or SHT_DYNSYM"); auto SectionOrErr = object::getSection(Sections, Sec.sh_link); @@ -622,7 +683,11 @@ if (Offset == 0) return StringRef(); if (Offset >= DotShstrtab.size()) - return createError("invalid string offset"); + return createError(ErrSaver.save("a section " + getSecIndex(this, Section) + + " has invalid sh_name (0x" + + Twine::utohexstr(Offset) + + ") offset which goes past the end of the " + "sections string table")); return StringRef(DotShstrtab.data() + Offset); } Index: lib/Object/ELF.cpp =================================================================== --- lib/Object/ELF.cpp +++ lib/Object/ELF.cpp @@ -13,6 +13,9 @@ using namespace llvm; using namespace object; +BumpPtrAllocator object::ErrAlloc; +StringSaver object::ErrSaver{ErrAlloc}; + #define STRINGIFY_ENUM_CASE(ns, name) \ case ns::name: \ return #name; @@ -537,12 +540,15 @@ } if (Dyn.empty()) + // TODO: this error is untested. return createError("invalid empty dynamic section"); if (DynSecSize % sizeof(Elf_Dyn) != 0) + // TODO: this error is untested. return createError("malformed dynamic section"); if (Dyn.back().d_tag != ELF::DT_NULL) + // TODO: this error is untested. return createError("dynamic sections must be DT_NULL terminated"); return Dyn; @@ -567,12 +573,14 @@ }); if (I == LoadSegments.begin()) - return createError("Virtual address is not in any segment"); + return createError(ErrSaver.save( + "virtual address is not in any segment: 0x" + Twine::utohexstr(VAddr))); --I; const Elf_Phdr &Phdr = **I; uint64_t Delta = VAddr - Phdr.p_vaddr; if (Delta >= Phdr.p_filesz) - return createError("Virtual address is not in any segment"); + return createError(ErrSaver.save( + "virtual address is not in any segment: 0x" + Twine::utohexstr(VAddr))); return base() + Phdr.p_offset + Delta; } Index: test/Object/corrupt.test =================================================================== --- test/Object/corrupt.test +++ test/Object/corrupt.test @@ -2,21 +2,21 @@ RUN: not llvm-readobj %p/Inputs/corrupt.elf-x86-64 -sections \ RUN: 2>&1 | FileCheck --check-prefix=SECNAME %s -SECNAME: invalid string offset +SECNAME: a section [5] has invalid sh_name (0x100031) offset which goes past the end of the sections string table // Section data offset past end of file. RUN: not llvm-readobj %p/Inputs/corrupt.elf-x86-64 -sections -section-data \ RUN: 2>&1 | FileCheck --check-prefix=SECDATA %s -SECDATA: invalid section offset +SECDATA: section [1] has invalid sh_offset (0x100001) or sh_size (38) // Symbol name offset overflows string table. RUN: not llvm-readobj %p/Inputs/corrupt.elf-x86-64 -symbols \ RUN: 2>&1 | FileCheck --check-prefix=SYMNAME %s -SYMNAME: invalid string offset +SYMNAME: a section [5] has invalid sh_name (0x100031) offset which goes past the end of the sections string table // Version index in .gnu.version overflows the version map. @@ -35,7 +35,7 @@ RUN: %p/Inputs/corrupt-invalid-virtual-addr.elf.x86-64 2>&1 | \ RUN: FileCheck --check-prefix=VIRTADDR %s -VIRTADDR: warning: Unable to parse DT_STRTAB: Virtual address is not in any segment +VIRTADDR: Unable to parse DT_STRTAB: virtual address is not in any segment: 0xffff RUN: not llvm-readobj --dyn-relocations \ Index: test/Object/elf-invalid-phdr.test =================================================================== --- test/Object/elf-invalid-phdr.test +++ test/Object/elf-invalid-phdr.test @@ -23,4 +23,4 @@ RUN: not llvm-objdump -private-headers %p/Inputs/invalid-phdr.elf 2>&1 \ RUN: | FileCheck %s -CHECK: LLVM ERROR: program headers longer than binary +CHECK: LLVM ERROR: program headers are longer than binary of size 4162: e_phoff = 0xffffff, e_phnum = 1, e_phentsize = 56 \ No newline at end of file Index: test/Object/invalid.test =================================================================== --- test/Object/invalid.test +++ test/Object/invalid.test @@ -91,8 +91,8 @@ # RUN: yaml2obj %s --docnum=5 -o %t5 # RUN: not llvm-objdump -syms %t5 2>&1 | FileCheck --check-prefix=NONULL %s -# NONULL: string table non-null terminated - +# NONULL: SHT_STRTAB string table section [1] is non-null terminated + --- !ELF FileHeader: Class: ELFCLASS64 @@ -152,7 +152,7 @@ # RUN: yaml2obj %s --docnum=8 -o %t8 # RUN: not llvm-readobj --symbols %t8 2>&1 | FileCheck --check-prefix=INVALID-SYMTAB-LINK %s -# INVALID-SYMTAB-LINK: invalid section index +# INVALID-SYMTAB-LINK: invalid section index: 255 --- !ELF FileHeader: @@ -171,7 +171,7 @@ # RUN: yaml2obj %s --docnum=9 -o %t9 # RUN: not llvm-readobj -S %t9 2>&1 | FileCheck --check-prefix=INVALID-SH-ENTSIZE %s -# INVALID-SH-ENTSIZE: invalid section header entry size (e_shentsize) in ELF header +# INVALID-SH-ENTSIZE: invalid e_shentsize in ELF header: 1 --- !ELF FileHeader: @@ -187,7 +187,7 @@ # RUN: yaml2obj %s --docnum=10 -o %t10 # RUN: not llvm-readobj --symbols %t10 2>&1 | FileCheck --check-prefix=INVALID-SYMTAB-SIZE %s -# INVALID-SYMTAB-SIZE: size is not a multiple of sh_entsize +# INVALID-SYMTAB-SIZE: section [1] has invalid sh_size (1): is not a multiple of sh_entsize (24) --- !ELF FileHeader: @@ -207,7 +207,7 @@ # RUN: yaml2obj %s --docnum=11 -o %t11 # RUN: not llvm-readobj --symbols %t11 2>&1 | FileCheck --check-prefix=INVALID-XINDEX-SIZE %s -# INVALID-XINDEX-SIZE: invalid section contents size +# INVALID-XINDEX-SIZE: SHT_SYMTAB_SHNDX section has invalid sh_size: 24 --- !ELF FileHeader: @@ -227,7 +227,7 @@ # RUN: not llvm-readobj --program-headers %p/Inputs/invalid-e_shnum.elf 2>&1 | \ # RUN: FileCheck --check-prefix=INVALID-PH-ENTSIZE %s -# INVALID-PH-ENTSIZE: invalid e_phentsize +# INVALID-PH-ENTSIZE: invalid e_phentsize: 12336 ## Check that llvm-readobj reports an error when we have no SHT_SYMTAB_SHNDX section, ## but have a symbol referencing it. @@ -235,25 +235,26 @@ # RUN: not llvm-readobj --symbols %p/Inputs/invalid-ext-symtab-index.elf-x86-64 2>&1 | \ # RUN: FileCheck --check-prefix=INVALID-EXT-SYMTAB-INDEX %s -# INVALID-EXT-SYMTAB-INDEX: index past the end of the symbol table +# INVALID-EXT-SYMTAB-INDEX: error: extended symbol index (0) is past the end of the SHT_SYMTAB_SHNDX section of size 0 ## Check that llvm-readobj reports an error if a relocation section ## has a broken sh_offset (past the end of the file). # RUN: not llvm-readobj -r %p/Inputs/invalid-relocation-sec-sh_offset.elf-i386 2>&1 | \ -# RUN: FileCheck --check-prefix=INVALID-RELOC-SH-OFFSET %s +# RUN: FileCheck --check-prefix=INVALID-RELOC-SH-OFFSET1 %s # RUN: not llvm-readobj -r %p/Inputs/invalid-relocation-sec-sh_offset.elf-x86-64 2>&1 | \ -# RUN: FileCheck --check-prefix=INVALID-RELOC-SH-OFFSET %s - -# INVALID-RELOC-SH-OFFSET: invalid section offset +# RUN: FileCheck --check-prefix=INVALID-RELOC-SH-OFFSET2 %s +# INVALID-RELOC-SH-OFFSET1: section [2] has invalid sh_offset (0xffffff) or sh_size (8) +# INVALID-RELOC-SH-OFFSET2: section [2] has invalid sh_offset (0xffffff) or sh_size (24) + ## Check that llvm-objdump reports an error when .shstrtab has a broken sh_offset ## so large that sh_offset + sh_size overflows the platform address size type. # RUN: not llvm-readobj --symbols %p/Inputs/invalid-section-size2.elf 2>&1 | \ # RUN: FileCheck --check-prefix=INVALID-SECTION-SIZE2 %s -# INVALID-SECTION-SIZE2: invalid section offset +# INVALID-SECTION-SIZE2: section [5] has invalid sh_offset (0xffff0381) or sh_size (65494) ## Check that llvm-readobj reports an error when trying to dump sections ## when the e_shnum field is broken (is greater than the actual number of sections). @@ -277,7 +278,7 @@ # RUN: yaml2obj %s --docnum=13 -o %t13 # RUN: not llvm-readobj -r %t13 2>&1 | FileCheck --check-prefix=INVALID-REL-SYM %s -# INVALID-REL-SYM: invalid section offset +# INVALID-REL-SYM: unable to access section [2] data at 0x18000180: offset goes past the end of file --- !ELF FileHeader: @@ -302,7 +303,7 @@ # RUN: echo -e -n "\x7f\x45\x4c\x46\x02\x01\x01\x03\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00" > %t11 # RUN: not llvm-readobj -r %t11 2>&1 | FileCheck --check-prefix=INVALID-BUFFER %s -# INVALID-BUFFER: Invalid buffer +# INVALID-BUFFER: invalid buffer, size is too small: 18 # RUN: not llvm-readobj %p/Inputs/invalid-coff-header-too-small 2>&1 | FileCheck --check-prefix=COFF-HEADER %s # COFF-HEADER: The file was not recognized as a valid object file Index: test/tools/llvm-elfabi/binary-read-bad-vaddr.test =================================================================== --- test/tools/llvm-elfabi/binary-read-bad-vaddr.test +++ test/tools/llvm-elfabi/binary-read-bad-vaddr.test @@ -47,4 +47,4 @@ Sections: - Section: .dynamic -# CHECK: Virtual address is not in any segment when locating .dynstr section contents +# CHECK: virtual address is not in any segment: 0x260 when locating .dynstr section contents Index: test/tools/llvm-objcopy/ELF/invalid-e_phoff.test =================================================================== --- test/tools/llvm-objcopy/ELF/invalid-e_phoff.test +++ test/tools/llvm-objcopy/ELF/invalid-e_phoff.test @@ -13,11 +13,13 @@ ## Truncate the file to end before the program header table ends. # RUN: %python -c "with open('%/t.o', 'r+b') as input: input.truncate(65)" -# RUN: not llvm-objcopy %t.o 2>&1 | FileCheck %s +# RUN: not llvm-objcopy %t.o 2>&1 | FileCheck %s --check-prefix=CASE1 + +# CASE1: error: program headers are longer than binary of size 65: e_phoff = 0x40, e_phnum = 1, e_phentsize = 56 ## Set the e_phoff field to a value much larger than the object file size. # RUN: %python -c "with open('%/t2.o', 'r+b') as input: import struct; bytes = struct.pack('&1 | FileCheck %s +# RUN: not llvm-objcopy %t2.o 2>&1 | FileCheck %s --check-prefix=CASE2 --- !ELF FileHeader: @@ -28,4 +30,4 @@ ProgramHeaders: - Type: PT_LOAD -# CHECK: error: program headers longer than binary +# CASE2: error: program headers are longer than binary of size 120: e_phoff = 0x40000000, e_phnum = 1, e_phentsize = 56 Index: test/tools/llvm-objcopy/ELF/invalid-e_shoff.test =================================================================== --- test/tools/llvm-objcopy/ELF/invalid-e_shoff.test +++ test/tools/llvm-objcopy/ELF/invalid-e_shoff.test @@ -11,11 +11,13 @@ ## Truncate the file to end before the section header table ends. # RUN: %python -c "with open('%/t.o', 'r+b') as input: input.truncate(65)" -# RUN: not llvm-objcopy %t.o 2>&1 | FileCheck %s -DINPUT=%t.o +# RUN: not llvm-objcopy %t.o 2>&1 | FileCheck %s -DINPUT=%t.o --check-prefix=CASE1 + +# CASE1: error: '[[INPUT]]': section header table goes past the end of the file: e_shoff = 0x40 ## Set the e_shoff field to a value much larger than the object file size. # RUN: %python -c "with open('%/t2.o', 'r+b') as input: import struct; bytes = struct.pack('&1 | FileCheck %s -DINPUT=%t2.o +# RUN: not llvm-objcopy %t2.o 2>&1 | FileCheck %s -DINPUT=%t2.o --check-prefix=CASE2 --- !ELF FileHeader: @@ -27,4 +29,4 @@ - Name: .foo Type: SHT_PROGBITS -# CHECK: error: '[[INPUT]]': section header table goes past the end of the file +# CASE2: error: '[[INPUT]]': section header table goes past the end of the file: e_shoff = 0x40000000 Index: test/tools/llvm-readobj/elf-broken-dynsym-link.test =================================================================== --- test/tools/llvm-readobj/elf-broken-dynsym-link.test +++ test/tools/llvm-readobj/elf-broken-dynsym-link.test @@ -6,7 +6,7 @@ # RUN: llvm-readobj -S %t1 2>&1 | FileCheck %s --check-prefixes=LLVM,ERR # RUN: llvm-readelf -S %t1 2>&1 | FileCheck %s --check-prefixes=GNU,ERR -# ERR: warning: invalid sh_type for string table, expected SHT_STRTAB +# ERR: warning: invalid sh_type for string table section [0]: expected SHT_STRTAB, but got SHT_NULL # LLVM: Name: .dynsym # LLVM-NEXT: Type: SHT_DYNSYM Index: test/tools/llvm-readobj/elf-dynamic-malformed.test =================================================================== --- test/tools/llvm-readobj/elf-dynamic-malformed.test +++ test/tools/llvm-readobj/elf-dynamic-malformed.test @@ -141,7 +141,7 @@ # RUN: llvm-readobj --dynamic-table %t.bad-strtab 2>&1 >/dev/null | FileCheck %s --check-prefix BAD-STRTAB-ERR # RUN: llvm-readelf --dynamic-table %t.bad-strtab 2>&1 >/dev/null | FileCheck %s --check-prefix BAD-STRTAB-ERR -# BAD-STRTAB-ERR: warning: Unable to parse DT_STRTAB: Virtual address is not in any segment +# BAD-STRTAB-ERR: warning: Unable to parse DT_STRTAB: virtual address is not in any segment: 0x2000000 # RUN: llvm-readobj --dynamic-table --needed-libs %t.bad-strtab | FileCheck %s --check-prefixes=BAD-STRTAB,BAD-STRTAB-LLVM # RUN: llvm-readelf --dynamic-table --needed-libs %t.bad-strtab | FileCheck %s --check-prefixes=BAD-STRTAB,BAD-STRTAB-GNU @@ -186,7 +186,8 @@ # RUN: llvm-readobj --dynamic-table %t.bad-rela 2>&1 | FileCheck %s --check-prefixes=CHECK,BAD-RELA # RUN: llvm-readelf --dynamic-table %t.bad-rela 2>&1 | FileCheck %s --check-prefixes=CHECK,BAD-RELA-GNU -# CHECK: warning: Unable to parse DT_RELA: Virtual address is not in any segment +# CHECK: warning: Unable to parse DT_RELA: virtual address is not in any segment: 0x1000000 + # BAD-RELA: DynamicSection [ (2 entries) # BAD-RELA-NEXT: Tag Type Name/Value # BAD-RELA-NEXT: 0x0000000000000007 RELA 0x1000000