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/10/sys/amd64/amd64/elf_machdep.c
Directory Properties:
  stable/10/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/11/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/11/   (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/10/sys/amd64/amd64/elf_machdep.c
==============================================================================
--- stable/10/sys/amd64/amd64/elf_machdep.c     Tue Sep 18 17:51:45 2018        
(r338755)
+++ stable/10/sys/amd64/amd64/elf_machdep.c     Tue Sep 18 20:46:55 2018        
(r338756)
@@ -181,6 +181,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:
@@ -214,6 +215,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);
_______________________________________________
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"

Reply via email to