From patchwork Fri Feb 18 08:12:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fangrui Song X-Patchwork-Id: 12751055 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 0DFF3C433F5 for ; Fri, 18 Feb 2022 08:13:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:From:Subject:Mime-Version: Message-Id:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=FJyOv1UrdzMic1RGIiUEVOszCWCXKA9U5f/NxQxKNq0=; b=iPd KpFyIAbq5rCORxkvRODDZCt10uATrj2lbMfAARNNyQA82WkoeFvFPHddyZbq5UvSU8KAl7U/Z2PLs G45+qP4fwpQH6yx4XOP3VGqlOyn+UKY5A2eSEZ09wS4J7X2KZVRtrnsOTgEXpyftQ/b0mNg049Rbn nQai/3lzuv9tanRQW/6VdUXUJL6UZ4aimDo6vE4lwu/W2roIr61ch7qlYpwu/tbe5YKccxup7eoeq 2qAZDvGr1XKYo2s5vTJpyeLmO9rpgnzOwQywjStr6UWfLF0GNWMfQihnmKuNK81/osM+sejxjkRpd zIvmZ0uSwIqdIV7/6PtVLgOl/iiNGBw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nKyNM-00DHqp-Ed; Fri, 18 Feb 2022 08:12:24 +0000 Received: from mail-yb1-xb49.google.com ([2607:f8b0:4864:20::b49]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nKyNJ-00DHqN-Hm for linux-arm-kernel@lists.infradead.org; Fri, 18 Feb 2022 08:12:23 +0000 Received: by mail-yb1-xb49.google.com with SMTP id d17-20020a253611000000b006244e94b7b4so311852yba.4 for ; Fri, 18 Feb 2022 00:12:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:message-id:mime-version:subject:from:to:cc; bh=LY6LzpHZdIBxY444vO4HWJP1kgYlpz84LA6VZYt38hY=; b=lEuSn3l5pcezU1xInfoD249SjcfV6GaVFory27iWzbW7ZT7zmkar496VK30MXNJk7x 789tElCsrFcMjN6iW4M0SbGSgFcN94e5GteBtfV6rt/GjbUNjQsnptSi3adn0kHyWwoj /AjelhWScjsbeOMhC+fHS+cHCVwAdMgloltoS9zdXhtqrQTvBapwSHCxhl3DjTB5fy38 HNolxKHOxT0fBft8mmI3ZP4/+GjGdm9TltWJ4MhKH6Wm/utyS3p3X3HyKNiAAViTAbaZ GocNFUTq6VjrdohFHC8YgLDjm6I7O87roTjWj+vI+igE4vicWRZLPvIBkEazW6m5GkH5 jb/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:message-id:mime-version:subject:from:to:cc; bh=LY6LzpHZdIBxY444vO4HWJP1kgYlpz84LA6VZYt38hY=; b=NjjlkVEARXWJmoXTq/7pqVlktuN80RHC0yrZUCml9WKAzR3k8KWV6BPN9iM7Q5GakH IwjtpqOW1m/chrQ/sA0+4yLLs7pFRNKUtekNZJ+NZgOq6uWOwrRg8QcB2Bb3zOBke9pC V5IK4SexBxBS3o7UPK0K1R24c354n9hFvNpH9K2+dMB1vMHHbANElZHUhcJ/f9L4nFVI 97kPo9o4jGCU5buakycFtGPzxDyr/YCgJxh4ww789MKO0dN7eJmHbSrJ02uHhjgfU89Z 2UJ3aH4JqUdseH3blgxZOnq8qlv96OfSeARUT7L8f6fkoVDGj6sY0dp4wm0FhJiw475g 8TEg== X-Gm-Message-State: AOAM532ZY17T9vba//R/gb8OFChZV8xsZ7QqoXeCeVotYQDpM0BOeQ92 ENjU6QUJRuVQTHdpZ276j6o1Leq7bcWs X-Google-Smtp-Source: ABdhPJyUH15xOgfJE/7Eoy6tw1EPASMqd2Dis3ZnH3C2ddCvFItgcrZSngmFaM+Jm6gD5vKMDevc9gHUk2Xe X-Received: from maskray1.svl.corp.google.com ([2620:15c:2ce:200:bdb7:3728:9760:87c]) (user=maskray job=sendgmr) by 2002:a81:364b:0:b0:2cf:5d3f:d256 with SMTP id d72-20020a81364b000000b002cf5d3fd256mr6356301ywa.458.1645171939884; Fri, 18 Feb 2022 00:12:19 -0800 (PST) Date: Fri, 18 Feb 2022 00:12:09 -0800 Message-Id: <20220218081209.354383-1-maskray@google.com> Mime-Version: 1.0 Subject: [PATCH] arm64 module: remove (NOLOAD) From: Fangrui Song To: Catalin Marinas , Will Deacon , Ard Biesheuvel , linux-arm-kernel@lists.infradead.org Cc: Nathan Chancellor , linux-kernel@vger.kernel.org, llvm@lists.linux.dev, Fangrui Song X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220218_001221_610549_E6E370A3 X-CRM114-Status: GOOD ( 10.72 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On ELF, (NOLOAD) sets the section type to SHT_NOBITS[1]. It is conceptually inappropriate for .plt and .text.* sections which are always SHT_PROGBITS. In GNU ld, if PLT entries are needed, .plt will be SHT_PROGBITS anyway and (NOLOAD) will be essentially ignored. In ld.lld, since https://reviews.llvm.org/D118840 ("[ELF] Support (TYPE=) to customize the output section type"), ld.lld will report a `section type mismatch` error. Just remove (NOLOAD) to fix the error. [1] https://lld.llvm.org/ELF/linker_script.html As of today, "The section should be marked as not loadable" on https://sourceware.org/binutils/docs/ld/Output-Section-Type.html is outdated for ELF. Acked-by: Ard Biesheuvel Reported-by: Nathan Chancellor Signed-off-by: Fangrui Song Acked-by: Ard Biesheuvel Tested-by: Nathan Chancellor --- arch/arm64/include/asm/module.lds.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/arm64/include/asm/module.lds.h b/arch/arm64/include/asm/module.lds.h index a11ccadd47d2..094701ec5500 100644 --- a/arch/arm64/include/asm/module.lds.h +++ b/arch/arm64/include/asm/module.lds.h @@ -1,8 +1,8 @@ SECTIONS { #ifdef CONFIG_ARM64_MODULE_PLTS - .plt 0 (NOLOAD) : { BYTE(0) } - .init.plt 0 (NOLOAD) : { BYTE(0) } - .text.ftrace_trampoline 0 (NOLOAD) : { BYTE(0) } + .plt 0 : { BYTE(0) } + .init.plt 0 : { BYTE(0) } + .text.ftrace_trampoline 0 : { BYTE(0) } #endif #ifdef CONFIG_KASAN_SW_TAGS