diff options
| author | Cherry Mui <cherryyz@google.com> | 2025-03-21 08:46:14 -0700 |
|---|---|---|
| committer | Cherry Mui <cherryyz@google.com> | 2025-03-21 09:29:02 -0700 |
| commit | 69ea62fe95a14a04d6b2ba145aaf78e36f42e2eb (patch) | |
| tree | 5f69cda72bd66af90d098014179e7f16b3f8d930 /src/cmd/link | |
| parent | c386ed107e65f495acb6aacb0efcaade27da6a15 (diff) | |
| download | go-69ea62fe95a14a04d6b2ba145aaf78e36f42e2eb.tar.xz | |
Revert "cmd/compile/internal/abi: fix ComputePadding"
This reverts CL 656736.
Reason for revert: breaks many builders (all flavors of
linux-amd64 builders).
Change-Id: Ie7190d4078fada227391804c5cf10b9ce9cc9115
Reviewed-on: https://go-review.googlesource.com/c/go/+/659955
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@google.com>
Diffstat (limited to 'src/cmd/link')
| -rw-r--r-- | src/cmd/link/internal/ld/dwarf_test.go | 113 |
1 files changed, 0 insertions, 113 deletions
diff --git a/src/cmd/link/internal/ld/dwarf_test.go b/src/cmd/link/internal/ld/dwarf_test.go index 99bf1a1778..28b5ddf74c 100644 --- a/src/cmd/link/internal/ld/dwarf_test.go +++ b/src/cmd/link/internal/ld/dwarf_test.go @@ -5,9 +5,7 @@ package ld import ( - "bytes" "debug/dwarf" - "debug/elf" "debug/pe" "fmt" "internal/platform" @@ -2044,114 +2042,3 @@ func TestConsistentGoKindAndRuntimeType(t *testing.T) { t.Logf("%d types checked\n", typesChecked) } } - -func TestIssue72053(t *testing.T) { - if runtime.GOOS != "linux" || runtime.GOARCH != "amd64" { - t.Skip("skipping test: requires ELF binary and amd64 arch") - } - - testenv.MustHaveGoBuild(t) - - mustHaveDWARF(t) - - t.Parallel() - - dir := t.TempDir() - - const prog = `package main - -import ( - "fmt" - "strings" -) - -func main() { - u := Address{Addr: "127.0.0.1"} - fmt.Println(u) // line 10 -} - -type Address struct { - TLS bool - Addr string -} - -func (a Address) String() string { - sb := new(strings.Builder) - sb.WriteString(a.Addr) - return sb.String() -} -` - - bf := gobuild(t, dir, prog, NoOpt) - - defer bf.Close() - - f, err := elf.Open(bf.path) - if err != nil { - t.Fatal(err) - } - - dwrf, err := f.DWARF() - if err != nil { - t.Fatal(err) - } - - rdr := dwrf.Reader() - - found := false - for { - e, err := rdr.Next() - if err != nil { - t.Fatal(err) - } - if e == nil { - break - } - - name, _ := e.Val(dwarf.AttrName).(string) - - if e.Tag == dwarf.TagSubprogram && name == "main.Address.String" { - found = true - continue - } - - if found && name == "a" { - loc := e.AttrField(dwarf.AttrLocation) - if loc != nil { - switch loc.Class { - case dwarf.ClassLocListPtr: - offset := loc.Val.(int64) - buf := make([]byte, 32) - s := f.Section(".debug_loc") - if s == nil { - t.Fatal("could not find debug_loc section") - } - d := s.Open() - // Seek past the first 16 bytes which establishes the base address and - // can be brittle and unreliable in the test due to compiler changes or DWARF - // version used. - d.Seek(offset+16, io.SeekStart) - d.Read(buf) - - // DW_OP_reg0 DW_OP_piece 0x1 DW_OP_piece 0x7 DW_OP_reg3 DW_OP_piece 0x8 DW_OP_reg2 DW_OP_piece 0x8 - expected := []byte{ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x0b, 0x00, 0x50, 0x93, 0x01, 0x93, 0x07, 0x53, - 0x93, 0x08, 0x52, 0x93, 0x08, 0x1f, 0x00, 0x00, - } - - if !bytes.Equal(buf, expected) { - t.Fatalf("unexpected DWARF sequence found, expected:\n%#v\nfound:\n%#v\n", expected, buf) - } - } - } else { - t.Fatal("unable to find expected DWARF location list") - } - break - } - } - if !found { - t.Fatal("unable to find expected DWARF location list") - } -} |
