Skip to content

Commit 7252e1e

Browse files
committed
cmd/link: convert -I foo to -Wl,--dynamic-linker,foo when externally linking
Fixes #22446 Change-Id: Id5b3fbc9cd3a7d6c4bf4e28428b8cb6d45a9ca92 Reviewed-on: https://go-review.googlesource.com/c/go/+/310349 Run-TryBot: Michael Hudson-Doyle <[email protected]> TryBot-Result: Go Bot <[email protected]> Trust: Michael Knyszek <[email protected]> Reviewed-by: Ian Lance Taylor <[email protected]>
1 parent 8865548 commit 7252e1e

File tree

1 file changed

+8
-0
lines changed
  • src/cmd/link/internal/ld

1 file changed

+8
-0
lines changed

src/cmd/link/internal/ld/lib.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1431,6 +1431,14 @@ func (ctxt *Link) hostlink() {
14311431
argv = append(argv, fmt.Sprintf("-Wl,-rpath,%s", rpath.val))
14321432
}
14331433

1434+
if *flagInterpreter != "" {
1435+
// Many linkers support both -I and the --dynamic-linker flags
1436+
// to set the ELF interpreter, but lld only supports
1437+
// --dynamic-linker so prefer that (ld on very old Solaris only
1438+
// supports -I but that seems less important).
1439+
argv = append(argv, fmt.Sprintf("-Wl,--dynamic-linker,%s", *flagInterpreter))
1440+
}
1441+
14341442
// Force global symbols to be exported for dlopen, etc.
14351443
if ctxt.IsELF {
14361444
argv = append(argv, "-rdynamic")

0 commit comments

Comments
 (0)