Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 9 Dec 2016 18:07:28 +0000 (UTC)
From:      Gleb Smirnoff <glebius@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r309748 - head/sys/amd64/amd64
Message-ID:  <201612091807.uB9I7SYU091609@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: glebius
Date: Fri Dec  9 18:07:28 2016
New Revision: 309748
URL: https://svnweb.freebsd.org/changeset/base/309748

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

Modified:
  head/sys/amd64/amd64/elf_machdep.c

Modified: head/sys/amd64/amd64/elf_machdep.c
==============================================================================
--- head/sys/amd64/amd64/elf_machdep.c	Fri Dec  9 18:00:45 2016	(r309747)
+++ head/sys/amd64/amd64/elf_machdep.c	Fri Dec  9 18:07:28 2016	(r309748)
@@ -178,6 +178,7 @@ elf_reloc_internal(linker_file_t lf, Elf
 		switch (rtype) {
 		case R_X86_64_PC32:
 		case R_X86_64_32S:
+		case R_X86_64_PLT32:
 			addend = *(Elf32_Addr *)where;
 			break;
 		default:
@@ -211,6 +212,8 @@ elf_reloc_internal(linker_file_t lf, Elf
 			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?201612091807.uB9I7SYU091609>