Skip to content

Commit 345afac

Browse files
psilva261rafael2k
authored andcommitted
fix start of text for objdump
1 parent aed6992 commit 345afac

File tree

3 files changed

+17
-2
lines changed

3 files changed

+17
-2
lines changed

src/debug/plan9obj/file.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ func NewFile(r io.ReaderAt) (*File, error) {
145145
if _, err := r.ReadAt(magic[:], 0); err != nil {
146146
return nil, err
147147
}
148-
_, err := parseMagic(magic[:])
148+
m, err := parseMagic(magic[:])
149149
if err != nil {
150150
return nil, err
151151
}
@@ -169,7 +169,11 @@ func NewFile(r io.ReaderAt) (*File, error) {
169169
return nil, err
170170
}
171171
f.PtrSize = 8
172-
f.LoadAddress = 0x200000
172+
if m == MagicARM64 {
173+
f.LoadAddress = 0x10000
174+
} else {
175+
f.LoadAddress = 0x200000
176+
}
173177
f.HdrSize += 8
174178
}
175179

src/debug/plan9obj/file_test.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,17 @@ var fileTests = []fileTest{
3838
{"pcsz", 0xca0, 0x7947},
3939
},
4040
},
41+
{
42+
"testdata/arm64-plan9-exec",
43+
FileHeader{MagicARM64, 0x408, 0x1003c, 8, 0x10000, 40},
44+
[]*SectionHeader{
45+
{"text", 0x4a00, 0x28},
46+
{"data", 0xaa0, 0x4a28},
47+
{"syms", 0x294a, 0x54c8},
48+
{"spsz", 0x0, 0x7e12},
49+
{"pcsz", 0xa6c, 0x7e12},
50+
},
51+
},
4152
}
4253

4354
func TestOpen(t *testing.T) {
34.1 KB
Binary file not shown.

0 commit comments

Comments
 (0)