LEFT | RIGHT |
1 // Copyright 2014 The Go Authors. All rights reserved. | 1 // Copyright 2014 The Go Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style | 2 // Use of this source code is governed by a BSD-style |
3 // license that can be found in the LICENSE file. | 3 // license that can be found in the LICENSE file. |
4 | 4 |
5 package x86asm | 5 package x86asm |
6 | 6 |
7 import ( | 7 import ( |
8 "bytes" | 8 "bytes" |
9 "debug/elf" | 9 "debug/elf" |
10 "encoding/binary" | 10 "encoding/binary" |
(...skipping 23 matching lines...) Expand all Loading... |
34 t.Fatal(err) | 34 t.Fatal(err) |
35 } | 35 } |
36 t.Skip(err) | 36 t.Skip(err) |
37 } | 37 } |
38 | 38 |
39 testExtDis(t, "gnu", arch, objdump, generate, allowedMismatchObjdump) | 39 testExtDis(t, "gnu", arch, objdump, generate, allowedMismatchObjdump) |
40 } | 40 } |
41 | 41 |
42 func objdump(ext *ExtDis) error { | 42 func objdump(ext *ExtDis) error { |
43 // File already written with instructions; add ELF header. | 43 // File already written with instructions; add ELF header. |
44 println("objdump", ext.Arch) | |
45 if ext.Arch == 32 { | 44 if ext.Arch == 32 { |
46 if err := writeELF32(ext.File, ext.Size); err != nil { | 45 if err := writeELF32(ext.File, ext.Size); err != nil { |
47 return err | 46 return err |
48 } | 47 } |
49 } else { | 48 } else { |
50 if err := writeELF64(ext.File, ext.Size); err != nil { | 49 if err := writeELF64(ext.File, ext.Size); err != nil { |
51 return err | 50 return err |
52 } | 51 } |
53 } | 52 } |
54 | 53 |
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
305 Addr: 0, | 304 Addr: 0, |
306 Off: uint64(off2 + (off3-off2)*3), | 305 Off: uint64(off2 + (off3-off2)*3), |
307 Size: uint64(len("\x00.text\x00.shstrtab\x00")), | 306 Size: uint64(len("\x00.text\x00.shstrtab\x00")), |
308 Addralign: 1, | 307 Addralign: 1, |
309 } | 308 } |
310 binary.Write(&buf, binary.LittleEndian, §) | 309 binary.Write(&buf, binary.LittleEndian, §) |
311 buf.WriteString("\x00.text\x00.shstrtab\x00") | 310 buf.WriteString("\x00.text\x00.shstrtab\x00") |
312 f.Write(buf.Bytes()) | 311 f.Write(buf.Bytes()) |
313 return nil | 312 return nil |
314 } | 313 } |
LEFT | RIGHT |