Skip to content

Commit 12420f9

Browse files
cherrymuidr2chase
authored andcommitted
cmd/link: resolve relocations to .TOC. symbol
CL 404296 breaks the PPC64LE build because the .TOC. symbol is visibility hidden and was skipped from the "unresolved symbol" check (the check needs to be fix). In face, the .TOC. symbol is special in that it doesn't have a type but we have special logic to assign a value to it in the address pass. So we can actually resolve a relocation to .TOC.. We already have a special case for PIE. It also applies to non-PIE as well. Fix PPC64LE builds. Change-Id: Iaf7e36f10c4d0a40fc56b2135e5ff38815e203b1 Reviewed-on: https://go-review.googlesource.com/c/go/+/404302 Run-TryBot: Cherry Mui <[email protected]> Reviewed-by: David Chase <[email protected]> TryBot-Result: Gopher Robot <[email protected]>
1 parent a4af356 commit 12420f9

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/cmd/link/internal/ld/data.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -227,8 +227,10 @@ func (st *relocSymState) relocsym(s loader.Sym, P []byte) {
227227
// DWARF info between the compiler and linker.
228228
continue
229229
}
230-
} else if target.IsPPC64() && target.IsPIE() && ldr.SymName(rs) == ".TOC." {
231-
// This is a TOC relative relocation generated from a go object. It is safe to resolve.
230+
} else if target.IsPPC64() && ldr.SymName(rs) == ".TOC." {
231+
// TOC symbol doesn't have a type but we do assign a value
232+
// (see the address pass) and we can resolve it.
233+
// TODO: give it a type.
232234
} else {
233235
st.err.errorUnresolved(ldr, s, rs)
234236
continue

0 commit comments

Comments
 (0)