From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Morton Subject: Re: [PATCH v3] kallsyms: add support for relative offsets in kallsyms address table Date: Fri, 22 Jan 2016 15:34:28 -0800 Message-ID: <20160122153428.8422f42877c7707dbcba0259@linux-foundation.org> References: <1453373299-28181-1-git-send-email-ard.biesheuvel@linaro.org> <1453396783-21591-1-git-send-email-ard.biesheuvel@linaro.org> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1453396783-21591-1-git-send-email-ard.biesheuvel@linaro.org> Sender: linux-kernel-owner@vger.kernel.org To: Ard Biesheuvel Cc: linux-kernel@vger.kernel.org, linux-s390@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, x86@kernel.org, keescook@chromium.org, mingo@kernel.org, hpa@zytor.com, heiko.carstens@de.ibm.com, benh@kernel.crashing.org, mpe@ellerman.id.au, mmarek@suse.cz, rusty@rustcorp.com.au, arnd@arndb.de, linux-arch@vger.kernel.org List-Id: linux-arch.vger.kernel.org On Thu, 21 Jan 2016 18:19:43 +0100 Ard Biesheuvel wrote: > Similar to how relative extables are implemented, it is possible to emit > the kallsyms table in such a way that it contains offsets relative to some > anchor point in the kernel image rather than absolute addresses. The benefit > is that such table entries are no longer subject to dynamic relocation when > the build time and runtime offsets of the kernel image are different. Also, > on 64-bit architectures, it essentially cuts the size of the address table > in half since offsets can typically be expressed in 32 bits. > > Since it is useful for some architectures (like x86) to retain the ability > to emit absolute values as well, this patch adds support for both, by > emitting absolute addresses as positive 32-bit values, and addresses > relative to the lowest encountered relative symbol as negative values, which > are subtracted from the runtime address of this base symbol to produce the > actual address. > > Support for the above is enabled by default for all architectures except > IA-64, whose symbols are too far apart to capture in this manner. scripts/kallsyms.c: In function 'record_relative_base': scripts/kallsyms.c:744: error: 'ULLONG_MAX' undeclared (first use in this function) scripts/kallsyms.c:744: error: (Each undeclared identifier is reported only once scripts/kallsyms.c:744: error: for each function it appears in.) That's with (ancient) glibc-headers-2.5-3. It appears that limits.h's ULLONG_MAX requires "#ifdef __USE_ISOC99". I'm not sure what's the correct way of turning this on. From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.linuxfoundation.org ([140.211.169.12]:59721 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756393AbcAVXea (ORCPT ); Fri, 22 Jan 2016 18:34:30 -0500 Date: Fri, 22 Jan 2016 15:34:28 -0800 From: Andrew Morton Subject: Re: [PATCH v3] kallsyms: add support for relative offsets in kallsyms address table Message-ID: <20160122153428.8422f42877c7707dbcba0259@linux-foundation.org> In-Reply-To: <1453396783-21591-1-git-send-email-ard.biesheuvel@linaro.org> References: <1453373299-28181-1-git-send-email-ard.biesheuvel@linaro.org> <1453396783-21591-1-git-send-email-ard.biesheuvel@linaro.org> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-arch-owner@vger.kernel.org List-ID: To: Ard Biesheuvel Cc: linux-kernel@vger.kernel.org, linux-s390@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, x86@kernel.org, keescook@chromium.org, mingo@kernel.org, hpa@zytor.com, heiko.carstens@de.ibm.com, benh@kernel.crashing.org, mpe@ellerman.id.au, mmarek@suse.cz, rusty@rustcorp.com.au, arnd@arndb.de, linux-arch@vger.kernel.org Message-ID: <20160122233428.cjqe9nGnHFujcdtJG3BLqUF1WRHUHKFBxIFtJYWPwsI@z> On Thu, 21 Jan 2016 18:19:43 +0100 Ard Biesheuvel wrote: > Similar to how relative extables are implemented, it is possible to emit > the kallsyms table in such a way that it contains offsets relative to some > anchor point in the kernel image rather than absolute addresses. The benefit > is that such table entries are no longer subject to dynamic relocation when > the build time and runtime offsets of the kernel image are different. Also, > on 64-bit architectures, it essentially cuts the size of the address table > in half since offsets can typically be expressed in 32 bits. > > Since it is useful for some architectures (like x86) to retain the ability > to emit absolute values as well, this patch adds support for both, by > emitting absolute addresses as positive 32-bit values, and addresses > relative to the lowest encountered relative symbol as negative values, which > are subtracted from the runtime address of this base symbol to produce the > actual address. > > Support for the above is enabled by default for all architectures except > IA-64, whose symbols are too far apart to capture in this manner. scripts/kallsyms.c: In function 'record_relative_base': scripts/kallsyms.c:744: error: 'ULLONG_MAX' undeclared (first use in this function) scripts/kallsyms.c:744: error: (Each undeclared identifier is reported only once scripts/kallsyms.c:744: error: for each function it appears in.) That's with (ancient) glibc-headers-2.5-3. It appears that limits.h's ULLONG_MAX requires "#ifdef __USE_ISOC99". I'm not sure what's the correct way of turning this on.