mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/link: avoid exporting all symbols on windows buildmode=pie
Marking one functions with __declspec(dllexport) forces mingw to create .reloc section without having to export all symbols. See https://insights.sei.cmu.edu/cert/2018/08/when-aslr-is-not-really-aslr---the-case-of-incorrect-assumptions-and-bad-defaults.html for more info. This change cuts 73kb of a "hello world" pie binary. Updates #6853 Fixes #40795 Change-Id: I3cc57c3b64f61187550bc8751dfa085f106c8475 Reviewed-on: https://go-review.googlesource.com/c/go/+/264459 Trust: Alex Brainman <alex.brainman@gmail.com> Run-TryBot: Alex Brainman <alex.brainman@gmail.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Alex Brainman <alex.brainman@gmail.com> Reviewed-by: Austin Clements <austin@google.com>
This commit is contained in:
parent
333d2010ec
commit
e463c28cc1
6 changed files with 52 additions and 7 deletions
|
|
@ -1320,9 +1320,6 @@ func (ctxt *Link) hostlink() {
|
|||
case objabi.Hdarwin, objabi.Haix:
|
||||
case objabi.Hwindows:
|
||||
argv = addASLRargs(argv)
|
||||
// Work around binutils limitation that strips relocation table for dynamicbase.
|
||||
// See https://sourceware.org/bugzilla/show_bug.cgi?id=19011
|
||||
argv = append(argv, "-Wl,--export-all-symbols")
|
||||
default:
|
||||
// ELF.
|
||||
if ctxt.UseRelro() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue