summaryrefslogtreecommitdiffstats
path: root/llvm/lib/MC/MachObjectWriter.cpp
diff options
context:
space:
mode:
authorPete Cooper <peter_cooper@apple.com>2015-06-08 17:17:28 +0000
committerPete Cooper <peter_cooper@apple.com>2015-06-08 17:17:28 +0000
commit916f79ef7b802f5dc614abf6150ba60910510f24 (patch)
tree2a5b2f7e1afe22452be5b95f7c57edc98b32bc09 /llvm/lib/MC/MachObjectWriter.cpp
parenteb012fa761c171e795222a454148e5c405ff509e (diff)
downloadbcm5719-llvm-916f79ef7b802f5dc614abf6150ba60910510f24.tar.gz
bcm5719-llvm-916f79ef7b802f5dc614abf6150ba60910510f24.zip
Move all flags logic to MCSymbolMachO.
Also delete the now unused MCMachOSymbolFlags.h header as the only enum in there was moved to MCSymbolMachO. Similarly to ELF and COFF, manipulating the flags is now done via helpers instead of spread throughout the codebase. Reviewed by Rafael EspĂ­ndola. llvm-svn: 239316
Diffstat (limited to 'llvm/lib/MC/MachObjectWriter.cpp')
-rw-r--r--llvm/lib/MC/MachObjectWriter.cpp24
1 files changed, 4 insertions, 20 deletions
diff --git a/llvm/lib/MC/MachObjectWriter.cpp b/llvm/lib/MC/MachObjectWriter.cpp
index c2f7f211359..fc046b85434 100644
--- a/llvm/lib/MC/MachObjectWriter.cpp
+++ b/llvm/lib/MC/MachObjectWriter.cpp
@@ -18,7 +18,7 @@
#include "llvm/MC/MCMachOSymbolFlags.h"
#include "llvm/MC/MCObjectWriter.h"
#include "llvm/MC/MCSectionMachO.h"
-#include "llvm/MC/MCSymbol.h"
+#include "llvm/MC/MCSymbolMachO.h"
#include "llvm/MC/MCValue.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/ErrorHandling.h"
@@ -46,7 +46,7 @@ bool MachObjectWriter::doesSymbolRequireExternRelocation(const MCSymbol &S) {
// References to weak definitions require external relocation entries; the
// definition may not always be the one in the same object file.
- if (S.getFlags() & SF_WeakDefinition)
+ if (cast<MCSymbolMachO>(S).isWeakDefinition())
return true;
// Otherwise, we can use an internal relocation.
@@ -327,7 +327,6 @@ void MachObjectWriter::writeNlist(MachSymbolData &MSD,
const MCSymbol *AliasedSymbol = &findAliasedSymbol(*Symbol);
uint8_t SectionIndex = MSD.SectionIndex;
uint8_t Type = 0;
- uint16_t Flags = Symbol->getFlags();
uint64_t Address = 0;
bool IsAlias = Symbol != AliasedSymbol;
@@ -371,23 +370,8 @@ void MachObjectWriter::writeNlist(MachSymbolData &MSD,
// Common symbols are encoded with the size in the address
// field, and their alignment in the flags.
Address = Symbol->getCommonSize();
-
- // Common alignment is packed into the 'desc' bits.
- if (unsigned Align = Symbol->getCommonAlignment()) {
- unsigned Log2Size = Log2_32(Align);
- assert((1U << Log2Size) == Align && "Invalid 'common' alignment!");
- if (Log2Size > 15)
- report_fatal_error("invalid 'common' alignment '" +
- Twine(Align) + "' for '" + Symbol->getName() + "'",
- false);
- // FIXME: Keep this mask with the SymbolFlags enumeration.
- Flags = (Flags & 0xF0FF) | (Log2Size << 8);
- }
}
- if (Layout.getAssembler().isThumbFunc(Symbol))
- Flags |= SF_ThumbFunc;
-
// struct nlist (12 bytes)
write32(MSD.StringIndex);
@@ -396,7 +380,7 @@ void MachObjectWriter::writeNlist(MachSymbolData &MSD,
// The Mach-O streamer uses the lowest 16-bits of the flags for the 'desc'
// value.
- write16(Flags);
+ write16(cast<MCSymbolMachO>(Symbol)->getEncodedFlags());
if (is64Bit())
write64(Address);
else
@@ -515,7 +499,7 @@ void MachObjectWriter::bindIndirectSymbols(MCAssembler &Asm) {
bool Created;
Asm.registerSymbol(*it->Symbol, &Created);
if (Created)
- it->Symbol->setFlags(it->Symbol->getFlags() | 0x0001);
+ cast<MCSymbolMachO>(it->Symbol)->setReferenceTypeUndefinedLazy(true);
}
}
OpenPOWER on IntegriCloud