cmd/link: suppress unnecessary DWARF relocs that confuse dsymutil
cmd/link: suppress unnecessary DWARF relocs that confuse dsymutil

During Mach-O linking, dsymutil takes the DWARF from individual object
files and combines it into a debug archive. Because it's content-aware,
it doesn't need our help to do its job. Nonetheless, it does try to
honor relocations that are present in its input.

When dsymutil encounters a relocation, it uses the value of that
relocation as an index into the debug map to find its final location.
When it does that, it's assuming that the value is an address in the
object file. But DWARF references are section-relative. So when it
processes a relocation for a DWARF reference, it gets confused,
and if the value happens to match the address of a function or
data symbol, it will rewrite it incorrectly.

Since the relocations don't help, and can hurt, drop them when
externally linking a Mach-O binary.

Fixes #22068

Change-Id: I8ec36da626575d9f6c8d0e7a0b76eab8ba22d62c
Reviewed-on: https://go-review.googlesource.com/68330
Run-TryBot: Heschi Kreinick <e89ab2b172855aa0ad01c40c4d8a3535a61ac68a@google.com>
TryBot-Result: Gobot Gobot <66cb808b70d30c07676d5e946fee83fd561249e5@golang.org>
Reviewed-by: David Crawshaw <a2f0bf29257797dd66800b4fbb9945c3e216c004@golang.org>

CAFxX/go,codestation/go,polyverse-security/go,akutz/go,polyverse-security/go,josharian/go,cloudflare/go,CAFxX/go,akutz/go,golang/go,codestation/go,nawawi/go,nawawi/go,golang/go,Cofyc/go,cloudflare/go,akutz/go,golang/go,codestation/go,cloudflare/go,Cofyc/go,nawawi/go,akutz/go,codestation/go,nawawi/go,CAFxX/go,cloudflare/go,nawawi/go,CAFxX/go,Cofyc/go,CAFxX/go,polyverse-security/go,cloudflare/go,polyverse-security/go,christopher-henderson/Go,golang/go,golang/go,polyverse-security/go,polyverse-security/go,akutz/go,codestation/go,josharian/go,josharian/go,akutz/go,cloudflare/go,Cofyc/go,akutz/go,CAFxX/go,Cofyc/go,josharian/go,cloudflare/go,Cofyc/go,Cofyc/go,josharian/go,nawawi/go,Cofyc/go,CAFxX/go,nawawi/go,golang/go,polyverse-security/go,codestation/go,nawawi/go,codestation/go,josharian/go,CAFxX/go,cloudflare/go,josharian/go,golang/go,golang/go,codestation/go,akutz/go,polyverse-security/go,josharian/go