From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from foss.arm.com (usa-sjc-mx-foss1.foss.arm.com [217.140.101.70]) by lists.ozlabs.org (Postfix) with ESMTP id 41G5yC08rZzDrbK for ; Thu, 28 Jun 2018 01:13:05 +1000 (AEST) Date: Wed, 27 Jun 2018 16:13:39 +0100 From: Will Deacon To: Ard Biesheuvel Cc: linux-kernel@vger.kernel.org, Arnd Bergmann , Kees Cook , Michael Ellerman , Thomas Garnier , Thomas Gleixner , "Serge E. Hallyn" , Bjorn Helgaas , Benjamin Herrenschmidt , Russell King , Paul Mackerras , Catalin Marinas , Petr Mladek , Ingo Molnar , James Morris , Andrew Morton , Nicolas Pitre , Josh Poimboeuf , Steven Rostedt , Sergey Senozhatsky , Linus Torvalds , Jessica Yu , linux-arm-kernel@lists.infradead.org, linuxppc-dev@lists.ozlabs.org, x86@kernel.org, Ingo Molnar Subject: Re: [PATCH v9 3/6] module: use relative references for __ksymtab entries Message-ID: <20180627151339.GD30631@arm.com> References: <20180626182802.19932-1-ard.biesheuvel@linaro.org> <20180626182802.19932-4-ard.biesheuvel@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii In-Reply-To: <20180626182802.19932-4-ard.biesheuvel@linaro.org> List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Hi Ard, On Tue, Jun 26, 2018 at 08:27:58PM +0200, Ard Biesheuvel wrote: > An ordinary arm64 defconfig build has ~64 KB worth of __ksymtab > entries, each consisting of two 64-bit fields containing absolute > references, to the symbol itself and to a char array containing > its name, respectively. [...] > diff --git a/include/linux/export.h b/include/linux/export.h > index ea7df303d68d..ae072bc5aacf 100644 > --- a/include/linux/export.h > +++ b/include/linux/export.h > @@ -18,12 +18,6 @@ > #define VMLINUX_SYMBOL_STR(x) __VMLINUX_SYMBOL_STR(x) > > #ifndef __ASSEMBLY__ > -struct kernel_symbol > -{ > - unsigned long value; > - const char *name; > -}; > - > #ifdef MODULE > extern struct module __this_module; > #define THIS_MODULE (&__this_module) > @@ -54,17 +48,47 @@ extern struct module __this_module; > #define __CRC_SYMBOL(sym, sec) > #endif > > +#ifdef CONFIG_HAVE_ARCH_PREL32_RELOCATIONS > +#include > +/* > + * Emit the ksymtab entry as a pair of relative references: this reduces > + * the size by half on 64-bit architectures, and eliminates the need for > + * absolute relocations that require runtime processing on relocatable > + * kernels. > + */ > +#define __KSYMTAB_ENTRY(sym, sec) \ > + __ADDRESSABLE(sym) \ > + asm(" .section \"___ksymtab" sec "+" #sym "\", \"a\" \n" \ > + " .balign 8 \n" \ Can we use KSYM_ALIGN here instead of 8, or do we need the 8-byte alignment even on 32-bit architectures? Will