diff mbox series

[RFC,1/3] go: rework patch to avoid identation

Message ID 20240227100709.1154-1-jose.quaresma@foundries.io
State Accepted, archived
Commit 5065025a66f96140ca895a140067fbde82879941
Headers show
Series [RFC,1/3] go: rework patch to avoid identation | expand

Commit Message

Jose Quaresma Feb. 27, 2024, 10:07 a.m. UTC
It's more hard to read but easy to rebase, no functional changes

Signed-off-by: Jose Quaresma <jose.quaresma@foundries.io>
---
 ...dist-separate-host-and-target-builds.patch | 136 +++++-------------
 1 file changed, 35 insertions(+), 101 deletions(-)

Comments

Jose Quaresma Feb. 27, 2024, 10:13 a.m. UTC | #1
Hi,

I would like to ask if this patchset could be exercised in the autobuilder?
I only got it working yesterday and today I'm going to do a more exhaustive
test.
This is still missing the update to 1.22, which I'll do later, but testing
this would be a good help.

Jose

Jose Quaresma via lists.openembedded.org <quaresma.jose=
gmail.com@lists.openembedded.org> escreveu (terça, 27/02/2024 à(s) 10:07):

> With go-1.21 dynamic linking cause a runtime panic:
>
> | root@qemux86-64:~# go-helloworld
> | panic: runtime error: index out of range [0] with length 0
> |
> | goroutine 1 [running]:
> | flag.init()
> |         /usr/lib/go/src/flag/flag.go:1199 +0xf9
>
> In my opinion, this would be a good trade-off so that we can update and
> leave the version 1.20 for the next LTS 5.0 since we are already quite
> behind on the version available upstream which already has the 1.22
> available.
>
> Signed-off-by: Jose Quaresma <jose.quaresma@foundries.io>
> ---
>  meta/classes-recipe/goarch.bbclass | 14 +++++++-------
>  1 file changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/meta/classes-recipe/goarch.bbclass
> b/meta/classes-recipe/goarch.bbclass
> index 1ebe03864f..6899ec28e4 100644
> --- a/meta/classes-recipe/goarch.bbclass
> +++ b/meta/classes-recipe/goarch.bbclass
> @@ -38,13 +38,13 @@ BASE_GOARM:armv5 = '5'
>  # Go supports dynamic linking on a limited set of architectures.
>  # See the supportsDynlink function in
> go/src/cmd/compile/internal/gc/main.go
>  GO_DYNLINK = ""
> -GO_DYNLINK:arm ?= "1"
> -GO_DYNLINK:aarch64 ?= "1"
> -GO_DYNLINK:x86 ?= "1"
> -GO_DYNLINK:x86-64 ?= "1"
> -GO_DYNLINK:powerpc64 ?= "1"
> -GO_DYNLINK:powerpc64le ?= "1"
> -GO_DYNLINK:class-native ?= ""
> +GO_DYNLINK:arm = ""
> +GO_DYNLINK:aarch64 = ""
> +GO_DYNLINK:x86 = ""
> +GO_DYNLINK:x86-64 = ""
> +GO_DYNLINK:powerpc64 = ""
> +GO_DYNLINK:powerpc64le = ""
> +GO_DYNLINK:class-native = ""
>  GO_DYNLINK:class-nativesdk = ""
>
>  # define here because everybody inherits this class
> --
> 2.44.0
>
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#196251):
> https://lists.openembedded.org/g/openembedded-core/message/196251
> Mute This Topic: https://lists.openembedded.org/mt/104600087/5052612
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [
> quaresma.jose@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
>
Alexander Kanavin Feb. 27, 2024, 10:51 a.m. UTC | #2
I was going to do that, but RP beat me to it:
https://autobuilder.yoctoproject.org/typhoon/#/builders/83/builds/6613

Alex

On Tue, 27 Feb 2024 at 11:13, Jose Quaresma <quaresma.jose@gmail.com> wrote:
>
> Hi,
>
> I would like to ask if this patchset could be exercised in the autobuilder?
> I only got it working yesterday and today I'm going to do a more exhaustive test.
> This is still missing the update to 1.22, which I'll do later, but testing this would be a good help.
>
> Jose
>
> Jose Quaresma via lists.openembedded.org <quaresma.jose=gmail.com@lists.openembedded.org> escreveu (terça, 27/02/2024 à(s) 10:07):
>>
>> With go-1.21 dynamic linking cause a runtime panic:
>>
>> | root@qemux86-64:~# go-helloworld
>> | panic: runtime error: index out of range [0] with length 0
>> |
>> | goroutine 1 [running]:
>> | flag.init()
>> |         /usr/lib/go/src/flag/flag.go:1199 +0xf9
>>
>> In my opinion, this would be a good trade-off so that we can update and
>> leave the version 1.20 for the next LTS 5.0 since we are already quite
>> behind on the version available upstream which already has the 1.22 available.
>>
>> Signed-off-by: Jose Quaresma <jose.quaresma@foundries.io>
>> ---
>>  meta/classes-recipe/goarch.bbclass | 14 +++++++-------
>>  1 file changed, 7 insertions(+), 7 deletions(-)
>>
>> diff --git a/meta/classes-recipe/goarch.bbclass b/meta/classes-recipe/goarch.bbclass
>> index 1ebe03864f..6899ec28e4 100644
>> --- a/meta/classes-recipe/goarch.bbclass
>> +++ b/meta/classes-recipe/goarch.bbclass
>> @@ -38,13 +38,13 @@ BASE_GOARM:armv5 = '5'
>>  # Go supports dynamic linking on a limited set of architectures.
>>  # See the supportsDynlink function in go/src/cmd/compile/internal/gc/main.go
>>  GO_DYNLINK = ""
>> -GO_DYNLINK:arm ?= "1"
>> -GO_DYNLINK:aarch64 ?= "1"
>> -GO_DYNLINK:x86 ?= "1"
>> -GO_DYNLINK:x86-64 ?= "1"
>> -GO_DYNLINK:powerpc64 ?= "1"
>> -GO_DYNLINK:powerpc64le ?= "1"
>> -GO_DYNLINK:class-native ?= ""
>> +GO_DYNLINK:arm = ""
>> +GO_DYNLINK:aarch64 = ""
>> +GO_DYNLINK:x86 = ""
>> +GO_DYNLINK:x86-64 = ""
>> +GO_DYNLINK:powerpc64 = ""
>> +GO_DYNLINK:powerpc64le = ""
>> +GO_DYNLINK:class-native = ""
>>  GO_DYNLINK:class-nativesdk = ""
>>
>>  # define here because everybody inherits this class
>> --
>> 2.44.0
>>
>>
>>
>>
>
>
> --
> Best regards,
>
> José Quaresma
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#196253): https://lists.openembedded.org/g/openembedded-core/message/196253
> Mute This Topic: https://lists.openembedded.org/mt/104600118/1686489
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [alex.kanavin@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
Jose Quaresma Feb. 27, 2024, 11 a.m. UTC | #3
Alexander Kanavin <alex.kanavin@gmail.com> escreveu (terça, 27/02/2024 à(s)
10:51):

> I was going to do that, but RP beat me to it:
> https://autobuilder.yoctoproject.org/typhoon/#/builders/83/builds/6613
>
>
I'm also going to do more tests today especially on more complex stacks
like Docker.
I know we are in a feature freeze but I would really like to be able to
submit the
update to the latest golang before the next LTS 5.0.

Thank you both for running this on the autobuilder.

Jose


> Alex
>
> On Tue, 27 Feb 2024 at 11:13, Jose Quaresma <quaresma.jose@gmail.com>
> wrote:
> >
> > Hi,
> >
> > I would like to ask if this patchset could be exercised in the
> autobuilder?
> > I only got it working yesterday and today I'm going to do a more
> exhaustive test.
> > This is still missing the update to 1.22, which I'll do later, but
> testing this would be a good help.
> >
> > Jose
> >
> > Jose Quaresma via lists.openembedded.org <quaresma.jose=
> gmail.com@lists.openembedded.org> escreveu (terça, 27/02/2024 à(s) 10:07):
> >>
> >> With go-1.21 dynamic linking cause a runtime panic:
> >>
> >> | root@qemux86-64:~# go-helloworld
> >> | panic: runtime error: index out of range [0] with length 0
> >> |
> >> | goroutine 1 [running]:
> >> | flag.init()
> >> |         /usr/lib/go/src/flag/flag.go:1199 +0xf9
> >>
> >> In my opinion, this would be a good trade-off so that we can update and
> >> leave the version 1.20 for the next LTS 5.0 since we are already quite
> >> behind on the version available upstream which already has the 1.22
> available.
> >>
> >> Signed-off-by: Jose Quaresma <jose.quaresma@foundries.io>
> >> ---
> >>  meta/classes-recipe/goarch.bbclass | 14 +++++++-------
> >>  1 file changed, 7 insertions(+), 7 deletions(-)
> >>
> >> diff --git a/meta/classes-recipe/goarch.bbclass
> b/meta/classes-recipe/goarch.bbclass
> >> index 1ebe03864f..6899ec28e4 100644
> >> --- a/meta/classes-recipe/goarch.bbclass
> >> +++ b/meta/classes-recipe/goarch.bbclass
> >> @@ -38,13 +38,13 @@ BASE_GOARM:armv5 = '5'
> >>  # Go supports dynamic linking on a limited set of architectures.
> >>  # See the supportsDynlink function in
> go/src/cmd/compile/internal/gc/main.go
> >>  GO_DYNLINK = ""
> >> -GO_DYNLINK:arm ?= "1"
> >> -GO_DYNLINK:aarch64 ?= "1"
> >> -GO_DYNLINK:x86 ?= "1"
> >> -GO_DYNLINK:x86-64 ?= "1"
> >> -GO_DYNLINK:powerpc64 ?= "1"
> >> -GO_DYNLINK:powerpc64le ?= "1"
> >> -GO_DYNLINK:class-native ?= ""
> >> +GO_DYNLINK:arm = ""
> >> +GO_DYNLINK:aarch64 = ""
> >> +GO_DYNLINK:x86 = ""
> >> +GO_DYNLINK:x86-64 = ""
> >> +GO_DYNLINK:powerpc64 = ""
> >> +GO_DYNLINK:powerpc64le = ""
> >> +GO_DYNLINK:class-native = ""
> >>  GO_DYNLINK:class-nativesdk = ""
> >>
> >>  # define here because everybody inherits this class
> >> --
> >> 2.44.0
> >>
> >>
> >>
> >>
> >
> >
> > --
> > Best regards,
> >
> > José Quaresma
> >
> > -=-=-=-=-=-=-=-=-=-=-=-
> > Links: You receive all messages sent to this group.
> > View/Reply Online (#196253):
> https://lists.openembedded.org/g/openembedded-core/message/196253
> > Mute This Topic: https://lists.openembedded.org/mt/104600118/1686489
> > Group Owner: openembedded-core+owner@lists.openembedded.org
> > Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [
> alex.kanavin@gmail.com]
> > -=-=-=-=-=-=-=-=-=-=-=-
> >
>
Richard Purdie Feb. 27, 2024, 1:56 p.m. UTC | #4
On Tue, 2024-02-27 at 10:13 +0000, Jose Quaresma wrote:
> Hi,
> 
> I would like to ask if this patchset could be exercised in the
> autobuilder?
> I only got it working yesterday and today I'm going to do a more
> exhaustive test.
> This is still missing the update to 1.22, which I'll do later, but
> testing this would be a good help.

I did put this in for testing. The build is still running but so far
there were two issues:

https://autobuilder.yoctoproject.org/typhoon/#/builders/87/builds/6466/steps/14/logs/stdio

from oe-selftest -r gotoolchain.oeGoToolchainSelfTest.test_go_dep_build

and meta-clang:

https://autobuilder.yoctoproject.org/typhoon/#/builders/142/builds/39

meta-virt did pass our testing but I've copied Bruce so he's aware of
this and can comment. Copying Khem for meta-clang too.

Cheers,

Richard
Bruce Ashfield Feb. 27, 2024, 2:01 p.m. UTC | #5
On Tue, Feb 27, 2024 at 8:57 AM Richard Purdie
<richard.purdie@linuxfoundation.org> wrote:
>
> On Tue, 2024-02-27 at 10:13 +0000, Jose Quaresma wrote:
> > Hi,
> >
> > I would like to ask if this patchset could be exercised in the
> > autobuilder?
> > I only got it working yesterday and today I'm going to do a more
> > exhaustive test.
> > This is still missing the update to 1.22, which I'll do later, but
> > testing this would be a good help.
>
> I did put this in for testing. The build is still running but so far
> there were two issues:
>
> https://autobuilder.yoctoproject.org/typhoon/#/builders/87/builds/6466/steps/14/logs/stdio
>
> from oe-selftest -r gotoolchain.oeGoToolchainSelfTest.test_go_dep_build
>
> and meta-clang:
>
> https://autobuilder.yoctoproject.org/typhoon/#/builders/142/builds/39
>
> meta-virt did pass our testing but I've copied Bruce so he's aware of
> this and can comment. Copying Khem for meta-clang too.

I'm running into some golang issues linking with my latest updates to
meta-virt .

I'll apply these locally and see if they help, make things worse or have
no impact on my upcoming recipe bumps for m-virt.

Bruce


>
> Cheers,
>
> Richard
Jose Quaresma Feb. 27, 2024, 3:20 p.m. UTC | #6
Bruce Ashfield <bruce.ashfield@gmail.com> escreveu (terça, 27/02/2024 à(s)
14:01):

> On Tue, Feb 27, 2024 at 8:57 AM Richard Purdie
> <richard.purdie@linuxfoundation.org> wrote:
> >
> > On Tue, 2024-02-27 at 10:13 +0000, Jose Quaresma wrote:
> > > Hi,
> > >
> > > I would like to ask if this patchset could be exercised in the
> > > autobuilder?
> > > I only got it working yesterday and today I'm going to do a more
> > > exhaustive test.
> > > This is still missing the update to 1.22, which I'll do later, but
> > > testing this would be a good help.
> >
> > I did put this in for testing. The build is still running but so far
> > there were two issues:
> >
> >
> https://autobuilder.yoctoproject.org/typhoon/#/builders/87/builds/6466/steps/14/logs/stdio
> >
> > from oe-selftest -r gotoolchain.oeGoToolchainSelfTest.test_go_dep_build
>

I have see of this also in my local builds in my distro and there are some
reports upstream
https://github.com/golang/go/issues/61928
I believe this one is expected with the update but I am still doing my
local tests.


> >
> > and meta-clang:
> >
> > https://autobuilder.yoctoproject.org/typhoon/#/builders/142/builds/39
> >
> > meta-virt did pass our testing but I've copied Bruce so he's aware of
> > this and can comment. Copying Khem for meta-clang too.
>

For meta-clang maybe we can switch to gcc to build the go-helloworld


>
> I'm running into some golang issues linking with my latest updates to
> meta-virt .
>
> I'll apply these locally and see if they help, make things worse or have
> no impact on my upcoming recipe bumps for m-virt.
>

I am testing mostly docker and everything seems fine so far.

Jose


>
> Bruce
>
>
> >
> > Cheers,
> >
> > Richard
>
>
>
> --
> - Thou shalt not follow the NULL pointer, for chaos and madness await
> thee at its end
> - "Use the force Harry" - Gandalf, Star Trek II
>
Jose Quaresma Feb. 28, 2024, 12:17 p.m. UTC | #7
Jose Quaresma via lists.openembedded.org <quaresma.jose=
gmail.com@lists.openembedded.org> escreveu (terça, 27/02/2024 à(s) 15:20):

>
>
> Bruce Ashfield <bruce.ashfield@gmail.com> escreveu (terça, 27/02/2024
> à(s) 14:01):
>
>> On Tue, Feb 27, 2024 at 8:57 AM Richard Purdie
>> <richard.purdie@linuxfoundation.org> wrote:
>> >
>> > On Tue, 2024-02-27 at 10:13 +0000, Jose Quaresma wrote:
>> > > Hi,
>> > >
>> > > I would like to ask if this patchset could be exercised in the
>> > > autobuilder?
>> > > I only got it working yesterday and today I'm going to do a more
>> > > exhaustive test.
>> > > This is still missing the update to 1.22, which I'll do later, but
>> > > testing this would be a good help.
>> >
>> > I did put this in for testing. The build is still running but so far
>> > there were two issues:
>> >
>> >
>> https://autobuilder.yoctoproject.org/typhoon/#/builders/87/builds/6466/steps/14/logs/stdio
>> >
>> > from oe-selftest -r gotoolchain.oeGoToolchainSelfTest.test_go_dep_build
>>
>
> I have see of this also in my local builds in my distro and there are some
> reports upstream
> https://github.com/golang/go/issues/61928
> I believe this one is expected with the update but I am still doing my
> local tests.
>

I have fixed something like this in my distro so I will fix it also in my
next and final submission.

Jose


>
>> >
>> > and meta-clang:
>> >
>> > https://autobuilder.yoctoproject.org/typhoon/#/builders/142/builds/39
>> >
>> > meta-virt did pass our testing but I've copied Bruce so he's aware of
>> > this and can comment. Copying Khem for meta-clang too.
>>
>
> For meta-clang maybe we can switch to gcc to build the go-helloworld
>
>
>>
>> I'm running into some golang issues linking with my latest updates to
>> meta-virt .
>>
>> I'll apply these locally and see if they help, make things worse or have
>> no impact on my upcoming recipe bumps for m-virt.
>>
>
> I am testing mostly docker and everything seems fine so far.
>
> Jose
>
>
>>
>> Bruce
>>
>>
>> >
>> > Cheers,
>> >
>> > Richard
>>
>>
>>
>> --
>> - Thou shalt not follow the NULL pointer, for chaos and madness await
>> thee at its end
>> - "Use the force Harry" - Gandalf, Star Trek II
>>
>
>
> --
> Best regards,
>
> José Quaresma
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#196275):
> https://lists.openembedded.org/g/openembedded-core/message/196275
> Mute This Topic: https://lists.openembedded.org/mt/104600118/5052612
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [
> quaresma.jose@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
>
diff mbox series

Patch

diff --git a/meta/recipes-devtools/go/go/0005-cmd-dist-separate-host-and-target-builds.patch b/meta/recipes-devtools/go/go/0005-cmd-dist-separate-host-and-target-builds.patch
index 29598449da..aa2df58995 100644
--- a/meta/recipes-devtools/go/go/0005-cmd-dist-separate-host-and-target-builds.patch
+++ b/meta/recipes-devtools/go/go/0005-cmd-dist-separate-host-and-target-builds.patch
@@ -3,8 +3,6 @@  From: Alex Kube <alexander.j.kube@gmail.com>
 Date: Wed, 23 Oct 2019 21:18:12 +0430
 Subject: [PATCH 5/9] cmd/dist: separate host and target builds
 
-Upstream-Status: Inappropriate [OE specific]
-
 Change the dist tool to allow for OE-style cross-
 and cross-canadian builds:
 
@@ -33,13 +31,20 @@  Adapted to Go 1.13 from patches originally submitted to
 the meta/recipes-devtools/go tree by
 Matt Madison <matt@madison.systems>.
 
+Rework the patch to avoid identation, it's more hard to read
+but easy to rebase.
+Jose Quaresma <jose.quaresma@foundries.io>
+
+Upstream-Status: Inappropriate [OE specific]
+
 Signed-off-by: Alexander J Kube <alexander.j.kube@gmail.com>
+Signed-off-by: Jose Quaresma <jose.quaresma@foundries.io>
 ---
- src/cmd/dist/build.go | 152 +++++++++++++++++++++++++++++++-----------
- 1 file changed, 113 insertions(+), 39 deletions(-)
+ src/cmd/dist/build.go | 76 ++++++++++++++++++++++++++++++++++++++++++-
+ 1 file changed, 75 insertions(+), 1 deletion(-)
 
 diff --git a/src/cmd/dist/build.go b/src/cmd/dist/build.go
-index 5d31718..1c7f308 100644
+index 5d3171856a..d0ba54c072 100644
 --- a/src/cmd/dist/build.go
 +++ b/src/cmd/dist/build.go
 @@ -44,6 +44,7 @@ var (
@@ -119,17 +124,14 @@  index 5d31718..1c7f308 100644
  		xprintf("\n")
  	}
  
--	gogcflags = os.Getenv("GO_GCFLAGS") // we were using $BOOT_GO_GCFLAGS until now
--	setNoOpt()
--	goldflags = os.Getenv("GO_LDFLAGS") // we were using $BOOT_GO_LDFLAGS until now
 +	// For split host/target cross/cross-canadian builds, we don't
 +	// want to be setting these flags until after we have compiled
 +	// the toolchain that runs on the build host.
 +	if !crossBuild {
-+		gogcflags = os.Getenv("GO_GCFLAGS") // we were using $BOOT_GO_GCFLAGS until now
-+		setNoOpt()
-+		goldflags = os.Getenv("GO_LDFLAGS") // we were using $BOOT_GO_LDFLAGS until now
-+	}
+ 	gogcflags = os.Getenv("GO_GCFLAGS") // we were using $BOOT_GO_GCFLAGS until now
+ 	setNoOpt()
+ 	goldflags = os.Getenv("GO_LDFLAGS") // we were using $BOOT_GO_LDFLAGS until now
++}
  	goBootstrap := pathf("%s/go_bootstrap", tooldir)
  	cmdGo := pathf("%s/go", gorootBin)
  	if debug {
@@ -137,25 +139,27 @@  index 5d31718..1c7f308 100644
  		xprintf("\n")
  	}
  	xprintf("Building Go toolchain2 using go_bootstrap and Go toolchain1.\n")
--	os.Setenv("CC", compilerEnvLookup(defaultcc, goos, goarch))
-+	if crossBuild {
++	if !crossBuild {
+ 	os.Setenv("CC", compilerEnvLookup(defaultcc, goos, goarch))
++} else {
 +		os.Setenv("CC", defaultcc[""])
-+	} else {
-+		os.Setenv("CC", compilerEnvLookup(defaultcc, goos, goarch))
 +	}
  	// Now that cmd/go is in charge of the build process, enable GOEXPERIMENT.
  	os.Setenv("GOEXPERIMENT", goexperiment)
  	goInstall(goBootstrap, toolchain...)
-@@ -1421,46 +1454,84 @@ func cmdbootstrap() {
+@@ -1421,6 +1454,7 @@ func cmdbootstrap() {
  		copyfile(pathf("%s/compile3", tooldir), pathf("%s/compile", tooldir), writeExec)
  	}
  
--	if goos == oldgoos && goarch == oldgoarch {
--		// Common case - not setting up for cross-compilation.
--		timelog("build", "toolchain")
--		if vflag > 0 {
--			xprintf("\n")
-+	if crossBuild {
++	if !crossBuild {
+ 	if goos == oldgoos && goarch == oldgoarch {
+ 		// Common case - not setting up for cross-compilation.
+ 		timelog("build", "toolchain")
+@@ -1462,6 +1496,42 @@ func cmdbootstrap() {
+ 		checkNotStale(goBootstrap, append(toolchain, "runtime/internal/sys")...)
+ 		copyfile(pathf("%s/compile4", tooldir), pathf("%s/compile", tooldir), writeExec)
+ 	}
++} else {
 +		gogcflags = os.Getenv("GO_GCFLAGS")
 +		goldflags = os.Getenv("GO_LDFLAGS")
 +		tool_files, _ := filepath.Glob(pathf("%s/*", tooldir))
@@ -189,94 +193,24 @@  index 5d31718..1c7f308 100644
 +			goInstall(goBootstrap, toBuild...)
 +			checkNotStale(goBootstrap, toBuild...)
 +			// Skip cmdGo staleness checks here, since we can't run the target's cmdGo binary
- 		}
--		xprintf("Building packages and commands for %s/%s.\n", goos, goarch)
- 	} else {
--		// GOOS/GOARCH does not match GOHOSTOS/GOHOSTARCH.
--		// Finish GOHOSTOS/GOHOSTARCH installation and then
--		// run GOOS/GOARCH installation.
--		timelog("build", "host toolchain")
--		if vflag > 0 {
--			xprintf("\n")
-+
-+		if goos == oldgoos && goarch == oldgoarch {
-+			// Common case - not setting up for cross-compilation.
-+			timelog("build", "toolchain")
-+			if vflag > 0 {
-+				xprintf("\n")
-+			}
-+			xprintf("Building packages and commands for %s/%s.\n", goos, goarch)
-+		} else {
-+			// GOOS/GOARCH does not match GOHOSTOS/GOHOSTARCH.
-+			// Finish GOHOSTOS/GOHOSTARCH installation and then
-+			// run GOOS/GOARCH installation.
-+			timelog("build", "host toolchain")
-+			if vflag > 0 {
-+				xprintf("\n")
-+			}
-+			xprintf("Building packages and commands for host, %s/%s.\n", goos, goarch)
-+			goInstall(goBootstrap, "std", "cmd")
-+			checkNotStale(goBootstrap, "std", "cmd")
-+			checkNotStale(cmdGo, "std", "cmd")
-+
-+			timelog("build", "target toolchain")
-+			if vflag > 0 {
-+				xprintf("\n")
-+			}
-+			goos = oldgoos
-+			goarch = oldgoarch
-+			os.Setenv("GOOS", goos)
-+			os.Setenv("GOARCH", goarch)
-+			os.Setenv("CC", compilerEnvLookup(defaultcc, goos, goarch))
-+			xprintf("Building packages and commands for target, %s/%s.\n", goos, goarch)
- 		}
--		xprintf("Building packages and commands for host, %s/%s.\n", goos, goarch)
- 		goInstall(goBootstrap, "std", "cmd")
- 		checkNotStale(goBootstrap, "std", "cmd")
- 		checkNotStale(cmdGo, "std", "cmd")
- 
--		timelog("build", "target toolchain")
--		if vflag > 0 {
--			xprintf("\n")
-+		if debug {
-+			run("", ShowOutput|CheckExit, pathf("%s/compile", tooldir), "-V=full")
-+			run("", ShowOutput|CheckExit, pathf("%s/buildid", tooldir), pathf("%s/pkg/%s_%s/runtime/internal/sys.a", goroot, goos, goarch))
-+			checkNotStale(goBootstrap, append(toolchain, "runtime/internal/sys")...)
-+			copyfile(pathf("%s/compile4", tooldir), pathf("%s/compile", tooldir), writeExec)
- 		}
--		goos = oldgoos
--		goarch = oldgoarch
--		os.Setenv("GOOS", goos)
--		os.Setenv("GOARCH", goarch)
--		os.Setenv("CC", compilerEnvLookup(defaultcc, goos, goarch))
--		xprintf("Building packages and commands for target, %s/%s.\n", goos, goarch)
--	}
--	targets := []string{"std", "cmd"}
--	goInstall(goBootstrap, targets...)
--	checkNotStale(goBootstrap, append(toolchain, "runtime/internal/sys")...)
--	checkNotStale(goBootstrap, targets...)
--	checkNotStale(cmdGo, targets...)
--	if debug {
--		run("", ShowOutput|CheckExit, pathf("%s/compile", tooldir), "-V=full")
--		checkNotStale(goBootstrap, append(toolchain, "runtime/internal/sys")...)
--		copyfile(pathf("%s/compile4", tooldir), pathf("%s/compile", tooldir), writeExec)
- 	}
++		}
++	}
  
  	// Check that there are no new files in $GOROOT/bin other than
-@@ -1477,8 +1548,11 @@ func cmdbootstrap() {
+ 	// go and gofmt and $GOOS_$GOARCH (target bin when cross-compiling).
+@@ -1477,8 +1547,12 @@ func cmdbootstrap() {
  		}
  	}
  
--	// Remove go_bootstrap now that we're done.
--	xremove(pathf("%s/go_bootstrap", tooldir))
 +	// Except that for split host/target cross-builds, we need to
 +	// keep it.
 +	if !crossBuild {
-+		xremove(pathf("%s/go_bootstrap", tooldir))
-+	}
+ 	// Remove go_bootstrap now that we're done.
+ 	xremove(pathf("%s/go_bootstrap", tooldir))
++}
  
  	if goos == "android" {
  		// Make sure the exec wrapper will sync a fresh $GOROOT to the device.
 -- 
-2.30.2
+2.43.0