]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/link/internal/ld: don't use linkname before 1.12
authorIan Lance Taylor <iant@golang.org>
Wed, 13 Oct 2021 19:46:33 +0000 (12:46 -0700)
committerIan Lance Taylor <iant@golang.org>
Thu, 14 Oct 2021 04:18:44 +0000 (04:18 +0000)
Before the 1.12 release the use of linkname did not prevent a compiler
error for an empty function body (see #23311). Add some build tags so
that cmd/link will build with earlier releases.

It's true that we currently require Go 1.16 as the bootstrap compiler (#44505).
But for this simple case keep things working with older compilers for now.

Change-Id: I67fe021406096c64c01d6e2c9adbcc4388988a6e
Reviewed-on: https://go-review.googlesource.com/c/go/+/355690
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
src/cmd/link/internal/ld/outbuf_darwin.go
src/cmd/link/internal/ld/outbuf_nofallocate.go
src/cmd/link/internal/ld/outbuf_notdarwin.go

index 6920a0a843aea4303fd89ff9e93ec45708d4285c..b1ee3c56282d347111cfdf8afe33ea86780425c3 100644 (file)
@@ -2,6 +2,9 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+//go:build darwin && go1.12
+// +build darwin,go1.12
+
 package ld
 
 import (
index 6564bd54a3d1bcf27977493fedff76c829c34d0d..3bffe4543dd9bda905292e365cfda72b7113249c 100644 (file)
@@ -2,8 +2,8 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-//go:build !darwin && !linux
-// +build !darwin,!linux
+//go:build (!darwin && !linux) || (darwin && !go1.12)
+// +build !darwin,!linux darwin,!go1.12
 
 package ld
 
index f9caa413e3c3c198a906d362e2a0e4aa7e5d8b99..85e64421a30f48064e54b581a8181871eafb79c2 100644 (file)
@@ -2,8 +2,8 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-//go:build !darwin
-// +build !darwin
+//go:build !darwin || (darwin && !go1.12)
+// +build !darwin darwin,!go1.12
 
 package ld