Bug 85429 - Several gotools tests FAIL with Solaris as
Summary: Several gotools tests FAIL with Solaris as
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: go (show other bugs)
Version: 8.0
: P3 normal
Target Milestone: ---
Assignee: Ian Lance Taylor
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-04-17 09:41 UTC by Rainer Orth
Modified: 2018-05-31 22:47 UTC (History)
0 users

See Also:
Host:
Target: *-*-solaris2.*
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments
proposed patch (740 bytes, patch)
2018-05-01 10:05 UTC, Rainer Orth
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Rainer Orth 2018-04-17 09:41:29 UTC
I noticed that several gotools tests FAIL when using Solaris as.  E.g. on x86:

=== RUN   TestGccgoCrashTracebackNodebug
--- FAIL: TestGccgoCrashTracebackNodebug (6.01s)
        crash_test.go:55: building testprogcxx []: exit status 2
                # _/vol/gcc/src/hg/trunk/local/libgo/go/runtime/testdata/testprogcxx
                Assembler:
                        "/var/tmp//ccPwSFPa.s", line 1 : Invalid section attribute

  "e" for SHF_EXCLUDE is only supported by gas, it seems.  I don't know an /bin/as
  alternative

                        "/var/tmp//ccPwSFPa.s", line 8 : Syntax error
                        Near line: " .section .note.GNU-stack,"",@progbits"
                        "/var/tmp//ccPwSFPa.s", line 9 : Syntax error
                        Near line: " .section .note.GNU-split-stack,"",@progbits"

  as cannot handle - in section names, it seems, and provides no quoting

* On sparc, the situation is worse because the .section syntax differs:

# cmd/go/internal/str
/usr/ccs/bin/as: "/var/tmp//ccZPzx3b.s", line 6: error: quoted-string operand required
/usr/ccs/bin/as: "/var/tmp//ccZPzx3b.s", line 13: error: invalid character (0x40)
/usr/ccs/bin/as: "/var/tmp//ccZPzx3b.s", line 13: error: quoted-string operand required
/usr/ccs/bin/as: "/var/tmp//ccZPzx3b.s", line 13: error: statement syntax
/usr/ccs/bin/as: "/var/tmp//ccZPzx3b.s", line 14: error: invalid character (0x40)
/usr/ccs/bin/as: "/var/tmp//ccZPzx3b.s", line 14: error: quoted-string operand required
/usr/ccs/bin/as: "/var/tmp//ccZPzx3b.s", line 14: error: statement syntax

I'm not sure about the buildid part, but there's probably no point in emitting
.note.GNU-stack and .note.GNU-split-stack on Solaris since nothing looks at
them anyway.

  Rainer
Comment 1 Ian Lance Taylor 2018-04-17 23:30:29 UTC
Does the SPARC Solaris assembler support a syntax like

    .section ".go.buildid",#exclude

?  That's what gas seems to support for compatibility.

Does that syntax work for x86?
Comment 2 ro@CeBiTec.Uni-Bielefeld.DE 2018-04-18 09:43:26 UTC
> --- Comment #1 from Ian Lance Taylor <ian at airs dot com> ---
> Does the SPARC Solaris assembler support a syntax like
>
>     .section ".go.buildid",#exclude
>
> ?  That's what gas seems to support for compatibility.

It does indeed.  I didn't think to look into gas docs because I couldn't
find anything in the Solaris SPARC assembler manual.

> Does that syntax work for x86?

Almost: you need

	.section .go.buildid,#exclude

It's weird that they use the sparc synatx in this case instead of the
common "e" flag.

One caveat, though: #exclude wasn't present in the original Solaris 10
assemblers.  However, both the current ones and the Solaris 11
assemblers do support it.  While I'll handle this when adding
SHF_EXCLUDE support with Solaris as to gcc proper, I don't know if I
care enough about those ancient systems...
Comment 3 ian@gcc.gnu.org 2018-04-27 18:01:33 UTC
Author: ian
Date: Fri Apr 27 18:01:00 2018
New Revision: 259719

URL: https://gcc.gnu.org/viewcvs?rev=259719&root=gcc&view=rev
Log:
	PR go/85429
    cmd/go: add Solaris assembler syntax for gccgo buildid file
    
    The Solaris assembler uses a different syntax for section directives.
    
    This is https://golang.org/cl/109140 ported over to gccgo.
    
    Reviewed-on: https://go-review.googlesource.com/109141

Modified:
    trunk/gcc/go/gofrontend/MERGE
    trunk/libgo/go/cmd/go/internal/work/buildid.go
Comment 4 Ian Lance Taylor 2018-04-27 18:35:38 UTC
Should be fixed on tip, requested permission to backport to GCC 8 branch.
Comment 5 ian@gcc.gnu.org 2018-04-27 18:45:04 UTC
Author: ian
Date: Fri Apr 27 18:44:28 2018
New Revision: 259721

URL: https://gcc.gnu.org/viewcvs?rev=259721&root=gcc&view=rev
Log:
	PR go/85429
    cmd/go: add Solaris assembler syntax for gccgo buildid file
    
    The Solaris assembler uses a different syntax for section directives.
    
    This is https://golang.org/cl/109140 ported over to gccgo.
    
    Reviewed-on: https://go-review.googlesource.com/109141

Modified:
    branches/gcc-8-branch/libgo/go/cmd/go/internal/work/buildid.go
Comment 6 ro@CeBiTec.Uni-Bielefeld.DE 2018-04-29 10:43:50 UTC
> --- Comment #4 from Ian Lance Taylor <ian at airs dot com> ---
> Should be fixed on tip, requested permission to backport to GCC 8 branch.

It's fixed on sparc, but the Solaris/x86 with as failures remain
(although shifting to a different reason):

# cmd/go/internal/str
Assembler:
        "/var/tmp//cc.Q_kMa.s", line 1 : Syntax error
        Near line: " .section ".go.buildid",#exclude"

Unlike sparc, there must be no quotes around the section name.

However, that form

	 .section .go.buildid,#exclude

makes gas 2.30 choke on x86:

$ gas-2.30 --32 excl.s -o excl.o
excl.s: Assembler messages:
excl.s:1: Error: character following name is not '#'

while it works just fine on sparc.
Comment 7 Ian Lance Taylor 2018-04-30 02:16:18 UTC
Do you think you could work out a patch that handles the various different cases?
Comment 8 ro@CeBiTec.Uni-Bielefeld.DE 2018-04-30 08:22:37 UTC
> --- Comment #7 from Ian Lance Taylor <ian at airs dot com> ---
> Do you think you could work out a patch that handles the various different
> cases?

Sure, if I can figure out how to determine whether or not gas is in use.
Comment 9 Ian Lance Taylor 2018-04-30 17:36:51 UTC
I suppose if worst comes to worst we can try it both ways.
Comment 10 Rainer Orth 2018-05-01 10:05:16 UTC
Created attachment 44043 [details]
proposed patch

Here's what I came up with: tested on i386-pc-solaris2.11 and sparc-sun-solaris2.11,
both with as and gas.  All exclude-related gotools failures are gone.
Comment 11 ian@gcc.gnu.org 2018-05-01 14:09:20 UTC
Author: ian
Date: Tue May  1 14:08:44 2018
New Revision: 259797

URL: https://gcc.gnu.org/viewcvs?rev=259797&root=gcc&view=rev
Log:
	PR go/85429
    cmd/go: support more Solaris assembler syntaxes
    
    Patch by Rainer Orth.
    
    Reviewed-on: https://go-review.googlesource.com/110563

Modified:
    trunk/gcc/go/gofrontend/MERGE
    trunk/libgo/go/cmd/go/internal/work/buildid.go
Comment 12 ian@gcc.gnu.org 2018-05-31 22:47:32 UTC
Author: ian
Date: Thu May 31 22:46:52 2018
New Revision: 261045

URL: https://gcc.gnu.org/viewcvs?rev=261045&root=gcc&view=rev
Log:
	PR go/85429

Various backports from mainline:

    libgo: update to Go 1.10.2 release

    cmd/go: support more Solaris assembler syntaxes
   
    Patch by Rainer Orth.
   
    cmd/go: update to match recent changes to gc
   
    In https://golang.org/cl/111097 the gc version of cmd/go was updated
    to include some gofrontend-specific changes. The gofrontend code
    already has different versions of those changes; this CL makes the
    gofrontend match the upstream code.
 
    cmd/go, cmd/vet: make vet work with gccgo
   
    Backport https://golang.org/cl/113715 and https://golang.org/cl/113716:
   
    cmd/go: don't pass -compiler flag to vet
   
    Without this running go vet -compiler=gccgo causes vet to fail.
    The vet tool does need to know the compiler, but it is passed in
    vetConfig.Compiler.
   
    cmd/go, cmd/vet, go/internal/gccgoimport: make vet work with gccgo
   
    When using gccgo/GoLLVM, there is no package file for a standard
    library package. Since it is impossible for the go tool to rebuild the
    package, and since the package file exists only in the form of a .gox
    file, this seems like the best choice. Unfortunately it was confusing
    vet, which wanted to see a real file. This caused vet to report errors
    about missing package files for standard library packages. The
    gccgoimporter knows how to correctly handle this case. Fix this by
   
    1) telling vet which packages are standard;
    2) letting vet skip those packages;
    3) letting the gccgoimporter handle this case.
   
    As a separate required fix, gccgo/GoLLVM has no runtime/cgo package,
    so don't try to depend on it (as it happens, this fixes golang/go#25324).
   
    The result is that the cmd/go vet tests pass when using -compiler=gccgo.

    crypto/x509: specify path to AIX certificate file

    go/build, cmd/go: update to match recent changes to gc
   
    Several recent changes to the gc version of cmd/go improve the
    gofrontend support. These changes are partially copies of existing
    gofrontend differences, and partially new code. This CL makes the
    gofrontend match the upstream code.
   
    The changes included here come from:
        https://golang.org/cl/111575
        https://golang.org/cl/111595
        https://golang.org/cl/111635
        https://golang.org/cl/111636
   
    For the record, the following recent gc changes are based on code
    already present in the gofrontend repo:
        https://golang.org/cl/110915
        https://golang.org/cl/111615
   
    For the record, a gc change, partially based on earlier gofrontend
    work, also with new gc code, was already copied to gofrontend repo in
    CL 111099:

    https://golang.org/cl/111097
    
    This moves the generated list of standard library packages from
    cmd/go/internal/load to go/build.

gotools/ChangeLog:

	Backport from mainline:
	2018-05-09  Ian Lance Taylor  <iant@golang.org>
	* Makefile.am (check-go-tool): Don't copy zstdpkglist.go.
	* Makefile.in: Rebuild.

Added:
    branches/gcc-8-branch/libgo/go/cmd/internal/objabi/funcid.go
    branches/gcc-8-branch/libgo/go/go/build/gc.go
    branches/gcc-8-branch/libgo/go/go/build/gccgo.go
    branches/gcc-8-branch/libgo/go/go/internal/srcimporter/testdata/issue23092/
    branches/gcc-8-branch/libgo/go/go/internal/srcimporter/testdata/issue23092/issue23092.go
    branches/gcc-8-branch/libgo/go/go/internal/srcimporter/testdata/issue24392/
    branches/gcc-8-branch/libgo/go/go/internal/srcimporter/testdata/issue24392/issue24392.go
    branches/gcc-8-branch/libgo/go/net/http/pprof/pprof_test.go
    branches/gcc-8-branch/libgo/misc/cgo/testplugin/src/issue24351/
    branches/gcc-8-branch/libgo/misc/cgo/testplugin/src/issue24351/main.go
    branches/gcc-8-branch/libgo/misc/cgo/testplugin/src/issue24351/plugin.go
Modified:
    branches/gcc-8-branch/gotools/ChangeLog
    branches/gcc-8-branch/gotools/Makefile.am
    branches/gcc-8-branch/gotools/Makefile.in
    branches/gcc-8-branch/libgo/MERGE
    branches/gcc-8-branch/libgo/Makefile.am
    branches/gcc-8-branch/libgo/Makefile.in
    branches/gcc-8-branch/libgo/VERSION
    branches/gcc-8-branch/libgo/go/archive/zip/reader.go
    branches/gcc-8-branch/libgo/go/archive/zip/reader_test.go
    branches/gcc-8-branch/libgo/go/cmd/go/alldocs.go
    branches/gcc-8-branch/libgo/go/cmd/go/go_test.go
    branches/gcc-8-branch/libgo/go/cmd/go/internal/cfg/cfg.go
    branches/gcc-8-branch/libgo/go/cmd/go/internal/get/vcs.go
    branches/gcc-8-branch/libgo/go/cmd/go/internal/get/vcs_test.go
    branches/gcc-8-branch/libgo/go/cmd/go/internal/help/helpdoc.go
    branches/gcc-8-branch/libgo/go/cmd/go/internal/load/pkg.go
    branches/gcc-8-branch/libgo/go/cmd/go/internal/test/test.go
    branches/gcc-8-branch/libgo/go/cmd/go/internal/vet/vet.go
    branches/gcc-8-branch/libgo/go/cmd/go/internal/vet/vetflag.go
    branches/gcc-8-branch/libgo/go/cmd/go/internal/work/buildid.go
    branches/gcc-8-branch/libgo/go/cmd/go/internal/work/exec.go
    branches/gcc-8-branch/libgo/go/cmd/go/internal/work/security.go
    branches/gcc-8-branch/libgo/go/cmd/go/internal/work/security_test.go
    branches/gcc-8-branch/libgo/go/cmd/vet/main.go
    branches/gcc-8-branch/libgo/go/crypto/x509/name_constraints_test.go
    branches/gcc-8-branch/libgo/go/crypto/x509/root_aix.go
    branches/gcc-8-branch/libgo/go/crypto/x509/verify.go
    branches/gcc-8-branch/libgo/go/crypto/x509/x509.go
    branches/gcc-8-branch/libgo/go/encoding/json/decode.go
    branches/gcc-8-branch/libgo/go/encoding/json/decode_test.go
    branches/gcc-8-branch/libgo/go/go/build/build.go
    branches/gcc-8-branch/libgo/go/go/internal/gccgoimporter/importer.go
    branches/gcc-8-branch/libgo/go/go/internal/srcimporter/srcimporter.go
    branches/gcc-8-branch/libgo/go/go/internal/srcimporter/srcimporter_test.go
    branches/gcc-8-branch/libgo/go/internal/singleflight/singleflight.go
    branches/gcc-8-branch/libgo/go/net/http/pprof/pprof.go
    branches/gcc-8-branch/libgo/go/net/lookup.go
    branches/gcc-8-branch/libgo/go/net/lookup_test.go
    branches/gcc-8-branch/libgo/go/net/tcpsock_unix_test.go
    branches/gcc-8-branch/libgo/go/runtime/error.go
    branches/gcc-8-branch/libgo/go/runtime/panic.go
    branches/gcc-8-branch/libgo/go/runtime/proc.go
    branches/gcc-8-branch/libgo/go/runtime/symtab.go
    branches/gcc-8-branch/libgo/misc/cgo/testplugin/test.bash
    branches/gcc-8-branch/libgo/misc/cgo/testshared/shared_test.go