mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-10-19 02:52:53 +02:00
[llvm-readelf/obj] - Report unique warnings in parseDynamicTable
.
This makes the warnings reported to be unique and adds test cases. Differential revision: https://reviews.llvm.org/D92382
This commit is contained in:
parent
9ac48f4618
commit
b7a191f814
@ -451,11 +451,15 @@ DynamicSymbols: []
|
||||
## c) In the case when the DT_SYMENT tag is present, we report when it's value does not match the
|
||||
# value of the symbol size for the platform.
|
||||
# RUN: yaml2obj %s -D BITS=32 --docnum=12 -o %t12
|
||||
# RUN: llvm-readobj --dyn-symbols %t12 2>&1 | FileCheck %s -DFILE=%t12 --check-prefix=DYNSYM-SIZE-INVALID3
|
||||
# RUN: llvm-readelf --dyn-symbols %t12 2>&1 | FileCheck %s -DFILE=%t12 --check-prefix=DYNSYM-SIZE-INVALID3
|
||||
# RUN: llvm-readobj --dyn-symbols %t12 2>&1 | \
|
||||
# RUN: FileCheck %s -DFILE=%t12 --implicit-check-not=warning: --check-prefix=DYNSYM-SIZE-INVALID3
|
||||
# RUN: llvm-readelf --dyn-symbols %t12 2>&1 | \
|
||||
# RUN: FileCheck %s -DFILE=%t12 --implicit-check-not=warning: --check-prefix=DYNSYM-SIZE-INVALID3
|
||||
# RUN: yaml2obj %s -D BITS=64 --docnum=12 -o %t13
|
||||
# RUN: llvm-readobj --dyn-symbols %t13 2>&1 | FileCheck %s -DFILE=%t13 --check-prefix=DYNSYM-SIZE-INVALID4
|
||||
# RUN: llvm-readelf --dyn-symbols %t13 2>&1 | FileCheck %s -DFILE=%t13 --check-prefix=DYNSYM-SIZE-INVALID4
|
||||
# RUN: llvm-readobj --dyn-symbols %t13 2>&1 | \
|
||||
# RUN: FileCheck %s -DFILE=%t13 --implicit-check-not=warning: --check-prefix=DYNSYM-SIZE-INVALID4
|
||||
# RUN: llvm-readelf --dyn-symbols %t13 2>&1 | \
|
||||
# RUN: FileCheck %s -DFILE=%t13 --implicit-check-not=warning: --check-prefix=DYNSYM-SIZE-INVALID4
|
||||
|
||||
# DYNSYM-SIZE-INVALID3: warning: '[[FILE]]': DT_SYMENT value of 0x123 is not the size of a symbol (0x10){{$}}
|
||||
# DYNSYM-SIZE-INVALID4: warning: '[[FILE]]': DT_SYMENT value of 0x123 is not the size of a symbol (0x18){{$}}
|
||||
@ -502,6 +506,8 @@ Sections:
|
||||
- Name: .dynamic
|
||||
Type: SHT_DYNAMIC
|
||||
Entries:
|
||||
- Tag: DT_SYMENT
|
||||
Value: 0x123
|
||||
- Tag: DT_SYMENT
|
||||
Value: 0x123
|
||||
- Tag: DT_NULL
|
||||
|
@ -215,6 +215,9 @@ Sections:
|
||||
Type: SHT_DYNAMIC
|
||||
Address: 0x1000
|
||||
Entries:
|
||||
## Two DT_STRTAB entries are needed to check that we don't report it twice.
|
||||
- Tag: DT_STRTAB
|
||||
Value: 0x2000000
|
||||
- Tag: DT_STRTAB
|
||||
Value: 0x2000000
|
||||
- Tag: DT_STRSZ
|
||||
|
@ -2090,11 +2090,9 @@ void ELFDumper<ELFT>::parseDynamicTable() {
|
||||
auto toMappedAddr = [&](uint64_t Tag, uint64_t VAddr) -> const uint8_t * {
|
||||
auto MappedAddrOrError = Obj.toMappedAddr(VAddr);
|
||||
if (!MappedAddrOrError) {
|
||||
Error Err =
|
||||
createError("Unable to parse DT_" + Obj.getDynamicTagAsString(Tag) +
|
||||
": " + llvm::toString(MappedAddrOrError.takeError()));
|
||||
|
||||
reportWarning(std::move(Err), ObjF.getFileName());
|
||||
this->reportUniqueWarning("Unable to parse DT_" +
|
||||
Obj.getDynamicTagAsString(Tag) + ": " +
|
||||
llvm::toString(MappedAddrOrError.takeError()));
|
||||
return nullptr;
|
||||
}
|
||||
return MappedAddrOrError.get();
|
||||
@ -2134,11 +2132,10 @@ void ELFDumper<ELFT>::parseDynamicTable() {
|
||||
case ELF::DT_SYMENT: {
|
||||
uint64_t Val = Dyn.getVal();
|
||||
if (Val != sizeof(Elf_Sym))
|
||||
reportWarning(createError("DT_SYMENT value of 0x" +
|
||||
this->reportUniqueWarning("DT_SYMENT value of 0x" +
|
||||
Twine::utohexstr(Val) +
|
||||
" is not the size of a symbol (0x" +
|
||||
Twine::utohexstr(sizeof(Elf_Sym)) + ")"),
|
||||
ObjF.getFileName());
|
||||
Twine::utohexstr(sizeof(Elf_Sym)) + ")");
|
||||
break;
|
||||
}
|
||||
case ELF::DT_RELA:
|
||||
|
Loading…
Reference in New Issue
Block a user