cmd/link/internal/ld: unexport ReadOnly and RelROMap

Change-Id: I08e33b92dd8a22e28ec15aa5753904aa8e1c71f5
Reviewed-on: https://go-review.googlesource.com/42031
Run-TryBot: Michael Hudson-Doyle <michael.hudson@canonical.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
Michael Hudson-Doyle 2017-04-28 08:11:21 +12:00
parent 4aca8b00ff
commit e29ea14100
2 changed files with 13 additions and 13 deletions

View file

@ -1361,8 +1361,8 @@ func (ctxt *Link) dodata() {
// "read only" data with relocations needs to go in its own section // "read only" data with relocations needs to go in its own section
// when building a shared library. We do this by boosting objects of // when building a shared library. We do this by boosting objects of
// type SXXX with relocations to type SXXXRELRO. // type SXXX with relocations to type SXXXRELRO.
for _, symnro := range ReadOnly { for _, symnro := range readOnly {
symnrelro := RelROMap[symnro] symnrelro := relROMap[symnro]
ro := []*Symbol{} ro := []*Symbol{}
relro := data[symnrelro] relro := data[symnrelro]
@ -1640,14 +1640,14 @@ func (ctxt *Link) dodata() {
ctxt.Syms.Lookup("runtime.types", 0).Sect = sect ctxt.Syms.Lookup("runtime.types", 0).Sect = sect
ctxt.Syms.Lookup("runtime.etypes", 0).Sect = sect ctxt.Syms.Lookup("runtime.etypes", 0).Sect = sect
} }
for _, symn := range ReadOnly { for _, symn := range readOnly {
align := dataMaxAlign[symn] align := dataMaxAlign[symn]
if sect.Align < align { if sect.Align < align {
sect.Align = align sect.Align = align
} }
} }
datsize = Rnd(datsize, int64(sect.Align)) datsize = Rnd(datsize, int64(sect.Align))
for _, symn := range ReadOnly { for _, symn := range readOnly {
for _, s := range data[symn] { for _, s := range data[symn] {
datsize = aligndatsize(datsize, s) datsize = aligndatsize(datsize, s)
s.Sect = sect s.Sect = sect
@ -1720,16 +1720,16 @@ func (ctxt *Link) dodata() {
sect.Vaddr = 0 sect.Vaddr = 0
ctxt.Syms.Lookup("runtime.types", 0).Sect = sect ctxt.Syms.Lookup("runtime.types", 0).Sect = sect
ctxt.Syms.Lookup("runtime.etypes", 0).Sect = sect ctxt.Syms.Lookup("runtime.etypes", 0).Sect = sect
for _, symnro := range ReadOnly { for _, symnro := range readOnly {
symn := RelROMap[symnro] symn := relROMap[symnro]
align := dataMaxAlign[symn] align := dataMaxAlign[symn]
if sect.Align < align { if sect.Align < align {
sect.Align = align sect.Align = align
} }
} }
datsize = Rnd(datsize, int64(sect.Align)) datsize = Rnd(datsize, int64(sect.Align))
for _, symnro := range ReadOnly { for _, symnro := range readOnly {
symn := RelROMap[symnro] symn := relROMap[symnro]
for _, s := range data[symn] { for _, s := range data[symn] {
datsize = aligndatsize(datsize, s) datsize = aligndatsize(datsize, s)
if s.Outer != nil && s.Outer.Sect != nil && s.Outer.Sect != sect { if s.Outer != nil && s.Outer.Sect != nil && s.Outer.Sect != sect {

View file

@ -124,10 +124,10 @@ var abiSymKindToSymKind = [...]SymKind{
SDWARFINFO, SDWARFINFO,
} }
// ReadOnly are the symbol kinds that form read-only sections. In some // readOnly are the symbol kinds that form read-only sections. In some
// cases, if they will require relocations, they are transformed into // cases, if they will require relocations, they are transformed into
// rel-ro sections using RelROMap. // rel-ro sections using relROMap.
var ReadOnly = []SymKind{ var readOnly = []SymKind{
STYPE, STYPE,
SSTRING, SSTRING,
SGOSTRING, SGOSTRING,
@ -137,9 +137,9 @@ var ReadOnly = []SymKind{
SFUNCTAB, SFUNCTAB,
} }
// RelROMap describes the transformation of read-only symbols to rel-ro // relROMap describes the transformation of read-only symbols to rel-ro
// symbols. // symbols.
var RelROMap = map[SymKind]SymKind{ var relROMap = map[SymKind]SymKind{
STYPE: STYPERELRO, STYPE: STYPERELRO,
SSTRING: SSTRINGRELRO, SSTRING: SSTRINGRELRO,
SGOSTRING: SGOSTRINGRELRO, SGOSTRING: SGOSTRINGRELRO,