Received: by 10.223.185.111 with SMTP id b44csp734931wrg; Fri, 9 Mar 2018 12:43:18 -0800 (PST) X-Google-Smtp-Source: AG47ELuYwZuvNc0UhceeifwrRQqVzffkvp9ZfQXBBR6tluY6vphYWgzkUUbdXFdAuaiOHlk3JqOf X-Received: by 10.98.23.73 with SMTP id 70mr22470876pfx.169.1520628197969; Fri, 09 Mar 2018 12:43:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520628197; cv=none; d=google.com; s=arc-20160816; b=hdTRb19lxFYKYyhK4wqMcwfV4PBSaasebbuQcZbESxDJNt8cj/uJoAHQv23isjodUS f+w5bpsj+kmcGgwsQlZNJCuwgW1fTf9ss643yj4F0+0g6agnH+lyQaC+dh7sZQFxEUqQ FsH+GOH8puQEaJ1lH/4+Zy7cO1PV5bIM7APmPjU4467kuaTGiziRKYusuACn7xd1MP/+ 3kpCVt7HO1QJA4MllwpFMyafMg8d6kNxllGq3jxMv6SVuIARlLCfOz+q+KXfXsepI6xj /jkg3Utp0sWYvPeFqVYpdv+5bjn8oUeLh9e7iY1l2RQpCu+kfeZE3oOsPkIGws2XC9+h hYIg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :arc-authentication-results; bh=Yjy1hqC5hx4Dp4tqa98G5RY+J6ydRuzYnHdEjL1pUjY=; b=ag4b2d54f+L/5W3vk0sReJuNRg/FgYRqN3e8P1tfL/R4+Uo/4C2WjlhvFLgYuo8NSd 2vr17i1D9nzaLXqypRJTU0AtzNJhD8Sz4lsyR5vtAWZ1B8hRUjpd6eRF6X+DZpKmz4VR DnREV5kMbFxAuyTYktKscJ8QIviA1HlfhzdTX2NtE7+9vnzWyD7DWr/JCqeAabv7OfAG dOdrKazTWhkuz/cOMXUUEKczjHLEB4EhUrK48f2E9jnGiFbGyWOx+lTrRpEkQ8GG7jMC l8aVLqx7XymbZg9wk9QeVkFphBMmtzpNBTQNSkSYC345h8rSsowV87I3Dahbu72EYSCn c4Jg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p18si1224679pgu.147.2018.03.09.12.42.59; Fri, 09 Mar 2018 12:43:17 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751349AbeCIUmD (ORCPT + 99 others); Fri, 9 Mar 2018 15:42:03 -0500 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:43624 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751211AbeCIUmC (ORCPT ); Fri, 9 Mar 2018 15:42:02 -0500 Received: from pps.filterd (m0098409.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w29KeiNw139038 for ; Fri, 9 Mar 2018 15:42:01 -0500 Received: from e12.ny.us.ibm.com (e12.ny.us.ibm.com [129.33.205.202]) by mx0a-001b2d01.pphosted.com with ESMTP id 2gkw89j8rv-1 (version=TLSv1.2 cipher=AES256-SHA256 bits=256 verify=NOT) for ; Fri, 09 Mar 2018 15:42:01 -0500 Received: from localhost by e12.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 9 Mar 2018 15:42:00 -0500 Received: from b01cxnp23033.gho.pok.ibm.com (9.57.198.28) by e12.ny.us.ibm.com (146.89.104.199) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Fri, 9 Mar 2018 15:41:56 -0500 Received: from b01ledav006.gho.pok.ibm.com (b01ledav006.gho.pok.ibm.com [9.57.199.111]) by b01cxnp23033.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w29KfutU53477608; Fri, 9 Mar 2018 20:41:56 GMT Received: from b01ledav006.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 4840FAC040; Fri, 9 Mar 2018 15:43:10 -0500 (EST) Received: from t470.localdomain.com (unknown [9.80.193.108]) by b01ledav006.gho.pok.ibm.com (Postfix) with ESMTP id 0521BAC03F; Fri, 9 Mar 2018 15:43:08 -0500 (EST) From: Mauricio Faria de Oliveira To: linux-kernel@vger.kernel.org, mpe@ellerman.id.au, jeyu@kernel.org Cc: npiggin@gmail.com, linuxppc-dev@lists.ozlabs.org Subject: [PATCH] powerpc/64: Fix section mismatch warnings for early boot symbols Date: Fri, 9 Mar 2018 17:41:51 -0300 X-Mailer: git-send-email 1.8.3.1 X-TM-AS-GCONF: 00 x-cbid: 18030920-0048-0000-0000-00000247A927 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00008642; HX=3.00000241; KW=3.00000007; PH=3.00000004; SC=3.00000254; SDB=6.01000675; UDB=6.00509017; IPR=6.00780006; MB=3.00019944; MTD=3.00000008; XFM=3.00000015; UTC=2018-03-09 20:41:58 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18030920-0049-0000-0000-000044634352 Message-Id: <1520628111-1361-1-git-send-email-mauricfo@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2018-03-09_10:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1011 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1803090245 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Some of the boot code located at the start of kernel text is "init" class, in that it only runs at boot time, however marking it as normal init code is problematic because that puts it into a different section located at the very end of kernel text. e.g., in case the TOC is not set up, we may not be able to tolerate a branch trampoline to reach the init function. Credits: code and message are based on 2016 patch by Nicholas Piggin, and slightly modified so not to rename the powerpc code/symbol names. Subject: [PATCH] powerpc/64: quieten section mismatch warnings From: Nicholas Piggin Date: Fri Dec 23 00:14:19 AEDT 2016 Signed-off-by: Mauricio Faria de Oliveira --- scripts/mod/modpost.c | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c index 9917f92..c65d5e2 100644 --- a/scripts/mod/modpost.c +++ b/scripts/mod/modpost.c @@ -1174,8 +1174,15 @@ static const struct sectioncheck *section_mismatch( * fromsec = text section * refsymname = *.constprop.* * + * Pattern 6: + * powerpc64 has boot functions that reference init, but must remain in text. + * This pattern is identified by + * tosec = init section + * fromsym = + * **/ -static int secref_whitelist(const struct sectioncheck *mismatch, +static int secref_whitelist(const struct elf_info *elf, + const struct sectioncheck *mismatch, const char *fromsec, const char *fromsym, const char *tosec, const char *tosym) { @@ -1212,6 +1219,17 @@ static int secref_whitelist(const struct sectioncheck *mismatch, match(fromsym, optim_symbols)) return 0; + /* Check for pattern 6 */ + if (elf->hdr->e_machine == EM_PPC64) + if (match(tosec, init_sections) && + (!strncmp(fromsym, "__boot_from_prom", + strlen("__boot_from_prom")) || + !strncmp(fromsym, "start_here_multiplatform", + strlen("start_here_multiplatform")) || + !strncmp(fromsym, "start_here_common", + strlen("start_here_common"))) + return 0; + return 1; } @@ -1552,7 +1570,7 @@ static void default_mismatch_handler(const char *modname, struct elf_info *elf, tosym = sym_name(elf, to); /* check whitelist - we may ignore it */ - if (secref_whitelist(mismatch, + if (secref_whitelist(elf, mismatch, fromsec, fromsym, tosec, tosym)) { report_sec_mismatch(modname, mismatch, fromsec, r->r_offset, fromsym, -- 1.8.3.1