kern: implement support for applying relr relocations

This commit is contained in:
Michael Scire 2023-10-11 10:12:20 -07:00 committed by SciresM
parent f93aea4c06
commit 11c02e22e0
2 changed files with 94 additions and 14 deletions

View file

@ -114,6 +114,23 @@ namespace ams::kern::init::Elf::Elf64 {
}
};
class Relr {
private:
Xword m_info;
public:
constexpr ALWAYS_INLINE bool IsLocation() const {
return (m_info & 1) == 0;
}
constexpr ALWAYS_INLINE Xword GetLocation() const {
return m_info;
}
constexpr ALWAYS_INLINE Xword GetBitmap() const {
return m_info >> 1;
}
};
enum DynamicTag {
DT_NULL = 0,
DT_RELA = 7,
@ -121,6 +138,10 @@ namespace ams::kern::init::Elf::Elf64 {
DT_REL = 17,
DT_RELENT = 19,
DT_RELRSZ = 35,
DT_RELR = 36,
DT_RELRENT = 37,
DT_RELACOUNT = 0x6ffffff9,
DT_RELCOUNT = 0x6ffffffa
};