From 965fa3b191270bbc23a040a520ce43406ba29343 Mon Sep 17 00:00:00 2001 From: Matthew Dempsky Date: Tue, 16 Oct 2018 12:49:17 -0700 Subject: [PATCH] cmd/compile: remove -dolinkobj flag This used to be used by cmd/vet and some assembly generation tests, but those were removed in CL 37691 and CL 107336. No point in keeping an unneeded flag around. Fixes #28220. Change-Id: I59f8546954ab36ea61ceba81c10d6e16d74b966a Reviewed-on: https://go-review.googlesource.com/c/142677 Run-TryBot: Matthew Dempsky Reviewed-by: Brad Fitzpatrick TryBot-Result: Gobot Gobot --- src/cmd/compile/internal/gc/go.go | 1 - src/cmd/compile/internal/gc/main.go | 113 ++++++++++++++-------------- src/cmd/compile/internal/gc/obj.go | 4 - 3 files changed, 55 insertions(+), 63 deletions(-) diff --git a/src/cmd/compile/internal/gc/go.go b/src/cmd/compile/internal/gc/go.go index 605afd6407..57533237bc 100644 --- a/src/cmd/compile/internal/gc/go.go +++ b/src/cmd/compile/internal/gc/go.go @@ -92,7 +92,6 @@ var pragcgobuf [][]string var outfile string var linkobj string -var dolinkobj bool // nerrors is the number of compiler errors reported // since the last call to saveerrors. diff --git a/src/cmd/compile/internal/gc/main.go b/src/cmd/compile/internal/gc/main.go index 9a226318b9..5b159e3661 100644 --- a/src/cmd/compile/internal/gc/main.go +++ b/src/cmd/compile/internal/gc/main.go @@ -218,7 +218,6 @@ func Main(archInit func(*Arch)) { if sys.MSanSupported(objabi.GOOS, objabi.GOARCH) { flag.BoolVar(&flag_msan, "msan", false, "build code compatible with C/C++ memory sanitizer") } - flag.BoolVar(&dolinkobj, "dolinkobj", true, "generate linker-specific objects; if false, some invalid code may compile") flag.BoolVar(&nolocalimports, "nolocalimports", false, "reject local (relative) imports") flag.StringVar(&outfile, "o", "", "write output to `file`") flag.StringVar(&myimportpath, "p", "", "set expected package import `path`") @@ -606,71 +605,69 @@ func Main(archInit func(*Arch)) { timings.Start("fe", "escapes") escapes(xtop) - if dolinkobj { - // Collect information for go:nowritebarrierrec - // checking. This must happen before transformclosure. - // We'll do the final check after write barriers are - // inserted. - if compiling_runtime { - nowritebarrierrecCheck = newNowritebarrierrecChecker() - } + // Collect information for go:nowritebarrierrec + // checking. This must happen before transformclosure. + // We'll do the final check after write barriers are + // inserted. + if compiling_runtime { + nowritebarrierrecCheck = newNowritebarrierrecChecker() + } - // Phase 7: Transform closure bodies to properly reference captured variables. - // This needs to happen before walk, because closures must be transformed - // before walk reaches a call of a closure. - timings.Start("fe", "xclosures") - for _, n := range xtop { - if n.Op == ODCLFUNC && n.Func.Closure != nil { - Curfn = n - transformclosure(n) - } + // Phase 7: Transform closure bodies to properly reference captured variables. + // This needs to happen before walk, because closures must be transformed + // before walk reaches a call of a closure. + timings.Start("fe", "xclosures") + for _, n := range xtop { + if n.Op == ODCLFUNC && n.Func.Closure != nil { + Curfn = n + transformclosure(n) } + } - // Prepare for SSA compilation. - // This must be before peekitabs, because peekitabs - // can trigger function compilation. - initssaconfig() - - // Just before compilation, compile itabs found on - // the right side of OCONVIFACE so that methods - // can be de-virtualized during compilation. - Curfn = nil - peekitabs() - - // Phase 8: Compile top level functions. - // Don't use range--walk can add functions to xtop. - timings.Start("be", "compilefuncs") - fcount = 0 - for i := 0; i < len(xtop); i++ { - n := xtop[i] - if n.Op == ODCLFUNC { - funccompile(n) - fcount++ - } - } - timings.AddEvent(fcount, "funcs") + // Prepare for SSA compilation. + // This must be before peekitabs, because peekitabs + // can trigger function compilation. + initssaconfig() + + // Just before compilation, compile itabs found on + // the right side of OCONVIFACE so that methods + // can be de-virtualized during compilation. + Curfn = nil + peekitabs() - if nsavederrors+nerrors == 0 { - fninit(xtop) + // Phase 8: Compile top level functions. + // Don't use range--walk can add functions to xtop. + timings.Start("be", "compilefuncs") + fcount = 0 + for i := 0; i < len(xtop); i++ { + n := xtop[i] + if n.Op == ODCLFUNC { + funccompile(n) + fcount++ } + } + timings.AddEvent(fcount, "funcs") - compileFunctions() + if nsavederrors+nerrors == 0 { + fninit(xtop) + } - if nowritebarrierrecCheck != nil { - // Write barriers are now known. Check the - // call graph. - nowritebarrierrecCheck.check() - nowritebarrierrecCheck = nil - } + compileFunctions() - // Finalize DWARF inline routine DIEs, then explicitly turn off - // DWARF inlining gen so as to avoid problems with generated - // method wrappers. - if Ctxt.DwFixups != nil { - Ctxt.DwFixups.Finalize(myimportpath, Debug_gendwarfinl != 0) - Ctxt.DwFixups = nil - genDwarfInline = 0 - } + if nowritebarrierrecCheck != nil { + // Write barriers are now known. Check the + // call graph. + nowritebarrierrecCheck.check() + nowritebarrierrecCheck = nil + } + + // Finalize DWARF inline routine DIEs, then explicitly turn off + // DWARF inlining gen so as to avoid problems with generated + // method wrappers. + if Ctxt.DwFixups != nil { + Ctxt.DwFixups.Finalize(myimportpath, Debug_gendwarfinl != 0) + Ctxt.DwFixups = nil + genDwarfInline = 0 } // Phase 9: Check external declarations. diff --git a/src/cmd/compile/internal/gc/obj.go b/src/cmd/compile/internal/gc/obj.go index 19862c03aa..aed0f060cf 100644 --- a/src/cmd/compile/internal/gc/obj.go +++ b/src/cmd/compile/internal/gc/obj.go @@ -43,10 +43,6 @@ const ( ) func dumpobj() { - if !dolinkobj { - dumpobj1(outfile, modeCompilerObj) - return - } if linkobj == "" { dumpobj1(outfile, modeCompilerObj|modeLinkerObj) return -- 2.48.1