Skip to content

Commit 93d8c9c

Browse files
committed
[𝘀𝗽𝗿] initial version
Created using spr 1.3.5-bogner
1 parent ad060df commit 93d8c9c

File tree

2 files changed

+97
-1
lines changed

2 files changed

+97
-1
lines changed
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
# RUN: rm -rf %t && split-file %s %t && cd %t
2+
# RUN: yaml2obj a.yaml -o out
3+
# RUN: llvm-objdump -td --adjust-vma=0x200000 --no-show-raw-insn out | FileCheck %s --match-full-lines
4+
5+
# CHECK: SYMBOL TABLE:
6+
# CHECK-NEXT: 0000000001200104 l .text 0000000000000000 f1
7+
# CHECK-NEXT: 0000000001200106 l .text 0000000000000000 f2
8+
# CHECK-NEXT: 0000000000000800 l *ABS* 0000000000000000 abs
9+
10+
# CHECK: 00000000012000f8 <_start>:
11+
# CHECK-NEXT: 12000f8: brasl %r14, 0x1200104
12+
# CHECK-NEXT: 12000fe: brasl %r14, 0x1200106
13+
# CHECK-EMPTY:
14+
# CHECK-NEXT: 0000000001200104 <f1>:
15+
# CHECK-NEXT: 1200104: br %r14
16+
# CHECK-EMPTY:
17+
# CHECK-NEXT: 0000000001200106 <f2>:
18+
# CHECK-NEXT: 1200106: br %r14
19+
20+
#--- a.s
21+
.globl _start
22+
_start:
23+
brasl %r14, f1
24+
brasl %r14, f2
25+
26+
f1:
27+
br %r14
28+
f2:
29+
br %r14
30+
31+
abs = 0x800
32+
#--- gen
33+
LLD_IN_TEST=1 clang --target=s390x-linux -no-pie -nostdlib -Wl,--no-rosegment,-zseparate-code,-znorelro,-znognustack -fuse-ld=lld a.s -o a
34+
obj2yaml a
35+
#--- a.yaml
36+
--- !ELF
37+
FileHeader:
38+
Class: ELFCLASS64
39+
Data: ELFDATA2MSB
40+
Type: ET_EXEC
41+
Machine: EM_S390
42+
Entry: 0x10000F8
43+
ProgramHeaders:
44+
- Type: PT_PHDR
45+
Flags: [ PF_R ]
46+
VAddr: 0x1000040
47+
Align: 0x8
48+
Offset: 0x40
49+
- Type: PT_INTERP
50+
Flags: [ PF_R ]
51+
FirstSec: .interp
52+
LastSec: .interp
53+
VAddr: 0x10000E8
54+
Offset: 0xE8
55+
- Type: PT_LOAD
56+
Flags: [ PF_X, PF_R ]
57+
FirstSec: .interp
58+
LastSec: .text
59+
VAddr: 0x1000000
60+
Align: 0x1000
61+
Offset: 0x0
62+
Sections:
63+
- Name: .interp
64+
Type: SHT_PROGBITS
65+
Flags: [ SHF_ALLOC ]
66+
Address: 0x10000E8
67+
AddressAlign: 0x1
68+
Content: 2F6C69622F6C6436342E736F2E3100
69+
- Name: .text
70+
Type: SHT_PROGBITS
71+
Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
72+
Address: 0x10000F8
73+
AddressAlign: 0x4
74+
Content: C0E500000006C0E50000000407FE07FE
75+
- Name: .comment
76+
Type: SHT_PROGBITS
77+
Flags: [ SHF_MERGE, SHF_STRINGS ]
78+
AddressAlign: 0x1
79+
EntSize: 0x1
80+
Offset: 0x1000
81+
Content: 4C696E6B65723A204C4C442032312E302E3000
82+
Symbols:
83+
- Name: f1
84+
Section: .text
85+
Value: 0x1000104
86+
- Name: f2
87+
Section: .text
88+
Value: 0x1000106
89+
- Name: abs
90+
Index: SHN_ABS
91+
Value: 0x800
92+
- Name: _start
93+
Section: .text
94+
Binding: STB_GLOBAL
95+
Value: 0x10000F8
96+
...

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2323,7 +2323,7 @@ disassembleObject(ObjectFile &Obj, const ObjectFile &DbgObj,
23232323
// provided
23242324
MCInst Inst;
23252325
ArrayRef<uint8_t> ThisBytes = Bytes.slice(Index);
2326-
uint64_t ThisAddr = SectionAddr + Index;
2326+
uint64_t ThisAddr = SectionAddr + Index + VMAAdjustment;
23272327
bool Disassembled = DT->DisAsm->getInstruction(
23282328
Inst, Size, ThisBytes, ThisAddr, CommentStream);
23292329
if (Size == 0)

0 commit comments

Comments
 (0)