Skip to content

Commit

Permalink
the trampoline inter-package check for tamago needs to account that r…
Browse files Browse the repository at this point in the history
…untime might be linked externally through go:linkname
  • Loading branch information
abarisani committed Sep 10, 2020
1 parent 252db92 commit 95ba4a1
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/cmd/link/internal/ld/data.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,6 @@ func trampoline(ctxt *Link, s loader.Sym) {
return // no need or no support of trampolines on this arch
}

if ctxt.HeadType == objabi.Htamago {
return // no need or no support of trampolines on this arch
}

ldr := ctxt.loader
relocs := ldr.Relocs(s)
for ri := 0; ri < relocs.Count(); ri++ {
Expand All @@ -111,6 +107,10 @@ func trampoline(ctxt *Link, s loader.Sym) {
if ldr.SymValue(rs) == 0 && (ldr.SymType(rs) != sym.SDYNIMPORT && ldr.SymType(rs) != sym.SUNDEFEXT) {
if ldr.SymPkg(rs) != ldr.SymPkg(s) {
if !isRuntimeDepPkg(ldr.SymPkg(s)) || !isRuntimeDepPkg(ldr.SymPkg(rs)) {
// tamago may call to runtime due to go:linkname
if ctxt.HeadType == objabi.Htamago && strings.HasPrefix(ldr.SymName(rs), "runtime.") {
continue
}
ctxt.Errorf(s, "unresolved inter-package jump to %s(%s) from %s", ldr.SymName(rs), ldr.SymPkg(rs), ldr.SymPkg(s))
}
// runtime and its dependent packages may call to each other.
Expand Down

0 comments on commit 95ba4a1

Please sign in to comment.