Commit 93b753f5 authored by Ian Lance Taylor's avatar Ian Lance Taylor Committed by Brad Fitzpatrick

cmd/link: fix handling of cgo_dynamic_interpreter

CL 27473 accidentally changed `!Debug['I']` to `*flagInterpreter != ""`.
Since the old `Debug['I']` was set when the new *flagInterpreter was
set, this inverted the sense of the condition. The effect was to always
ignore the cgo_dynamic_interpreter setting from runtime/cgo. This worked
OK when the default interpreter was the correct one, but failed when it
was not, as is currently the case on, at least, PPC64 and ARM.

This CL restores the old behavior by using a separate variable to track
whether the -I flag was used, just as we used to.

Change-Id: Icf9b65fa41349ed2e4de477fec0a557ef1eb8189
Reviewed-on: https://go-review.googlesource.com/27562
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
parent 550caa1c
......@@ -267,8 +267,8 @@ func loadcgo(ctxt *Link, file string, pkg string, p string) {
goto err
}
if *flagInterpreter != "" {
if *flagInterpreter != f[1] {
if !flagInterpreterSet {
if *flagInterpreter != "" && *flagInterpreter != f[1] {
fmt.Fprintf(os.Stderr, "%s: conflict dynlinker: %s and %s\n", os.Args[0], *flagInterpreter, f[1])
nerrors++
return
......
......@@ -73,18 +73,20 @@ var (
flagExtldflags = flag.String("extldflags", "", "pass `flags` to external linker")
flagExtar = flag.String("extar", "", "archive program for buildmode=c-archive")
flagA = flag.Bool("a", false, "disassemble output")
FlagC = flag.Bool("c", false, "dump call graph")
FlagD = flag.Bool("d", false, "disable dynamic executable")
flagF = flag.Bool("f", false, "ignore version mismatch")
flagG = flag.Bool("g", false, "disable go package data checks")
flagH = flag.Bool("h", false, "halt on error")
flagN = flag.Bool("n", false, "dump symbol table")
FlagS = flag.Bool("s", false, "disable symbol table")
flagU = flag.Bool("u", false, "reject unsafe packages")
FlagW = flag.Bool("w", false, "disable DWARF generation")
Flag8 bool // use 64-bit addresses in symbol table
flagInterpreter = flag.String("I", "", "use `linker` as ELF dynamic linker")
flagA = flag.Bool("a", false, "disassemble output")
FlagC = flag.Bool("c", false, "dump call graph")
FlagD = flag.Bool("d", false, "disable dynamic executable")
flagF = flag.Bool("f", false, "ignore version mismatch")
flagG = flag.Bool("g", false, "disable go package data checks")
flagH = flag.Bool("h", false, "halt on error")
flagN = flag.Bool("n", false, "dump symbol table")
FlagS = flag.Bool("s", false, "disable symbol table")
flagU = flag.Bool("u", false, "reject unsafe packages")
FlagW = flag.Bool("w", false, "disable DWARF generation")
Flag8 bool // use 64-bit addresses in symbol table
flagInterpreter = flag.String("I", "", "use `linker` as ELF dynamic linker")
flagInterpreterSet bool
FlagRound = flag.Int("R", -1, "set address rounding `quantum`")
FlagTextAddr = flag.Int64("T", -1, "set text segment `address`")
......@@ -131,6 +133,7 @@ func Main() {
}
obj.Flagparse(usage)
flagInterpreterSet = *flagInterpreter != ""
startProfile()
ctxt.Bso = ctxt.Bso
......
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