summaryrefslogtreecommitdiff
path: root/gold/reloc.h
diff options
context:
space:
mode:
Diffstat (limited to 'gold/reloc.h')
-rw-r--r--gold/reloc.h23
1 files changed, 23 insertions, 0 deletions
diff --git a/gold/reloc.h b/gold/reloc.h
index 3a33c9b01ba..fefcb3f1e28 100644
--- a/gold/reloc.h
+++ b/gold/reloc.h
@@ -247,6 +247,8 @@ class Relocatable_relocs
RELOC_ADJUST_FOR_SECTION_2,
RELOC_ADJUST_FOR_SECTION_4,
RELOC_ADJUST_FOR_SECTION_8,
+ // Like RELOC_ADJUST_FOR_SECTION_4 but for unaligned relocs.
+ RELOC_ADJUST_FOR_SECTION_4_UNALIGNED,
// Discard the input reloc--process it completely when relocating
// the data section contents.
RELOC_DISCARD,
@@ -347,6 +349,20 @@ private:
elfcpp::Swap<valsize, big_endian>::writeval(wv, x);
}
+ // Like the above but for relocs at unaligned addresses.
+ template<int valsize>
+ static inline void
+ rel_unaligned(unsigned char* view,
+ const Sized_relobj_file<size, big_endian>* object,
+ const Symbol_value<size>* psymval)
+ {
+ typedef typename elfcpp::Swap_unaligned<valsize, big_endian>::Valtype
+ Valtype;
+ Valtype x = elfcpp::Swap_unaligned<valsize, big_endian>::readval(view);
+ x = psymval->value(object, x);
+ elfcpp::Swap_unaligned<valsize, big_endian>::writeval(view, x);
+ }
+
// Do a simple relocation with the addend in the relocation.
// VALSIZE is the size of the value.
template<int valsize>
@@ -558,6 +574,13 @@ public:
const Symbol_value<size>* psymval)
{ This::template rel<32>(view, object, psymval); }
+ // Like above but for relocs at unaligned addresses.
+ static inline void
+ rel32_unaligned(unsigned char* view,
+ const Sized_relobj_file<size, big_endian>* object,
+ const Symbol_value<size>* psymval)
+ { This::template rel_unaligned<32>(view, object, psymval); }
+
// Do an 32-bit RELA relocation with the addend in the relocation.
static inline void
rela32(unsigned char* view, elfcpp::Elf_Word value, elfcpp::Elf_Word addend)