]> Cypherpunks repositories - gostls13.git/commitdiff
[dev.regabi] cmd/compile,cmd/link: additional code review suggestions for CL 270863
authorThan McIntosh <thanm@google.com>
Tue, 22 Dec 2020 21:48:13 +0000 (16:48 -0500)
committerThan McIntosh <thanm@google.com>
Thu, 14 Jan 2021 17:35:39 +0000 (17:35 +0000)
This patch pulls in a few additional changes requested by code
reviewers for CL 270863 that were accidentally left out. Specifically,
guarding use of ORETJMP to insure it is not used when building dynlink
on ppc64le, and a tweaking the command line flags used to control
wrapper generation.

Change-Id: I4f96462e570180887eb8693e11badd83d142710a
Reviewed-on: https://go-review.googlesource.com/c/go/+/279527
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Trust: Than McIntosh <thanm@google.com>

src/cmd/compile/internal/ssagen/abi.go
src/cmd/link/internal/ld/main.go
src/cmd/link/internal/ld/symtab.go

index f1226f6a47f3273c57cfb7ffaae7ea64d5e5104b..7ff8e21a48cfb125aea33cbd4ad874e77e41c2bf 100644 (file)
@@ -301,7 +301,8 @@ func makeABIWrapper(f *ir.Func, wrapperABI obj.ABI) {
        // extra work in typecheck/walk/ssa, might want to add a new node
        // OTAILCALL or something to this effect.
        var tail ir.Node
-       if tfn.Type().NumResults() == 0 && tfn.Type().NumParams() == 0 && tfn.Type().NumRecvs() == 0 {
+       if tfn.Type().NumResults() == 0 && tfn.Type().NumParams() == 0 && tfn.Type().NumRecvs() == 0 && !(base.Ctxt.Arch.Name == "ppc64le" && base.Ctxt.Flag_dynlink) {
+
                tail = ir.NewBranchStmt(base.Pos, ir.ORETJMP, f.Nname.Sym())
        } else {
                call := ir.NewCallExpr(base.Pos, ir.OCALL, f.Nname, nil)
index 1420030eec41e4ed3360749d360dcdd6f32d3c41..133308e5f4dae105ac6c1c08d93d0af354718684 100644 (file)
@@ -95,7 +95,7 @@ var (
        cpuprofile        = flag.String("cpuprofile", "", "write cpu profile to `file`")
        memprofile        = flag.String("memprofile", "", "write memory profile to `file`")
        memprofilerate    = flag.Int64("memprofilerate", 0, "set runtime.MemProfileRate to `rate`")
-       flagAbiWrap       = false
+       flagAbiWrap       = flag.Bool("abiwrap", objabi.Regabi_enabled != 0, "support ABI wrapper functions")
        benchmarkFlag     = flag.String("benchmark", "", "set to 'mem' or 'cpu' to enable phase benchmarking")
        benchmarkFileFlag = flag.String("benchmarkprofile", "", "emit phase profiles to `base`_phase.{cpu,mem}prof")
 )
@@ -134,9 +134,6 @@ func Main(arch *sys.Arch, theArch Arch) {
        objabi.Flagfn1("X", "add string value `definition` of the form importpath.name=value", func(s string) { addstrdata1(ctxt, s) })
        objabi.Flagcount("v", "print link trace", &ctxt.Debugvlog)
        objabi.Flagfn1("importcfg", "read import configuration from `file`", ctxt.readImportCfg)
-       if objabi.Regabi_enabled != 0 {
-               flag.BoolVar(&flagAbiWrap, "abiwrap", true, "support ABI wrapper functions")
-       }
 
        objabi.Flagparse(usage)
 
index 3b709baf758bdcd4c957bbfa526973f8c91b6e8e..85a8ff42ad0d00479b651436034fbd24d5cf2858 100644 (file)
@@ -120,7 +120,7 @@ func putelfsym(ctxt *Link, x loader.Sym, typ elf.SymType, curbind elf.SymBind) {
        // sym or marker relocation to associate the wrapper with the
        // wrapped function.
        //
-       if flagAbiWrap {
+       if *flagAbiWrap {
                if !ldr.IsExternal(x) && ldr.SymType(x) == sym.STEXT {
                        // First case
                        if ldr.SymVersion(x) == sym.SymVerABIInternal {