Treat R_X86_64_PLT32 relocs as R_X86_64_PC32.
If we load a binary that is designed to be a library, it produces relocatable code via assembler directives in the assembly itself (rather than compiler options). This emits R_X86_64_PLT32 relocations, which are not handled by the kernel linker. Submitted by: gallatin Reviewed by: kib
This commit is contained in:
@@ -178,6 +178,7 @@ elf_reloc_internal(linker_file_t lf, Elf_Addr relocbase, const void *data,
|
|||||||
switch (rtype) {
|
switch (rtype) {
|
||||||
case R_X86_64_PC32:
|
case R_X86_64_PC32:
|
||||||
case R_X86_64_32S:
|
case R_X86_64_32S:
|
||||||
|
case R_X86_64_PLT32:
|
||||||
addend = *(Elf32_Addr *)where;
|
addend = *(Elf32_Addr *)where;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@@ -211,6 +212,8 @@ elf_reloc_internal(linker_file_t lf, Elf_Addr relocbase, const void *data,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case R_X86_64_PC32: /* S + A - P */
|
case R_X86_64_PC32: /* S + A - P */
|
||||||
|
case R_X86_64_PLT32: /* L + A - P, L is PLT location for
|
||||||
|
the symbol, which we treat as S */
|
||||||
error = lookup(lf, symidx, 1, &addr);
|
error = lookup(lf, symidx, 1, &addr);
|
||||||
where32 = (Elf32_Addr *)where;
|
where32 = (Elf32_Addr *)where;
|
||||||
val32 = (Elf32_Addr)(addr + addend - (Elf_Addr)where);
|
val32 = (Elf32_Addr)(addr + addend - (Elf_Addr)where);
|
||||||
|
|||||||
Reference in New Issue
Block a user