Skip to content

Commit c8b6cb0

Browse files
heschigopherbot
authored andcommitted
cmd/release: drop relocation type checks
1.15 is out of support, and I don't understand the value of the test for 1.16+. AIUI, we had a problem in 1.15 where we used a newer relocation type than some toolchains supported, and we wanted to make sure we didn't accidentally use that type before we were ready. That makes sense to me. But I don't see the value of guaranteeing that we don't use the old kind, which everything should still support. As always, please correct me if I'm missing something -- I don't mind keeping this if it's actually useful. Updates golang/go#31293. For golang/go#51797. Change-Id: If92e4b3e22759183d856e40b52a45d1251aa8e45 Reviewed-on: https://go-review.googlesource.com/c/build/+/391074 Trust: Heschi Kreinick <[email protected]> Run-TryBot: Heschi Kreinick <[email protected]> Reviewed-by: Dmitri Shuralyov <[email protected]> Auto-Submit: Heschi Kreinick <[email protected]> TryBot-Result: Gopher Robot <[email protected]>
1 parent ea7e41e commit c8b6cb0

File tree

1 file changed

+0
-47
lines changed

1 file changed

+0
-47
lines changed

cmd/release/release.go

Lines changed: 0 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -440,10 +440,6 @@ func (b *Build) make() error {
440440
return fmt.Errorf("Build failed: %v\nOutput:\n%v", remoteErr, out)
441441
}
442442

443-
if err := b.checkRelocations(client); err != nil {
444-
return err
445-
}
446-
447443
goCmd := path.Join(goDir, "bin/go")
448444
if b.OS == "windows" {
449445
goCmd += ".exe"
@@ -865,49 +861,6 @@ func (b *Build) writeFile(name string, r io.Reader) error {
865861
return nil
866862
}
867863

868-
// checkRelocations runs readelf on pkg/linux_amd64/runtime/cgo.a and makes sure
869-
// we don't see R_X86_64_REX_GOTPCRELX in new Go 1.15 minor releases.
870-
// See golang.org/issue/31293 and golang.org/issue/40561#issuecomment-731482962.
871-
func (b *Build) checkRelocations(client buildlet.Client) error {
872-
if b.OS != "linux" || b.Arch != "amd64" || b.TestOnly {
873-
// This check is only applicable to linux/amd64 builds.
874-
// However, skip it on test-only builds because they
875-
// don't produce binaries that are shipped to users.
876-
return nil
877-
}
878-
var out bytes.Buffer
879-
file := fmt.Sprintf("go/pkg/linux_%s/runtime/cgo.a", b.Arch)
880-
remoteErr, err := client.Exec(context.Background(), "readelf", buildlet.ExecOpts{
881-
Output: &out,
882-
Args: []string{"-r", "--wide", file},
883-
SystemLevel: true, // look for readelf in system's PATH
884-
})
885-
if err != nil {
886-
return fmt.Errorf("failed to run readelf: %v", err)
887-
}
888-
got := out.String()
889-
switch {
890-
default: // Go 1.16 and newer.
891-
// Note: This check was kept and updated for Go 1.16, since it wasn't hard.
892-
// Remove it at some point in the future if it becomes no longer useful or
893-
// overly expensive to maintain.
894-
if strings.Contains(got, "R_X86_64_GOTPCREL") {
895-
return fmt.Errorf("%s contained a R_X86_64_GOTPCREL relocation", file)
896-
}
897-
if !strings.Contains(got, "R_X86_64_REX_GOTPCRELX") {
898-
return fmt.Errorf("%s did not contain a R_X86_64_REX_GOTPCRELX relocation; remoteErr=%v, %s", file, remoteErr, got)
899-
}
900-
case strings.HasPrefix(*version, "go1.15"):
901-
if strings.Contains(got, "R_X86_64_REX_GOTPCRELX") {
902-
return fmt.Errorf("%s contained a R_X86_64_REX_GOTPCRELX relocation", file)
903-
}
904-
if !strings.Contains(got, "R_X86_64_GOTPCREL") {
905-
return fmt.Errorf("%s did not contain a R_X86_64_GOTPCREL relocation; remoteErr=%v, %s", file, remoteErr, got)
906-
}
907-
}
908-
return nil
909-
}
910-
911864
// verifyGzipSingleStream verifies that the named gzip file is not
912865
// a multi-stream file. See golang.org/issue/19052
913866
func verifyGzipSingleStream(name string) error {

0 commit comments

Comments
 (0)