Revert: "cmd/link: add option to enable full RELRO for ELF"

This reverts https://go.dev/cl/c/go/+/473495.

Reason for revert: breaks some Google-internal tests.

This revert will be temporary until we can gather more info on the
nature of the failures and hopefully develop an upstream test case,
etc.

Updates #45681.

Change-Id: Ib628ddc53bc5489e4f76c0f4ad809b75e899102c
Reviewed-on: https://go-review.googlesource.com/c/go/+/571415
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
This commit is contained in:
Than McIntosh 2024-03-13 17:46:29 +00:00
parent 1e20af021f
commit be58fd0070
8 changed files with 11 additions and 198 deletions

View file

@ -1604,16 +1604,12 @@ func (ctxt *Link) hostlink() {
}
var altLinker string
if ctxt.IsELF && (ctxt.DynlinkingGo() || *flagBindNow) {
// For ELF targets, when producing dynamically linked Go code
// or when immediate binding is explicitly requested,
// we force all symbol resolution to be done at program startup
if ctxt.IsELF && ctxt.DynlinkingGo() {
// We force all symbol resolution to be done at program startup
// because lazy PLT resolution can use large amounts of stack at
// times we cannot allow it to do so.
argv = append(argv, "-Wl,-z,now")
}
if ctxt.IsELF && ctxt.DynlinkingGo() {
// Do not let the host linker generate COPY relocations. These
// can move symbols out of sections that rely on stable offsets
// from the beginning of the section (like sym.STYPE).