1
1
mirror of https://github.com/rui314/mold.git synced 2024-10-04 16:48:04 +03:00

[ELF] Improve R_X86_64_PC64 and R_386_PC32 handlings

I believe they can be represented using dynamic relocations at runtime.
Since they are used rarely and there even seem to have no assembler
syntax to generate such relocations, I can't write tests for them.
This commit is contained in:
Rui Ueyama 2022-01-13 00:16:41 +09:00
parent 74e0e4f6d0
commit 299078aefe
2 changed files with 3 additions and 4 deletions

View File

@ -426,7 +426,7 @@ void InputSection<I386>::scan_relocations(Context<I386> &ctx) {
case R_386_PC32: {
Action table[][4] = {
// Absolute Local Imported data Imported code
{ BASEREL, NONE, ERROR, ERROR }, // DSO
{ BASEREL, NONE, DYNREL, DYNREL }, // DSO
{ BASEREL, NONE, COPYREL, PLT }, // PIE
{ NONE, NONE, COPYREL, PLT }, // PDE
};

View File

@ -82,8 +82,7 @@ static void write_ibtplt(Context<X86_64> &ctx) {
}
}
// The regular PLT. Unless `-z ibtplt` is given (which is rare), this
// version will be used.
// The regular PLT.
static void write_plt(Context<X86_64> &ctx) {
u8 *buf = ctx.buf + ctx.plt->shdr.sh_offset;
@ -654,7 +653,7 @@ void InputSection<X86_64>::scan_relocations(Context<X86_64> &ctx) {
case R_X86_64_PC64: {
Action table[][4] = {
// Absolute Local Imported data Imported code
{ BASEREL, NONE, ERROR, ERROR }, // DSO
{ BASEREL, NONE, DYNREL, DYNREL }, // DSO
{ BASEREL, NONE, COPYREL, PLT }, // PIE
{ NONE, NONE, COPYREL, PLT }, // PDE
};