summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lld/lib/ReaderWriter/MachO/ExecutableAtoms.h8
-rw-r--r--lld/test/mach-o/mh_bundle_header.yaml7
2 files changed, 8 insertions, 7 deletions
diff --git a/lld/lib/ReaderWriter/MachO/ExecutableAtoms.h b/lld/lib/ReaderWriter/MachO/ExecutableAtoms.h
index e98139e2052..e1a252bbf9b 100644
--- a/lld/lib/ReaderWriter/MachO/ExecutableAtoms.h
+++ b/lld/lib/ReaderWriter/MachO/ExecutableAtoms.h
@@ -71,7 +71,6 @@ public:
: SimpleFile("mach_header symbols", kindHeaderObject) {
StringRef machHeaderSymbolName;
DefinedAtom::Scope symbolScope = DefinedAtom::scopeLinkageUnit;
- bool noDeadStrip = false;
StringRef dsoHandleName;
switch (context.outputMachOType()) {
case llvm::MachO::MH_OBJECT:
@@ -80,7 +79,6 @@ public:
case llvm::MachO::MH_EXECUTE:
machHeaderSymbolName = "__mh_execute_header";
symbolScope = DefinedAtom::scopeGlobal;
- noDeadStrip = true;
dsoHandleName = "___dso_handle";
break;
case llvm::MachO::MH_FVMLIB:
@@ -112,13 +110,15 @@ public:
if (!machHeaderSymbolName.empty())
_definedAtoms.push_back(new (allocator()) MachODefinedAtom(
*this, machHeaderSymbolName, symbolScope,
- DefinedAtom::typeMachHeader, DefinedAtom::mergeNo, false, noDeadStrip,
+ DefinedAtom::typeMachHeader, DefinedAtom::mergeNo, false,
+ true /* noDeadStrip */,
ArrayRef<uint8_t>(), DefinedAtom::Alignment(4096)));
if (!dsoHandleName.empty())
_definedAtoms.push_back(new (allocator()) MachODefinedAtom(
*this, dsoHandleName, DefinedAtom::scopeLinkageUnit,
- DefinedAtom::typeDSOHandle, DefinedAtom::mergeNo, false, false,
+ DefinedAtom::typeDSOHandle, DefinedAtom::mergeNo, false,
+ true /* noDeadStrip */,
ArrayRef<uint8_t>(), DefinedAtom::Alignment(1)));
}
diff --git a/lld/test/mach-o/mh_bundle_header.yaml b/lld/test/mach-o/mh_bundle_header.yaml
index 558df2ca2e9..87b35e7bdd5 100644
--- a/lld/test/mach-o/mh_bundle_header.yaml
+++ b/lld/test/mach-o/mh_bundle_header.yaml
@@ -1,5 +1,5 @@
-# RUN: lld -flavor darwin -arch x86_64 %s -bundle -o %t %p/Inputs/libSystem.yaml
-# RUN: llvm-nm -m -n %t | FileCheck %s
+# RUN: lld -flavor darwin -arch x86_64 %s -bundle -o %t %p/Inputs/libSystem.yaml && llvm-nm -m -n %t | FileCheck %s
+# RUN: lld -flavor darwin -arch x86_64 %s -bundle -dead_strip -o %t %p/Inputs/libSystem.yaml && llvm-nm -m -n %t | FileCheck %s
#
# Test that __mh_bundle_header symbol is available for bundles
#
@@ -39,6 +39,7 @@ global-symbols:
type: N_SECT
scope: [ N_EXT ]
sect: 1
+ desc: [ N_NO_DEAD_STRIP ]
value: 0x0000000000000000
undefined-symbols:
- name: __mh_bundle_header
@@ -49,5 +50,5 @@ undefined-symbols:
...
-# CHECK_NOT: __mh_bundle_header
+# CHECK: __mh_bundle_header
# CHECK: _foo
OpenPOWER on IntegriCloud