diff options
author | Ian Lance Taylor <ian@gcc.gnu.org> | 2016-07-22 18:15:38 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@gcc.gnu.org> | 2016-07-22 18:15:38 +0000 |
commit | 22b955cca564a9a3a5b8c9d9dd1e295b7943c128 (patch) | |
tree | abdbd898676e1f853fca2d7e031d105d7ebcf676 /libgo/go/debug/gosym/pclntab_test.go | |
parent | 9d04a3af4c6491536badf6bde9707c907e4d196b (diff) | |
download | gcc-22b955cca564a9a3a5b8c9d9dd1e295b7943c128.tar.gz |
libgo: update to go1.7rc3
Reviewed-on: https://go-review.googlesource.com/25150
From-SVN: r238662
Diffstat (limited to 'libgo/go/debug/gosym/pclntab_test.go')
-rw-r--r-- | libgo/go/debug/gosym/pclntab_test.go | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/libgo/go/debug/gosym/pclntab_test.go b/libgo/go/debug/gosym/pclntab_test.go index 8d4aa547a02..9f82e31ae41 100644 --- a/libgo/go/debug/gosym/pclntab_test.go +++ b/libgo/go/debug/gosym/pclntab_test.go @@ -1,10 +1,11 @@ -// Copyright 2009 The Go Authors. All rights reserved. +// Copyright 2009 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package gosym import ( + "bytes" "debug/elf" "internal/testenv" "io/ioutil" @@ -42,7 +43,22 @@ func dotest(t *testing.T) { if err := cmd.Run(); err != nil { t.Fatal(err) } - cmd = exec.Command("go", "tool", "link", "-H", "linux", "-E", "main", + + // stamp .o file as being 'package main' so that go tool link will accept it + data, err := ioutil.ReadFile(pclinetestBinary + ".o") + if err != nil { + t.Fatal(err) + } + i := bytes.IndexByte(data, '\n') + if i < 0 { + t.Fatal("bad binary") + } + data = append(append(data[:i:i], "\nmain"...), data[i:]...) + if err := ioutil.WriteFile(pclinetestBinary+".o", data, 0666); err != nil { + t.Fatal(err) + } + + cmd = exec.Command("go", "tool", "link", "-H", "linux", "-o", pclinetestBinary, pclinetestBinary+".o") cmd.Stdout = os.Stdout cmd.Stderr = os.Stderr @@ -111,8 +127,6 @@ func parse(file string, f *elf.File, t *testing.T) (*elf.File, *Table) { return f, tab } -var goarch = os.Getenv("O") - func TestLineFromAline(t *testing.T) { skipIfNotELF(t) @@ -210,6 +224,7 @@ func TestPCLine(t *testing.T) { defer endtest() f, tab := crack(pclinetestBinary, t) + defer f.Close() text := f.Section(".text") textdat, err := text.Data() if err != nil { |