[lld-macho] Don't support relocations in cstring sections
authorJez Ng <jezng@fb.com>
Thu, 5 Jan 2023 19:14:11 +0000 (14:14 -0500)
committerJez Ng <jezng@fb.com>
Thu, 5 Jan 2023 19:14:11 +0000 (14:14 -0500)
commit2828a54996c407a3b5f5435da8fc9208c5e0ddd1
treea56826818a16f7b2fb58491749365733782b3c26
parent93a0ff232849b22278945a06ef9c84cf404c1074
[lld-macho] Don't support relocations in cstring sections

We can technically handle them, but since they shouldn't come up in any
real-world programs (since ld64 dedups strings unconditionally), there's
no reason to support them.

It's a thoroughly untested code path too -- as evidenced by the fact
that the only test this change breaks is one that verifies that we
reject relocations when dedup'ing. There is no test that covers the case
where we handle relocations in cstring sections when dedup is disabled.

Reviewed By: #lld-macho, oontvoo, keith, thakis

Differential Revision: https://reviews.llvm.org/D141025
lld/MachO/InputFiles.cpp
lld/test/MachO/invalid/cstring-dedup.s