mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
runtime,cmd/ld: on darwin, create theads using libc
Replace thread creation with calls to the pthread library in libc. Update #17490 Change-Id: I1e19965c45255deb849b059231252fc6a7861d6c Reviewed-on: https://go-review.googlesource.com/108679 Run-TryBot: Keith Randall <khr@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
parent
743fd9171f
commit
b7f1777a70
26 changed files with 1008 additions and 210 deletions
|
|
@ -159,8 +159,8 @@ func relocsym(ctxt *Link, s *sym.Symbol) {
|
|||
}
|
||||
|
||||
// We need to be able to reference dynimport symbols when linking against
|
||||
// shared libraries, and Solaris needs it always
|
||||
if ctxt.HeadType != objabi.Hsolaris && r.Sym != nil && r.Sym.Type == sym.SDYNIMPORT && !ctxt.DynlinkingGo() && !r.Sym.Attr.SubSymbol() {
|
||||
// shared libraries, and Solaris and Darwin need it always
|
||||
if ctxt.HeadType != objabi.Hsolaris && ctxt.HeadType != objabi.Hdarwin && r.Sym != nil && r.Sym.Type == sym.SDYNIMPORT && !ctxt.DynlinkingGo() && !r.Sym.Attr.SubSymbol() {
|
||||
if !(ctxt.Arch.Family == sys.PPC64 && ctxt.LinkMode == LinkExternal && r.Sym.Name == ".TOC.") {
|
||||
Errorf(s, "unhandled relocation for %s (type %d (%s) rtype %d (%s))", r.Sym.Name, r.Sym.Type, r.Sym.Type, r.Type, sym.RelocName(ctxt.Arch, r.Type))
|
||||
}
|
||||
|
|
@ -402,10 +402,22 @@ func relocsym(ctxt *Link, s *sym.Symbol) {
|
|||
}
|
||||
} else if ctxt.HeadType == objabi.Hdarwin {
|
||||
if r.Type == objabi.R_CALL {
|
||||
if rs.Type != sym.SHOSTOBJ {
|
||||
o += int64(uint64(Symaddr(rs)) - rs.Sect.Vaddr)
|
||||
if ctxt.LinkMode == LinkExternal && rs.Type == sym.SDYNIMPORT {
|
||||
switch ctxt.Arch.Family {
|
||||
case sys.AMD64:
|
||||
// AMD64 dynamic relocations are relative to the end of the relocation.
|
||||
o += int64(r.Siz)
|
||||
case sys.I386:
|
||||
// I386 dynamic relocations are relative to the start of the section.
|
||||
o -= int64(r.Off) // offset in symbol
|
||||
o -= int64(s.Value - int64(s.Sect.Vaddr)) // offset of symbol in section
|
||||
}
|
||||
} else {
|
||||
if rs.Type != sym.SHOSTOBJ {
|
||||
o += int64(uint64(Symaddr(rs)) - rs.Sect.Vaddr)
|
||||
}
|
||||
o -= int64(r.Off) // relative to section offset, not symbol
|
||||
}
|
||||
o -= int64(r.Off) // relative to section offset, not symbol
|
||||
} else if ctxt.Arch.Family == sys.ARM {
|
||||
// see ../arm/asm.go:/machoreloc1
|
||||
o += Symaddr(rs) - s.Value - int64(r.Off)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue