[PATCH] D153027: [llvm-objdump] --adjust-vma adjust symbol table
Hamidreza Sanaee via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sat Jun 17 06:27:49 PDT 2023
HamidrezaSK updated this revision to Diff 532393.
HamidrezaSK edited the summary of this revision.
HamidrezaSK added a comment.
Add a shouldAdjustVA(Section) guard on top of the address update.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D153027/new/
https://reviews.llvm.org/D153027
Files:
llvm/test/tools/llvm-objdump/X86/adjust-vma.test
llvm/tools/llvm-objdump/llvm-objdump.cpp
Index: llvm/tools/llvm-objdump/llvm-objdump.cpp
===================================================================
--- llvm/tools/llvm-objdump/llvm-objdump.cpp
+++ llvm/tools/llvm-objdump/llvm-objdump.cpp
@@ -2400,6 +2400,9 @@
const MachOObjectFile *MachO = dyn_cast<const MachOObjectFile>(&O);
uint64_t Address = unwrapOrError(Symbol.getAddress(), FileName, ArchiveName,
ArchitectureName);
+ section_iterator SecI = unwrapOrError(Symbol.getSection(), FileName);
+ if (shouldAdjustVA(*SecI))
+ Address += AdjustVMA;
if ((Address < StartAddress) || (Address > StopAddress))
return;
SymbolRef::Type Type =
Index: llvm/test/tools/llvm-objdump/X86/adjust-vma.test
===================================================================
--- llvm/test/tools/llvm-objdump/X86/adjust-vma.test
+++ llvm/test/tools/llvm-objdump/X86/adjust-vma.test
@@ -27,10 +27,15 @@
# ADJUST-NEXT: 7 .strtab 00000010 0000000000000000
# ADJUST-NEXT: 8 .shstrtab 0000003c 0000000000000000
-# COMMON: SYMBOL TABLE:
-# COMMON-NEXT: 0000000000000001 l F .text 0000000000000000 func
-# COMMON-NEXT: 0000000000000000 l .text 0000000000000000 sym
-# COMMON-NEXT: 0000000000000000 l d .text 0000000000000000 .text
+# NOADJUST: SYMBOL TABLE:
+# NOADJUST-NEXT: 0000000000000001 l F .text 0000000000000000 func
+# NOADJUST-NEXT: 0000000000000000 l .text 0000000000000000 sym
+# NOADJUST-NEXT: 0000000000000000 l d .text 0000000000000000 .text
+
+# ADJUST: SYMBOL TABLE:
+# ADJUST-NEXT: 0000000000123001 l F .text 0000000000000000 func
+# ADJUST-NEXT: 0000000000123000 l .text 0000000000000000 sym
+# ADJUST-NEXT: 0000000000123000 l d .text 0000000000000000 .text
# NOADJUST: 0000000000000000 <sym>:
# NOADJUST-NEXT: 0: {{.*}} nop
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D153027.532393.patch
Type: text/x-patch
Size: 1823 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230617/55d26c5e/attachment.bin>
More information about the llvm-commits
mailing list