[PATCH] D70284: Constant strings emitted when `-fno-constant-cfstrings` is passed should allow dead stripping
Ben D. Jones via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Nov 14 17:49:07 PST 2019
bendjones created this revision.
bendjones added reviewers: erik.pilkington, ahatanak.
bendjones created this object with edit policy "Administrators".
bendjones added a project: clang.
Herald added subscribers: cfe-commits, dexonsmith.
Part of rdar://56643852 that makes all possible constant string code paths emit without `no_dead_strip` so that dead stripping is allowed.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D70284
Files:
clang/lib/CodeGen/CGObjCMac.cpp
Index: clang/lib/CodeGen/CGObjCMac.cpp
===================================================================
--- clang/lib/CodeGen/CGObjCMac.cpp
+++ clang/lib/CodeGen/CGObjCMac.cpp
@@ -1978,6 +1978,7 @@
return V;
}
+// This is only used when `-fno-constant-cfstrings` is given
ConstantAddress
CGObjCCommonMac::GenerateConstantNSString(const StringLiteral *Literal) {
unsigned StringLength = 0;
@@ -2029,10 +2030,8 @@
GV = Fields.finishAndCreateGlobal("_unnamed_nsstring_", Alignment,
/*constant*/ true,
llvm::GlobalVariable::PrivateLinkage);
- const char *NSStringSection = "__OBJC,__cstring_object,regular,no_dead_strip";
- const char *NSStringNonFragileABISection =
- "__DATA,__objc_stringobj,regular,no_dead_strip";
- // FIXME. Fix section.
+ const char *NSStringSection = "__OBJC,__cstring_object,regular";
+ const char *NSStringNonFragileABISection = "__DATA,__objc_stringobj,regular";
GV->setSection(CGM.getLangOpts().ObjCRuntime.isNonFragile()
? NSStringNonFragileABISection
: NSStringSection);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D70284.229429.patch
Type: text/x-patch
Size: 1145 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20191115/74f27940/attachment.bin>
More information about the cfe-commits
mailing list