Message ID | CAOyqgcVNamciWHaWtBO+cLK-GD145JXypE0w+BeXJ=UuxjVBCw@mail.gmail.com |
---|---|
State | New |
Headers | show |
On Thu, Jul 13, 2017 at 9:56 PM, Ian Lance Taylor <iant@golang.org> wrote: > On Thu, Jun 29, 2017 at 11:40 PM, Uros Bizjak <ubizjak@gmail.com> wrote: >> >>> This patch to the gotools Makefile adds tests to `make check`. We now >>> test the runtime package using the newly built go tool, and test that >>> cgo works by running the misc/cgo/test and misc/cgo/testcarchive >>> tests. Bootstrapped and ran Go testsuite on x86_64-pc-linux-gnu. >>> Committed to mainline. >> >> There are several failures on non-split targets, e.g.: >> >> FAIL: TestCgoHandlesWlORIGIN >> go_test.go:267: running testgo [build origin] >> go_test.go:286: standard error: >> go_test.go:287: # origin >> cc1: error: '-fsplit-stack' requires assembler support for CFI >> directives >> cc1: error: '-fsplit-stack' is not supported by this compiler >> configuration >> >> and: >> >> FAIL: TestCgoCrashHandler >> crash_test.go:70: building testprogcgo []: exit status 2 >> # _/home/uros/git/gcc/libgo/go/runtime/testdata/testprogcgo >> cc1: error: '-fsplit-stack' requires assembler support for CFI >> directives >> cc1: error: '-fsplit-stack' is not supported by this compiler >> configuration >> >> As evident from TestBuildDryRunWithCgo dump, -fsplit-stack argument is >> added unconditionally to the compile flags. > > Would you mind checking whether this patch fixes the problem on your > system? Thanks. Yes, this patch correctly detects that the compiler doesn't support -fsplit-stack. Thanks, Uros.
On Fri, Jul 14, 2017 at 11:41 AM, Uros Bizjak <ubizjak@gmail.com> wrote: > On Thu, Jul 13, 2017 at 9:56 PM, Ian Lance Taylor <iant@golang.org> wrote: >> On Thu, Jun 29, 2017 at 11:40 PM, Uros Bizjak <ubizjak@gmail.com> wrote: >>> >>>> This patch to the gotools Makefile adds tests to `make check`. We now >>>> test the runtime package using the newly built go tool, and test that >>>> cgo works by running the misc/cgo/test and misc/cgo/testcarchive >>>> tests. Bootstrapped and ran Go testsuite on x86_64-pc-linux-gnu. >>>> Committed to mainline. >>> >>> There are several failures on non-split targets, e.g.: >>> >>> FAIL: TestCgoHandlesWlORIGIN >>> go_test.go:267: running testgo [build origin] >>> go_test.go:286: standard error: >>> go_test.go:287: # origin >>> cc1: error: '-fsplit-stack' requires assembler support for CFI >>> directives >>> cc1: error: '-fsplit-stack' is not supported by this compiler >>> configuration >>> >>> and: >>> >>> FAIL: TestCgoCrashHandler >>> crash_test.go:70: building testprogcgo []: exit status 2 >>> # _/home/uros/git/gcc/libgo/go/runtime/testdata/testprogcgo >>> cc1: error: '-fsplit-stack' requires assembler support for CFI >>> directives >>> cc1: error: '-fsplit-stack' is not supported by this compiler >>> configuration >>> >>> As evident from TestBuildDryRunWithCgo dump, -fsplit-stack argument is >>> added unconditionally to the compile flags. >> >> Would you mind checking whether this patch fixes the problem on your >> system? Thanks. > > Yes, this patch correctly detects that the compiler doesn't support > -fsplit-stack. Thanks for checking. I've committed the patch to mainline. Ian
diff --git a/libgo/go/cmd/go/build.go b/libgo/go/cmd/go/build.go index 72265efa..9623b9c3 100644 --- a/libgo/go/cmd/go/build.go +++ b/libgo/go/cmd/go/build.go @@ -3092,8 +3092,7 @@ func (tools gccgoToolchain) cc(b *builder, p *Package, objdir, ofile, cfile stri if pkgpath := gccgoCleanPkgpath(p); pkgpath != "" { defs = append(defs, `-D`, `GOPKGPATH="`+pkgpath+`"`) } - switch goarch { - case "386", "amd64": + if b.gccSupportsFlag("-fsplit-stack") { defs = append(defs, "-fsplit-stack") } defs = tools.maybePIC(defs) @@ -3428,8 +3427,7 @@ func (b *builder) cgo(a *action, cgoExe, obj string, pcCFLAGS, pcLDFLAGS, cgofil } if _, ok := buildToolchain.(gccgoToolchain); ok { - switch goarch { - case "386", "amd64": + if b.gccSupportsFlag("-fsplit-stack") { cgoCFLAGS = append(cgoCFLAGS, "-fsplit-stack") } cgoflags = append(cgoflags, "-gccgo")