summaryrefslogtreecommitdiffstats
path: root/llvm/lib/MC
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2010-05-05 19:01:05 +0000
committerDaniel Dunbar <daniel@zuster.org>2010-05-05 19:01:05 +0000
commitf3a53baf006007c21cd50d2492b0f090d4ceaece (patch)
treeef484379fa56ad5bef7612703b1e54e1a2f0a9ae /llvm/lib/MC
parentdeb7ba9cc00b8bbb085011f9582033ba5694ebe0 (diff)
downloadbcm5719-llvm-f3a53baf006007c21cd50d2492b0f090d4ceaece.tar.gz
bcm5719-llvm-f3a53baf006007c21cd50d2492b0f090d4ceaece.zip
MC/Mach-O: Mark absolute variable's appropriately, and add Mach-O support for
writing them. - <rdar://problem/7885351> integrated assembler broken for i386 objc code llvm-svn: 103112
Diffstat (limited to 'llvm/lib/MC')
-rw-r--r--llvm/lib/MC/MCAsmStreamer.cpp1
-rw-r--r--llvm/lib/MC/MCMachOStreamer.cpp1
-rw-r--r--llvm/lib/MC/MCSymbol.cpp4
-rw-r--r--llvm/lib/MC/MachObjectWriter.cpp4
4 files changed, 6 insertions, 4 deletions
diff --git a/llvm/lib/MC/MCAsmStreamer.cpp b/llvm/lib/MC/MCAsmStreamer.cpp
index 1d231bbffa0..22b1a376e3a 100644
--- a/llvm/lib/MC/MCAsmStreamer.cpp
+++ b/llvm/lib/MC/MCAsmStreamer.cpp
@@ -239,7 +239,6 @@ void MCAsmStreamer::EmitAssignment(MCSymbol *Symbol, const MCExpr *Value) {
EmitEOL();
// FIXME: Lift context changes into super class.
- // FIXME: Set associated section.
Symbol->setVariableValue(Value);
}
diff --git a/llvm/lib/MC/MCMachOStreamer.cpp b/llvm/lib/MC/MCMachOStreamer.cpp
index b4bd5575358..5ca31943f1f 100644
--- a/llvm/lib/MC/MCMachOStreamer.cpp
+++ b/llvm/lib/MC/MCMachOStreamer.cpp
@@ -193,7 +193,6 @@ void MCMachOStreamer::EmitAssemblerFlag(MCAssemblerFlag Flag) {
void MCMachOStreamer::EmitAssignment(MCSymbol *Symbol, const MCExpr *Value) {
// FIXME: Lift context changes into super class.
- // FIXME: Set associated section.
Symbol->setVariableValue(AddValueSymbols(Value));
}
diff --git a/llvm/lib/MC/MCSymbol.cpp b/llvm/lib/MC/MCSymbol.cpp
index 82d72a3e95b..07751f72984 100644
--- a/llvm/lib/MC/MCSymbol.cpp
+++ b/llvm/lib/MC/MCSymbol.cpp
@@ -44,6 +44,10 @@ void MCSymbol::setVariableValue(const MCExpr *Value) {
assert((isUndefined() || (isAbsolute() && isa<MCConstantExpr>(Value))) &&
"Invalid redefinition!");
this->Value = Value;
+
+ // Mark the variable as absolute as appropriate.
+ if (isa<MCConstantExpr>(Value))
+ setAbsolute();
}
void MCSymbol::print(raw_ostream &OS) const {
diff --git a/llvm/lib/MC/MachObjectWriter.cpp b/llvm/lib/MC/MachObjectWriter.cpp
index f4aef96e302..bb8eb10a483 100644
--- a/llvm/lib/MC/MachObjectWriter.cpp
+++ b/llvm/lib/MC/MachObjectWriter.cpp
@@ -404,7 +404,7 @@ public:
// Compute the symbol address.
if (Symbol.isDefined()) {
if (Symbol.isAbsolute()) {
- llvm_unreachable("FIXME: Not yet implemented!");
+ Address = cast<MCConstantExpr>(Symbol.getVariableValue())->getValue();
} else {
Address = Layout.getSymbolAddress(&Data);
}
@@ -552,7 +552,7 @@ public:
// possible. This seems to be done because the debugger doesn't fully
// understand x86_64 relocation entries, and expects to find values that
// have already been fixed up.
- if (Symbol->isDefined()) {
+ if (Symbol->isInSection()) {
const MCSectionMachO &Section = static_cast<const MCSectionMachO&>(
Fragment->getParent()->getSection());
if (Section.hasAttribute(MCSectionMachO::S_ATTR_DEBUG))
OpenPOWER on IntegriCloud