aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/link/internal/ld/data.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/cmd/link/internal/ld/data.go')
-rw-r--r--src/cmd/link/internal/ld/data.go8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/cmd/link/internal/ld/data.go b/src/cmd/link/internal/ld/data.go
index 21b2e9a9d4..95fc8b5a42 100644
--- a/src/cmd/link/internal/ld/data.go
+++ b/src/cmd/link/internal/ld/data.go
@@ -368,9 +368,11 @@ func (st *relocSymState) relocsym(s loader.Sym, P []byte) {
o = 0
}
} else if target.IsDarwin() {
- if ldr.SymType(rs) != sym.SHOSTOBJ && ldr.SymType(s) != sym.SINITARR {
- // ld-prime drops the offset in data for SINITARR. We need to use
- // symbol-targeted relocation. See also machoreloc1.
+ if ldr.SymType(s).IsDWARF() {
+ // We generally use symbol-targeted relocations.
+ // DWARF tools seem to only handle section-targeted relocations,
+ // so generate section-targeted relocations in DWARF sections.
+ // See also machoreloc1.
o += ldr.SymValue(rs)
}
} else if target.IsWindows() {