[PATCH] D109895: [lld-macho][nfc] Construct CFString literals by copying the ConcatInputSection
Vy Nguyen via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 16 09:44:58 PDT 2021
oontvoo accepted this revision.
oontvoo added a comment.
This revision is now accepted and ready to land.
LGTM
...with some nits. Thanks!
================
Comment at: lld/MachO/InputFiles.cpp:238-239
+static Optional<size_t> getRecordSize(StringRef segname, StringRef name) {
+ if (name == section_names::cfString)
+ if (config->icfLevel != ICFLevel::none && segname == segment_names::data)
+ return target->wordSize == 8 ? 32 : 16;
----------------
why not `&&` here rather than nested if?
================
Comment at: lld/MachO/InputFiles.cpp:303
subsections.push_back({{0, isec}});
- } else if (config->icfLevel != ICFLevel::none &&
- (name == section_names::cfString &&
- segname == segment_names::data)) {
- uint64_t literalSize = target->wordSize == 8 ? 32 : 16;
- subsections.push_back({});
- SubsectionMap &subsecMap = subsections.back();
- for (uint64_t off = 0; off < data.size(); off += literalSize)
- subsecMap.push_back(
- {off, make<ConcatInputSection>(segname, name, this,
- data.slice(off, literalSize), align,
- flags)});
+ } else if (auto recordSize = getRecordSize(segname, name)) {
+ splitRecords(*recordSize);
----------------
nit: no braces
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D109895/new/
https://reviews.llvm.org/D109895
More information about the llvm-commits
mailing list