From owner-svn-src-all@freebsd.org Wed Feb 27 13:24:43 2019 Return-Path: Delivered-To: svn-src-all@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 85C53151D3A4; Wed, 27 Feb 2019 13:24:43 +0000 (UTC) (envelope-from luporl@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 221CF76931; Wed, 27 Feb 2019 13:24:43 +0000 (UTC) (envelope-from luporl@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 109D91D571; Wed, 27 Feb 2019 13:24:43 +0000 (UTC) (envelope-from luporl@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x1RDOgPi082153; Wed, 27 Feb 2019 13:24:42 GMT (envelope-from luporl@FreeBSD.org) Received: (from luporl@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x1RDOgQX082151; Wed, 27 Feb 2019 13:24:42 GMT (envelope-from luporl@FreeBSD.org) Message-Id: <201902271324.x1RDOgQX082151@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: luporl set sender to luporl@FreeBSD.org using -f From: Leandro Lupori Date: Wed, 27 Feb 2019 13:24:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r344620 - head/usr.sbin/kldxref X-SVN-Group: head X-SVN-Commit-Author: luporl X-SVN-Commit-Paths: head/usr.sbin/kldxref X-SVN-Commit-Revision: 344620 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 221CF76931 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_LONG(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.97)[-0.969,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 Feb 2019 13:24:43 -0000 Author: luporl Date: Wed Feb 27 13:24:42 2019 New Revision: 344620 URL: https://svnweb.freebsd.org/changeset/base/344620 Log: Fix kldxref on PowerPC64 When using kldxref on kernel modules built with clang8 + lld8, kldxref would be unable to find the modules metadata information, because PowerPC64 was using the ef_nop.c implementation of ef_reloc(). When GNU LD was used, it was also relocating the metadata section of the .ko file. LLD does not do this, but only generate dynamic relocations for it. With minor changes, ef_powerpc.c can now work for PowerPC64 too. Reviewed by: emaste Differential Revision: https://reviews.freebsd.org/D19370 Modified: head/usr.sbin/kldxref/Makefile head/usr.sbin/kldxref/ef_powerpc.c Modified: head/usr.sbin/kldxref/Makefile ============================================================================== --- head/usr.sbin/kldxref/Makefile Wed Feb 27 13:01:17 2019 (r344619) +++ head/usr.sbin/kldxref/Makefile Wed Feb 27 13:24:42 2019 (r344620) @@ -6,7 +6,7 @@ SRCS= kldxref.c ef.c ef_obj.c WARNS?= 2 -.if exists(ef_${MACHINE_CPUARCH}.c) && ${MACHINE_ARCH} != "powerpc64" +.if exists(ef_${MACHINE_CPUARCH}.c) SRCS+= ef_${MACHINE_CPUARCH}.c .else SRCS+= ef_nop.c Modified: head/usr.sbin/kldxref/ef_powerpc.c ============================================================================== --- head/usr.sbin/kldxref/ef_powerpc.c Wed Feb 27 13:01:17 2019 (r344619) +++ head/usr.sbin/kldxref/ef_powerpc.c Wed Feb 27 13:24:42 2019 (r344620) @@ -34,10 +34,17 @@ #include #include +#include #include #include "ef.h" +#ifdef __powerpc64__ +#define PRI_ELF_SIZE PRIu64 +#else +#define PRI_ELF_SIZE PRIu32 +#endif + /* * Apply relocations to the values obtained from the file. `relbase' is the * target relocation address of the section, and `dataoff/len' is the region @@ -63,11 +70,11 @@ ef_reloc(struct elf_file *ef, const void *reldata, int return (0); switch (rtype) { - case R_PPC_RELATIVE: /* word32 B + A */ + case R_PPC_RELATIVE: /* word32|doubleword64 B + A */ *where = relbase + addend; break; default: - warnx("unhandled relocation type %u", rtype); + warnx("unhandled relocation type %" PRI_ELF_SIZE, rtype); } return (0); }