[PATCH] D154665: fixed invalid symbol handling in ELFObjectFile::getSymbolName
Dayann D'almeida via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 11 16:18:16 PDT 2023
JestrTulip updated this revision to Diff 539323.
JestrTulip added a comment.
updated section-symbols.test
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D154665/new/
https://reviews.llvm.org/D154665
Files:
llvm/include/llvm/Object/ELFObjectFile.h
llvm/test/tools/llvm-objdump/ELF/section-symbols.test
Index: llvm/test/tools/llvm-objdump/ELF/section-symbols.test
===================================================================
--- llvm/test/tools/llvm-objdump/ELF/section-symbols.test
+++ llvm/test/tools/llvm-objdump/ELF/section-symbols.test
@@ -5,12 +5,15 @@
# RUN: yaml2obj %s -o %t1
# RUN: llvm-objdump -r --syms %t1 2>&1 | \
# RUN: FileCheck %s -DFILE=%t1 --implicit-check-not=warning:
+# RUN: llvm-objdump -d --syms %t1 2>&1 | \
+# RUN: FileCheck %s -DFILE=%t1 --check-prefix=CHECK-DISAS
# CHECK: SYMBOL TABLE:
# CHECK-NEXT: 00000000 l d .foo 00000000 .foo
# CHECK-NEXT: 00000000 l d .foo 00000000 .foo
# CHECK-NEXT: warning: '[[FILE]]': invalid section index: 67
# CHECK-NEXT: warning: '[[FILE]]': invalid section index: 68
+# CHECK-DISAS: warning: '[[FILE]]': invalid section index: 67
# CHECK: RELOCATION RECORDS FOR [.foo]:
# CHECK-NEXT: OFFSET TYPE VALUE
Index: llvm/include/llvm/Object/ELFObjectFile.h
===================================================================
--- llvm/include/llvm/Object/ELFObjectFile.h
+++ llvm/include/llvm/Object/ELFObjectFile.h
@@ -530,10 +530,10 @@
// If the symbol name is empty use the section name.
if ((*SymOrErr)->getType() == ELF::STT_SECTION) {
- if (Expected<section_iterator> SecOrErr = getSymbolSection(Sym)) {
- consumeError(Name.takeError());
+ Expected<section_iterator> SecOrErr = getSymbolSection(Sym);
+ if (SecOrErr)
return (*SecOrErr)->getName();
- }
+ return SecOrErr.takeError();
}
return Name;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D154665.539323.patch
Type: text/x-patch
Size: 1568 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230711/93ef01a5/attachment.bin>
More information about the llvm-commits
mailing list