Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 18 Sep 2018 20:46:55 +0000 (UTC)
From:      Dimitry Andric <dim@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
Subject:   svn commit: r338756 - in stable: 10/sys/amd64/amd64 11/sys/amd64/amd64 8/sys/amd64/amd64 9/sys/amd64/amd64
Message-ID:  <201809182046.w8IKkt0C055593@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: dim
Date: Tue Sep 18 20:46:55 2018
New Revision: 338756
URL: https://svnweb.freebsd.org/changeset/base/338756

Log:
  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

Modified:
  stable/9/sys/amd64/amd64/elf_machdep.c
Directory Properties:
  stable/9/   (props changed)
  stable/9/sys/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/10/sys/amd64/amd64/elf_machdep.c
  stable/11/sys/amd64/amd64/elf_machdep.c
  stable/8/sys/amd64/amd64/elf_machdep.c
Directory Properties:
  stable/10/   (props changed)
  stable/11/   (props changed)
  stable/8/   (props changed)
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/   (props changed)

Modified: stable/9/sys/amd64/amd64/elf_machdep.c
==============================================================================
--- stable/9/sys/amd64/amd64/elf_machdep.c	Tue Sep 18 17:51:45 2018	(r338755)
+++ stable/9/sys/amd64/amd64/elf_machdep.c	Tue Sep 18 20:46:55 2018	(r338756)
@@ -163,6 +163,7 @@ elf_reloc_internal(linker_file_t lf, Elf_Addr relocbas
 		switch (rtype) {
 		case R_X86_64_PC32:
 		case R_X86_64_32S:
+		case R_X86_64_PLT32:
 			addend = *(Elf32_Addr *)where;
 			break;
 		default:
@@ -196,6 +197,8 @@ elf_reloc_internal(linker_file_t lf, Elf_Addr relocbas
 			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);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201809182046.w8IKkt0C055593>