Commit aefa6cd1 authored by Russ Cox's avatar Russ Cox

cmd/link: delete dead flags

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/10315Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
Reviewed-by: 's avatarJosh Bleecher Snyder <josharian@gmail.com>
parent 12795c02
......@@ -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:
......
......@@ -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))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment