Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp2418169rdb; Tue, 12 Sep 2023 00:45:21 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGCSBWi3CEY2nE3J0AHIkhs+siD7OoSs7oBVwrvRooFlFzjGmd2qKc1/vQAvPLDxWMqbvf4 X-Received: by 2002:a17:90b:3a90:b0:268:4485:c868 with SMTP id om16-20020a17090b3a9000b002684485c868mr9342058pjb.49.1694504721373; Tue, 12 Sep 2023 00:45:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694504721; cv=none; d=google.com; s=arc-20160816; b=rXgkQOCH5ygV3e8jjZdYszVkDZhP1ylLPlZFdKHb8ZFzsFjWcv6zO2ouKrpgU+ExU8 yzm7xSuYvJtrAYyfQpQnZDqeUBArG6/4ETaid/kDPxy6NZdcvHzlehGWB1fVrkZqdktO D1zChTkmW3I5VlfOt0Kzw5nWMrFKYEnzorDSQsFiEzz9vaxR+hKk4+oY2uawO0vLrUnk 1YH34kL/7cSZ8Q0swIoK7sVsnipu80hWINaK3Qj4YTCJy94ENXwQO26eCJ0/NVHVH+x/ +LFFz0n5uJoOA5hrOmwIAz6ZsTw3L5EHatVvTE5bh4uo18AFGeV/wggQNy6IB+1cxgqA +CQQ== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=2t8hdjSg50gFjTBBfYbCHf0405PVHNoTQQTPVQ7kWQY=; fh=v9uG8q42dbwxZFukVADsiTq/34E1rTcV7VhoZSEPcQo=; b=xdlKthnRqWOOBrqLRWGli38ZEjvrPxLLQ1juEyXn7mboQLdgCyV3yUHAOHToSQddmu 3QeLBVGb9J3iXOy+YCB6Bh3s42SSxbS8vAiKxG/Bxj/N5RNCDZ6j25bEjaXY3z91AJPz SyTv9R7RwnaJWTsL42UbWoH2xpLQKtgrEUq5bIvYSSJh1QSrxi1+psCN0XSb1xrI4xIL wPkRNfLYhc3OVtqv5q6NDxJtK49FExm99SrnLLyG99573E/PqSS1XKxSbyeCcse1HK4S /tJaliTc9H8ATOyEQA/avLZ0XNObD+U/7fxGIS9fp1RNlxCh41eyFZ1+kkPoTfF6PafM LWKA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=aHhhtPBV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id me15-20020a17090b17cf00b0026f40a0a3c1si9411635pjb.92.2023.09.12.00.45.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Sep 2023 00:45:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=aHhhtPBV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 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 (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 64BE283348B7; Tue, 12 Sep 2023 00:32:29 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231671AbjILHcY (ORCPT + 99 others); Tue, 12 Sep 2023 03:32:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33878 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231642AbjILHcV (ORCPT ); Tue, 12 Sep 2023 03:32:21 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D039A10C9 for ; Tue, 12 Sep 2023 00:32:16 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 03EA6C433C8; Tue, 12 Sep 2023 07:32:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1694503936; bh=LVkhyWFH59zqNCV7QiwAO5x1uYMJKWUxGuvv3jXu/IQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aHhhtPBV+49U1o/r/CM1Znsy1im0RnVGuv+yP6AeptLwXw+lvr/lhnlUccKnXlFza CxEAXhnH8pc8T94zdnvctdmtyVQtYbVkveTHcQ/0W4T/hAyXENARO14ni3pqj/yTbq hqGY1FVIM78CX8gH7hQSR4vMDLOj4f0ag7rE/LHveaIEzJPws+iZ2dZg5hlAskdD9B Scm6tv7vyPmLHmgJVNN5Jhsb/5WxilSJr+cLda46qfqDuVnkHsTDUEXGp1zG/8JysC mdO0kLM+J+gwzJQpXmq/5H5BxIWp5rrynf9cN1Dp5FNkOeD80HSRR4Yltjl9BuFFYP 1X5TKbkKrh+eg== From: Jisheng Zhang To: Paul Walmsley , Palmer Dabbelt , Albert Ou Cc: Andrew Jones , linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, Emil Renner Berthing Subject: [RESEND PATCH 3/3] riscv: vdso.lds.S: remove hardcoded 0x800 .text start addr Date: Tue, 12 Sep 2023 15:20:15 +0800 Message-Id: <20230912072015.2424-4-jszhang@kernel.org> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230912072015.2424-1-jszhang@kernel.org> References: <20230912072015.2424-1-jszhang@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Tue, 12 Sep 2023 00:32:29 -0700 (PDT) I believe the hardcoded 0x800 and related comments come from the long history VDSO_TEXT_OFFSET in x86 vdso code, but commit 5b9304933730 ("x86 vDSO: generate vdso-syms.lds") and commit f6b46ebf904f ("x86 vDSO: new layout") removes the comment and hard coding for x86. Similar as x86 and other arch, riscv doesn't need the rigid layout using VDSO_TEXT_OFFSET since it "no longer matters to the kernel". so we could remove the hard coding now, and removing it brings a small vdso.so and aligns with other architectures. Also, having enough separation between data and text is important for I-cache, so similar as x86, move .note, .eh_frame_hdr, and .eh_frame between .rodata and .text. Signed-off-by: Jisheng Zhang Reviewed-by: Andrew Jones Tested-by: Emil Renner Berthing --- arch/riscv/kernel/vdso/vdso.lds.S | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/arch/riscv/kernel/vdso/vdso.lds.S b/arch/riscv/kernel/vdso/vdso.lds.S index 671aa21769bc..cbe2a179331d 100644 --- a/arch/riscv/kernel/vdso/vdso.lds.S +++ b/arch/riscv/kernel/vdso/vdso.lds.S @@ -23,12 +23,8 @@ SECTIONS .gnu.version_d : { *(.gnu.version_d) } .gnu.version_r : { *(.gnu.version_r) } - .note : { *(.note.*) } :text :note .dynamic : { *(.dynamic) } :text :dynamic - .eh_frame_hdr : { *(.eh_frame_hdr) } :text :eh_frame_hdr - .eh_frame : { KEEP (*(.eh_frame)) } :text - .rodata : { *(.rodata .rodata.* .gnu.linkonce.r.*) *(.got.plt) *(.got) @@ -37,13 +33,16 @@ SECTIONS *(.bss .bss.* .gnu.linkonce.b.*) } + .note : { *(.note.*) } :text :note + + .eh_frame_hdr : { *(.eh_frame_hdr) } :text :eh_frame_hdr + .eh_frame : { KEEP (*(.eh_frame)) } :text + /* - * This linker script is used both with -r and with -shared. - * For the layouts to match, we need to skip more than enough - * space for the dynamic symbol table, etc. If this amount is - * insufficient, ld -shared will error; simply increase it here. + * Text is well-separated from actual data: there's plenty of + * stuff that isn't used at runtime in between. */ - . = 0x800; + . = ALIGN(16); .text : { *(.text .text.*) } :text . = ALIGN(4); -- 2.40.1