From owner-svn-src-stable@freebsd.org Tue Sep 18 20:46:57 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 09CB010A895C; Tue, 18 Sep 2018 20:46:57 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B349882AD4; Tue, 18 Sep 2018 20:46:56 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AB0C32513E; Tue, 18 Sep 2018 20:46:56 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w8IKkupW055606; Tue, 18 Sep 2018 20:46:56 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w8IKkuJm055605; Tue, 18 Sep 2018 20:46:56 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201809182046.w8IKkuJm055605@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Tue, 18 Sep 2018 20:46:56 +0000 (UTC) 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 X-SVN-Group: stable-11 X-SVN-Commit-Author: dim X-SVN-Commit-Paths: in stable: 10/sys/amd64/amd64 11/sys/amd64/amd64 8/sys/amd64/amd64 9/sys/amd64/amd64 X-SVN-Commit-Revision: 338756 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Sep 2018 20:46:57 -0000 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);