]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/link: delete dead flags
authorRuss Cox <rsc@golang.org>
Thu, 21 May 2015 18:42:14 +0000 (14:42 -0400)
committerRuss Cox <rsc@golang.org>
Fri, 5 Jun 2015 04:55:53 +0000 (04:55 +0000)
Also fix the interaction between -buildmode and -shared.
It's okay for -shared to change the default build mode,
but it's not okay for it to silently override an explicit -buildmode=exe.

Change-Id: Id40f93d140cddf75b19e262b3ba4856ee09a07ba
Reviewed-on: https://go-review.googlesource.com/10315
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
src/cmd/link/internal/ld/lib.go
src/cmd/link/internal/ld/pobj.go

index 18c02f8f01271ec98e9c7b59518fe635b4787bcb..bf4ca55020d26e8bf3a965aab0c1a9636dd9f66c 100644 (file)
@@ -276,7 +276,8 @@ func Lflag(arg string) {
 type BuildMode uint8
 
 const (
-       BuildmodeExe BuildMode = iota
+       BuildmodeUnset BuildMode = iota
+       BuildmodeExe
        BuildmodeCArchive
        BuildmodeCShared
        BuildmodeShared
@@ -316,6 +317,8 @@ func (mode *BuildMode) Set(s string) error {
 
 func (mode *BuildMode) String() string {
        switch *mode {
+       case BuildmodeUnset:
+               return "" // avoid showing a default in usage message
        case BuildmodeExe:
                return "exe"
        case BuildmodeCArchive:
index 20f060cb05c10864af55f019f6220b70d2466929..fd541fbb3b5a4d1d359cebe64fbdf71c6c7df270 100644 (file)
@@ -70,40 +70,21 @@ func Ldmain() {
                }
        }
 
-       if Thearch.Thechar == '5' && Ctxt.Goarm == 5 {
-               Debug['F'] = 1
-       }
-
-       obj.Flagcount("1", "use alternate profiling code", &Debug['1'])
-       if Thearch.Thechar == '6' {
-               obj.Flagcount("8", "assume 64-bit addresses", &Debug['8'])
+       if Thearch.Thechar == '6' && obj.Getgoos() == "plan9" {
+               obj.Flagcount("8", "use 64-bit addresses in symbol table", &Debug['8'])
        }
        obj.Flagfn1("B", "add an ELF NT_GNU_BUILD_ID `note` when using ELF", addbuildinfo)
        obj.Flagcount("C", "check Go calls to C code", &Debug['C'])
        obj.Flagint64("D", "set data segment `address`", &INITDAT)
        obj.Flagstr("E", "set `entry` symbol name", &INITENTRY)
-       if Thearch.Thechar == '5' {
-               obj.Flagcount("G", "debug pseudo-ops", &Debug['G'])
-       }
        obj.Flagfn1("I", "use `linker` as ELF dynamic linker", setinterp)
        obj.Flagfn1("L", "add specified `directory` to library path", Lflag)
        obj.Flagfn1("H", "set header `type`", setheadtype)
-       obj.Flagcount("K", "add stack underflow checks", &Debug['K'])
-       if Thearch.Thechar == '5' {
-               obj.Flagcount("M", "disable software div/mod", &Debug['M'])
-       }
-       obj.Flagcount("O", "print pc-line tables", &Debug['O'])
-       obj.Flagcount("Q", "debug byte-register code gen", &Debug['Q'])
-       if Thearch.Thechar == '5' {
-               obj.Flagcount("P", "debug code generation", &Debug['P'])
-       }
        obj.Flagint32("R", "set address rounding `quantum`", &INITRND)
-       obj.Flagcount("nil", "check type signatures", &Debug['S'])
        obj.Flagint64("T", "set text segment `address`", &INITTEXT)
        obj.Flagfn0("V", "print version and exit", doversion)
        obj.Flagcount("W", "disassemble input", &Debug['W'])
        obj.Flagfn1("X", "add string value `definition` of the form importpath.name=value", addstrdata1)
-       obj.Flagcount("Z", "clear stack frame on entry", &Debug['Z'])
        obj.Flagcount("a", "disassemble output", &Debug['a'])
        obj.Flagstr("buildid", "record `id` as Go toolchain build id", &buildid)
        flag.Var(&Buildmode, "buildmode", "set build `mode`")
@@ -169,12 +150,15 @@ func Ldmain() {
        Ctxt.Bso = &Bso
        Ctxt.Debugvlog = int32(Debug['v'])
        if flagShared != 0 {
-               if Buildmode == BuildmodeExe {
+               if Buildmode == BuildmodeUnset {
                        Buildmode = BuildmodeCShared
                } else if Buildmode != BuildmodeCShared {
                        Exitf("-shared and -buildmode=%s are incompatible", Buildmode.String())
                }
        }
+       if Buildmode == BuildmodeUnset {
+               Buildmode = BuildmodeExe
+       }
 
        if Buildmode != BuildmodeShared && flag.NArg() != 1 {
                usage()
@@ -229,7 +213,7 @@ func Ldmain() {
 
        if Thearch.Thechar == '5' {
                // mark some functions that are only referenced after linker code editing
-               if Debug['F'] != 0 {
+               if Ctxt.Goarm == 5 {
                        mark(Linkrlookup(Ctxt, "_sfloat", 0))
                }
                mark(Linklookup(Ctxt, "runtime.read_tls_fallback", 0))