Skip to content

Commit 7b74706

Browse files
committed
[llvm-objdump] --adjust-vma adjust symbol table
Add a shouldAdjustVA(Section) guard on top of address update. Update llvm-objdump file to update symbol table when --adjust-vma used. Fixes #63203 Patch by HamidrezaSK (Hamidreza Sanaee)
1 parent 46ee3b3 commit 7b74706

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

llvm/test/tools/llvm-objdump/X86/adjust-vma.test

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@
3535
# NOADJUST-NEXT: 0000000000000000 l .debug_str 0000000000000000 debug_str_sym
3636

3737
# ADJUST: SYMBOL TABLE:
38-
# ADJUST-NEXT: 0000000000000001 l F .text 0000000000000000 func
39-
# ADJUST-NEXT: 0000000000000000 l .text 0000000000000000 sym
40-
# ADJUST-NEXT: 0000000000000000 l d .text 0000000000000000 .text
38+
# ADJUST-NEXT: 0000000000123001 l F .text 0000000000000000 func
39+
# ADJUST-NEXT: 0000000000123000 l .text 0000000000000000 sym
40+
# ADJUST-NEXT: 0000000000123000 l d .text 0000000000000000 .text
4141
# ADJUST-NEXT: 0000000000003333 l *ABS* 0000000000000000 abs
4242
# ADJUST-NEXT: 0000000000000000 l .debug_str 0000000000000000 debug_str_sym
4343

llvm/tools/llvm-objdump/llvm-objdump.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2555,6 +2555,9 @@ void Dumper::printSymbol(const SymbolRef &Symbol,
25552555
return;
25562556
}
25572557
uint64_t Address = *AddrOrErr;
2558+
section_iterator SecI = unwrapOrError(Symbol.getSection(), FileName);
2559+
if (SecI != O.section_end() && shouldAdjustVA(*SecI))
2560+
Address += AdjustVMA;
25582561
if ((Address < StartAddress) || (Address > StopAddress))
25592562
return;
25602563
SymbolRef::Type Type =

0 commit comments

Comments
 (0)