To refer to types and names by offsets, we want to keep the symbols in
the same sections. Do this by making all types .relro for now.
Once name offsets are further along, name data can move out of relro.
Change-Id: I1cbd2e914bd180cdf25c4aeb13d9c1c734febe69
Reviewed-on: https://go-review.googlesource.com/21394
Reviewed-by: Michael Hudson-Doyle <michael.hudson@canonical.com>
Run-TryBot: David Crawshaw <crawshaw@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
// when building a shared library. We do this by boosting objects of
// type SXXX with relocations to type SXXXRELRO.
for s := datap; s != nil; s = s.Next {
- if (s.Type >= obj.STYPE && s.Type <= obj.SFUNCTAB && len(s.R) > 0) || s.Type == obj.SGOSTRINGHDR {
+ if (s.Type >= obj.STYPE && s.Type <= obj.SFUNCTAB && len(s.R) > 0) || s.Type == obj.STYPE || s.Type == obj.SGOSTRINGHDR {
s.Type += (obj.STYPERELRO - obj.STYPE)
if s.Outer != nil {
s.Outer.Type = s.Type
case BuildmodeCShared, BuildmodeShared, BuildmodePIE:
return Iself
default:
- return false
+ return Linkshared
}
}
continue
}
- if strings.HasPrefix(s.Name, "type.") && !DynlinkingGo() {
- s.Attr |= AttrHidden
+ if strings.HasPrefix(s.Name, "type.") {
+ if !DynlinkingGo() {
+ s.Attr |= AttrHidden
+ }
if UseRelro() && len(s.R) > 0 {
s.Type = obj.STYPERELRO
s.Outer = symtyperel