mirror of
https://github.com/golang/go
synced 2024-11-23 09:30:03 -07:00
cmd/link: correct type..importpath symbol handling
The linker specially handles go.importpath symbols. But the compiler doesn't actually generate such symbols. Instead, it generates type..importpath symbols. It is already in the type section as the name starts with "type.". Also set its alignment to 1, as it is string data. Change-Id: I771f5529a0ff41a5bb476b3a02c8cc75729792de Reviewed-on: https://go-review.googlesource.com/c/go/+/353489 Trust: Cherry Mui <cherryyz@google.com> Run-TryBot: Cherry Mui <cherryyz@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Than McIntosh <thanm@google.com>
This commit is contained in:
parent
8d494b0818
commit
e5ad363fff
@ -540,11 +540,6 @@ func (ctxt *Link) symtab(pcln *pclntab) []sym.SymKind {
|
||||
align := int32(1)
|
||||
name := ldr.SymName(s)
|
||||
switch {
|
||||
case strings.HasPrefix(name, "go.importpath.") && ctxt.UseRelro():
|
||||
// Keep go.importpath symbols in the same section as types and
|
||||
// names, as they can be referred to by a section offset.
|
||||
symGroupType[s] = sym.STYPERELRO
|
||||
|
||||
case strings.HasPrefix(name, "go.string."):
|
||||
symGroupType[s] = sym.SGOSTRING
|
||||
ldr.SetAttrNotInSymbolTable(s, true)
|
||||
@ -611,7 +606,7 @@ func (ctxt *Link) symtab(pcln *pclntab) []sym.SymKind {
|
||||
ldr.SetCarrierSym(s, symtype)
|
||||
}
|
||||
}
|
||||
if strings.HasPrefix(name, "type..namedata.") && ldr.SymAlign(s) == 0 {
|
||||
if (strings.HasPrefix(name, "type..namedata.") || strings.HasPrefix(name, "type..importpath.")) && ldr.SymAlign(s) == 0 {
|
||||
ldr.SetSymAlign(s, 1) // String data is just bytes, no padding.
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user