1
0
mirror of https://github.com/golang/go synced 2024-11-26 21:41:33 -07:00

[dev.regabi] cmd/compile,cmd/link: additional code review suggestions for CL 270863

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>
This commit is contained in:
Than McIntosh 2020-12-22 16:48:13 -05:00
parent 9734fd482d
commit 35b9c66601
3 changed files with 4 additions and 6 deletions

View 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 // extra work in typecheck/walk/ssa, might want to add a new node
// OTAILCALL or something to this effect. // OTAILCALL or something to this effect.
var tail ir.Node 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()) tail = ir.NewBranchStmt(base.Pos, ir.ORETJMP, f.Nname.Sym())
} else { } else {
call := ir.NewCallExpr(base.Pos, ir.OCALL, f.Nname, nil) call := ir.NewCallExpr(base.Pos, ir.OCALL, f.Nname, nil)

View File

@ -95,7 +95,7 @@ var (
cpuprofile = flag.String("cpuprofile", "", "write cpu profile to `file`") cpuprofile = flag.String("cpuprofile", "", "write cpu profile to `file`")
memprofile = flag.String("memprofile", "", "write memory profile to `file`") memprofile = flag.String("memprofile", "", "write memory profile to `file`")
memprofilerate = flag.Int64("memprofilerate", 0, "set runtime.MemProfileRate to `rate`") 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") 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") 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.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.Flagcount("v", "print link trace", &ctxt.Debugvlog)
objabi.Flagfn1("importcfg", "read import configuration from `file`", ctxt.readImportCfg) 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) objabi.Flagparse(usage)

View 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 // sym or marker relocation to associate the wrapper with the
// wrapped function. // wrapped function.
// //
if flagAbiWrap { if *flagAbiWrap {
if !ldr.IsExternal(x) && ldr.SymType(x) == sym.STEXT { if !ldr.IsExternal(x) && ldr.SymType(x) == sym.STEXT {
// First case // First case
if ldr.SymVersion(x) == sym.SymVerABIInternal { if ldr.SymVersion(x) == sym.SymVerABIInternal {