aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/MC/MCObjectFileInfo.cpp
diff options
context:
space:
mode:
authorSteven Wu <stevenwu@apple.com>2018-04-10 20:16:35 +0000
committerSteven Wu <stevenwu@apple.com>2018-04-10 20:16:35 +0000
commitd0804aa6dc476f75017a74d5fd77e737efe9a9ea (patch)
tree63f04a66107c24bc5694b7164efcccac0e6dcb30 /llvm/lib/MC/MCObjectFileInfo.cpp
parentc0f879bcecd4058732aad6c1e113adf78990f5a3 (diff)
downloadllvm-d0804aa6dc476f75017a74d5fd77e737efe9a9ea.zip
llvm-d0804aa6dc476f75017a74d5fd77e737efe9a9ea.tar.gz
llvm-d0804aa6dc476f75017a74d5fd77e737efe9a9ea.tar.bz2
[MachO] Emit Weak ReadOnlyWithRel to ConstDataSection
Summary: Darwin dynamic linker can handle weak symbols in ConstDataSection. ReadonReadOnlyWithRel symbols should be emitted in ConstDataSection instead of normal DataSection. rdar://problem/39298457 Reviewers: dexonsmith, kledzik Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D45472 llvm-svn: 329752
Diffstat (limited to 'llvm/lib/MC/MCObjectFileInfo.cpp')
-rw-r--r--llvm/lib/MC/MCObjectFileInfo.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/llvm/lib/MC/MCObjectFileInfo.cpp b/llvm/lib/MC/MCObjectFileInfo.cpp
index b154c98..5b36361 100644
--- a/llvm/lib/MC/MCObjectFileInfo.cpp
+++ b/llvm/lib/MC/MCObjectFileInfo.cpp
@@ -135,6 +135,10 @@ void MCObjectFileInfo::initMachOMCObjectFileInfo(const Triple &T) {
// "__DATA/__datacoal_nt" => section "__DATA/__data"
Triple::ArchType ArchTy = T.getArch();
+ ConstDataSection // .const_data
+ = Ctx->getMachOSection("__DATA", "__const", 0,
+ SectionKind::getReadOnlyWithRel());
+
if (ArchTy == Triple::ppc || ArchTy == Triple::ppc64) {
TextCoalSection
= Ctx->getMachOSection("__TEXT", "__textcoal_nt",
@@ -147,15 +151,14 @@ void MCObjectFileInfo::initMachOMCObjectFileInfo(const Triple &T) {
SectionKind::getReadOnly());
DataCoalSection = Ctx->getMachOSection(
"__DATA", "__datacoal_nt", MachO::S_COALESCED, SectionKind::getData());
+ ConstDataCoalSection = DataCoalSection;
} else {
TextCoalSection = TextSection;
ConstTextCoalSection = ReadOnlySection;
DataCoalSection = DataSection;
+ ConstDataCoalSection = ConstDataSection;
}
- ConstDataSection // .const_data
- = Ctx->getMachOSection("__DATA", "__const", 0,
- SectionKind::getReadOnlyWithRel());
DataCommonSection
= Ctx->getMachOSection("__DATA","__common",
MachO::S_ZEROFILL,