mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/objdump: disassemble local text symbols
Fixes #8803. LGTM=rsc R=rsc CC=golang-codereviews https://golang.org/cl/169720043
This commit is contained in:
parent
6b54cc93d0
commit
324b293878
2 changed files with 18 additions and 3 deletions
|
|
@ -157,12 +157,15 @@ var armNeed = []string{
|
|||
// binary for the current system (only) and test that objdump
|
||||
// can handle that one.
|
||||
|
||||
func TestDisasm(t *testing.T) {
|
||||
func testDisasm(t *testing.T, flags ...string) {
|
||||
tmp, exe := buildObjdump(t)
|
||||
defer os.RemoveAll(tmp)
|
||||
|
||||
hello := filepath.Join(tmp, "hello.exe")
|
||||
out, err := exec.Command("go", "build", "-o", hello, "testdata/fmthello.go").CombinedOutput()
|
||||
args := []string{"build", "-o", hello}
|
||||
args = append(args, flags...)
|
||||
args = append(args, "testdata/fmthello.go")
|
||||
out, err := exec.Command("go", args...).CombinedOutput()
|
||||
if err != nil {
|
||||
t.Fatalf("go build fmthello.go: %v\n%s", err, out)
|
||||
}
|
||||
|
|
@ -194,3 +197,15 @@ func TestDisasm(t *testing.T) {
|
|||
t.Logf("full disassembly:\n%s", text)
|
||||
}
|
||||
}
|
||||
|
||||
func TestDisasm(t *testing.T) {
|
||||
testDisasm(t)
|
||||
}
|
||||
|
||||
func TestDisasmExtld(t *testing.T) {
|
||||
switch runtime.GOOS {
|
||||
case "windows":
|
||||
t.Skipf("skipping on %s", runtime.GOOS)
|
||||
}
|
||||
testDisasm(t, "-ldflags=-linkmode=external")
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue