[PATCH] D141025: [lld-macho] Don't support relocations in cstring sections
Jez Ng via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 5 11:14:20 PST 2023
This revision was automatically updated to reflect the committed changes.
Closed by commit rG2828a54996c4: [lld-macho] Don't support relocations in cstring sections (authored by int3).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D141025/new/
https://reviews.llvm.org/D141025
Files:
lld/MachO/InputFiles.cpp
lld/test/MachO/invalid/cstring-dedup.s
Index: lld/test/MachO/invalid/cstring-dedup.s
===================================================================
--- lld/test/MachO/invalid/cstring-dedup.s
+++ lld/test/MachO/invalid/cstring-dedup.s
@@ -11,7 +11,7 @@
# RUN: not %lld -dylib %t/relocs.o 2>&1 | FileCheck %s --check-prefix=RELOCS
# TERM: not-terminated.o:(__cstring+0x4): string is not null terminated
-# RELOCS: relocs.o contains relocations in __TEXT,__cstring, so LLD cannot deduplicate strings. Try re-running with --no-deduplicate-strings.
+# RELOCS: error: {{.*}}relocs.o: __TEXT,__cstring contains relocations, which is unsupported
#--- not-terminated.s
.cstring
Index: lld/MachO/InputFiles.cpp
===================================================================
--- lld/MachO/InputFiles.cpp
+++ lld/MachO/InputFiles.cpp
@@ -343,23 +343,20 @@
};
if (sectionType(sec.flags) == S_CSTRING_LITERALS) {
- if (sec.nreloc && config->dedupStrings)
- fatal(toString(this) + " contains relocations in " + sec.segname + "," +
- sec.sectname +
- ", so LLD cannot deduplicate strings. Try re-running with "
- "--no-deduplicate-strings.");
-
- InputSection *isec = make<CStringInputSection>(
- section, data, align,
- /*dedupLiterals=*/name == section_names::objcMethname ||
- config->dedupStrings);
+ if (sec.nreloc)
+ fatal(toString(this) + ": " + sec.segname + "," + sec.sectname +
+ " contains relocations, which is unsupported");
+ bool dedupLiterals =
+ name == section_names::objcMethname || config->dedupStrings;
+ InputSection *isec =
+ make<CStringInputSection>(section, data, align, dedupLiterals);
// FIXME: parallelize this?
cast<CStringInputSection>(isec)->splitIntoPieces();
section.subsections.push_back({0, isec});
} else if (isWordLiteralSection(sec.flags)) {
if (sec.nreloc)
- fatal(toString(this) + " contains unsupported relocations in " +
- sec.segname + "," + sec.sectname);
+ fatal(toString(this) + ": " + sec.segname + "," + sec.sectname +
+ " contains relocations, which is unsupported");
InputSection *isec = make<WordLiteralInputSection>(section, data, align);
section.subsections.push_back({0, isec});
} else if (auto recordSize = getRecordSize(segname, name)) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D141025.486637.patch
Type: text/x-patch
Size: 2404 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230105/cc785bf2/attachment.bin>
More information about the llvm-commits
mailing list