aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2018-09-18 20:46:55 +0000
committerDimitry Andric <dim@FreeBSD.org>2018-09-18 20:46:55 +0000
commite837bd8d024753f126e57bf72f4e368a52e5dd01 (patch)
tree3f7e3649f8dac293fe088946b7d3a240a0866e10
parent8620f1555c4aa6d68bf34a0e22ff294f4fc0a2d8 (diff)
downloadsrc-e837bd8d024753f126e57bf72f4e368a52e5dd01.tar.gz
src-e837bd8d024753f126e57bf72f4e368a52e5dd01.zip
MFC r309748 (by glebius):
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 PR: 231451
Notes
Notes: svn path=/stable/8/; revision=338756
-rw-r--r--sys/amd64/amd64/elf_machdep.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/sys/amd64/amd64/elf_machdep.c b/sys/amd64/amd64/elf_machdep.c
index 7dcaac7be06a..20e49f99c6ec 100644
--- a/sys/amd64/amd64/elf_machdep.c
+++ b/sys/amd64/amd64/elf_machdep.c
@@ -161,6 +161,7 @@ elf_reloc_internal(linker_file_t lf, Elf_Addr relocbase, const void *data,
switch (rtype) {
case R_X86_64_PC32:
case R_X86_64_32S:
+ case R_X86_64_PLT32:
addend = *(Elf32_Addr *)where;
break;
default:
@@ -194,6 +195,8 @@ elf_reloc_internal(linker_file_t lf, Elf_Addr relocbase, const void *data,
break;
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 */
addr = lookup(lf, symidx, 1);
where32 = (Elf32_Addr *)where;
val32 = (Elf32_Addr)(addr + addend - (Elf_Addr)where);