Revert "cmd/internal/ld: put read-only relocated data into .data.rel.ro when making a shared object"

This reverts commit 2c2cbb69c8.

Broke darwin/arm64

Change-Id: Ibd2dea475d6ce6a8b4b40e2da19a83fc0514025d
Reviewed-on: https://go-review.googlesource.com/14301
Reviewed-by: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
Dave Cheney 2015-09-04 09:53:35 +00:00 committed by Michael Hudson-Doyle
parent ced0646fe5
commit e49b2460a4
13 changed files with 18 additions and 206 deletions

View file

@ -174,12 +174,6 @@ func DynlinkingGo() bool {
return Buildmode == BuildmodeShared || Linkshared
}
// UseRelro returns whether to make use of "read only relocations" aka
// relro.
func UseRelro() bool {
return (Buildmode == BuildmodeCShared || Buildmode == BuildmodeShared) && Iself
}
var (
Thestring string
Thelinkarch *LinkArch
@ -986,9 +980,6 @@ func hostlink() {
argv = append(argv, "-dynamiclib")
} else {
argv = append(argv, "-Wl,-Bsymbolic")
if UseRelro() {
argv = append(argv, "-Wl,-z,relro")
}
argv = append(argv, "-shared")
}
case BuildmodeShared:
@ -1000,10 +991,7 @@ func hostlink() {
// think we may well end up wanting to use -Bsymbolic here
// anyway.
argv = append(argv, "-Wl,-Bsymbolic-functions")
if UseRelro() {
argv = append(argv, "-shared")
}
argv = append(argv, "-Wl,-z,relro")
argv = append(argv, "-shared")
}
if Linkshared && Iself {
@ -1783,12 +1771,6 @@ func genasmsym(put func(*LSym, string, int, int64, int64, int, *LSym)) {
obj.SGOSTRING,
obj.SGOFUNC,
obj.SGCBITS,
obj.STYPERELRO,
obj.SSTRINGRELRO,
obj.SGOSTRINGRELRO,
obj.SGOFUNCRELRO,
obj.SGCBITSRELRO,
obj.SRODATARELRO,
obj.SWINDOWS:
if !s.Reachable {
continue