diff options
author | Ondřej Surý <ondrej@sury.org> | 2011-08-03 16:54:30 +0200 |
---|---|---|
committer | Ondřej Surý <ondrej@sury.org> | 2011-08-03 16:54:30 +0200 |
commit | 28592ee1ea1f5cdffcf85472f9de0285d928cf12 (patch) | |
tree | 32944e18b23f7fe4a0818a694aa2a6dfb1835463 /src/pkg/debug/elf | |
parent | e836bee4716dc0d4d913537ad3ad1925a7ac32d0 (diff) | |
download | golang-upstream/59.tar.gz |
Imported Upstream version 59upstream/59
Diffstat (limited to 'src/pkg/debug/elf')
-rw-r--r-- | src/pkg/debug/elf/file.go | 24 | ||||
-rw-r--r-- | src/pkg/debug/elf/file_test.go | 6 | ||||
-rw-r--r-- | src/pkg/debug/elf/testdata/go-relocation-test-gcc424-x86-64.obj (renamed from src/pkg/debug/elf/testdata/go-relocation-test-gcc424-x86-64.o) | bin | 3088 -> 3088 bytes | |||
-rw-r--r-- | src/pkg/debug/elf/testdata/go-relocation-test-gcc441-x86-64.obj (renamed from src/pkg/debug/elf/testdata/go-relocation-test-gcc441-x86-64.o) | bin | 2936 -> 2936 bytes | |||
-rw-r--r-- | src/pkg/debug/elf/testdata/go-relocation-test-gcc441-x86.obj (renamed from src/pkg/debug/elf/testdata/go-relocation-test-gcc441-x86.o) | bin | 1884 -> 1884 bytes |
5 files changed, 15 insertions, 15 deletions
diff --git a/src/pkg/debug/elf/file.go b/src/pkg/debug/elf/file.go index 220ab9408..346fe2a78 100644 --- a/src/pkg/debug/elf/file.go +++ b/src/pkg/debug/elf/file.go @@ -81,7 +81,7 @@ func (s *Section) Data() ([]byte, os.Error) { // 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 nil, os.NewError("section has invalid string table link") } return f.Sections[link].Data() } @@ -341,27 +341,27 @@ func (f *File) getSymbols(typ SectionType) ([]Symbol, []byte, os.Error) { return f.getSymbols32(typ) } - return nil, nil, os.ErrorString("not implemented") + return nil, nil, os.NewError("not implemented") } func (f *File) getSymbols32(typ SectionType) ([]Symbol, []byte, os.Error) { symtabSection := f.SectionByType(typ) if symtabSection == nil { - return nil, nil, os.ErrorString("no symbol section") + return nil, nil, os.NewError("no symbol section") } data, err := symtabSection.Data() if err != nil { - return nil, nil, os.ErrorString("cannot load symbol section") + return nil, nil, os.NewError("cannot load symbol section") } symtab := bytes.NewBuffer(data) if symtab.Len()%Sym32Size != 0 { - return nil, nil, os.ErrorString("length of symbol section is not a multiple of SymSize") + return nil, nil, os.NewError("length of symbol section is not a multiple of SymSize") } strdata, err := f.stringTable(symtabSection.Link) if err != nil { - return nil, nil, os.ErrorString("cannot load string table section") + return nil, nil, os.NewError("cannot load string table section") } // The first entry is all zeros. @@ -390,21 +390,21 @@ func (f *File) getSymbols32(typ SectionType) ([]Symbol, []byte, os.Error) { func (f *File) getSymbols64(typ SectionType) ([]Symbol, []byte, os.Error) { symtabSection := f.SectionByType(typ) if symtabSection == nil { - return nil, nil, os.ErrorString("no symbol section") + return nil, nil, os.NewError("no symbol section") } data, err := symtabSection.Data() if err != nil { - return nil, nil, os.ErrorString("cannot load symbol section") + return nil, nil, os.NewError("cannot load symbol section") } symtab := bytes.NewBuffer(data) if symtab.Len()%Sym64Size != 0 { - return nil, nil, os.ErrorString("length of symbol section is not a multiple of Sym64Size") + return nil, nil, os.NewError("length of symbol section is not a multiple of Sym64Size") } strdata, err := f.stringTable(symtabSection.Link) if err != nil { - return nil, nil, os.ErrorString("cannot load string table section") + return nil, nil, os.NewError("cannot load string table section") } // The first entry is all zeros. @@ -462,12 +462,12 @@ func (f *File) applyRelocations(dst []byte, rels []byte) os.Error { return f.applyRelocationsAMD64(dst, rels) } - return os.ErrorString("not implemented") + return os.NewError("not implemented") } func (f *File) applyRelocationsAMD64(dst []byte, rels []byte) os.Error { if len(rels)%Sym64Size != 0 { - return os.ErrorString("length of relocation section is not a multiple of Sym64Size") + return os.NewError("length of relocation section is not a multiple of Sym64Size") } symbols, _, err := f.getSymbols(SHT_SYMTAB) diff --git a/src/pkg/debug/elf/file_test.go b/src/pkg/debug/elf/file_test.go index 84068ea12..37f62796e 100644 --- a/src/pkg/debug/elf/file_test.go +++ b/src/pkg/debug/elf/file_test.go @@ -136,15 +136,15 @@ type relocationTest struct { var relocationTests = []relocationTest{ { - "testdata/go-relocation-test-gcc441-x86-64.o", + "testdata/go-relocation-test-gcc441-x86-64.obj", &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)}}}, }, { - "testdata/go-relocation-test-gcc441-x86.o", + "testdata/go-relocation-test-gcc441-x86.obj", &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)}}}, }, { - "testdata/go-relocation-test-gcc424-x86-64.o", + "testdata/go-relocation-test-gcc424-x86-64.obj", &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)}}}, }, } diff --git a/src/pkg/debug/elf/testdata/go-relocation-test-gcc424-x86-64.o b/src/pkg/debug/elf/testdata/go-relocation-test-gcc424-x86-64.obj Binary files differindex a7c6d6e56..a7c6d6e56 100644 --- a/src/pkg/debug/elf/testdata/go-relocation-test-gcc424-x86-64.o +++ b/src/pkg/debug/elf/testdata/go-relocation-test-gcc424-x86-64.obj diff --git a/src/pkg/debug/elf/testdata/go-relocation-test-gcc441-x86-64.o b/src/pkg/debug/elf/testdata/go-relocation-test-gcc441-x86-64.obj Binary files differindex 2d37ab6e6..2d37ab6e6 100644 --- a/src/pkg/debug/elf/testdata/go-relocation-test-gcc441-x86-64.o +++ b/src/pkg/debug/elf/testdata/go-relocation-test-gcc441-x86-64.obj diff --git a/src/pkg/debug/elf/testdata/go-relocation-test-gcc441-x86.o b/src/pkg/debug/elf/testdata/go-relocation-test-gcc441-x86.obj Binary files differindex 0d59fe303..0d59fe303 100644 --- a/src/pkg/debug/elf/testdata/go-relocation-test-gcc441-x86.o +++ b/src/pkg/debug/elf/testdata/go-relocation-test-gcc441-x86.obj |