mirror of https://github.com/golang/go.git
cmd/link: use __got as the .got section name
The __nl_symbol_ptr is not a common section name anymore. LLVM prefers __got for GOT symbols in the __DATA_CONST segment. Note that the Go linker used to place the GOT section in the __DATA segment, but since CL 644055 we place it in the __DATA_CONST segment. Updates #71416. Cq-Include-Trybots: luci.golang.try:gotip-darwin-amd64-longtest Change-Id: Icb776e19855eaabb4777a9b1eb433497842413b4 Reviewed-on: https://go-review.googlesource.com/c/go/+/652555 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Cherry Mui <cherryyz@google.com> Reviewed-by: Michael Pratt <mpratt@google.com>
This commit is contained in:
parent
74ba2164a0
commit
2298215f5b
|
|
@ -461,7 +461,7 @@ func (ctxt *Link) domacho() {
|
|||
sb.SetType(sym.SMACHOPLT)
|
||||
sb.SetReachable(true)
|
||||
|
||||
s = ctxt.loader.LookupOrCreateSym(".got", 0) // will be __nl_symbol_ptr
|
||||
s = ctxt.loader.LookupOrCreateSym(".got", 0) // will be __got
|
||||
sb = ctxt.loader.MakeSymbolUpdater(s)
|
||||
if ctxt.UseRelro() {
|
||||
sb.SetType(sym.SMACHORELROSECT)
|
||||
|
|
@ -587,7 +587,7 @@ func machoshbits(ctxt *Link, mseg *MachoSeg, sect *sym.Section, segname string)
|
|||
}
|
||||
|
||||
if sect.Name == ".got" {
|
||||
msect.name = "__nl_symbol_ptr"
|
||||
msect.name = "__got"
|
||||
msect.flag = S_NON_LAZY_SYMBOL_POINTERS
|
||||
msect.res1 = uint32(ctxt.loader.SymSize(ctxt.ArchSyms.LinkEditPLT) / 4) /* offset into indirect symbol table */
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ func TestMachoSectionsReadOnly(t *testing.T) {
|
|||
args: []string{"-ldflags", "-linkmode=internal"},
|
||||
prog: prog,
|
||||
mustInternalLink: true,
|
||||
wantSecsRO: []string{"__nl_symbol_ptr", "__rodata", "__itablink", "__typelink", "__gosymtab", "__gopclntab"},
|
||||
wantSecsRO: []string{"__got", "__rodata", "__itablink", "__typelink", "__gosymtab", "__gopclntab"},
|
||||
},
|
||||
{
|
||||
name: "linkmode-external",
|
||||
|
|
|
|||
Loading…
Reference in New Issue