public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Ian Lance Taylor <iant@golang.org>
To: gcc-patches <gcc-patches@gcc.gnu.org>,
	 gofrontend-dev <gofrontend-dev@googlegroups.com>
Subject: libgo patch committed: Make runtime.Version return a useful value
Date: Tue, 28 Jun 2022 10:20:12 -0700	[thread overview]
Message-ID: <CAOyqgcVCPLAMp3XTEgdNMNFgHUhV5nm_xeDxxO1dG0QV_z2vLA@mail.gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 338 bytes --]

This libgo patch makes runtime.Version return a meaningful string.
This also means that "go version" will print something useful, e.g.,

go version go1.18 gccgo (GCC) 12.0.1 20220216 (experimental) linux/amd64

This fixes https://go.dev/issue/51850.

Bootstrapped and ran Go testsuite on x86_64-pc-linux-gnu.  Committed
to mainline.

Ian

[-- Attachment #2: patch.txt --]
[-- Type: text/plain, Size: 2075 bytes --]

0d8541c7c906c92c750c779958beafb0e0dbfe47
diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE
index a0e386ab4f6..551ea650acf 100644
--- a/gcc/go/gofrontend/MERGE
+++ b/gcc/go/gofrontend/MERGE
@@ -1,4 +1,4 @@
-28fe9fad4acb4e02083faf5503b06e3e6e8eecaf
+d5b4abed2f206e492890acc20738e89617ea542c
 
 The first line of this file holds the git revision number of the last
 merge done from the gofrontend repository.
diff --git a/libgo/Makefile.am b/libgo/Makefile.am
index a5d4b6a3525..b03e6553e90 100644
--- a/libgo/Makefile.am
+++ b/libgo/Makefile.am
@@ -568,6 +568,7 @@ s-goroot: Makefile
 	rm -f goroot.go.tmp
 	echo "package runtime" > goroot.go.tmp
 	echo 'var defaultGOROOT = `$(prefix)`' >> goroot.go.tmp
+	echo 'var buildVersion = `'`cat $(srcdir)/VERSION | sed 1q`' '`$(GOC) --version | sed 1q`'`' >> goroot.go.tmp
 	$(SHELL) $(srcdir)/mvifdiff.sh goroot.go.tmp goroot.go
 	$(STAMP) $@
 
diff --git a/libgo/Makefile.in b/libgo/Makefile.in
index 22f48a52938..16ed62a82ed 100644
--- a/libgo/Makefile.in
+++ b/libgo/Makefile.in
@@ -2780,6 +2780,7 @@ s-goroot: Makefile
 	rm -f goroot.go.tmp
 	echo "package runtime" > goroot.go.tmp
 	echo 'var defaultGOROOT = `$(prefix)`' >> goroot.go.tmp
+	echo 'var buildVersion = `'`cat $(srcdir)/VERSION | sed 1q`' '`$(GOC) --version | sed 1q`'`' >> goroot.go.tmp
 	$(SHELL) $(srcdir)/mvifdiff.sh goroot.go.tmp goroot.go
 	$(STAMP) $@
 
diff --git a/libgo/go/runtime/extern.go b/libgo/go/runtime/extern.go
index a371d9c0ee0..8e226147965 100644
--- a/libgo/go/runtime/extern.go
+++ b/libgo/go/runtime/extern.go
@@ -231,16 +231,6 @@ func GOROOT() string {
 	return defaultGOROOT
 }
 
-// buildVersion is the Go tree's version string at build time.
-//
-// If any GOEXPERIMENTs are set to non-default values, it will include
-// "X:<GOEXPERIMENT>".
-//
-// This is set by the linker.
-//
-// This is accessed by "go version <binary>".
-var buildVersion string
-
 // Version returns the Go tree's version string.
 // It is either the commit hash and date at the time of the build or,
 // when possible, a release tag like "go1.3".

             reply	other threads:[~2022-06-28 17:20 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-28 17:20 Ian Lance Taylor [this message]
2022-09-13 20:13 ` Ian Lance Taylor

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAOyqgcVCPLAMp3XTEgdNMNFgHUhV5nm_xeDxxO1dG0QV_z2vLA@mail.gmail.com \
    --to=iant@golang.org \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=gofrontend-dev@googlegroups.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).