From patchwork Mon Mar 30 11:49:26 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 6120411 Return-Path: X-Original-To: patchwork-linux-kbuild@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 4FF52BF4A7 for ; Mon, 30 Mar 2015 11:49:49 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5F6F5202FE for ; Mon, 30 Mar 2015 11:49:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5102F20373 for ; Mon, 30 Mar 2015 11:49:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752631AbbC3Ltm (ORCPT ); Mon, 30 Mar 2015 07:49:42 -0400 Received: from mail-wi0-f172.google.com ([209.85.212.172]:35821 "EHLO mail-wi0-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752846AbbC3Ltk (ORCPT ); Mon, 30 Mar 2015 07:49:40 -0400 Received: by wicne17 with SMTP id ne17so27969234wic.0 for ; Mon, 30 Mar 2015 04:49:39 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=BJbvv7Be2i5K92U6ew67hCSrorGXITY1vx+lp7LB5dQ=; b=J7C+k4f57+pZ0zcC/GFJst2TwSVG5852XWpHPyi6ewk126hzBbCXKt6VBuOATCC+UN hAviDXnmi4d1rH5LzzhMF2Qd6D2uhJGuDR4+UGPtF5vuwKF5wB3iSnJvi3sJjiGrZtkO he5Jv5NQLgLkWgea/tkEqyVryzq2qvZdEjYoKNAZ7VHxJXv1j+TvErBslxVC0o5P8/Rv S6fxvepw9BblMDwECHzd5Pq9s4dSIu4UZy1RphE7J2Dnw120zHRmFrXhAj84WV0OC0RD XYQpmQXMGqkbcvrDZUrDfRp3C0UdXUgazMv/Ty/gVpOpkmA1g24wx8jQlAgexer3Hk72 UN0w== X-Gm-Message-State: ALoCoQnpch59caXC9h/4zzNdmmEDsFgs4+QSWTKLwbv0q4lVyDHPnz3R0IipqBDUgKLF2jKpuaOc X-Received: by 10.194.60.173 with SMTP id i13mr61864885wjr.124.1427716179177; Mon, 30 Mar 2015 04:49:39 -0700 (PDT) Received: from ards-macbook-pro.local (129.20.90.92.rev.sfr.net. [92.90.20.129]) by mx.google.com with ESMTPSA id md2sm15976347wic.19.2015.03.30.04.49.36 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 30 Mar 2015 04:49:38 -0700 (PDT) From: Ard Biesheuvel To: linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, arnd@arndb.de, mmarek@suse.cz, linux@arm.linux.org.uk Cc: Ard Biesheuvel Subject: [RFC PATCH 1/2] Kbuild: kallsyms: ignore veneers emitted by the ARM linker Date: Mon, 30 Mar 2015 13:49:26 +0200 Message-Id: <1427716167-25078-2-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1427716167-25078-1-git-send-email-ard.biesheuvel@linaro.org> References: <1427716167-25078-1-git-send-email-ard.biesheuvel@linaro.org> Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP When linking large kernels on ARM, the linker will insert veneers (i.e., PLT like stubs) when function symbols are out of reach for the ordinary relative branch/branch-and-link instructions. However, due to the fact that the kallsyms region sits in .rodata, which is between .text and .init.text, additional veneers may be emitted in the second pass due to the fact that the size of the kallsyms region itself has pushed the .init.text section further down, resulting in additional veneers to be emitted. So ignore the veneers when generating the symbol table. Veneers have no corresponding source code, and they will not turn up in backtraces anyway. Signed-off-by: Ard Biesheuvel --- scripts/kallsyms.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/scripts/kallsyms.c b/scripts/kallsyms.c index c6d33bd15b04..6668c87d599f 100644 --- a/scripts/kallsyms.c +++ b/scripts/kallsyms.c @@ -212,6 +212,12 @@ static int symbol_valid(struct sym_entry *s) "_SDA_BASE_", /* ppc */ "_SDA2_BASE_", /* ppc */ NULL }; + + static char *special_suffixes[] = { + "_compiled.", /* gcc < 3.0: "gcc[0-9]_compiled." */ + "_veneer", /* arm */ + NULL }; + int i; int offset = 1; @@ -244,13 +250,18 @@ static int symbol_valid(struct sym_entry *s) } /* Exclude symbols which vary between passes. */ - if (strstr((char *)s->sym + offset, "_compiled.")) - return 0; - for (i = 0; special_symbols[i]; i++) if( strcmp((char *)s->sym + offset, special_symbols[i]) == 0 ) return 0; + for (i = 0; special_suffixes[i]; i++) { + char *sym_name = (char *)s->sym + offset; + int l = strlen(sym_name) - strlen(special_suffixes[i]); + + if (l >= 0 && strcmp(sym_name + l, special_suffixes[i]) == 0) + return 0; + } + return 1; }