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: 46505 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ob0-f200.google.com (mail-ob0-f200.google.com [209.85.214.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 0B5ED2159A for ; Mon, 30 Mar 2015 11:49:58 +0000 (UTC) Received: by obcrt5 with SMTP id rt5sf174394807obc.3 for ; Mon, 30 Mar 2015 04:49:57 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=JfOjLcKz3sLrzJsT/AiLd5W/BHobtMbje+kq4+i9DIQ=; b=JHjcneytJjN9bRMIchlx4VkcfRStJtPgL2uTf/kqVNHlLDCwCVV+jG73lfczh625u+ foeFBRtiD8r3k44P85kvLzmo8orAKImb280jH9vFTvXBlYJLSroPmieQ1eg3+WX5LpLv lQbs3z607vnEJpRNhgzZHL7wUhED4zcE+rgNZa5y+ZRHEw0+uLdn+R7Ux9EwuJZAyEZ9 YO6RghsfzaA/nDep/PJVhAbwfGtLw3b144BGLfYagawVimLtEJUT6EDMssXidndLkF8t Gga31S09BbhdrVY3cLYn+9qEVqthjxyxMrQ3wxKfg5PQmrR0QpHJtOh3SeFqZZCR4usK 5lBQ== X-Gm-Message-State: ALoCoQnf+F88ssydDInzTrVA98dSMAJR+5lBk7C0pyT8rjDn6tvgBuJoCcxuRO/1FsM9XMFTZH86 X-Received: by 10.182.65.37 with SMTP id u5mr39262962obs.27.1427716197684; Mon, 30 Mar 2015 04:49:57 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.25.139 with SMTP id 11ls2056329qgt.82.gmail; Mon, 30 Mar 2015 04:49:57 -0700 (PDT) X-Received: by 10.140.218.196 with SMTP id o187mr42244728qhb.30.1427716197544; Mon, 30 Mar 2015 04:49:57 -0700 (PDT) Received: from mail-qc0-f172.google.com (mail-qc0-f172.google.com. [209.85.216.172]) by mx.google.com with ESMTPS id u6si6409254qhd.83.2015.03.30.04.49.57 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 30 Mar 2015 04:49:57 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.216.172 as permitted sender) client-ip=209.85.216.172; Received: by qcbjx9 with SMTP id jx9so67999996qcb.0 for ; Mon, 30 Mar 2015 04:49:57 -0700 (PDT) X-Received: by 10.140.97.203 with SMTP id m69mr40025081qge.39.1427716197387; Mon, 30 Mar 2015 04:49:57 -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.96.155.231 with SMTP id vz7csp1399428qdb; Mon, 30 Mar 2015 04:49:56 -0700 (PDT) X-Received: by 10.68.110.37 with SMTP id hx5mr58177289pbb.46.1427716196357; Mon, 30 Mar 2015 04:49:56 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id an6si14431125pad.182.2015.03.30.04.49.55; Mon, 30 Mar 2015 04:49:56 -0700 (PDT) Received-SPF: none (google.com: linux-kernel-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752932AbbC3Ltp (ORCPT + 27 others); Mon, 30 Mar 2015 07:49:45 -0400 Received: from mail-wg0-f49.google.com ([74.125.82.49]:35190 "EHLO mail-wg0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752847AbbC3Ltk (ORCPT ); Mon, 30 Mar 2015 07:49:40 -0400 Received: by wgdm6 with SMTP id m6so171493486wgd.2 for ; Mon, 30 Mar 2015 04:49:39 -0700 (PDT) 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-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.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.216.172 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 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , 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; }