[lld-macho] Preserve alignment for non-deduplicated cstrings
authorLeonard Grey <lgrey@chromium.org>
Tue, 29 Jun 2021 02:22:21 +0000 (22:22 -0400)
committerNico Weber <thakis@chromium.org>
Tue, 29 Jun 2021 02:26:43 +0000 (22:26 -0400)
commita8a6e5b094aac642f436390294ec837400c521bb
tree6b028239ce517d24c31574ff676b7c6e16355df5
parent0d6e4199e32a3a5942f920bf13c0a0ddf10d2579
[lld-macho] Preserve alignment for non-deduplicated cstrings

Fixes PR50637.

Downstream bug: https://crbug.com/1218958

Currently, we split __cstring along symbol boundaries with .subsections_via_symbols
when not deduplicating, and along null bytes when deduplicating. This change splits
along null bytes unconditionally, and preserves original alignment in the non-
deduplicated case.

Removing subsections-section-relocs.s because with this change, __cstring
is never reordered based on the order file.

Differential Revision: https://reviews.llvm.org/D104919
lld/MachO/InputFiles.cpp
lld/MachO/InputSection.cpp
lld/MachO/InputSection.h
lld/MachO/SyntheticSections.cpp
lld/MachO/SyntheticSections.h
lld/MachO/Writer.cpp
lld/test/MachO/dead-strip-align.s [new file with mode: 0644]
lld/test/MachO/subsections-section-relocs.s [deleted file]