diff options
| author | Rafael Espindola <rafael.espindola@gmail.com> | 2015-06-04 05:00:12 +0000 |
|---|---|---|
| committer | Rafael Espindola <rafael.espindola@gmail.com> | 2015-06-04 05:00:12 +0000 |
| commit | a86ecee52ba011fc16a4cac338bf2a7015becb2a (patch) | |
| tree | 993f2c4a0ca9d387df188ef776edefe1961d1a29 /llvm/lib/Target | |
| parent | 4c5901eefc7f22fe5e789535b783235d8c6e77ba (diff) | |
| download | bcm5719-llvm-a86ecee52ba011fc16a4cac338bf2a7015becb2a.tar.gz bcm5719-llvm-a86ecee52ba011fc16a4cac338bf2a7015becb2a.zip | |
Revert "Pack the MCSymbolELF bit fields into MCSymbol's Flags."
This reverts commit r239006.
I am debugging the powerpc failures.
llvm-svn: 239010
Diffstat (limited to 'llvm/lib/Target')
4 files changed, 25 insertions, 10 deletions
diff --git a/llvm/lib/Target/Mips/MCTargetDesc/MipsELFObjectWriter.cpp b/llvm/lib/Target/Mips/MCTargetDesc/MipsELFObjectWriter.cpp index 982a7f54e82..82ae41330bc 100644 --- a/llvm/lib/Target/Mips/MCTargetDesc/MipsELFObjectWriter.cpp +++ b/llvm/lib/Target/Mips/MCTargetDesc/MipsELFObjectWriter.cpp @@ -384,7 +384,7 @@ bool MipsELFObjectWriter::needsRelocateWithSymbol(const MCSymbol &Sym, return true; case ELF::R_MIPS_32: - if (cast<MCSymbolELF>(Sym).getOther() & ELF::STO_MIPS_MICROMIPS) + if (cast<MCSymbolELF>(Sym).getOther() & (ELF::STO_MIPS_MICROMIPS >> 2)) return true; // falltrough case ELF::R_MIPS_26: diff --git a/llvm/lib/Target/Mips/MCTargetDesc/MipsELFStreamer.cpp b/llvm/lib/Target/Mips/MCTargetDesc/MipsELFStreamer.cpp index b45d9cf621d..d1e3a47f94b 100644 --- a/llvm/lib/Target/Mips/MCTargetDesc/MipsELFStreamer.cpp +++ b/llvm/lib/Target/Mips/MCTargetDesc/MipsELFStreamer.cpp @@ -44,7 +44,10 @@ void MipsELFStreamer::createPendingLabelRelocs() { for (auto *L : Labels) { auto *Label = cast<MCSymbolELF>(L); getAssembler().registerSymbol(*Label); - Label->setOther(ELF::STO_MIPS_MICROMIPS); + // The "other" values are stored in the last 6 bits of the second byte. + // The traditional defines for STO values assume the full byte and thus + // the shift to pack it. + Label->setOther(ELF::STO_MIPS_MICROMIPS >> 2); } } diff --git a/llvm/lib/Target/Mips/MCTargetDesc/MipsTargetStreamer.cpp b/llvm/lib/Target/Mips/MCTargetDesc/MipsTargetStreamer.cpp index a051f4c123f..787d9a7b450 100644 --- a/llvm/lib/Target/Mips/MCTargetDesc/MipsTargetStreamer.cpp +++ b/llvm/lib/Target/Mips/MCTargetDesc/MipsTargetStreamer.cpp @@ -462,7 +462,10 @@ void MipsTargetELFStreamer::emitLabel(MCSymbol *S) { if (Type != ELF::STT_FUNC) return; - Symbol->setOther(ELF::STO_MIPS_MICROMIPS); + // The "other" values are stored in the last 6 bits of the second byte + // The traditional defines for STO values assume the full byte and thus + // the shift to pack it. + Symbol->setOther(ELF::STO_MIPS_MICROMIPS >> 2); } void MipsTargetELFStreamer::finish() { @@ -524,10 +527,13 @@ void MipsTargetELFStreamer::emitAssignment(MCSymbol *S, const MCExpr *Value) { const auto &RhsSym = cast<MCSymbolELF>( static_cast<const MCSymbolRefExpr *>(Value)->getSymbol()); - if (!(RhsSym.getOther() & ELF::STO_MIPS_MICROMIPS)) + if (!(RhsSym.getOther() & (ELF::STO_MIPS_MICROMIPS >> 2))) return; - Symbol->setOther(ELF::STO_MIPS_MICROMIPS); + // The "other" values are stored in the last 6 bits of the second byte. + // The traditional defines for STO values assume the full byte and thus + // the shift to pack it. + Symbol->setOther(ELF::STO_MIPS_MICROMIPS >> 2); } MCELFStreamer &MipsTargetELFStreamer::getStreamer() { diff --git a/llvm/lib/Target/PowerPC/MCTargetDesc/PPCMCTargetDesc.cpp b/llvm/lib/Target/PowerPC/MCTargetDesc/PPCMCTargetDesc.cpp index aba262c3b1f..0f9697bb141 100644 --- a/llvm/lib/Target/PowerPC/MCTargetDesc/PPCMCTargetDesc.cpp +++ b/llvm/lib/Target/PowerPC/MCTargetDesc/PPCMCTargetDesc.cpp @@ -169,10 +169,13 @@ public: if (Res != ELF::decodePPC64LocalEntryOffset(Encoded)) report_fatal_error(".localentry expression cannot be encoded."); - unsigned Other = S->getOther(); + // The "other" values are stored in the last 6 bits of the second byte. + // The traditional defines for STO values assume the full byte and thus + // the shift to pack it. + unsigned Other = S->getOther() << 2; Other &= ~ELF::STO_PPC64_LOCAL_MASK; Other |= Encoded; - S->setOther(Other); + S->setOther(Other >> 2); // For GAS compatibility, unless we already saw a .abiversion directive, // set e_flags to indicate ELFv2 ABI. @@ -188,10 +191,13 @@ public: return; const auto &RhsSym = cast<MCSymbolELF>( static_cast<const MCSymbolRefExpr *>(Value)->getSymbol()); - unsigned Other = Symbol->getOther(); + // The "other" values are stored in the last 6 bits of the second byte. + // The traditional defines for STO values assume the full byte and thus + // the shift to pack it. + unsigned Other = Symbol->getOther() << 2; Other &= ~ELF::STO_PPC64_LOCAL_MASK; - Other |= RhsSym.getOther() & ELF::STO_PPC64_LOCAL_MASK; - Symbol->setOther(Other); + Other |= (RhsSym.getOther() << 2) & ELF::STO_PPC64_LOCAL_MASK; + Symbol->setOther(Other >> 2); } }; |

