summaryrefslogtreecommitdiffstats
path: root/lld/lib/ReaderWriter/MachO/File.h
diff options
context:
space:
mode:
authorNick Kledzik <kledzik@apple.com>2014-08-21 22:18:30 +0000
committerNick Kledzik <kledzik@apple.com>2014-08-21 22:18:30 +0000
commit7820c80f7db81b29911568613b6f01f481c65c2f (patch)
treecec955a62b4277541a6ab08623cf09c2b283ea1e /lld/lib/ReaderWriter/MachO/File.h
parent34fcca723b223caad4a48110be4269be3ca00321 (diff)
downloadbcm5719-llvm-7820c80f7db81b29911568613b6f01f481c65c2f.tar.gz
bcm5719-llvm-7820c80f7db81b29911568613b6f01f481c65c2f.zip
[mach-o] support N_NO_DEAD_STRIP nlist.desc bit
Mach-O symbols can have an attribute on them means their content should never be dead code stripped. This translates to deadStrip() == deadStripNever. llvm-svn: 216234
Diffstat (limited to 'lld/lib/ReaderWriter/MachO/File.h')
-rw-r--r--lld/lib/ReaderWriter/MachO/File.h25
1 files changed, 14 insertions, 11 deletions
diff --git a/lld/lib/ReaderWriter/MachO/File.h b/lld/lib/ReaderWriter/MachO/File.h
index bc6a75a39f5..f3e77e788de 100644
--- a/lld/lib/ReaderWriter/MachO/File.h
+++ b/lld/lib/ReaderWriter/MachO/File.h
@@ -32,9 +32,10 @@ public:
void addDefinedAtom(StringRef name, Atom::Scope scope,
DefinedAtom::ContentType type, DefinedAtom::Merge merge,
uint64_t sectionOffset, uint64_t contentSize, bool thumb,
- bool copyRefs, const Section *inSection) {
+ bool noDeadStrip, bool copyRefs,
+ const Section *inSection) {
assert(sectionOffset+contentSize <= inSection->content.size());
- ArrayRef<uint8_t> content = inSection->content.slice(sectionOffset,
+ ArrayRef<uint8_t> content = inSection->content.slice(sectionOffset,
contentSize);
if (copyRefs) {
// Make a copy of the atom's name and content that is owned by this file.
@@ -42,18 +43,18 @@ public:
content = content.copy(_allocator);
}
MachODefinedAtom *atom =
- new (_allocator) MachODefinedAtom(*this, name, scope, type, merge,
- thumb, content);
+ new (_allocator) MachODefinedAtom(*this, name, scope, type, merge,
+ thumb, noDeadStrip, content);
addAtomForSection(inSection, atom, sectionOffset);
}
void addDefinedAtomInCustomSection(StringRef name, Atom::Scope scope,
DefinedAtom::ContentType type, DefinedAtom::Merge merge,
- bool thumb, uint64_t sectionOffset, uint64_t contentSize,
- StringRef sectionName, bool copyRefs,
- const Section *inSection) {
+ bool thumb, bool noDeadStrip, uint64_t sectionOffset,
+ uint64_t contentSize, StringRef sectionName,
+ bool copyRefs, const Section *inSection) {
assert(sectionOffset+contentSize <= inSection->content.size());
- ArrayRef<uint8_t> content = inSection->content.slice(sectionOffset,
+ ArrayRef<uint8_t> content = inSection->content.slice(sectionOffset,
contentSize);
if (copyRefs) {
// Make a copy of the atom's name and content that is owned by this file.
@@ -63,20 +64,22 @@ public:
}
MachODefinedCustomSectionAtom *atom =
new (_allocator) MachODefinedCustomSectionAtom(*this, name, scope, type,
- merge, thumb, content,
+ merge, thumb,
+ noDeadStrip, content,
sectionName);
addAtomForSection(inSection, atom, sectionOffset);
}
void addZeroFillDefinedAtom(StringRef name, Atom::Scope scope,
uint64_t sectionOffset, uint64_t size,
- bool copyRefs, const Section *inSection) {
+ bool noDeadStrip, bool copyRefs,
+ const Section *inSection) {
if (copyRefs) {
// Make a copy of the atom's name and content that is owned by this file.
name = name.copy(_allocator);
}
MachODefinedAtom *atom =
- new (_allocator) MachODefinedAtom(*this, name, scope, size);
+ new (_allocator) MachODefinedAtom(*this, name, scope, size, noDeadStrip);
addAtomForSection(inSection, atom, sectionOffset);
}
OpenPOWER on IntegriCloud