diff options
| author | Andrew Kelley <superjoe30@gmail.com> | 2018-01-17 17:29:21 -0500 |
|---|---|---|
| committer | Andrew Kelley <superjoe30@gmail.com> | 2018-01-17 17:29:21 -0500 |
| commit | 4aed7ea6f89a091aede10ccf0fb45b3ce12c710d (patch) | |
| tree | 1e29f13ad17bfc841c33f6ac3d0ccb092404f409 /deps/lld/ELF/Arch/PPC.cpp | |
| parent | 48cd808185f54e935714539d101585a9a0a41673 (diff) | |
| download | zig-4aed7ea6f89a091aede10ccf0fb45b3ce12c710d.tar.gz zig-4aed7ea6f89a091aede10ccf0fb45b3ce12c710d.zip | |
update embedded LLD to 6.0.0rc1
Diffstat (limited to 'deps/lld/ELF/Arch/PPC.cpp')
| -rw-r--r-- | deps/lld/ELF/Arch/PPC.cpp | 36 |
1 files changed, 21 insertions, 15 deletions
diff --git a/deps/lld/ELF/Arch/PPC.cpp b/deps/lld/ELF/Arch/PPC.cpp index 19e10729a0..6af0df331d 100644 --- a/deps/lld/ELF/Arch/PPC.cpp +++ b/deps/lld/ELF/Arch/PPC.cpp @@ -7,9 +7,9 @@ // //===----------------------------------------------------------------------===// -#include "Error.h" #include "Symbols.h" #include "Target.h" +#include "lld/Common/ErrorHandler.h" #include "llvm/Support/Endian.h" using namespace llvm; @@ -22,17 +22,33 @@ namespace { class PPC final : public TargetInfo { public: PPC() { GotBaseSymOff = 0x8000; } - void relocateOne(uint8_t *Loc, uint32_t Type, uint64_t Val) const override; - RelExpr getRelExpr(uint32_t Type, const SymbolBody &S, + void relocateOne(uint8_t *Loc, RelType Type, uint64_t Val) const override; + RelExpr getRelExpr(RelType Type, const Symbol &S, const uint8_t *Loc) const override; }; } // namespace -void PPC::relocateOne(uint8_t *Loc, uint32_t Type, uint64_t Val) const { +RelExpr PPC::getRelExpr(RelType Type, const Symbol &S, + const uint8_t *Loc) const { + switch (Type) { + case R_PPC_REL24: + case R_PPC_REL32: + return R_PC; + case R_PPC_PLTREL24: + return R_PLT_PC; + default: + return R_ABS; + } +} + +void PPC::relocateOne(uint8_t *Loc, RelType Type, uint64_t Val) const { switch (Type) { case R_PPC_ADDR16_HA: write16be(Loc, (Val + 0x8000) >> 16); break; + case R_PPC_ADDR16_HI: + write16be(Loc, Val >> 16); + break; case R_PPC_ADDR16_LO: write16be(Loc, Val); break; @@ -40,6 +56,7 @@ void PPC::relocateOne(uint8_t *Loc, uint32_t Type, uint64_t Val) const { case R_PPC_REL32: write32be(Loc, Val); break; + case R_PPC_PLTREL24: case R_PPC_REL24: write32be(Loc, read32be(Loc) | (Val & 0x3FFFFFC)); break; @@ -48,17 +65,6 @@ void PPC::relocateOne(uint8_t *Loc, uint32_t Type, uint64_t Val) const { } } -RelExpr PPC::getRelExpr(uint32_t Type, const SymbolBody &S, - const uint8_t *Loc) const { - switch (Type) { - case R_PPC_REL24: - case R_PPC_REL32: - return R_PC; - default: - return R_ABS; - } -} - TargetInfo *elf::getPPCTargetInfo() { static PPC Target; return &Target; |
