Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 18 Sep 2018 20:46:56 +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-11@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.w8IKkuJm055605@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/11/sys/amd64/amd64/elf_machdep.c
Directory Properties:
  stable/11/   (props changed)

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

Modified: stable/11/sys/amd64/amd64/elf_machdep.c
==============================================================================
--- stable/11/sys/amd64/amd64/elf_machdep.c	Tue Sep 18 17:51:45 2018	(r338755)
+++ stable/11/sys/amd64/amd64/elf_machdep.c	Tue Sep 18 20:46:55 2018	(r338756)
@@ -200,6 +200,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:
@@ -235,6 +236,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 */
 			error = lookup(lf, symidx, 1, &addr);
 			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.w8IKkuJm055605>