]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/link: do not pass -Bsymbolic for PE DLLs
authorJason A. Donenfeld <Jason@zx2c4.com>
Sun, 14 Feb 2021 13:44:14 +0000 (14:44 +0100)
committerJason A. Donenfeld <Jason@zx2c4.com>
Tue, 23 Feb 2021 15:03:39 +0000 (15:03 +0000)
This is only a valid option on ELF. Binutils accepts it, but LLVM
rejects it, so for Windows, it's best to just omit it.

Updates #44250.
Updates #39326.
Updates #38755.
Updates #36439.
Updates #43800.

Change-Id: Iffd2345d757f23dd737e63bd464cd412527077c4
Reviewed-on: https://go-review.googlesource.com/c/go/+/291632
Trust: Jason A. Donenfeld <Jason@zx2c4.com>
Run-TryBot: Jason A. Donenfeld <Jason@zx2c4.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
src/cmd/link/internal/ld/lib.go

index 314896824a03fcb8d3dcb58146759d10adbeb615..28713456c40d2919d7e4a5e7a6c215c5d999fcdf 100644 (file)
@@ -1343,8 +1343,6 @@ func (ctxt *Link) hostlink() {
                if ctxt.HeadType == objabi.Hdarwin {
                        argv = append(argv, "-dynamiclib")
                } else {
-                       // ELF.
-                       argv = append(argv, "-Wl,-Bsymbolic")
                        if ctxt.UseRelro() {
                                argv = append(argv, "-Wl,-z,relro")
                        }
@@ -1357,6 +1355,8 @@ func (ctxt *Link) hostlink() {
                                // Pass -z nodelete to mark the shared library as
                                // non-closeable: a dlclose will do nothing.
                                argv = append(argv, "-Wl,-z,nodelete")
+                               // Only pass Bsymbolic on non-Windows.
+                               argv = append(argv, "-Wl,-Bsymbolic")
                        }
                }
        case BuildModeShared: