mirror of
https://github.com/rui314/mold.git
synced 2024-10-05 00:57:08 +03:00
[ELF] Create dynamic entries for .relr.dyn
If the corresponding DT_RELR, DT_RELRSZ and DT_RELRENT dynamic entries are not present, dynamic linkers won't pick up the relocations encoded in .relr.dyn. Signed-off-by: Daniel Bertalan <dani@danielbertalan.dev>
This commit is contained in:
parent
1ae6c55c52
commit
d1151a9528
@ -186,6 +186,9 @@ static constexpr u32 DT_INIT_ARRAYSZ = 27;
|
||||
static constexpr u32 DT_FINI_ARRAYSZ = 28;
|
||||
static constexpr u32 DT_RUNPATH = 29;
|
||||
static constexpr u32 DT_FLAGS = 30;
|
||||
static constexpr u32 DT_RELRSZ = 35;
|
||||
static constexpr u32 DT_RELR = 36;
|
||||
static constexpr u32 DT_RELRENT = 37;
|
||||
static constexpr u32 DT_GNU_HASH = 0x6ffffef5;
|
||||
static constexpr u32 DT_VERSYM = 0x6ffffff0;
|
||||
static constexpr u32 DT_RELACOUNT = 0x6ffffff9;
|
||||
|
@ -524,6 +524,12 @@ static std::vector<typename E::WordTy> create_dynamic_section(Context<E> &ctx) {
|
||||
define(E::is_rel ? DT_RELENT : DT_RELAENT, sizeof(ElfRel<E>));
|
||||
}
|
||||
|
||||
if (ctx.relrdyn) {
|
||||
define(DT_RELR, ctx.relrdyn->shdr.sh_addr);
|
||||
define(DT_RELRSZ, ctx.relrdyn->shdr.sh_size);
|
||||
define(DT_RELRENT, ctx.relrdyn->shdr.sh_entsize);
|
||||
}
|
||||
|
||||
if (ctx.relplt->shdr.sh_size) {
|
||||
define(DT_JMPREL, ctx.relplt->shdr.sh_addr);
|
||||
define(DT_PLTRELSZ, ctx.relplt->shdr.sh_size);
|
||||
|
Loading…
Reference in New Issue
Block a user