summaryrefslogtreecommitdiff
path: root/src/pkg/debug/elf
diff options
context:
space:
mode:
Diffstat (limited to 'src/pkg/debug/elf')
-rw-r--r--src/pkg/debug/elf/Makefile2
-rw-r--r--src/pkg/debug/elf/elf.go917
-rw-r--r--src/pkg/debug/elf/elf_test.go44
-rw-r--r--src/pkg/debug/elf/file.go161
-rw-r--r--src/pkg/debug/elf/file_test.go150
5 files changed, 701 insertions, 573 deletions
diff --git a/src/pkg/debug/elf/Makefile b/src/pkg/debug/elf/Makefile
index 931f9d24d..dd431f653 100644
--- a/src/pkg/debug/elf/Makefile
+++ b/src/pkg/debug/elf/Makefile
@@ -2,7 +2,7 @@
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
-include ../../../Make.$(GOARCH)
+include ../../../Make.inc
TARG=debug/elf
GOFILES=\
diff --git a/src/pkg/debug/elf/elf.go b/src/pkg/debug/elf/elf.go
index 394a7cc87..74e979986 100644
--- a/src/pkg/debug/elf/elf.go
+++ b/src/pkg/debug/elf/elf.go
@@ -69,8 +69,8 @@ const (
)
var versionStrings = []intName{
- intName{0, "EV_NONE"},
- intName{1, "EV_CURRENT"},
+ {0, "EV_NONE"},
+ {1, "EV_CURRENT"},
}
func (i Version) String() string { return stringName(uint32(i), versionStrings, false) }
@@ -86,9 +86,9 @@ const (
)
var classStrings = []intName{
- intName{0, "ELFCLASSNONE"},
- intName{1, "ELFCLASS32"},
- intName{2, "ELFCLASS64"},
+ {0, "ELFCLASSNONE"},
+ {1, "ELFCLASS32"},
+ {2, "ELFCLASS64"},
}
func (i Class) String() string { return stringName(uint32(i), classStrings, false) }
@@ -104,9 +104,9 @@ const (
)
var dataStrings = []intName{
- intName{0, "ELFDATANONE"},
- intName{1, "ELFDATA2LSB"},
- intName{2, "ELFDATA2MSB"},
+ {0, "ELFDATANONE"},
+ {1, "ELFDATA2LSB"},
+ {2, "ELFDATA2MSB"},
}
func (i Data) String() string { return stringName(uint32(i), dataStrings, false) }
@@ -136,23 +136,23 @@ const (
)
var osabiStrings = []intName{
- intName{0, "ELFOSABI_NONE"},
- intName{1, "ELFOSABI_HPUX"},
- intName{2, "ELFOSABI_NETBSD"},
- intName{3, "ELFOSABI_LINUX"},
- intName{4, "ELFOSABI_HURD"},
- intName{5, "ELFOSABI_86OPEN"},
- intName{6, "ELFOSABI_SOLARIS"},
- intName{7, "ELFOSABI_AIX"},
- intName{8, "ELFOSABI_IRIX"},
- intName{9, "ELFOSABI_FREEBSD"},
- intName{10, "ELFOSABI_TRU64"},
- intName{11, "ELFOSABI_MODESTO"},
- intName{12, "ELFOSABI_OPENBSD"},
- intName{13, "ELFOSABI_OPENVMS"},
- intName{14, "ELFOSABI_NSK"},
- intName{97, "ELFOSABI_ARM"},
- intName{255, "ELFOSABI_STANDALONE"},
+ {0, "ELFOSABI_NONE"},
+ {1, "ELFOSABI_HPUX"},
+ {2, "ELFOSABI_NETBSD"},
+ {3, "ELFOSABI_LINUX"},
+ {4, "ELFOSABI_HURD"},
+ {5, "ELFOSABI_86OPEN"},
+ {6, "ELFOSABI_SOLARIS"},
+ {7, "ELFOSABI_AIX"},
+ {8, "ELFOSABI_IRIX"},
+ {9, "ELFOSABI_FREEBSD"},
+ {10, "ELFOSABI_TRU64"},
+ {11, "ELFOSABI_MODESTO"},
+ {12, "ELFOSABI_OPENBSD"},
+ {13, "ELFOSABI_OPENVMS"},
+ {14, "ELFOSABI_NSK"},
+ {97, "ELFOSABI_ARM"},
+ {255, "ELFOSABI_STANDALONE"},
}
func (i OSABI) String() string { return stringName(uint32(i), osabiStrings, false) }
@@ -174,15 +174,15 @@ const (
)
var typeStrings = []intName{
- intName{0, "ET_NONE"},
- intName{1, "ET_REL"},
- intName{2, "ET_EXEC"},
- intName{3, "ET_DYN"},
- intName{4, "ET_CORE"},
- intName{0xfe00, "ET_LOOS"},
- intName{0xfeff, "ET_HIOS"},
- intName{0xff00, "ET_LOPROC"},
- intName{0xffff, "ET_HIPROC"},
+ {0, "ET_NONE"},
+ {1, "ET_REL"},
+ {2, "ET_EXEC"},
+ {3, "ET_DYN"},
+ {4, "ET_CORE"},
+ {0xfe00, "ET_LOOS"},
+ {0xfeff, "ET_HIOS"},
+ {0xff00, "ET_LOPROC"},
+ {0xffff, "ET_HIPROC"},
}
func (i Type) String() string { return stringName(uint32(i), typeStrings, false) }
@@ -244,55 +244,55 @@ const (
)
var machineStrings = []intName{
- intName{0, "EM_NONE"},
- intName{1, "EM_M32"},
- intName{2, "EM_SPARC"},
- intName{3, "EM_386"},
- intName{4, "EM_68K"},
- intName{5, "EM_88K"},
- intName{7, "EM_860"},
- intName{8, "EM_MIPS"},
- intName{9, "EM_S370"},
- intName{10, "EM_MIPS_RS3_LE"},
- intName{15, "EM_PARISC"},
- intName{17, "EM_VPP500"},
- intName{18, "EM_SPARC32PLUS"},
- intName{19, "EM_960"},
- intName{20, "EM_PPC"},
- intName{21, "EM_PPC64"},
- intName{22, "EM_S390"},
- intName{36, "EM_V800"},
- intName{37, "EM_FR20"},
- intName{38, "EM_RH32"},
- intName{39, "EM_RCE"},
- intName{40, "EM_ARM"},
- intName{42, "EM_SH"},
- intName{43, "EM_SPARCV9"},
- intName{44, "EM_TRICORE"},
- intName{45, "EM_ARC"},
- intName{46, "EM_H8_300"},
- intName{47, "EM_H8_300H"},
- intName{48, "EM_H8S"},
- intName{49, "EM_H8_500"},
- intName{50, "EM_IA_64"},
- intName{51, "EM_MIPS_X"},
- intName{52, "EM_COLDFIRE"},
- intName{53, "EM_68HC12"},
- intName{54, "EM_MMA"},
- intName{55, "EM_PCP"},
- intName{56, "EM_NCPU"},
- intName{57, "EM_NDR1"},
- intName{58, "EM_STARCORE"},
- intName{59, "EM_ME16"},
- intName{60, "EM_ST100"},
- intName{61, "EM_TINYJ"},
- intName{62, "EM_X86_64"},
+ {0, "EM_NONE"},
+ {1, "EM_M32"},
+ {2, "EM_SPARC"},
+ {3, "EM_386"},
+ {4, "EM_68K"},
+ {5, "EM_88K"},
+ {7, "EM_860"},
+ {8, "EM_MIPS"},
+ {9, "EM_S370"},
+ {10, "EM_MIPS_RS3_LE"},
+ {15, "EM_PARISC"},
+ {17, "EM_VPP500"},
+ {18, "EM_SPARC32PLUS"},
+ {19, "EM_960"},
+ {20, "EM_PPC"},
+ {21, "EM_PPC64"},
+ {22, "EM_S390"},
+ {36, "EM_V800"},
+ {37, "EM_FR20"},
+ {38, "EM_RH32"},
+ {39, "EM_RCE"},
+ {40, "EM_ARM"},
+ {42, "EM_SH"},
+ {43, "EM_SPARCV9"},
+ {44, "EM_TRICORE"},
+ {45, "EM_ARC"},
+ {46, "EM_H8_300"},
+ {47, "EM_H8_300H"},
+ {48, "EM_H8S"},
+ {49, "EM_H8_500"},
+ {50, "EM_IA_64"},
+ {51, "EM_MIPS_X"},
+ {52, "EM_COLDFIRE"},
+ {53, "EM_68HC12"},
+ {54, "EM_MMA"},
+ {55, "EM_PCP"},
+ {56, "EM_NCPU"},
+ {57, "EM_NDR1"},
+ {58, "EM_STARCORE"},
+ {59, "EM_ME16"},
+ {60, "EM_ST100"},
+ {61, "EM_TINYJ"},
+ {62, "EM_X86_64"},
/* Non-standard or deprecated. */
- intName{6, "EM_486"},
- intName{10, "EM_MIPS_RS4_BE"},
- intName{41, "EM_ALPHA_STD"},
- intName{0x9026, "EM_ALPHA"},
+ {6, "EM_486"},
+ {10, "EM_MIPS_RS4_BE"},
+ {41, "EM_ALPHA_STD"},
+ {0x9026, "EM_ALPHA"},
}
func (i Machine) String() string { return stringName(uint32(i), machineStrings, false) }
@@ -315,12 +315,12 @@ const (
)
var shnStrings = []intName{
- intName{0, "SHN_UNDEF"},
- intName{0xff00, "SHN_LOPROC"},
- intName{0xff20, "SHN_LOOS"},
- intName{0xfff1, "SHN_ABS"},
- intName{0xfff2, "SHN_COMMON"},
- intName{0xffff, "SHN_XINDEX"},
+ {0, "SHN_UNDEF"},
+ {0xff00, "SHN_LOPROC"},
+ {0xff20, "SHN_LOOS"},
+ {0xfff1, "SHN_ABS"},
+ {0xfff2, "SHN_COMMON"},
+ {0xffff, "SHN_XINDEX"},
}
func (i SectionIndex) String() string { return stringName(uint32(i), shnStrings, false) }
@@ -356,29 +356,29 @@ const (
)
var shtStrings = []intName{
- intName{0, "SHT_NULL"},
- intName{1, "SHT_PROGBITS"},
- intName{2, "SHT_SYMTAB"},
- intName{3, "SHT_STRTAB"},
- intName{4, "SHT_RELA"},
- intName{5, "SHT_HASH"},
- intName{6, "SHT_DYNAMIC"},
- intName{7, "SHT_NOTE"},
- intName{8, "SHT_NOBITS"},
- intName{9, "SHT_REL"},
- intName{10, "SHT_SHLIB"},
- intName{11, "SHT_DYNSYM"},
- intName{14, "SHT_INIT_ARRAY"},
- intName{15, "SHT_FINI_ARRAY"},
- intName{16, "SHT_PREINIT_ARRAY"},
- intName{17, "SHT_GROUP"},
- intName{18, "SHT_SYMTAB_SHNDX"},
- intName{0x60000000, "SHT_LOOS"},
- intName{0x6fffffff, "SHT_HIOS"},
- intName{0x70000000, "SHT_LOPROC"},
- intName{0x7fffffff, "SHT_HIPROC"},
- intName{0x80000000, "SHT_LOUSER"},
- intName{0xffffffff, "SHT_HIUSER"},
+ {0, "SHT_NULL"},
+ {1, "SHT_PROGBITS"},
+ {2, "SHT_SYMTAB"},
+ {3, "SHT_STRTAB"},
+ {4, "SHT_RELA"},
+ {5, "SHT_HASH"},
+ {6, "SHT_DYNAMIC"},
+ {7, "SHT_NOTE"},
+ {8, "SHT_NOBITS"},
+ {9, "SHT_REL"},
+ {10, "SHT_SHLIB"},
+ {11, "SHT_DYNSYM"},
+ {14, "SHT_INIT_ARRAY"},
+ {15, "SHT_FINI_ARRAY"},
+ {16, "SHT_PREINIT_ARRAY"},
+ {17, "SHT_GROUP"},
+ {18, "SHT_SYMTAB_SHNDX"},
+ {0x60000000, "SHT_LOOS"},
+ {0x6fffffff, "SHT_HIOS"},
+ {0x70000000, "SHT_LOPROC"},
+ {0x7fffffff, "SHT_HIPROC"},
+ {0x80000000, "SHT_LOUSER"},
+ {0xffffffff, "SHT_HIUSER"},
}
func (i SectionType) String() string { return stringName(uint32(i), shtStrings, false) }
@@ -403,16 +403,16 @@ const (
)
var shfStrings = []intName{
- intName{0x1, "SHF_WRITE"},
- intName{0x2, "SHF_ALLOC"},
- intName{0x4, "SHF_EXECINSTR"},
- intName{0x10, "SHF_MERGE"},
- intName{0x20, "SHF_STRINGS"},
- intName{0x40, "SHF_INFO_LINK"},
- intName{0x80, "SHF_LINK_ORDER"},
- intName{0x100, "SHF_OS_NONCONFORMING"},
- intName{0x200, "SHF_GROUP"},
- intName{0x400, "SHF_TLS"},
+ {0x1, "SHF_WRITE"},
+ {0x2, "SHF_ALLOC"},
+ {0x4, "SHF_EXECINSTR"},
+ {0x10, "SHF_MERGE"},
+ {0x20, "SHF_STRINGS"},
+ {0x40, "SHF_INFO_LINK"},
+ {0x80, "SHF_LINK_ORDER"},
+ {0x100, "SHF_OS_NONCONFORMING"},
+ {0x200, "SHF_GROUP"},
+ {0x400, "SHF_TLS"},
}
func (i SectionFlag) String() string { return flagName(uint32(i), shfStrings, false) }
@@ -437,18 +437,18 @@ const (
)
var ptStrings = []intName{
- intName{0, "PT_NULL"},
- intName{1, "PT_LOAD"},
- intName{2, "PT_DYNAMIC"},
- intName{3, "PT_INTERP"},
- intName{4, "PT_NOTE"},
- intName{5, "PT_SHLIB"},
- intName{6, "PT_PHDR"},
- intName{7, "PT_TLS"},
- intName{0x60000000, "PT_LOOS"},
- intName{0x6fffffff, "PT_HIOS"},
- intName{0x70000000, "PT_LOPROC"},
- intName{0x7fffffff, "PT_HIPROC"},
+ {0, "PT_NULL"},
+ {1, "PT_LOAD"},
+ {2, "PT_DYNAMIC"},
+ {3, "PT_INTERP"},
+ {4, "PT_NOTE"},
+ {5, "PT_SHLIB"},
+ {6, "PT_PHDR"},
+ {7, "PT_TLS"},
+ {0x60000000, "PT_LOOS"},
+ {0x6fffffff, "PT_HIOS"},
+ {0x70000000, "PT_LOPROC"},
+ {0x7fffffff, "PT_HIPROC"},
}
func (i ProgType) String() string { return stringName(uint32(i), ptStrings, false) }
@@ -466,9 +466,9 @@ const (
)
var pfStrings = []intName{
- intName{0x1, "PF_X"},
- intName{0x2, "PF_W"},
- intName{0x4, "PF_R"},
+ {0x1, "PF_X"},
+ {0x2, "PF_W"},
+ {0x4, "PF_R"},
}
func (i ProgFlag) String() string { return flagName(uint32(i), pfStrings, false) }
@@ -523,44 +523,44 @@ const (
)
var dtStrings = []intName{
- intName{0, "DT_NULL"},
- intName{1, "DT_NEEDED"},
- intName{2, "DT_PLTRELSZ"},
- intName{3, "DT_PLTGOT"},
- intName{4, "DT_HASH"},
- intName{5, "DT_STRTAB"},
- intName{6, "DT_SYMTAB"},
- intName{7, "DT_RELA"},
- intName{8, "DT_RELASZ"},
- intName{9, "DT_RELAENT"},
- intName{10, "DT_STRSZ"},
- intName{11, "DT_SYMENT"},
- intName{12, "DT_INIT"},
- intName{13, "DT_FINI"},
- intName{14, "DT_SONAME"},
- intName{15, "DT_RPATH"},
- intName{16, "DT_SYMBOLIC"},
- intName{17, "DT_REL"},
- intName{18, "DT_RELSZ"},
- intName{19, "DT_RELENT"},
- intName{20, "DT_PLTREL"},
- intName{21, "DT_DEBUG"},
- intName{22, "DT_TEXTREL"},
- intName{23, "DT_JMPREL"},
- intName{24, "DT_BIND_NOW"},
- intName{25, "DT_INIT_ARRAY"},
- intName{26, "DT_FINI_ARRAY"},
- intName{27, "DT_INIT_ARRAYSZ"},
- intName{28, "DT_FINI_ARRAYSZ"},
- intName{29, "DT_RUNPATH"},
- intName{30, "DT_FLAGS"},
- intName{32, "DT_ENCODING"},
- intName{32, "DT_PREINIT_ARRAY"},
- intName{33, "DT_PREINIT_ARRAYSZ"},
- intName{0x6000000d, "DT_LOOS"},
- intName{0x6ffff000, "DT_HIOS"},
- intName{0x70000000, "DT_LOPROC"},
- intName{0x7fffffff, "DT_HIPROC"},
+ {0, "DT_NULL"},
+ {1, "DT_NEEDED"},
+ {2, "DT_PLTRELSZ"},
+ {3, "DT_PLTGOT"},
+ {4, "DT_HASH"},
+ {5, "DT_STRTAB"},
+ {6, "DT_SYMTAB"},
+ {7, "DT_RELA"},
+ {8, "DT_RELASZ"},
+ {9, "DT_RELAENT"},
+ {10, "DT_STRSZ"},
+ {11, "DT_SYMENT"},
+ {12, "DT_INIT"},
+ {13, "DT_FINI"},
+ {14, "DT_SONAME"},
+ {15, "DT_RPATH"},
+ {16, "DT_SYMBOLIC"},
+ {17, "DT_REL"},
+ {18, "DT_RELSZ"},
+ {19, "DT_RELENT"},
+ {20, "DT_PLTREL"},
+ {21, "DT_DEBUG"},
+ {22, "DT_TEXTREL"},
+ {23, "DT_JMPREL"},
+ {24, "DT_BIND_NOW"},
+ {25, "DT_INIT_ARRAY"},
+ {26, "DT_FINI_ARRAY"},
+ {27, "DT_INIT_ARRAYSZ"},
+ {28, "DT_FINI_ARRAYSZ"},
+ {29, "DT_RUNPATH"},
+ {30, "DT_FLAGS"},
+ {32, "DT_ENCODING"},
+ {32, "DT_PREINIT_ARRAY"},
+ {33, "DT_PREINIT_ARRAYSZ"},
+ {0x6000000d, "DT_LOOS"},
+ {0x6ffff000, "DT_HIOS"},
+ {0x70000000, "DT_LOPROC"},
+ {0x7fffffff, "DT_HIPROC"},
}
func (i DynTag) String() string { return stringName(uint32(i), dtStrings, false) }
@@ -585,11 +585,11 @@ const (
)
var dflagStrings = []intName{
- intName{0x0001, "DF_ORIGIN"},
- intName{0x0002, "DF_SYMBOLIC"},
- intName{0x0004, "DF_TEXTREL"},
- intName{0x0008, "DF_BIND_NOW"},
- intName{0x0010, "DF_STATIC_TLS"},
+ {0x0001, "DF_ORIGIN"},
+ {0x0002, "DF_SYMBOLIC"},
+ {0x0004, "DF_TEXTREL"},
+ {0x0008, "DF_BIND_NOW"},
+ {0x0010, "DF_STATIC_TLS"},
}
func (i DynFlag) String() string { return flagName(uint32(i), dflagStrings, false) }
@@ -605,9 +605,9 @@ const (
)
var ntypeStrings = []intName{
- intName{1, "NT_PRSTATUS"},
- intName{2, "NT_FPREGSET"},
- intName{3, "NT_PRPSINFO"},
+ {1, "NT_PRSTATUS"},
+ {2, "NT_FPREGSET"},
+ {3, "NT_PRPSINFO"},
}
func (i NType) String() string { return stringName(uint32(i), ntypeStrings, false) }
@@ -627,13 +627,13 @@ const (
)
var stbStrings = []intName{
- intName{0, "STB_LOCAL"},
- intName{1, "STB_GLOBAL"},
- intName{2, "STB_WEAK"},
- intName{10, "STB_LOOS"},
- intName{12, "STB_HIOS"},
- intName{13, "STB_LOPROC"},
- intName{15, "STB_HIPROC"},
+ {0, "STB_LOCAL"},
+ {1, "STB_GLOBAL"},
+ {2, "STB_WEAK"},
+ {10, "STB_LOOS"},
+ {12, "STB_HIOS"},
+ {13, "STB_LOPROC"},
+ {15, "STB_HIPROC"},
}
func (i SymBind) String() string { return stringName(uint32(i), stbStrings, false) }
@@ -657,17 +657,17 @@ const (
)
var sttStrings = []intName{
- intName{0, "STT_NOTYPE"},
- intName{1, "STT_OBJECT"},
- intName{2, "STT_FUNC"},
- intName{3, "STT_SECTION"},
- intName{4, "STT_FILE"},
- intName{5, "STT_COMMON"},
- intName{6, "STT_TLS"},
- intName{10, "STT_LOOS"},
- intName{12, "STT_HIOS"},
- intName{13, "STT_LOPROC"},
- intName{15, "STT_HIPROC"},
+ {0, "STT_NOTYPE"},
+ {1, "STT_OBJECT"},
+ {2, "STT_FUNC"},
+ {3, "STT_SECTION"},
+ {4, "STT_FILE"},
+ {5, "STT_COMMON"},
+ {6, "STT_TLS"},
+ {10, "STT_LOOS"},
+ {12, "STT_HIOS"},
+ {13, "STT_LOPROC"},
+ {15, "STT_HIPROC"},
}
func (i SymType) String() string { return stringName(uint32(i), sttStrings, false) }
@@ -684,10 +684,10 @@ const (
)
var stvStrings = []intName{
- intName{0x0, "STV_DEFAULT"},
- intName{0x1, "STV_INTERNAL"},
- intName{0x2, "STV_HIDDEN"},
- intName{0x3, "STV_PROTECTED"},
+ {0x0, "STV_DEFAULT"},
+ {0x1, "STV_INTERNAL"},
+ {0x2, "STV_HIDDEN"},
+ {0x3, "STV_PROTECTED"},
}
func (i SymVis) String() string { return stringName(uint32(i), stvStrings, false) }
@@ -728,30 +728,30 @@ const (
)
var rx86_64Strings = []intName{
- intName{0, "R_X86_64_NONE"},
- intName{1, "R_X86_64_64"},
- intName{2, "R_X86_64_PC32"},
- intName{3, "R_X86_64_GOT32"},
- intName{4, "R_X86_64_PLT32"},
- intName{5, "R_X86_64_COPY"},
- intName{6, "R_X86_64_GLOB_DAT"},
- intName{7, "R_X86_64_JMP_SLOT"},
- intName{8, "R_X86_64_RELATIVE"},
- intName{9, "R_X86_64_GOTPCREL"},
- intName{10, "R_X86_64_32"},
- intName{11, "R_X86_64_32S"},
- intName{12, "R_X86_64_16"},
- intName{13, "R_X86_64_PC16"},
- intName{14, "R_X86_64_8"},
- intName{15, "R_X86_64_PC8"},
- intName{16, "R_X86_64_DTPMOD64"},
- intName{17, "R_X86_64_DTPOFF64"},
- intName{18, "R_X86_64_TPOFF64"},
- intName{19, "R_X86_64_TLSGD"},
- intName{20, "R_X86_64_TLSLD"},
- intName{21, "R_X86_64_DTPOFF32"},
- intName{22, "R_X86_64_GOTTPOFF"},
- intName{23, "R_X86_64_TPOFF32"},
+ {0, "R_X86_64_NONE"},
+ {1, "R_X86_64_64"},
+ {2, "R_X86_64_PC32"},
+ {3, "R_X86_64_GOT32"},
+ {4, "R_X86_64_PLT32"},
+ {5, "R_X86_64_COPY"},
+ {6, "R_X86_64_GLOB_DAT"},
+ {7, "R_X86_64_JMP_SLOT"},
+ {8, "R_X86_64_RELATIVE"},
+ {9, "R_X86_64_GOTPCREL"},
+ {10, "R_X86_64_32"},
+ {11, "R_X86_64_32S"},
+ {12, "R_X86_64_16"},
+ {13, "R_X86_64_PC16"},
+ {14, "R_X86_64_8"},
+ {15, "R_X86_64_PC8"},
+ {16, "R_X86_64_DTPMOD64"},
+ {17, "R_X86_64_DTPOFF64"},
+ {18, "R_X86_64_TPOFF64"},
+ {19, "R_X86_64_TLSGD"},
+ {20, "R_X86_64_TLSLD"},
+ {21, "R_X86_64_DTPOFF32"},
+ {22, "R_X86_64_GOTTPOFF"},
+ {23, "R_X86_64_TPOFF32"},
}
func (i R_X86_64) String() string { return stringName(uint32(i), rx86_64Strings, false) }
@@ -792,34 +792,34 @@ const (
)
var ralphaStrings = []intName{
- intName{0, "R_ALPHA_NONE"},
- intName{1, "R_ALPHA_REFLONG"},
- intName{2, "R_ALPHA_REFQUAD"},
- intName{3, "R_ALPHA_GPREL32"},
- intName{4, "R_ALPHA_LITERAL"},
- intName{5, "R_ALPHA_LITUSE"},
- intName{6, "R_ALPHA_GPDISP"},
- intName{7, "R_ALPHA_BRADDR"},
- intName{8, "R_ALPHA_HINT"},
- intName{9, "R_ALPHA_SREL16"},
- intName{10, "R_ALPHA_SREL32"},
- intName{11, "R_ALPHA_SREL64"},
- intName{12, "R_ALPHA_OP_PUSH"},
- intName{13, "R_ALPHA_OP_STORE"},
- intName{14, "R_ALPHA_OP_PSUB"},
- intName{15, "R_ALPHA_OP_PRSHIFT"},
- intName{16, "R_ALPHA_GPVALUE"},
- intName{17, "R_ALPHA_GPRELHIGH"},
- intName{18, "R_ALPHA_GPRELLOW"},
- intName{19, "R_ALPHA_IMMED_GP_16"},
- intName{20, "R_ALPHA_IMMED_GP_HI32"},
- intName{21, "R_ALPHA_IMMED_SCN_HI32"},
- intName{22, "R_ALPHA_IMMED_BR_HI32"},
- intName{23, "R_ALPHA_IMMED_LO32"},
- intName{24, "R_ALPHA_COPY"},
- intName{25, "R_ALPHA_GLOB_DAT"},
- intName{26, "R_ALPHA_JMP_SLOT"},
- intName{27, "R_ALPHA_RELATIVE"},
+ {0, "R_ALPHA_NONE"},
+ {1, "R_ALPHA_REFLONG"},
+ {2, "R_ALPHA_REFQUAD"},
+ {3, "R_ALPHA_GPREL32"},
+ {4, "R_ALPHA_LITERAL"},
+ {5, "R_ALPHA_LITUSE"},
+ {6, "R_ALPHA_GPDISP"},
+ {7, "R_ALPHA_BRADDR"},
+ {8, "R_ALPHA_HINT"},
+ {9, "R_ALPHA_SREL16"},
+ {10, "R_ALPHA_SREL32"},
+ {11, "R_ALPHA_SREL64"},
+ {12, "R_ALPHA_OP_PUSH"},
+ {13, "R_ALPHA_OP_STORE"},
+ {14, "R_ALPHA_OP_PSUB"},
+ {15, "R_ALPHA_OP_PRSHIFT"},
+ {16, "R_ALPHA_GPVALUE"},
+ {17, "R_ALPHA_GPRELHIGH"},
+ {18, "R_ALPHA_GPRELLOW"},
+ {19, "R_ALPHA_IMMED_GP_16"},
+ {20, "R_ALPHA_IMMED_GP_HI32"},
+ {21, "R_ALPHA_IMMED_SCN_HI32"},
+ {22, "R_ALPHA_IMMED_BR_HI32"},
+ {23, "R_ALPHA_IMMED_LO32"},
+ {24, "R_ALPHA_COPY"},
+ {25, "R_ALPHA_GLOB_DAT"},
+ {26, "R_ALPHA_JMP_SLOT"},
+ {27, "R_ALPHA_RELATIVE"},
}
func (i R_ALPHA) String() string { return stringName(uint32(i), ralphaStrings, false) }
@@ -865,39 +865,39 @@ const (
)
var rarmStrings = []intName{
- intName{0, "R_ARM_NONE"},
- intName{1, "R_ARM_PC24"},
- intName{2, "R_ARM_ABS32"},
- intName{3, "R_ARM_REL32"},
- intName{4, "R_ARM_PC13"},
- intName{5, "R_ARM_ABS16"},
- intName{6, "R_ARM_ABS12"},
- intName{7, "R_ARM_THM_ABS5"},
- intName{8, "R_ARM_ABS8"},
- intName{9, "R_ARM_SBREL32"},
- intName{10, "R_ARM_THM_PC22"},
- intName{11, "R_ARM_THM_PC8"},
- intName{12, "R_ARM_AMP_VCALL9"},
- intName{13, "R_ARM_SWI24"},
- intName{14, "R_ARM_THM_SWI8"},
- intName{15, "R_ARM_XPC25"},
- intName{16, "R_ARM_THM_XPC22"},
- intName{20, "R_ARM_COPY"},
- intName{21, "R_ARM_GLOB_DAT"},
- intName{22, "R_ARM_JUMP_SLOT"},
- intName{23, "R_ARM_RELATIVE"},
- intName{24, "R_ARM_GOTOFF"},
- intName{25, "R_ARM_GOTPC"},
- intName{26, "R_ARM_GOT32"},
- intName{27, "R_ARM_PLT32"},
- intName{100, "R_ARM_GNU_VTENTRY"},
- intName{101, "R_ARM_GNU_VTINHERIT"},
- intName{250, "R_ARM_RSBREL32"},
- intName{251, "R_ARM_THM_RPC22"},
- intName{252, "R_ARM_RREL32"},
- intName{253, "R_ARM_RABS32"},
- intName{254, "R_ARM_RPC24"},
- intName{255, "R_ARM_RBASE"},
+ {0, "R_ARM_NONE"},
+ {1, "R_ARM_PC24"},
+ {2, "R_ARM_ABS32"},
+ {3, "R_ARM_REL32"},
+ {4, "R_ARM_PC13"},
+ {5, "R_ARM_ABS16"},
+ {6, "R_ARM_ABS12"},
+ {7, "R_ARM_THM_ABS5"},
+ {8, "R_ARM_ABS8"},
+ {9, "R_ARM_SBREL32"},
+ {10, "R_ARM_THM_PC22"},
+ {11, "R_ARM_THM_PC8"},
+ {12, "R_ARM_AMP_VCALL9"},
+ {13, "R_ARM_SWI24"},
+ {14, "R_ARM_THM_SWI8"},
+ {15, "R_ARM_XPC25"},
+ {16, "R_ARM_THM_XPC22"},
+ {20, "R_ARM_COPY"},
+ {21, "R_ARM_GLOB_DAT"},
+ {22, "R_ARM_JUMP_SLOT"},
+ {23, "R_ARM_RELATIVE"},
+ {24, "R_ARM_GOTOFF"},
+ {25, "R_ARM_GOTPC"},
+ {26, "R_ARM_GOT32"},
+ {27, "R_ARM_PLT32"},
+ {100, "R_ARM_GNU_VTENTRY"},
+ {101, "R_ARM_GNU_VTINHERIT"},
+ {250, "R_ARM_RSBREL32"},
+ {251, "R_ARM_THM_RPC22"},
+ {252, "R_ARM_RREL32"},
+ {253, "R_ARM_RABS32"},
+ {254, "R_ARM_RPC24"},
+ {255, "R_ARM_RBASE"},
}
func (i R_ARM) String() string { return stringName(uint32(i), rarmStrings, false) }
@@ -941,37 +941,37 @@ const (
)
var r386Strings = []intName{
- intName{0, "R_386_NONE"},
- intName{1, "R_386_32"},
- intName{2, "R_386_PC32"},
- intName{3, "R_386_GOT32"},
- intName{4, "R_386_PLT32"},
- intName{5, "R_386_COPY"},
- intName{6, "R_386_GLOB_DAT"},
- intName{7, "R_386_JMP_SLOT"},
- intName{8, "R_386_RELATIVE"},
- intName{9, "R_386_GOTOFF"},
- intName{10, "R_386_GOTPC"},
- intName{14, "R_386_TLS_TPOFF"},
- intName{15, "R_386_TLS_IE"},
- intName{16, "R_386_TLS_GOTIE"},
- intName{17, "R_386_TLS_LE"},
- intName{18, "R_386_TLS_GD"},
- intName{19, "R_386_TLS_LDM"},
- intName{24, "R_386_TLS_GD_32"},
- intName{25, "R_386_TLS_GD_PUSH"},
- intName{26, "R_386_TLS_GD_CALL"},
- intName{27, "R_386_TLS_GD_POP"},
- intName{28, "R_386_TLS_LDM_32"},
- intName{29, "R_386_TLS_LDM_PUSH"},
- intName{30, "R_386_TLS_LDM_CALL"},
- intName{31, "R_386_TLS_LDM_POP"},
- intName{32, "R_386_TLS_LDO_32"},
- intName{33, "R_386_TLS_IE_32"},
- intName{34, "R_386_TLS_LE_32"},
- intName{35, "R_386_TLS_DTPMOD32"},
- intName{36, "R_386_TLS_DTPOFF32"},
- intName{37, "R_386_TLS_TPOFF32"},
+ {0, "R_386_NONE"},
+ {1, "R_386_32"},
+ {2, "R_386_PC32"},
+ {3, "R_386_GOT32"},
+ {4, "R_386_PLT32"},
+ {5, "R_386_COPY"},
+ {6, "R_386_GLOB_DAT"},
+ {7, "R_386_JMP_SLOT"},
+ {8, "R_386_RELATIVE"},
+ {9, "R_386_GOTOFF"},
+ {10, "R_386_GOTPC"},
+ {14, "R_386_TLS_TPOFF"},
+ {15, "R_386_TLS_IE"},
+ {16, "R_386_TLS_GOTIE"},
+ {17, "R_386_TLS_LE"},
+ {18, "R_386_TLS_GD"},
+ {19, "R_386_TLS_LDM"},
+ {24, "R_386_TLS_GD_32"},
+ {25, "R_386_TLS_GD_PUSH"},
+ {26, "R_386_TLS_GD_CALL"},
+ {27, "R_386_TLS_GD_POP"},
+ {28, "R_386_TLS_LDM_32"},
+ {29, "R_386_TLS_LDM_PUSH"},
+ {30, "R_386_TLS_LDM_CALL"},
+ {31, "R_386_TLS_LDM_POP"},
+ {32, "R_386_TLS_LDO_32"},
+ {33, "R_386_TLS_IE_32"},
+ {34, "R_386_TLS_LE_32"},
+ {35, "R_386_TLS_DTPMOD32"},
+ {36, "R_386_TLS_DTPOFF32"},
+ {37, "R_386_TLS_TPOFF32"},
}
func (i R_386) String() string { return stringName(uint32(i), r386Strings, false) }
@@ -1061,85 +1061,85 @@ const (
)
var rppcStrings = []intName{
- intName{0, "R_PPC_NONE"},
- intName{1, "R_PPC_ADDR32"},
- intName{2, "R_PPC_ADDR24"},
- intName{3, "R_PPC_ADDR16"},
- intName{4, "R_PPC_ADDR16_LO"},
- intName{5, "R_PPC_ADDR16_HI"},
- intName{6, "R_PPC_ADDR16_HA"},
- intName{7, "R_PPC_ADDR14"},
- intName{8, "R_PPC_ADDR14_BRTAKEN"},
- intName{9, "R_PPC_ADDR14_BRNTAKEN"},
- intName{10, "R_PPC_REL24"},
- intName{11, "R_PPC_REL14"},
- intName{12, "R_PPC_REL14_BRTAKEN"},
- intName{13, "R_PPC_REL14_BRNTAKEN"},
- intName{14, "R_PPC_GOT16"},
- intName{15, "R_PPC_GOT16_LO"},
- intName{16, "R_PPC_GOT16_HI"},
- intName{17, "R_PPC_GOT16_HA"},
- intName{18, "R_PPC_PLTREL24"},
- intName{19, "R_PPC_COPY"},
- intName{20, "R_PPC_GLOB_DAT"},
- intName{21, "R_PPC_JMP_SLOT"},
- intName{22, "R_PPC_RELATIVE"},
- intName{23, "R_PPC_LOCAL24PC"},
- intName{24, "R_PPC_UADDR32"},
- intName{25, "R_PPC_UADDR16"},
- intName{26, "R_PPC_REL32"},
- intName{27, "R_PPC_PLT32"},
- intName{28, "R_PPC_PLTREL32"},
- intName{29, "R_PPC_PLT16_LO"},
- intName{30, "R_PPC_PLT16_HI"},
- intName{31, "R_PPC_PLT16_HA"},
- intName{32, "R_PPC_SDAREL16"},
- intName{33, "R_PPC_SECTOFF"},
- intName{34, "R_PPC_SECTOFF_LO"},
- intName{35, "R_PPC_SECTOFF_HI"},
- intName{36, "R_PPC_SECTOFF_HA"},
-
- intName{67, "R_PPC_TLS"},
- intName{68, "R_PPC_DTPMOD32"},
- intName{69, "R_PPC_TPREL16"},
- intName{70, "R_PPC_TPREL16_LO"},
- intName{71, "R_PPC_TPREL16_HI"},
- intName{72, "R_PPC_TPREL16_HA"},
- intName{73, "R_PPC_TPREL32"},
- intName{74, "R_PPC_DTPREL16"},
- intName{75, "R_PPC_DTPREL16_LO"},
- intName{76, "R_PPC_DTPREL16_HI"},
- intName{77, "R_PPC_DTPREL16_HA"},
- intName{78, "R_PPC_DTPREL32"},
- intName{79, "R_PPC_GOT_TLSGD16"},
- intName{80, "R_PPC_GOT_TLSGD16_LO"},
- intName{81, "R_PPC_GOT_TLSGD16_HI"},
- intName{82, "R_PPC_GOT_TLSGD16_HA"},
- intName{83, "R_PPC_GOT_TLSLD16"},
- intName{84, "R_PPC_GOT_TLSLD16_LO"},
- intName{85, "R_PPC_GOT_TLSLD16_HI"},
- intName{86, "R_PPC_GOT_TLSLD16_HA"},
- intName{87, "R_PPC_GOT_TPREL16"},
- intName{88, "R_PPC_GOT_TPREL16_LO"},
- intName{89, "R_PPC_GOT_TPREL16_HI"},
- intName{90, "R_PPC_GOT_TPREL16_HA"},
-
- intName{101, "R_PPC_EMB_NADDR32"},
- intName{102, "R_PPC_EMB_NADDR16"},
- intName{103, "R_PPC_EMB_NADDR16_LO"},
- intName{104, "R_PPC_EMB_NADDR16_HI"},
- intName{105, "R_PPC_EMB_NADDR16_HA"},
- intName{106, "R_PPC_EMB_SDAI16"},
- intName{107, "R_PPC_EMB_SDA2I16"},
- intName{108, "R_PPC_EMB_SDA2REL"},
- intName{109, "R_PPC_EMB_SDA21"},
- intName{110, "R_PPC_EMB_MRKREF"},
- intName{111, "R_PPC_EMB_RELSEC16"},
- intName{112, "R_PPC_EMB_RELST_LO"},
- intName{113, "R_PPC_EMB_RELST_HI"},
- intName{114, "R_PPC_EMB_RELST_HA"},
- intName{115, "R_PPC_EMB_BIT_FLD"},
- intName{116, "R_PPC_EMB_RELSDA"},
+ {0, "R_PPC_NONE"},
+ {1, "R_PPC_ADDR32"},
+ {2, "R_PPC_ADDR24"},
+ {3, "R_PPC_ADDR16"},
+ {4, "R_PPC_ADDR16_LO"},
+ {5, "R_PPC_ADDR16_HI"},
+ {6, "R_PPC_ADDR16_HA"},
+ {7, "R_PPC_ADDR14"},
+ {8, "R_PPC_ADDR14_BRTAKEN"},
+ {9, "R_PPC_ADDR14_BRNTAKEN"},
+ {10, "R_PPC_REL24"},
+ {11, "R_PPC_REL14"},
+ {12, "R_PPC_REL14_BRTAKEN"},
+ {13, "R_PPC_REL14_BRNTAKEN"},
+ {14, "R_PPC_GOT16"},
+ {15, "R_PPC_GOT16_LO"},
+ {16, "R_PPC_GOT16_HI"},
+ {17, "R_PPC_GOT16_HA"},
+ {18, "R_PPC_PLTREL24"},
+ {19, "R_PPC_COPY"},
+ {20, "R_PPC_GLOB_DAT"},
+ {21, "R_PPC_JMP_SLOT"},
+ {22, "R_PPC_RELATIVE"},
+ {23, "R_PPC_LOCAL24PC"},
+ {24, "R_PPC_UADDR32"},
+ {25, "R_PPC_UADDR16"},
+ {26, "R_PPC_REL32"},
+ {27, "R_PPC_PLT32"},
+ {28, "R_PPC_PLTREL32"},
+ {29, "R_PPC_PLT16_LO"},
+ {30, "R_PPC_PLT16_HI"},
+ {31, "R_PPC_PLT16_HA"},
+ {32, "R_PPC_SDAREL16"},
+ {33, "R_PPC_SECTOFF"},
+ {34, "R_PPC_SECTOFF_LO"},
+ {35, "R_PPC_SECTOFF_HI"},
+ {36, "R_PPC_SECTOFF_HA"},
+
+ {67, "R_PPC_TLS"},
+ {68, "R_PPC_DTPMOD32"},
+ {69, "R_PPC_TPREL16"},
+ {70, "R_PPC_TPREL16_LO"},
+ {71, "R_PPC_TPREL16_HI"},
+ {72, "R_PPC_TPREL16_HA"},
+ {73, "R_PPC_TPREL32"},
+ {74, "R_PPC_DTPREL16"},
+ {75, "R_PPC_DTPREL16_LO"},
+ {76, "R_PPC_DTPREL16_HI"},
+ {77, "R_PPC_DTPREL16_HA"},
+ {78, "R_PPC_DTPREL32"},
+ {79, "R_PPC_GOT_TLSGD16"},
+ {80, "R_PPC_GOT_TLSGD16_LO"},
+ {81, "R_PPC_GOT_TLSGD16_HI"},
+ {82, "R_PPC_GOT_TLSGD16_HA"},
+ {83, "R_PPC_GOT_TLSLD16"},
+ {84, "R_PPC_GOT_TLSLD16_LO"},
+ {85, "R_PPC_GOT_TLSLD16_HI"},
+ {86, "R_PPC_GOT_TLSLD16_HA"},
+ {87, "R_PPC_GOT_TPREL16"},
+ {88, "R_PPC_GOT_TPREL16_LO"},
+ {89, "R_PPC_GOT_TPREL16_HI"},
+ {90, "R_PPC_GOT_TPREL16_HA"},
+
+ {101, "R_PPC_EMB_NADDR32"},
+ {102, "R_PPC_EMB_NADDR16"},
+ {103, "R_PPC_EMB_NADDR16_LO"},
+ {104, "R_PPC_EMB_NADDR16_HI"},
+ {105, "R_PPC_EMB_NADDR16_HA"},
+ {106, "R_PPC_EMB_SDAI16"},
+ {107, "R_PPC_EMB_SDA2I16"},
+ {108, "R_PPC_EMB_SDA2REL"},
+ {109, "R_PPC_EMB_SDA21"},
+ {110, "R_PPC_EMB_MRKREF"},
+ {111, "R_PPC_EMB_RELSEC16"},
+ {112, "R_PPC_EMB_RELST_LO"},
+ {113, "R_PPC_EMB_RELST_HI"},
+ {114, "R_PPC_EMB_RELST_HA"},
+ {115, "R_PPC_EMB_BIT_FLD"},
+ {116, "R_PPC_EMB_RELSDA"},
}
func (i R_PPC) String() string { return stringName(uint32(i), rppcStrings, false) }
@@ -1208,62 +1208,62 @@ const (
)
var rsparcStrings = []intName{
- intName{0, "R_SPARC_NONE"},
- intName{1, "R_SPARC_8"},
- intName{2, "R_SPARC_16"},
- intName{3, "R_SPARC_32"},
- intName{4, "R_SPARC_DISP8"},
- intName{5, "R_SPARC_DISP16"},
- intName{6, "R_SPARC_DISP32"},
- intName{7, "R_SPARC_WDISP30"},
- intName{8, "R_SPARC_WDISP22"},
- intName{9, "R_SPARC_HI22"},
- intName{10, "R_SPARC_22"},
- intName{11, "R_SPARC_13"},
- intName{12, "R_SPARC_LO10"},
- intName{13, "R_SPARC_GOT10"},
- intName{14, "R_SPARC_GOT13"},
- intName{15, "R_SPARC_GOT22"},
- intName{16, "R_SPARC_PC10"},
- intName{17, "R_SPARC_PC22"},
- intName{18, "R_SPARC_WPLT30"},
- intName{19, "R_SPARC_COPY"},
- intName{20, "R_SPARC_GLOB_DAT"},
- intName{21, "R_SPARC_JMP_SLOT"},
- intName{22, "R_SPARC_RELATIVE"},
- intName{23, "R_SPARC_UA32"},
- intName{24, "R_SPARC_PLT32"},
- intName{25, "R_SPARC_HIPLT22"},
- intName{26, "R_SPARC_LOPLT10"},
- intName{27, "R_SPARC_PCPLT32"},
- intName{28, "R_SPARC_PCPLT22"},
- intName{29, "R_SPARC_PCPLT10"},
- intName{30, "R_SPARC_10"},
- intName{31, "R_SPARC_11"},
- intName{32, "R_SPARC_64"},
- intName{33, "R_SPARC_OLO10"},
- intName{34, "R_SPARC_HH22"},
- intName{35, "R_SPARC_HM10"},
- intName{36, "R_SPARC_LM22"},
- intName{37, "R_SPARC_PC_HH22"},
- intName{38, "R_SPARC_PC_HM10"},
- intName{39, "R_SPARC_PC_LM22"},
- intName{40, "R_SPARC_WDISP16"},
- intName{41, "R_SPARC_WDISP19"},
- intName{42, "R_SPARC_GLOB_JMP"},
- intName{43, "R_SPARC_7"},
- intName{44, "R_SPARC_5"},
- intName{45, "R_SPARC_6"},
- intName{46, "R_SPARC_DISP64"},
- intName{47, "R_SPARC_PLT64"},
- intName{48, "R_SPARC_HIX22"},
- intName{49, "R_SPARC_LOX10"},
- intName{50, "R_SPARC_H44"},
- intName{51, "R_SPARC_M44"},
- intName{52, "R_SPARC_L44"},
- intName{53, "R_SPARC_REGISTER"},
- intName{54, "R_SPARC_UA64"},
- intName{55, "R_SPARC_UA16"},
+ {0, "R_SPARC_NONE"},
+ {1, "R_SPARC_8"},
+ {2, "R_SPARC_16"},
+ {3, "R_SPARC_32"},
+ {4, "R_SPARC_DISP8"},
+ {5, "R_SPARC_DISP16"},
+ {6, "R_SPARC_DISP32"},
+ {7, "R_SPARC_WDISP30"},
+ {8, "R_SPARC_WDISP22"},
+ {9, "R_SPARC_HI22"},
+ {10, "R_SPARC_22"},
+ {11, "R_SPARC_13"},
+ {12, "R_SPARC_LO10"},
+ {13, "R_SPARC_GOT10"},
+ {14, "R_SPARC_GOT13"},
+ {15, "R_SPARC_GOT22"},
+ {16, "R_SPARC_PC10"},
+ {17, "R_SPARC_PC22"},
+ {18, "R_SPARC_WPLT30"},
+ {19, "R_SPARC_COPY"},
+ {20, "R_SPARC_GLOB_DAT"},
+ {21, "R_SPARC_JMP_SLOT"},
+ {22, "R_SPARC_RELATIVE"},
+ {23, "R_SPARC_UA32"},
+ {24, "R_SPARC_PLT32"},
+ {25, "R_SPARC_HIPLT22"},
+ {26, "R_SPARC_LOPLT10"},
+ {27, "R_SPARC_PCPLT32"},
+ {28, "R_SPARC_PCPLT22"},
+ {29, "R_SPARC_PCPLT10"},
+ {30, "R_SPARC_10"},
+ {31, "R_SPARC_11"},
+ {32, "R_SPARC_64"},
+ {33, "R_SPARC_OLO10"},
+ {34, "R_SPARC_HH22"},
+ {35, "R_SPARC_HM10"},
+ {36, "R_SPARC_LM22"},
+ {37, "R_SPARC_PC_HH22"},
+ {38, "R_SPARC_PC_HM10"},
+ {39, "R_SPARC_PC_LM22"},
+ {40, "R_SPARC_WDISP16"},
+ {41, "R_SPARC_WDISP19"},
+ {42, "R_SPARC_GLOB_JMP"},
+ {43, "R_SPARC_7"},
+ {44, "R_SPARC_5"},
+ {45, "R_SPARC_6"},
+ {46, "R_SPARC_DISP64"},
+ {47, "R_SPARC_PLT64"},
+ {48, "R_SPARC_HIX22"},
+ {49, "R_SPARC_LOX10"},
+ {50, "R_SPARC_H44"},
+ {51, "R_SPARC_M44"},
+ {52, "R_SPARC_L44"},
+ {53, "R_SPARC_REGISTER"},
+ {54, "R_SPARC_UA64"},
+ {55, "R_SPARC_UA16"},
}
func (i R_SPARC) String() string { return stringName(uint32(i), rsparcStrings, false) }
@@ -1356,9 +1356,12 @@ type Sym32 struct {
const Sym32Size = 16
-func ST_BIND(info uint8) SymBind { return SymBind(info >> 4) }
-func ST_TYPE(bind SymBind, typ SymType) uint8 { return uint8(bind)<<4 | uint8(typ)&0xf }
-func ST_VISIBILITY(other uint8) SymVis { return SymVis(other & 3) }
+func ST_BIND(info uint8) SymBind { return SymBind(info >> 4) }
+func ST_TYPE(info uint8) SymType { return SymType(info & 0xF) }
+func ST_INFO(bind SymBind, typ SymType) uint8 {
+ return uint8(bind)<<4 | uint8(typ)&0xf
+}
+func ST_VISIBILITY(other uint8) SymVis { return SymVis(other & 3) }
/*
* ELF64
diff --git a/src/pkg/debug/elf/elf_test.go b/src/pkg/debug/elf/elf_test.go
index 6f827faf0..67b961b5c 100644
--- a/src/pkg/debug/elf/elf_test.go
+++ b/src/pkg/debug/elf/elf_test.go
@@ -15,28 +15,28 @@ type nameTest struct {
}
var nameTests = []nameTest{
- nameTest{ELFOSABI_LINUX, "ELFOSABI_LINUX"},
- nameTest{ET_EXEC, "ET_EXEC"},
- nameTest{EM_860, "EM_860"},
- nameTest{SHN_LOPROC, "SHN_LOPROC"},
- nameTest{SHT_PROGBITS, "SHT_PROGBITS"},
- nameTest{SHF_MERGE + SHF_TLS, "SHF_MERGE+SHF_TLS"},
- nameTest{PT_LOAD, "PT_LOAD"},
- nameTest{PF_W + PF_R + 0x50, "PF_W+PF_R+0x50"},
- nameTest{DT_SYMBOLIC, "DT_SYMBOLIC"},
- nameTest{DF_BIND_NOW, "DF_BIND_NOW"},
- nameTest{NT_FPREGSET, "NT_FPREGSET"},
- nameTest{STB_GLOBAL, "STB_GLOBAL"},
- nameTest{STT_COMMON, "STT_COMMON"},
- nameTest{STV_HIDDEN, "STV_HIDDEN"},
- nameTest{R_X86_64_PC32, "R_X86_64_PC32"},
- nameTest{R_ALPHA_OP_PUSH, "R_ALPHA_OP_PUSH"},
- nameTest{R_ARM_THM_ABS5, "R_ARM_THM_ABS5"},
- nameTest{R_386_GOT32, "R_386_GOT32"},
- nameTest{R_PPC_GOT16_HI, "R_PPC_GOT16_HI"},
- nameTest{R_SPARC_GOT22, "R_SPARC_GOT22"},
- nameTest{ET_LOOS + 5, "ET_LOOS+5"},
- nameTest{ProgFlag(0x50), "0x50"},
+ {ELFOSABI_LINUX, "ELFOSABI_LINUX"},
+ {ET_EXEC, "ET_EXEC"},
+ {EM_860, "EM_860"},
+ {SHN_LOPROC, "SHN_LOPROC"},
+ {SHT_PROGBITS, "SHT_PROGBITS"},
+ {SHF_MERGE + SHF_TLS, "SHF_MERGE+SHF_TLS"},
+ {PT_LOAD, "PT_LOAD"},
+ {PF_W + PF_R + 0x50, "PF_W+PF_R+0x50"},
+ {DT_SYMBOLIC, "DT_SYMBOLIC"},
+ {DF_BIND_NOW, "DF_BIND_NOW"},
+ {NT_FPREGSET, "NT_FPREGSET"},
+ {STB_GLOBAL, "STB_GLOBAL"},
+ {STT_COMMON, "STT_COMMON"},
+ {STV_HIDDEN, "STV_HIDDEN"},
+ {R_X86_64_PC32, "R_X86_64_PC32"},
+ {R_ALPHA_OP_PUSH, "R_ALPHA_OP_PUSH"},
+ {R_ARM_THM_ABS5, "R_ARM_THM_ABS5"},
+ {R_386_GOT32, "R_386_GOT32"},
+ {R_PPC_GOT16_HI, "R_PPC_GOT16_HI"},
+ {R_SPARC_GOT22, "R_SPARC_GOT22"},
+ {ET_LOOS + 5, "ET_LOOS+5"},
+ {ProgFlag(0x50), "0x50"},
}
func TestNames(t *testing.T) {
diff --git a/src/pkg/debug/elf/file.go b/src/pkg/debug/elf/file.go
index 568370b85..e69317a75 100644
--- a/src/pkg/debug/elf/file.go
+++ b/src/pkg/debug/elf/file.go
@@ -75,6 +75,15 @@ func (s *Section) Data() ([]byte, os.Error) {
return dat[0:n], err
}
+// stringTable reads and returns the string table given by the
+// specified link value.
+func (f *File) stringTable(link uint32) ([]byte, os.Error) {
+ if link <= 0 || link >= uint32(len(f.Sections)) {
+ return nil, os.ErrorString("section has invalid string table link")
+ }
+ return f.Sections[link].Data()
+}
+
// Open returns a new ReadSeeker reading the ELF section.
func (s *Section) Open() io.ReadSeeker { return io.NewSectionReader(s.sr, 0, 1<<63-1) }
@@ -108,9 +117,9 @@ func (p *Prog) Open() io.ReadSeeker { return io.NewSectionReader(p.sr, 0, 1<<63-
// A Symbol represents an entry in an ELF symbol table section.
type Symbol struct {
- Name uint32
+ Name string
Info, Other byte
- Section uint32
+ Section SectionIndex
Value, Size uint64
}
@@ -160,6 +169,17 @@ func (f *File) Close() os.Error {
return err
}
+// SectionByType returns the first section in f with the
+// given type, or nil if there is no such section.
+func (f *File) SectionByType(typ SectionType) *Section {
+ for _, s := range f.Sections {
+ if s.Type == typ {
+ return s
+ }
+ }
+ return nil
+}
+
// NewFile creates a new File for accessing an ELF binary in an underlying reader.
// The ELF binary is expected to start at position 0 in the ReaderAt.
func NewFile(r io.ReaderAt) (*File, os.Error) {
@@ -293,9 +313,8 @@ func NewFile(r io.ReaderAt) (*File, os.Error) {
}
// Load section header string table.
- s := f.Sections[shstrndx]
- shstrtab := make([]byte, s.Size)
- if _, err := r.ReadAt(shstrtab, int64(s.Offset)); err != nil {
+ shstrtab, err := f.Sections[shstrndx].Data()
+ if err != nil {
return nil, err
}
for i, s := range f.Sections {
@@ -309,25 +328,65 @@ func NewFile(r io.ReaderAt) (*File, os.Error) {
return f, nil
}
-func (f *File) getSymbols() ([]Symbol, os.Error) {
+// getSymbols returns a slice of Symbols from parsing the symbol table
+// with the given type.
+func (f *File) getSymbols(typ SectionType) ([]Symbol, os.Error) {
switch f.Class {
case ELFCLASS64:
- return f.getSymbols64()
+ return f.getSymbols64(typ)
+
+ case ELFCLASS32:
+ return f.getSymbols32(typ)
}
return nil, os.ErrorString("not implemented")
}
-// GetSymbols returns a slice of Symbols from parsing the symbol table.
-func (f *File) getSymbols64() ([]Symbol, os.Error) {
- var symtabSection *Section
- for _, section := range f.Sections {
- if section.Type == SHT_SYMTAB {
- symtabSection = section
- break
- }
+func (f *File) getSymbols32(typ SectionType) ([]Symbol, os.Error) {
+ symtabSection := f.SectionByType(typ)
+ if symtabSection == nil {
+ return nil, os.ErrorString("no symbol section")
+ }
+
+ data, err := symtabSection.Data()
+ if err != nil {
+ return nil, os.ErrorString("cannot load symbol section")
+ }
+ symtab := bytes.NewBuffer(data)
+ if symtab.Len()%Sym32Size != 0 {
+ return nil, os.ErrorString("length of symbol section is not a multiple of SymSize")
+ }
+
+ strdata, err := f.stringTable(symtabSection.Link)
+ if err != nil {
+ return nil, os.ErrorString("cannot load string table section")
+ }
+
+ // The first entry is all zeros.
+ var skip [Sym32Size]byte
+ symtab.Read(skip[0:])
+
+ symbols := make([]Symbol, symtab.Len()/Sym32Size)
+
+ i := 0
+ var sym Sym32
+ for symtab.Len() > 0 {
+ binary.Read(symtab, f.ByteOrder, &sym)
+ str, _ := getString(strdata, int(sym.Name))
+ symbols[i].Name = str
+ symbols[i].Info = sym.Info
+ symbols[i].Other = sym.Other
+ symbols[i].Section = SectionIndex(sym.Shndx)
+ symbols[i].Value = uint64(sym.Value)
+ symbols[i].Size = uint64(sym.Size)
+ i++
}
+ return symbols, nil
+}
+
+func (f *File) getSymbols64(typ SectionType) ([]Symbol, os.Error) {
+ symtabSection := f.SectionByType(typ)
if symtabSection == nil {
return nil, os.ErrorString("no symbol section")
}
@@ -341,6 +400,11 @@ func (f *File) getSymbols64() ([]Symbol, os.Error) {
return nil, os.ErrorString("length of symbol section is not a multiple of Sym64Size")
}
+ strdata, err := f.stringTable(symtabSection.Link)
+ if err != nil {
+ return nil, os.ErrorString("cannot load string table section")
+ }
+
// The first entry is all zeros.
var skip [Sym64Size]byte
symtab.Read(skip[0:])
@@ -351,10 +415,11 @@ func (f *File) getSymbols64() ([]Symbol, os.Error) {
var sym Sym64
for symtab.Len() > 0 {
binary.Read(symtab, f.ByteOrder, &sym)
- symbols[i].Name = sym.Name
+ str, _ := getString(strdata, int(sym.Name))
+ symbols[i].Name = str
symbols[i].Info = sym.Info
symbols[i].Other = sym.Other
- symbols[i].Section = uint32(sym.Shndx)
+ symbols[i].Section = SectionIndex(sym.Shndx)
symbols[i].Value = sym.Value
symbols[i].Size = sym.Size
i++
@@ -403,7 +468,7 @@ func (f *File) applyRelocationsAMD64(dst []byte, rels []byte) os.Error {
return os.ErrorString("length of relocation section is not a multiple of Sym64Size")
}
- symbols, err := f.getSymbols()
+ symbols, err := f.getSymbols(SHT_SYMTAB)
if err != nil {
return err
}
@@ -478,3 +543,63 @@ func (f *File) DWARF() (*dwarf.Data, os.Error) {
abbrev, info, str := dat[0], dat[1], dat[2]
return dwarf.New(abbrev, nil, nil, info, nil, nil, nil, str)
}
+
+// ImportedSymbols returns the names of all symbols
+// referred to by the binary f that are expected to be
+// satisfied by other libraries at dynamic load time.
+// It does not return weak symbols.
+func (f *File) ImportedSymbols() ([]string, os.Error) {
+ sym, err := f.getSymbols(SHT_DYNSYM)
+ if err != nil {
+ return nil, err
+ }
+ var all []string
+ for _, s := range sym {
+ if ST_BIND(s.Info) == STB_GLOBAL && s.Section == SHN_UNDEF {
+ all = append(all, s.Name)
+ }
+ }
+ return all, nil
+}
+
+// ImportedLibraries returns the names of all libraries
+// referred to by the binary f that are expected to be
+// linked with the binary at dynamic link time.
+func (f *File) ImportedLibraries() ([]string, os.Error) {
+ ds := f.SectionByType(SHT_DYNAMIC)
+ if ds == nil {
+ // not dynamic, so no libraries
+ return nil, nil
+ }
+ d, err := ds.Data()
+ if err != nil {
+ return nil, err
+ }
+ str, err := f.stringTable(ds.Link)
+ if err != nil {
+ return nil, err
+ }
+ var all []string
+ for len(d) > 0 {
+ var tag DynTag
+ var value uint64
+ switch f.Class {
+ case ELFCLASS32:
+ tag = DynTag(f.ByteOrder.Uint32(d[0:4]))
+ value = uint64(f.ByteOrder.Uint32(d[4:8]))
+ d = d[8:]
+ case ELFCLASS64:
+ tag = DynTag(f.ByteOrder.Uint64(d[0:8]))
+ value = f.ByteOrder.Uint64(d[8:16])
+ d = d[16:]
+ }
+ if tag == DT_NEEDED {
+ s, ok := getString(str, int(value))
+ if ok {
+ all = append(all, s)
+ }
+ }
+ }
+
+ return all, nil
+}
diff --git a/src/pkg/debug/elf/file_test.go b/src/pkg/debug/elf/file_test.go
index 49adc4dc7..84068ea12 100644
--- a/src/pkg/debug/elf/file_test.go
+++ b/src/pkg/debug/elf/file_test.go
@@ -18,83 +18,83 @@ type fileTest struct {
}
var fileTests = []fileTest{
- fileTest{
+ {
"testdata/gcc-386-freebsd-exec",
FileHeader{ELFCLASS32, ELFDATA2LSB, EV_CURRENT, ELFOSABI_FREEBSD, 0, binary.LittleEndian, ET_EXEC, EM_386},
[]SectionHeader{
- SectionHeader{"", SHT_NULL, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0},
- SectionHeader{".interp", SHT_PROGBITS, SHF_ALLOC, 0x80480d4, 0xd4, 0x15, 0x0, 0x0, 0x1, 0x0},
- SectionHeader{".hash", SHT_HASH, SHF_ALLOC, 0x80480ec, 0xec, 0x90, 0x3, 0x0, 0x4, 0x4},
- SectionHeader{".dynsym", SHT_DYNSYM, SHF_ALLOC, 0x804817c, 0x17c, 0x110, 0x4, 0x1, 0x4, 0x10},
- SectionHeader{".dynstr", SHT_STRTAB, SHF_ALLOC, 0x804828c, 0x28c, 0xbb, 0x0, 0x0, 0x1, 0x0},
- SectionHeader{".rel.plt", SHT_REL, SHF_ALLOC, 0x8048348, 0x348, 0x20, 0x3, 0x7, 0x4, 0x8},
- SectionHeader{".init", SHT_PROGBITS, SHF_ALLOC + SHF_EXECINSTR, 0x8048368, 0x368, 0x11, 0x0, 0x0, 0x4, 0x0},
- SectionHeader{".plt", SHT_PROGBITS, SHF_ALLOC + SHF_EXECINSTR, 0x804837c, 0x37c, 0x50, 0x0, 0x0, 0x4, 0x4},
- SectionHeader{".text", SHT_PROGBITS, SHF_ALLOC + SHF_EXECINSTR, 0x80483cc, 0x3cc, 0x180, 0x0, 0x0, 0x4, 0x0},
- SectionHeader{".fini", SHT_PROGBITS, SHF_ALLOC + SHF_EXECINSTR, 0x804854c, 0x54c, 0xc, 0x0, 0x0, 0x4, 0x0},
- SectionHeader{".rodata", SHT_PROGBITS, SHF_ALLOC, 0x8048558, 0x558, 0xa3, 0x0, 0x0, 0x1, 0x0},
- SectionHeader{".data", SHT_PROGBITS, SHF_WRITE + SHF_ALLOC, 0x80495fc, 0x5fc, 0xc, 0x0, 0x0, 0x4, 0x0},
- SectionHeader{".eh_frame", SHT_PROGBITS, SHF_ALLOC, 0x8049608, 0x608, 0x4, 0x0, 0x0, 0x4, 0x0},
- SectionHeader{".dynamic", SHT_DYNAMIC, SHF_WRITE + SHF_ALLOC, 0x804960c, 0x60c, 0x98, 0x4, 0x0, 0x4, 0x8},
- SectionHeader{".ctors", SHT_PROGBITS, SHF_WRITE + SHF_ALLOC, 0x80496a4, 0x6a4, 0x8, 0x0, 0x0, 0x4, 0x0},
- SectionHeader{".dtors", SHT_PROGBITS, SHF_WRITE + SHF_ALLOC, 0x80496ac, 0x6ac, 0x8, 0x0, 0x0, 0x4, 0x0},
- SectionHeader{".jcr", SHT_PROGBITS, SHF_WRITE + SHF_ALLOC, 0x80496b4, 0x6b4, 0x4, 0x0, 0x0, 0x4, 0x0},
- SectionHeader{".got", SHT_PROGBITS, SHF_WRITE + SHF_ALLOC, 0x80496b8, 0x6b8, 0x1c, 0x0, 0x0, 0x4, 0x4},
- SectionHeader{".bss", SHT_NOBITS, SHF_WRITE + SHF_ALLOC, 0x80496d4, 0x6d4, 0x20, 0x0, 0x0, 0x4, 0x0},
- SectionHeader{".comment", SHT_PROGBITS, 0x0, 0x0, 0x6d4, 0x12d, 0x0, 0x0, 0x1, 0x0},
- SectionHeader{".debug_aranges", SHT_PROGBITS, 0x0, 0x0, 0x801, 0x20, 0x0, 0x0, 0x1, 0x0},
- SectionHeader{".debug_pubnames", SHT_PROGBITS, 0x0, 0x0, 0x821, 0x1b, 0x0, 0x0, 0x1, 0x0},
- SectionHeader{".debug_info", SHT_PROGBITS, 0x0, 0x0, 0x83c, 0x11d, 0x0, 0x0, 0x1, 0x0},
- SectionHeader{".debug_abbrev", SHT_PROGBITS, 0x0, 0x0, 0x959, 0x41, 0x0, 0x0, 0x1, 0x0},
- SectionHeader{".debug_line", SHT_PROGBITS, 0x0, 0x0, 0x99a, 0x35, 0x0, 0x0, 0x1, 0x0},
- SectionHeader{".debug_frame", SHT_PROGBITS, 0x0, 0x0, 0x9d0, 0x30, 0x0, 0x0, 0x4, 0x0},
- SectionHeader{".debug_str", SHT_PROGBITS, 0x0, 0x0, 0xa00, 0xd, 0x0, 0x0, 0x1, 0x0},
- SectionHeader{".shstrtab", SHT_STRTAB, 0x0, 0x0, 0xa0d, 0xf8, 0x0, 0x0, 0x1, 0x0},
- SectionHeader{".symtab", SHT_SYMTAB, 0x0, 0x0, 0xfb8, 0x4b0, 0x1d, 0x38, 0x4, 0x10},
- SectionHeader{".strtab", SHT_STRTAB, 0x0, 0x0, 0x1468, 0x206, 0x0, 0x0, 0x1, 0x0},
+ {"", SHT_NULL, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0},
+ {".interp", SHT_PROGBITS, SHF_ALLOC, 0x80480d4, 0xd4, 0x15, 0x0, 0x0, 0x1, 0x0},
+ {".hash", SHT_HASH, SHF_ALLOC, 0x80480ec, 0xec, 0x90, 0x3, 0x0, 0x4, 0x4},
+ {".dynsym", SHT_DYNSYM, SHF_ALLOC, 0x804817c, 0x17c, 0x110, 0x4, 0x1, 0x4, 0x10},
+ {".dynstr", SHT_STRTAB, SHF_ALLOC, 0x804828c, 0x28c, 0xbb, 0x0, 0x0, 0x1, 0x0},
+ {".rel.plt", SHT_REL, SHF_ALLOC, 0x8048348, 0x348, 0x20, 0x3, 0x7, 0x4, 0x8},
+ {".init", SHT_PROGBITS, SHF_ALLOC + SHF_EXECINSTR, 0x8048368, 0x368, 0x11, 0x0, 0x0, 0x4, 0x0},
+ {".plt", SHT_PROGBITS, SHF_ALLOC + SHF_EXECINSTR, 0x804837c, 0x37c, 0x50, 0x0, 0x0, 0x4, 0x4},
+ {".text", SHT_PROGBITS, SHF_ALLOC + SHF_EXECINSTR, 0x80483cc, 0x3cc, 0x180, 0x0, 0x0, 0x4, 0x0},
+ {".fini", SHT_PROGBITS, SHF_ALLOC + SHF_EXECINSTR, 0x804854c, 0x54c, 0xc, 0x0, 0x0, 0x4, 0x0},
+ {".rodata", SHT_PROGBITS, SHF_ALLOC, 0x8048558, 0x558, 0xa3, 0x0, 0x0, 0x1, 0x0},
+ {".data", SHT_PROGBITS, SHF_WRITE + SHF_ALLOC, 0x80495fc, 0x5fc, 0xc, 0x0, 0x0, 0x4, 0x0},
+ {".eh_frame", SHT_PROGBITS, SHF_ALLOC, 0x8049608, 0x608, 0x4, 0x0, 0x0, 0x4, 0x0},
+ {".dynamic", SHT_DYNAMIC, SHF_WRITE + SHF_ALLOC, 0x804960c, 0x60c, 0x98, 0x4, 0x0, 0x4, 0x8},
+ {".ctors", SHT_PROGBITS, SHF_WRITE + SHF_ALLOC, 0x80496a4, 0x6a4, 0x8, 0x0, 0x0, 0x4, 0x0},
+ {".dtors", SHT_PROGBITS, SHF_WRITE + SHF_ALLOC, 0x80496ac, 0x6ac, 0x8, 0x0, 0x0, 0x4, 0x0},
+ {".jcr", SHT_PROGBITS, SHF_WRITE + SHF_ALLOC, 0x80496b4, 0x6b4, 0x4, 0x0, 0x0, 0x4, 0x0},
+ {".got", SHT_PROGBITS, SHF_WRITE + SHF_ALLOC, 0x80496b8, 0x6b8, 0x1c, 0x0, 0x0, 0x4, 0x4},
+ {".bss", SHT_NOBITS, SHF_WRITE + SHF_ALLOC, 0x80496d4, 0x6d4, 0x20, 0x0, 0x0, 0x4, 0x0},
+ {".comment", SHT_PROGBITS, 0x0, 0x0, 0x6d4, 0x12d, 0x0, 0x0, 0x1, 0x0},
+ {".debug_aranges", SHT_PROGBITS, 0x0, 0x0, 0x801, 0x20, 0x0, 0x0, 0x1, 0x0},
+ {".debug_pubnames", SHT_PROGBITS, 0x0, 0x0, 0x821, 0x1b, 0x0, 0x0, 0x1, 0x0},
+ {".debug_info", SHT_PROGBITS, 0x0, 0x0, 0x83c, 0x11d, 0x0, 0x0, 0x1, 0x0},
+ {".debug_abbrev", SHT_PROGBITS, 0x0, 0x0, 0x959, 0x41, 0x0, 0x0, 0x1, 0x0},
+ {".debug_line", SHT_PROGBITS, 0x0, 0x0, 0x99a, 0x35, 0x0, 0x0, 0x1, 0x0},
+ {".debug_frame", SHT_PROGBITS, 0x0, 0x0, 0x9d0, 0x30, 0x0, 0x0, 0x4, 0x0},
+ {".debug_str", SHT_PROGBITS, 0x0, 0x0, 0xa00, 0xd, 0x0, 0x0, 0x1, 0x0},
+ {".shstrtab", SHT_STRTAB, 0x0, 0x0, 0xa0d, 0xf8, 0x0, 0x0, 0x1, 0x0},
+ {".symtab", SHT_SYMTAB, 0x0, 0x0, 0xfb8, 0x4b0, 0x1d, 0x38, 0x4, 0x10},
+ {".strtab", SHT_STRTAB, 0x0, 0x0, 0x1468, 0x206, 0x0, 0x0, 0x1, 0x0},
},
},
- fileTest{
+ {
"testdata/gcc-amd64-linux-exec",
FileHeader{ELFCLASS64, ELFDATA2LSB, EV_CURRENT, ELFOSABI_NONE, 0, binary.LittleEndian, ET_EXEC, EM_X86_64},
[]SectionHeader{
- SectionHeader{"", SHT_NULL, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0},
- SectionHeader{".interp", SHT_PROGBITS, SHF_ALLOC, 0x400200, 0x200, 0x1c, 0x0, 0x0, 0x1, 0x0},
- SectionHeader{".note.ABI-tag", SHT_NOTE, SHF_ALLOC, 0x40021c, 0x21c, 0x20, 0x0, 0x0, 0x4, 0x0},
- SectionHeader{".hash", SHT_HASH, SHF_ALLOC, 0x400240, 0x240, 0x24, 0x5, 0x0, 0x8, 0x4},
- SectionHeader{".gnu.hash", SHT_LOOS + 268435446, SHF_ALLOC, 0x400268, 0x268, 0x1c, 0x5, 0x0, 0x8, 0x0},
- SectionHeader{".dynsym", SHT_DYNSYM, SHF_ALLOC, 0x400288, 0x288, 0x60, 0x6, 0x1, 0x8, 0x18},
- SectionHeader{".dynstr", SHT_STRTAB, SHF_ALLOC, 0x4002e8, 0x2e8, 0x3d, 0x0, 0x0, 0x1, 0x0},
- SectionHeader{".gnu.version", SHT_HIOS, SHF_ALLOC, 0x400326, 0x326, 0x8, 0x5, 0x0, 0x2, 0x2},
- SectionHeader{".gnu.version_r", SHT_LOOS + 268435454, SHF_ALLOC, 0x400330, 0x330, 0x20, 0x6, 0x1, 0x8, 0x0},
- SectionHeader{".rela.dyn", SHT_RELA, SHF_ALLOC, 0x400350, 0x350, 0x18, 0x5, 0x0, 0x8, 0x18},
- SectionHeader{".rela.plt", SHT_RELA, SHF_ALLOC, 0x400368, 0x368, 0x30, 0x5, 0xc, 0x8, 0x18},
- SectionHeader{".init", SHT_PROGBITS, SHF_ALLOC + SHF_EXECINSTR, 0x400398, 0x398, 0x18, 0x0, 0x0, 0x4, 0x0},
- SectionHeader{".plt", SHT_PROGBITS, SHF_ALLOC + SHF_EXECINSTR, 0x4003b0, 0x3b0, 0x30, 0x0, 0x0, 0x4, 0x10},
- SectionHeader{".text", SHT_PROGBITS, SHF_ALLOC + SHF_EXECINSTR, 0x4003e0, 0x3e0, 0x1b4, 0x0, 0x0, 0x10, 0x0},
- SectionHeader{".fini", SHT_PROGBITS, SHF_ALLOC + SHF_EXECINSTR, 0x400594, 0x594, 0xe, 0x0, 0x0, 0x4, 0x0},
- SectionHeader{".rodata", SHT_PROGBITS, SHF_ALLOC, 0x4005a4, 0x5a4, 0x11, 0x0, 0x0, 0x4, 0x0},
- SectionHeader{".eh_frame_hdr", SHT_PROGBITS, SHF_ALLOC, 0x4005b8, 0x5b8, 0x24, 0x0, 0x0, 0x4, 0x0},
- SectionHeader{".eh_frame", SHT_PROGBITS, SHF_ALLOC, 0x4005e0, 0x5e0, 0xa4, 0x0, 0x0, 0x8, 0x0},
- SectionHeader{".ctors", SHT_PROGBITS, SHF_WRITE + SHF_ALLOC, 0x600688, 0x688, 0x10, 0x0, 0x0, 0x8, 0x0},
- SectionHeader{".dtors", SHT_PROGBITS, SHF_WRITE + SHF_ALLOC, 0x600698, 0x698, 0x10, 0x0, 0x0, 0x8, 0x0},
- SectionHeader{".jcr", SHT_PROGBITS, SHF_WRITE + SHF_ALLOC, 0x6006a8, 0x6a8, 0x8, 0x0, 0x0, 0x8, 0x0},
- SectionHeader{".dynamic", SHT_DYNAMIC, SHF_WRITE + SHF_ALLOC, 0x6006b0, 0x6b0, 0x1a0, 0x6, 0x0, 0x8, 0x10},
- SectionHeader{".got", SHT_PROGBITS, SHF_WRITE + SHF_ALLOC, 0x600850, 0x850, 0x8, 0x0, 0x0, 0x8, 0x8},
- SectionHeader{".got.plt", SHT_PROGBITS, SHF_WRITE + SHF_ALLOC, 0x600858, 0x858, 0x28, 0x0, 0x0, 0x8, 0x8},
- SectionHeader{".data", SHT_PROGBITS, SHF_WRITE + SHF_ALLOC, 0x600880, 0x880, 0x18, 0x0, 0x0, 0x8, 0x0},
- SectionHeader{".bss", SHT_NOBITS, SHF_WRITE + SHF_ALLOC, 0x600898, 0x898, 0x8, 0x0, 0x0, 0x4, 0x0},
- SectionHeader{".comment", SHT_PROGBITS, 0x0, 0x0, 0x898, 0x126, 0x0, 0x0, 0x1, 0x0},
- SectionHeader{".debug_aranges", SHT_PROGBITS, 0x0, 0x0, 0x9c0, 0x90, 0x0, 0x0, 0x10, 0x0},
- SectionHeader{".debug_pubnames", SHT_PROGBITS, 0x0, 0x0, 0xa50, 0x25, 0x0, 0x0, 0x1, 0x0},
- SectionHeader{".debug_info", SHT_PROGBITS, 0x0, 0x0, 0xa75, 0x1a7, 0x0, 0x0, 0x1, 0x0},
- SectionHeader{".debug_abbrev", SHT_PROGBITS, 0x0, 0x0, 0xc1c, 0x6f, 0x0, 0x0, 0x1, 0x0},
- SectionHeader{".debug_line", SHT_PROGBITS, 0x0, 0x0, 0xc8b, 0x13f, 0x0, 0x0, 0x1, 0x0},
- SectionHeader{".debug_str", SHT_PROGBITS, SHF_MERGE + SHF_STRINGS, 0x0, 0xdca, 0xb1, 0x0, 0x0, 0x1, 0x1},
- SectionHeader{".debug_ranges", SHT_PROGBITS, 0x0, 0x0, 0xe80, 0x90, 0x0, 0x0, 0x10, 0x0},
- SectionHeader{".shstrtab", SHT_STRTAB, 0x0, 0x0, 0xf10, 0x149, 0x0, 0x0, 0x1, 0x0},
- SectionHeader{".symtab", SHT_SYMTAB, 0x0, 0x0, 0x19a0, 0x6f0, 0x24, 0x39, 0x8, 0x18},
- SectionHeader{".strtab", SHT_STRTAB, 0x0, 0x0, 0x2090, 0x1fc, 0x0, 0x0, 0x1, 0x0},
+ {"", SHT_NULL, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0},
+ {".interp", SHT_PROGBITS, SHF_ALLOC, 0x400200, 0x200, 0x1c, 0x0, 0x0, 0x1, 0x0},
+ {".note.ABI-tag", SHT_NOTE, SHF_ALLOC, 0x40021c, 0x21c, 0x20, 0x0, 0x0, 0x4, 0x0},
+ {".hash", SHT_HASH, SHF_ALLOC, 0x400240, 0x240, 0x24, 0x5, 0x0, 0x8, 0x4},
+ {".gnu.hash", SHT_LOOS + 268435446, SHF_ALLOC, 0x400268, 0x268, 0x1c, 0x5, 0x0, 0x8, 0x0},
+ {".dynsym", SHT_DYNSYM, SHF_ALLOC, 0x400288, 0x288, 0x60, 0x6, 0x1, 0x8, 0x18},
+ {".dynstr", SHT_STRTAB, SHF_ALLOC, 0x4002e8, 0x2e8, 0x3d, 0x0, 0x0, 0x1, 0x0},
+ {".gnu.version", SHT_HIOS, SHF_ALLOC, 0x400326, 0x326, 0x8, 0x5, 0x0, 0x2, 0x2},
+ {".gnu.version_r", SHT_LOOS + 268435454, SHF_ALLOC, 0x400330, 0x330, 0x20, 0x6, 0x1, 0x8, 0x0},
+ {".rela.dyn", SHT_RELA, SHF_ALLOC, 0x400350, 0x350, 0x18, 0x5, 0x0, 0x8, 0x18},
+ {".rela.plt", SHT_RELA, SHF_ALLOC, 0x400368, 0x368, 0x30, 0x5, 0xc, 0x8, 0x18},
+ {".init", SHT_PROGBITS, SHF_ALLOC + SHF_EXECINSTR, 0x400398, 0x398, 0x18, 0x0, 0x0, 0x4, 0x0},
+ {".plt", SHT_PROGBITS, SHF_ALLOC + SHF_EXECINSTR, 0x4003b0, 0x3b0, 0x30, 0x0, 0x0, 0x4, 0x10},
+ {".text", SHT_PROGBITS, SHF_ALLOC + SHF_EXECINSTR, 0x4003e0, 0x3e0, 0x1b4, 0x0, 0x0, 0x10, 0x0},
+ {".fini", SHT_PROGBITS, SHF_ALLOC + SHF_EXECINSTR, 0x400594, 0x594, 0xe, 0x0, 0x0, 0x4, 0x0},
+ {".rodata", SHT_PROGBITS, SHF_ALLOC, 0x4005a4, 0x5a4, 0x11, 0x0, 0x0, 0x4, 0x0},
+ {".eh_frame_hdr", SHT_PROGBITS, SHF_ALLOC, 0x4005b8, 0x5b8, 0x24, 0x0, 0x0, 0x4, 0x0},
+ {".eh_frame", SHT_PROGBITS, SHF_ALLOC, 0x4005e0, 0x5e0, 0xa4, 0x0, 0x0, 0x8, 0x0},
+ {".ctors", SHT_PROGBITS, SHF_WRITE + SHF_ALLOC, 0x600688, 0x688, 0x10, 0x0, 0x0, 0x8, 0x0},
+ {".dtors", SHT_PROGBITS, SHF_WRITE + SHF_ALLOC, 0x600698, 0x698, 0x10, 0x0, 0x0, 0x8, 0x0},
+ {".jcr", SHT_PROGBITS, SHF_WRITE + SHF_ALLOC, 0x6006a8, 0x6a8, 0x8, 0x0, 0x0, 0x8, 0x0},
+ {".dynamic", SHT_DYNAMIC, SHF_WRITE + SHF_ALLOC, 0x6006b0, 0x6b0, 0x1a0, 0x6, 0x0, 0x8, 0x10},
+ {".got", SHT_PROGBITS, SHF_WRITE + SHF_ALLOC, 0x600850, 0x850, 0x8, 0x0, 0x0, 0x8, 0x8},
+ {".got.plt", SHT_PROGBITS, SHF_WRITE + SHF_ALLOC, 0x600858, 0x858, 0x28, 0x0, 0x0, 0x8, 0x8},
+ {".data", SHT_PROGBITS, SHF_WRITE + SHF_ALLOC, 0x600880, 0x880, 0x18, 0x0, 0x0, 0x8, 0x0},
+ {".bss", SHT_NOBITS, SHF_WRITE + SHF_ALLOC, 0x600898, 0x898, 0x8, 0x0, 0x0, 0x4, 0x0},
+ {".comment", SHT_PROGBITS, 0x0, 0x0, 0x898, 0x126, 0x0, 0x0, 0x1, 0x0},
+ {".debug_aranges", SHT_PROGBITS, 0x0, 0x0, 0x9c0, 0x90, 0x0, 0x0, 0x10, 0x0},
+ {".debug_pubnames", SHT_PROGBITS, 0x0, 0x0, 0xa50, 0x25, 0x0, 0x0, 0x1, 0x0},
+ {".debug_info", SHT_PROGBITS, 0x0, 0x0, 0xa75, 0x1a7, 0x0, 0x0, 0x1, 0x0},
+ {".debug_abbrev", SHT_PROGBITS, 0x0, 0x0, 0xc1c, 0x6f, 0x0, 0x0, 0x1, 0x0},
+ {".debug_line", SHT_PROGBITS, 0x0, 0x0, 0xc8b, 0x13f, 0x0, 0x0, 0x1, 0x0},
+ {".debug_str", SHT_PROGBITS, SHF_MERGE + SHF_STRINGS, 0x0, 0xdca, 0xb1, 0x0, 0x0, 0x1, 0x1},
+ {".debug_ranges", SHT_PROGBITS, 0x0, 0x0, 0xe80, 0x90, 0x0, 0x0, 0x10, 0x0},
+ {".shstrtab", SHT_STRTAB, 0x0, 0x0, 0xf10, 0x149, 0x0, 0x0, 0x1, 0x0},
+ {".symtab", SHT_SYMTAB, 0x0, 0x0, 0x19a0, 0x6f0, 0x24, 0x39, 0x8, 0x18},
+ {".strtab", SHT_STRTAB, 0x0, 0x0, 0x2090, 0x1fc, 0x0, 0x0, 0x1, 0x0},
},
},
}
@@ -135,17 +135,17 @@ type relocationTest struct {
}
var relocationTests = []relocationTest{
- relocationTest{
+ {
"testdata/go-relocation-test-gcc441-x86-64.o",
- &dwarf.Entry{Offset: 0xb, Tag: dwarf.TagCompileUnit, Children: true, Field: []dwarf.Field{dwarf.Field{Attr: dwarf.AttrProducer, Val: "GNU C 4.4.1"}, dwarf.Field{Attr: dwarf.AttrLanguage, Val: int64(1)}, dwarf.Field{Attr: dwarf.AttrName, Val: "go-relocation-test.c"}, dwarf.Field{Attr: dwarf.AttrCompDir, Val: "/tmp"}, dwarf.Field{Attr: dwarf.AttrLowpc, Val: uint64(0x0)}, dwarf.Field{Attr: dwarf.AttrHighpc, Val: uint64(0x6)}, dwarf.Field{Attr: dwarf.AttrStmtList, Val: int64(0)}}},
+ &dwarf.Entry{Offset: 0xb, Tag: dwarf.TagCompileUnit, Children: true, Field: []dwarf.Field{{Attr: dwarf.AttrProducer, Val: "GNU C 4.4.1"}, {Attr: dwarf.AttrLanguage, Val: int64(1)}, {Attr: dwarf.AttrName, Val: "go-relocation-test.c"}, {Attr: dwarf.AttrCompDir, Val: "/tmp"}, {Attr: dwarf.AttrLowpc, Val: uint64(0x0)}, {Attr: dwarf.AttrHighpc, Val: uint64(0x6)}, {Attr: dwarf.AttrStmtList, Val: int64(0)}}},
},
- relocationTest{
+ {
"testdata/go-relocation-test-gcc441-x86.o",
- &dwarf.Entry{Offset: 0xb, Tag: dwarf.TagCompileUnit, Children: true, Field: []dwarf.Field{dwarf.Field{Attr: dwarf.AttrProducer, Val: "GNU C 4.4.1"}, dwarf.Field{Attr: dwarf.AttrLanguage, Val: int64(1)}, dwarf.Field{Attr: dwarf.AttrName, Val: "t.c"}, dwarf.Field{Attr: dwarf.AttrCompDir, Val: "/tmp"}, dwarf.Field{Attr: dwarf.AttrLowpc, Val: uint64(0x0)}, dwarf.Field{Attr: dwarf.AttrHighpc, Val: uint64(0x5)}, dwarf.Field{Attr: dwarf.AttrStmtList, Val: int64(0)}}},
+ &dwarf.Entry{Offset: 0xb, Tag: dwarf.TagCompileUnit, Children: true, Field: []dwarf.Field{{Attr: dwarf.AttrProducer, Val: "GNU C 4.4.1"}, {Attr: dwarf.AttrLanguage, Val: int64(1)}, {Attr: dwarf.AttrName, Val: "t.c"}, {Attr: dwarf.AttrCompDir, Val: "/tmp"}, {Attr: dwarf.AttrLowpc, Val: uint64(0x0)}, {Attr: dwarf.AttrHighpc, Val: uint64(0x5)}, {Attr: dwarf.AttrStmtList, Val: int64(0)}}},
},
- relocationTest{
+ {
"testdata/go-relocation-test-gcc424-x86-64.o",
- &dwarf.Entry{Offset: 0xb, Tag: dwarf.TagCompileUnit, Children: true, Field: []dwarf.Field{dwarf.Field{Attr: dwarf.AttrProducer, Val: "GNU C 4.2.4 (Ubuntu 4.2.4-1ubuntu4)"}, dwarf.Field{Attr: dwarf.AttrLanguage, Val: int64(1)}, dwarf.Field{Attr: dwarf.AttrName, Val: "go-relocation-test-gcc424.c"}, dwarf.Field{Attr: dwarf.AttrCompDir, Val: "/tmp"}, dwarf.Field{Attr: dwarf.AttrLowpc, Val: uint64(0x0)}, dwarf.Field{Attr: dwarf.AttrHighpc, Val: uint64(0x6)}, dwarf.Field{Attr: dwarf.AttrStmtList, Val: int64(0)}}},
+ &dwarf.Entry{Offset: 0xb, Tag: dwarf.TagCompileUnit, Children: true, Field: []dwarf.Field{{Attr: dwarf.AttrProducer, Val: "GNU C 4.2.4 (Ubuntu 4.2.4-1ubuntu4)"}, {Attr: dwarf.AttrLanguage, Val: int64(1)}, {Attr: dwarf.AttrName, Val: "go-relocation-test-gcc424.c"}, {Attr: dwarf.AttrCompDir, Val: "/tmp"}, {Attr: dwarf.AttrLowpc, Val: uint64(0x0)}, {Attr: dwarf.AttrHighpc, Val: uint64(0x6)}, {Attr: dwarf.AttrStmtList, Val: int64(0)}}},
},
}