Received: by 2002:a05:6358:c692:b0:131:369:b2a3 with SMTP id fe18csp1377721rwb; Wed, 26 Jul 2023 11:30:14 -0700 (PDT) X-Google-Smtp-Source: APBJJlE5IsJEmaoBMfFV+cm4owJdlgjZUSHuYaI/DnT1Y9Y9KTf+1IxK2pzlQxCSC+mJxDIbP4/L X-Received: by 2002:a17:907:6e1e:b0:995:3c9e:a629 with SMTP id sd30-20020a1709076e1e00b009953c9ea629mr346203ejc.31.1690396214506; Wed, 26 Jul 2023 11:30:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690396214; cv=none; d=google.com; s=arc-20160816; b=yl4OpPn87jinghFVMrlqSsA1W0PR0oZyK+0DEAua6IVQeS0kEG6NA2Ov6Acx4KI440 6uIXkknWfs0O6ryEXLsp/Z7Qs+TFT66ebtGVyGAkv+0jCSpjr1054Z3xL9n0w0bQyU8x aOcJFWQi+5r/OEniB9q47RUrF4YEHUYggEIlgEUCPqTdINjkT6B5I2jkRxAP8Z6Ne9VN P0g8zjOjcBPRuXcX6RiI2evYNcXUX3hJ53CQ9GFIFecridZDojwPl9thr0EhD+jNp/hC PZyFqjjp3doVy+Y1a4il6wFR80l5jR15WHLcR/keOSQs9QKCWRHSnNn4uWDgpV9Mygtb MY6A== 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=/gV6P5sd4eCqqtHETqXEx1QlMMfuhBIbV15qdOFNoqU=; fh=2AmsHgAxkXvhtq2BfB2hBoQPDQHM9O1rz+6h2hgCO5A=; b=QzL3O17rTKTRJmFSQz+o4wxLZG1+nEVbxntriklSAGDSqH1ljHVtsrRxitzRhLYcw8 ZuY0bq4IoDRzhwsqebbBENnGAHFHBA0y3o1CRyd8UP76aOuMOIzDiaXaB1gQ52FNomkH ink1N4XVEmNgiPikc6P4bvW3LM8By3O6ZXlLiOPNgnSIDgrWlNhDdcO4TX4X9TjyWQ/Z Sd7gDDEICLhTenaAkM0dDGEYqrp0nB+8yd6RLPHj1ClpRzvi015oD8RNwZqwafsPFB8R Ro+BobyQf82BHclNltqYUAesUpWPSho5xFooIqKkRBnDAgPGzgPQKNCpWk/0Iccm6Dqd udMQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Hwi9cpkO; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id xo17-20020a170907bb9100b00992aea2c6a6si9207397ejc.977.2023.07.26.11.29.47; Wed, 26 Jul 2023 11:30:14 -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=Hwi9cpkO; 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 S231464AbjGZRmK (ORCPT + 99 others); Wed, 26 Jul 2023 13:42:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39348 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229545AbjGZRmH (ORCPT ); Wed, 26 Jul 2023 13:42:07 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 35665269A for ; Wed, 26 Jul 2023 10:42:06 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id C691E61BE2 for ; Wed, 26 Jul 2023 17:42:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E90F2C433C7; Wed, 26 Jul 2023 17:42:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1690393325; bh=FoAwbwQLJJvL1URKvVipUOgohpgmWIsUn9uEVNXhbv4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Hwi9cpkOp5qyxCKXnFW+26Vq/LNWYfZRyi9CI0m8x6q9gKxP0xKNHmKHxiN3khZdO VQKVo3IQ0913QtAp52fnxpEKeegDd7NI2ubQ9fxgGDHIUfy94gjD0Z2IV8hGPgxpVb YQaY1vexRV7F9vL3/dCQMUvaSMPUXkX/uW6+7HXBep4yEXbNYkBcaOQc5DvM5MdOrV 3WJ00MF0BwFzViuZaXZPd6dDbHSZbSOCnTwivlK/bIE6ojgjAz3rET4r2/VKhdF0E3 S/uMori21qVJjlBqjHW6hAccFsvwY0+ASlLx50f9Qt9LE811HW23GU769K4alyTT2i 7MGwzfvVI3bbQ== From: Jisheng Zhang To: Paul Walmsley , Palmer Dabbelt , Albert Ou Cc: Andrew Jones , linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 3/3] riscv: vdso.lds.S: remove hardcoded 0x800 .text start addr Date: Thu, 27 Jul 2023 01:30:24 +0800 Message-Id: <20230726173024.3684-4-jszhang@kernel.org> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230726173024.3684-1-jszhang@kernel.org> References: <20230726173024.3684-1-jszhang@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 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 --- 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