From patchwork Thu May 11 16:24:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 92723 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp4509921vqo; Thu, 11 May 2023 09:30:55 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5RRbsTGAJrIDvGUyMx4HEETkcQxq8vnA2B3yRxLuHpKl/7aF5RwFX4KoCteXJurHcvlIjn X-Received: by 2002:a17:902:f543:b0:1ac:6084:1f4 with SMTP id h3-20020a170902f54300b001ac608401f4mr25994754plf.27.1683822654928; Thu, 11 May 2023 09:30:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683822654; cv=none; d=google.com; s=arc-20160816; b=nhlsDjGhqNkH/r3SNMAvA8UisrhzeDrWlj4LCqB+SMUNhTq/7S68Qbsp1No/k6EMw9 lRClVCmzOSZJj4uEzRIdrnIf49hIGlEQ0euPshMMgBnDcDbJHGsX++gPEU0c/aqmFEZg 60zpIxtaNjs927uG1vuohPyjJRHVZFPriuLUCufq/O0kScLfh+aa9sAOcHImoxFB/C+Z OSkIPUWVAI0bVbloXfpeDqU7JWvej7U9xAT1kdDM09gCCkpkj6BV5JUAhQ82fYpFgAkC QamOkNR0rPN9Ly+ty0+W8mwA6at+0DB7V9fkmlvU4eIGY5OJNozM1QU+qy/dAA6S4wbk MP+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=Mrh8gFB/ciehUQY16h2orVhSNUCPaHIxX5Gfqc+vZ+I=; b=m7FIkCnwa2rb1fYUaHmLkRDVUidjmC6XLRqacoCQVu8zWrB/5MMt2F0jO1UUbP4p+H swYPGEu0yNWx5tIUDIWXvssCHDFzExUznf0wCyrCRoGqv9uYSoKCONcyIyo9D8fRWafj rEyxiR6BcZSMxlGzeWhzGRfa9/CuY2ALNOJcGmlRf+KABcG79CAmFcXubt1tTvxf3s6p QXg+3JfZyd3VfwvgWLXm5TPs7/cIyKdt/m6NqQQVDA62KwW8bgEM+tnihOgzlU7SrxzJ NCMa9gsa4XxzokgrIXFLsHGRUVJ1yuZmQ2Z/BFTVRGbbFS7rkiJiNayp7sA5uoMFFZxf 5kbg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Vr38RPBF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b17-20020a170903229100b001a1ee8ceedcsi7540156plh.495.2023.05.11.09.30.37; Thu, 11 May 2023 09:30:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Vr38RPBF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238795AbjEKQZZ (ORCPT + 99 others); Thu, 11 May 2023 12:25:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39284 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238130AbjEKQZY (ORCPT ); Thu, 11 May 2023 12:25:24 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4866FF1; Thu, 11 May 2023 09:25:23 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id DB6BB61A85; Thu, 11 May 2023 16:25:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 09390C433D2; Thu, 11 May 2023 16:25:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1683822322; bh=O0ddsVjQX2XqLZGXzSarzIeiDR/AJKke8DZiiaGgiso=; h=From:To:Cc:Subject:Date:From; b=Vr38RPBFMq334MQhYb6E7bf93P39D7Tk5w0Qn8WmkdlCKfe5TW0cqr1Ou3feEJUQP nrwe1amGLeGDVfpE0MFZaZbzmmsQu6Eyl59KTPbN1D3E3ZteDDmwTsGGG9+BvQn9I9 tCRj3h8NhV3BDlIxrA0/2TRL/s+g0cg1WF9FMxEKTKP46Crt26T/PSuEAgF3dGjhTd 1zGv/YN5wzi9EGf/xohpX53ZTXhdJ5tLILUcXqYv9cvPu52zGyyi1Al2pjl9AHXiLW hBg0g3SqLUTl2a9UPgF6CETox1momsItbjb9fxEvi6GHJZJWIUn15lVqlMISWM9i6L n+HwaeHTMjhNw== From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Masahiro Yamada , Nathan Chancellor , Nick Desaulniers , Nicolas Schier Subject: [PATCH] modpost: error out if addend_*_rel() is not implemented for REL arch Date: Fri, 12 May 2023 01:24:22 +0900 Message-Id: <20230511162423.1922133-1-masahiroy@kernel.org> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1765616023814550556?= X-GMAIL-MSGID: =?utf-8?q?1765616023814550556?= The section mismatch check relies on the relocation entries. For REL, the addend value is implicit, so we need some code to compute it. Currently, EM_386, EM_ARM, and EM_MIPS are supported. This commit makes sure we covered all the cases. I believe the other architectures use RELA, where the explicit r_addend field exists. Signed-off-by: Masahiro Yamada --- scripts/mod/modpost.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c index 95da374cc534..44309d463a49 100644 --- a/scripts/mod/modpost.c +++ b/scripts/mod/modpost.c @@ -1442,6 +1442,8 @@ static void section_rel(const char *modname, struct elf_info *elf, if (addend_mips_rel(elf, sechdr, &r)) continue; break; + default: + fatal("Please add code to calculate addend for this architecture\n"); } sym = elf->symtab_start + r_sym; /* Skip special sections */