diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2010-12-07 17:12:32 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2010-12-07 17:12:32 +0000 |
commit | e78d3b38de37bed94b7e3b58e99c854d14aaf2da (patch) | |
tree | 2151ddf1533562978e2b510dd45e88d8a3cdec26 /llvm/lib/MC/MachObjectWriter.cpp | |
parent | d732156bed1bec8601c56872333856a57f33d263 (diff) | |
download | bcm5719-llvm-e78d3b38de37bed94b7e3b58e99c854d14aaf2da.tar.gz bcm5719-llvm-e78d3b38de37bed94b7e3b58e99c854d14aaf2da.zip |
Fix absolute recording of differences of symbols in two sections. Reduced from ctor_dtor_count-2.cpp.
llvm-svn: 121152
Diffstat (limited to 'llvm/lib/MC/MachObjectWriter.cpp')
-rw-r--r-- | llvm/lib/MC/MachObjectWriter.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/llvm/lib/MC/MachObjectWriter.cpp b/llvm/lib/MC/MachObjectWriter.cpp index d31ecef27a8..1eb7c1ceead 100644 --- a/llvm/lib/MC/MachObjectWriter.cpp +++ b/llvm/lib/MC/MachObjectWriter.cpp @@ -884,6 +884,17 @@ public: // FIXME: Currently, these are never generated (see code below). I cannot // find a case where they are actually emitted. Type = macho::RIT_Vanilla; + } else if (SD->getSymbol().isVariable()) { + const MCExpr *Value = SD->getSymbol().getVariableValue(); + int64_t Res; + bool isAbs = Value->EvaluateAsAbsolute(Res, Layout, SectionAddress); + if (isAbs) { + FixedValue = Res; + return; + } else { + report_fatal_error("unsupported relocation of variable '" + + SD->getSymbol().getName() + "'"); + } } else { // Check whether we need an external or internal relocation. if (doesSymbolRequireExternRelocation(SD)) { |