]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/link: fix handling of cgo_dynamic_interpreter
authorIan Lance Taylor <iant@golang.org>
Tue, 23 Aug 2016 04:49:32 +0000 (21:49 -0700)
committerBrad Fitzpatrick <bradfitz@golang.org>
Tue, 23 Aug 2016 05:08:46 +0000 (05:08 +0000)
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: Brad Fitzpatrick <bradfitz@golang.org>
src/cmd/link/internal/ld/go.go
src/cmd/link/internal/ld/main.go

index 4f7db2696c5db0b787c503db9d180f4407c4cf0c..b89843779b569b8aa91c8574c9d9fe18aa68d1fe 100644 (file)
@@ -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
index 6a70b3eec964291a60b7a81e95c231b49e400fad..280648a06f9b998ca20314f9ff1d631476a845b7 100644 (file)
@@ -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