From patchwork Fri Mar 13 12:07:32 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 45773 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f199.google.com (mail-wi0-f199.google.com [209.85.212.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 1FFAB214BF for ; Fri, 13 Mar 2015 12:13:44 +0000 (UTC) Received: by wivr20 with SMTP id r20sf3289235wiv.0 for ; Fri, 13 Mar 2015 05:13:42 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:subject:date:message-id :in-reply-to:references:cc:precedence:list-id:list-unsubscribe :list-archive:list-post:list-help:list-subscribe:mime-version :content-type:content-transfer-encoding:sender:errors-to :x-original-sender:x-original-authentication-results:mailing-list; bh=H/8JC5xP8LQhgFGnPS4olgHp4Df9BGHric5qUCjzQGU=; b=aGIPewIgpYzPkPpeaRnN1wLaG7E63aBQM1TUNspMUfULrF50TfdJiotLD+Tv6QWWgm OhXsXZbezuM6g6yXUnnSgJS+/saMzWELzoSvS8Xg78IVpXrj74BEj7Awkc8w9ZRdcTMm ZC5fACgLkizjP0UyYBGt5s+ZTH34vXvwqO8gAUmRdKAAc8qPqeVvR6JxfvkFtxfouT3m EFeWjvDA1qAL0ocYR0XTLWrpQ+b1E/kuWIgeKDArBCc42kvsZ6Sjdl28bAfgKEjO1xXb m2cBx9nzMHDZMLjqhzj6cZAW/f2tI4rjtJjWlpksdUZLfMr2TiJ5dF0N8nSUNPByrzP4 m+IA== X-Gm-Message-State: ALoCoQkLW+8Nw/h2bs3NksBegTxN9r8X7kNM5L8//s1EPynjekbggopqVcnTxwGaPgvLW1KmXYlk X-Received: by 10.180.90.169 with SMTP id bx9mr4410415wib.6.1426248822443; Fri, 13 Mar 2015 05:13:42 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.20.98 with SMTP id m2ls411413lae.5.gmail; Fri, 13 Mar 2015 05:13:42 -0700 (PDT) X-Received: by 10.112.138.233 with SMTP id qt9mr43048547lbb.44.1426248822021; Fri, 13 Mar 2015 05:13:42 -0700 (PDT) Received: from mail-lb0-f182.google.com (mail-lb0-f182.google.com. [209.85.217.182]) by mx.google.com with ESMTPS id s1si1240390lbf.154.2015.03.13.05.13.41 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 13 Mar 2015 05:13:41 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.182 as permitted sender) client-ip=209.85.217.182; Received: by lbjb6 with SMTP id b6so22210526lbj.9 for ; Fri, 13 Mar 2015 05:13:41 -0700 (PDT) X-Received: by 10.112.204.197 with SMTP id la5mr42615236lbc.29.1426248821578; Fri, 13 Mar 2015 05:13:41 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.35.133 with SMTP id h5csp864928lbj; Fri, 13 Mar 2015 05:13:40 -0700 (PDT) X-Received: by 10.107.9.213 with SMTP id 82mr66430378ioj.57.1426248819990; Fri, 13 Mar 2015 05:13:39 -0700 (PDT) Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id hv8si3722802pad.13.2015.03.13.05.13.39 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 13 Mar 2015 05:13:39 -0700 (PDT) Received-SPF: none (google.com: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org does not designate permitted sender hosts) client-ip=2001:1868:205::9; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1YWORT-0003R0-0Q; Fri, 13 Mar 2015 12:11:51 +0000 Received: from merlin.infradead.org ([2001:4978:20e::2]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1YWOOE-000062-K6 for linux-arm-kernel@bombadil.infradead.org; Fri, 13 Mar 2015 12:08:30 +0000 Received: from mail-we0-f169.google.com ([74.125.82.169]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1YWOOC-0000Hf-Bz for linux-arm-kernel@lists.infradead.org; Fri, 13 Mar 2015 12:08:28 +0000 Received: by wesq59 with SMTP id q59so22785687wes.9 for ; Fri, 13 Mar 2015 05:08:04 -0700 (PDT) X-Received: by 10.180.74.135 with SMTP id t7mr9058921wiv.72.1426248484134; Fri, 13 Mar 2015 05:08:04 -0700 (PDT) Received: from ards-macbook-pro.local (53.Red-79-151-58.dynamicIP.rima-tde.net. [79.151.58.53]) by mx.google.com with ESMTPSA id w4sm2507612wib.19.2015.03.13.05.08.01 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 13 Mar 2015 05:08:03 -0700 (PDT) From: Ard Biesheuvel To: linux-arm-kernel@lists.infradead.org, arnd@arndb.de, linux@arm.linux.org.uk, nico@linaro.org Subject: [PATCH v2 8/8] kallsyms: allow kallsyms data to reside in the .data section Date: Fri, 13 Mar 2015 13:07:32 +0100 Message-Id: <1426248452-4773-9-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1426248452-4773-1-git-send-email-ard.biesheuvel@linaro.org> References: <1426248452-4773-1-git-send-email-ard.biesheuvel@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150313_080828_523407_820DD7D1 X-CRM114-Status: GOOD ( 15.71 ) X-Spam-Score: -2.6 (--) X-Spam-Report: SpamAssassin version 3.4.0 on merlin.infradead.org summary: Content analysis details: (-2.6 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [74.125.82.169 listed in list.dnswl.org] -0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [74.125.82.169 listed in wl.mailspike.net] -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.0 RCVD_IN_MSPIKE_WL Mailspike good senders Cc: linux-arch@vger.kernel.org, Andrew Morton , Rusty Russell , Ard Biesheuvel X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: ard.biesheuvel@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.182 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 On architectures such as ARM, the default location of the kallsyms data in the rodata section may be problematic, as it then sits right between the .text and .init.text/.exit.text sections. This is usually not a problem, but as soon as the code size exceeds a certain threshold, the linker will start adding trampolines to ensure the two code regions can reach each other through ordinary relative branches. This causes inconsistencies between subsequent versions of the kallsyms data, causing the build to fail. This adds a Kconfig symbol that, when set, causes the kallsyms data regions to be moved to the .data section instead, which works around this problem. Cc: linux-arch@vger.kernel.org Cc: Rusty Russell Cc: Andrew Morton Signed-off-by: Ard Biesheuvel --- arch/arm/Kconfig | 1 + include/asm-generic/vmlinux.lds.h | 12 +++++++++++- init/Kconfig | 4 ++++ scripts/kallsyms.c | 2 +- 4 files changed, 17 insertions(+), 2 deletions(-) diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 9f1f09a2bc9b..639e215bd9a1 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -11,6 +11,7 @@ config ARM select ARCH_USE_BUILTIN_BSWAP select ARCH_USE_CMPXCHG_LOCKREF select ARCH_WANT_IPC_PARSE_VERSION + select ARCH_HAVE_KALLSYMS_IN_DATA_SECTION select BUILDTIME_EXTABLE_SORT if MMU select CLONE_BACKWARDS select CPU_PM if (SUSPEND || CPU_IDLE) diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h index 463231d5bfc7..09f93bfaad0e 100644 --- a/include/asm-generic/vmlinux.lds.h +++ b/include/asm-generic/vmlinux.lds.h @@ -150,6 +150,14 @@ #define TRACE_SYSCALLS() #endif +#ifdef CONFIG_ARCH_HAVE_KALLSYMS_IN_DATA_SECTION +#define KALLSYMS_RODATA +#define KALLSYMS_DATA *(.kallsyms_data) +#else +#define KALLSYMS_RODATA *(.kallsyms_data) +#define KALLSYMS_DATA +#endif + #define ___OF_TABLE(cfg, name) _OF_TABLE_##cfg(name) #define __OF_TABLE(cfg, name) ___OF_TABLE(cfg, name) @@ -197,7 +205,8 @@ LIKELY_PROFILE() \ BRANCH_PROFILE() \ TRACE_PRINTKS() \ - TRACEPOINT_STR() + TRACEPOINT_STR() \ + KALLSYMS_DATA /* * Data section helpers @@ -234,6 +243,7 @@ .rodata : AT(ADDR(.rodata) - LOAD_OFFSET) { \ VMLINUX_SYMBOL(__start_rodata) = .; \ *(.rodata) *(.rodata.*) \ + KALLSYMS_RODATA \ *(__vermagic) /* Kernel version magic */ \ . = ALIGN(8); \ VMLINUX_SYMBOL(__start___tracepoints_ptrs) = .; \ diff --git a/init/Kconfig b/init/Kconfig index 058e3671fa11..d6f4920f3487 100644 --- a/init/Kconfig +++ b/init/Kconfig @@ -1410,6 +1410,10 @@ config KALLSYMS_ALL Say N unless you really need all symbols. +config ARCH_HAVE_KALLSYMS_IN_DATA_SECTION + bool + depends on KALLSYMS + config PRINTK default y bool "Enable support for printk" if EXPERT diff --git a/scripts/kallsyms.c b/scripts/kallsyms.c index c6d33bd15b04..b23682a967e0 100644 --- a/scripts/kallsyms.c +++ b/scripts/kallsyms.c @@ -333,7 +333,7 @@ static void write_src(void) printf("#define ALGN .align 4\n"); printf("#endif\n"); - printf("\t.section .rodata, \"a\"\n"); + printf("\t.section .kallsyms_data, \"a\"\n"); /* Provide proper symbols relocatability by their '_text' * relativeness. The symbol names cannot be used to construct