From patchwork Fri Sep 16 04:07:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicholas Piggin X-Patchwork-Id: 1678488 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ozlabs.org (client-ip=112.213.38.117; helo=lists.ozlabs.org; envelope-from=linuxppc-dev-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=au6qXo8m; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4MTLD86Gkvz1yp0 for ; Fri, 16 Sep 2022 14:08:56 +1000 (AEST) Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4MTLD85lCgz3c1Q for ; Fri, 16 Sep 2022 14:08:56 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=au6qXo8m; dkim-atps=neutral X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gmail.com (client-ip=2607:f8b0:4864:20::1036; helo=mail-pj1-x1036.google.com; envelope-from=npiggin@gmail.com; receiver=) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=au6qXo8m; dkim-atps=neutral Received: from mail-pj1-x1036.google.com (mail-pj1-x1036.google.com [IPv6:2607:f8b0:4864:20::1036]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4MTLCH2XQTz2yYL for ; Fri, 16 Sep 2022 14:08:10 +1000 (AEST) Received: by mail-pj1-x1036.google.com with SMTP id q3so19794304pjg.3 for ; Thu, 15 Sep 2022 21:08:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date; bh=HQWmPgcG9K9dWkqcXsV/N4w2BTo24yF4jhvx5rNhVXk=; b=au6qXo8mYWMi0LjJjBefffiIIyyyrwnl42NP1QHvr2l+RYktDtPTlNkfCBirbSVDUd hoGhW4AgPb8zeLPDe+1XQhKIkP5m8DgwWRAinaFYbA3Ea+G3sPcxhDhmdStwgJsQTCjD 1oj/cL7oeTAmYPpa60mGTsQWqHiZBRQaXP7bZpGc2IFMptQXwDVMCj5rhg9tjnnNLNWm BwYoxk8UA4cOpVgUz+TmQX2/nhvJz9BereM+zlz2KeWXu0PqvsU3XVHMV5WDLUllSmc3 Q8ddi/dmywXbFhds+Gy1RqqdD3mfNYk4fkEjNdsxsERwJRGYXR7PFAJQICgveqJlhYUc qtTg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date; bh=HQWmPgcG9K9dWkqcXsV/N4w2BTo24yF4jhvx5rNhVXk=; b=dOJMob6o7iOcwJ/ghUnDWI16cjOphI2+aDuP19gCPH8ZR8Pqymn5vPFfu4NM02qEV1 fGcgYuz35KSXlaYDtXinghwpbAoh87UFgrsyNE/S56IfyzWqb5dXYHVWR6L5wzJxKM1U 59nZj2+ocrh6jbZL2P95lenekL/sRvX8c7FLudd4zo8z5thV48Zyyy1UdmnJPpQB8/q1 LLqBA2Ho+XDuNG9vieBfkmFO9IdvYIUWSfkuRWiHr1lPNABdJwhXP3SrJbnzmtaVrFVN L3XI0Vq5pGbDIomc1SX92vnCFnYPkL0Q12EyF1RCtvjlFkT4o7PQvq6nLd0ymv55tgwD 6Kow== X-Gm-Message-State: ACrzQf0mCMFeE4COZli6dWzQmrQyWpq/RoVYBiSsCTrC2mEATCPEToFh RVc2hr+wP+lwqw7lx+lMjxAy57dh15A= X-Google-Smtp-Source: AMsMyM4g/0x2u7tDt6u1p+8dCvURuzu36t5NO/r96BJiIGGEbGTRL/Ok+SrFoHelsnGjwG76Qm38zg== X-Received: by 2002:a17:902:d4c1:b0:176:b795:c639 with SMTP id o1-20020a170902d4c100b00176b795c639mr2832025plg.154.1663301288295; Thu, 15 Sep 2022 21:08:08 -0700 (PDT) Received: from bobo.ozlabs.ibm.com (193-116-127-167.tpgi.com.au. [193.116.127.167]) by smtp.gmail.com with ESMTPSA id t6-20020a1709027fc600b0017534ffd491sm13696816plb.163.2022.09.15.21.08.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Sep 2022 21:08:07 -0700 (PDT) From: Nicholas Piggin To: linuxppc-dev@lists.ozlabs.org, Michael Ellerman , Christophe Leroy Subject: [PATCH v2 1/7] powerpc: move __end_rodata to cover arch read-only sections Date: Fri, 16 Sep 2022 14:07:49 +1000 Message-Id: <20220916040755.2398112-2-npiggin@gmail.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220916040755.2398112-1-npiggin@gmail.com> References: <20220916040755.2398112-1-npiggin@gmail.com> MIME-Version: 1.0 X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Nicholas Piggin Errors-To: linuxppc-dev-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" powerpc has a number of read-only sections and tables that are put after RO_DATA(). Move the __end_rodata symbol to cover these as well. Setting memory to read-only at boot is done using __init_begin, change that that to use __end_rodata. This removes the requirement for the init section to follow read-only data. This makes is_kernel_rodata() exactly cover the read-only region, as well as other things using __end_rodata (e.g., kernel/dma/debug.c). Boot dmesg also prints the rodata size more accurately. Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/vmlinux.lds.S | 3 +++ arch/powerpc/mm/book3s32/mmu.c | 2 +- arch/powerpc/mm/book3s64/hash_pgtable.c | 2 +- arch/powerpc/mm/book3s64/radix_pgtable.c | 6 +++--- arch/powerpc/mm/pgtable_32.c | 7 ++++--- 5 files changed, 12 insertions(+), 8 deletions(-) diff --git a/arch/powerpc/kernel/vmlinux.lds.S b/arch/powerpc/kernel/vmlinux.lds.S index fe22d940412f..d81e4392da26 100644 --- a/arch/powerpc/kernel/vmlinux.lds.S +++ b/arch/powerpc/kernel/vmlinux.lds.S @@ -210,6 +210,9 @@ SECTIONS } #endif + . = ALIGN(STRICT_ALIGN_SIZE); + __end_rodata = .; + /* * Init sections discarded at runtime */ diff --git a/arch/powerpc/mm/book3s32/mmu.c b/arch/powerpc/mm/book3s32/mmu.c index a96b73006dfb..e13b883e4e5b 100644 --- a/arch/powerpc/mm/book3s32/mmu.c +++ b/arch/powerpc/mm/book3s32/mmu.c @@ -240,7 +240,7 @@ void mmu_mark_rodata_ro(void) for (i = 0; i < nb; i++) { struct ppc_bat *bat = BATS[i]; - if (bat_addrs[i].start < (unsigned long)__init_begin) + if (bat_addrs[i].start < (unsigned long)__end_rodata) bat[1].batl = (bat[1].batl & ~BPP_RW) | BPP_RX; } diff --git a/arch/powerpc/mm/book3s64/hash_pgtable.c b/arch/powerpc/mm/book3s64/hash_pgtable.c index ae008b9df0e6..28332001bd87 100644 --- a/arch/powerpc/mm/book3s64/hash_pgtable.c +++ b/arch/powerpc/mm/book3s64/hash_pgtable.c @@ -541,7 +541,7 @@ void hash__mark_rodata_ro(void) unsigned long start, end, pp; start = (unsigned long)_stext; - end = (unsigned long)__init_begin; + end = (unsigned long)__end_rodata; pp = htab_convert_pte_flags(pgprot_val(PAGE_KERNEL_ROX), HPTE_USE_KERNEL_KEY); diff --git a/arch/powerpc/mm/book3s64/radix_pgtable.c b/arch/powerpc/mm/book3s64/radix_pgtable.c index 698274109c91..eb3c56975c37 100644 --- a/arch/powerpc/mm/book3s64/radix_pgtable.c +++ b/arch/powerpc/mm/book3s64/radix_pgtable.c @@ -228,7 +228,7 @@ void radix__mark_rodata_ro(void) unsigned long start, end; start = (unsigned long)_stext; - end = (unsigned long)__init_begin; + end = (unsigned long)__end_rodata; radix__change_memory_range(start, end, _PAGE_WRITE); } @@ -259,8 +259,8 @@ print_mapping(unsigned long start, unsigned long end, unsigned long size, bool e static unsigned long next_boundary(unsigned long addr, unsigned long end) { #ifdef CONFIG_STRICT_KERNEL_RWX - if (addr < __pa_symbol(__init_begin)) - return __pa_symbol(__init_begin); + if (addr < __pa_symbol(__end_rodata)) + return __pa_symbol(__end_rodata); #endif return end; } diff --git a/arch/powerpc/mm/pgtable_32.c b/arch/powerpc/mm/pgtable_32.c index 3ac73f9fb5d5..5c02fd08d61e 100644 --- a/arch/powerpc/mm/pgtable_32.c +++ b/arch/powerpc/mm/pgtable_32.c @@ -158,10 +158,11 @@ void mark_rodata_ro(void) } /* - * mark .text and .rodata as read only. Use __init_begin rather than - * __end_rodata to cover NOTES and EXCEPTION_TABLE. + * mark text and rodata as read only. __end_rodata is set by + * powerpc's linker script and includes tables and data + * requiring relocation which are not put in RO_DATA. */ - numpages = PFN_UP((unsigned long)__init_begin) - + numpages = PFN_UP((unsigned long)__end_rodata) - PFN_DOWN((unsigned long)_stext); set_memory_ro((unsigned long)_stext, numpages); From patchwork Fri Sep 16 04:07:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicholas Piggin X-Patchwork-Id: 1678489 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ozlabs.org (client-ip=112.213.38.117; helo=lists.ozlabs.org; envelope-from=linuxppc-dev-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=b74pbhzZ; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4MTLDr2tlYz1yp0 for ; Fri, 16 Sep 2022 14:09:32 +1000 (AEST) Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4MTLDr0JlHz3bd5 for ; Fri, 16 Sep 2022 14:09:32 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=b74pbhzZ; dkim-atps=neutral X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gmail.com (client-ip=2607:f8b0:4864:20::435; helo=mail-pf1-x435.google.com; envelope-from=npiggin@gmail.com; receiver=) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=b74pbhzZ; dkim-atps=neutral Received: from mail-pf1-x435.google.com (mail-pf1-x435.google.com [IPv6:2607:f8b0:4864:20::435]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4MTLCL2CDkz2yWK for ; Fri, 16 Sep 2022 14:08:14 +1000 (AEST) Received: by mail-pf1-x435.google.com with SMTP id w2so9766483pfb.0 for ; Thu, 15 Sep 2022 21:08:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date; bh=425jscTdOENl/IcYfphn9Q48DiS+qua4nYw7KaUJl48=; b=b74pbhzZZxqqd69pmwTPIeN5arYMmb/aFh58pqIW6q17eeHxiHsFPFMI/tsZDIxK2d xjWS6szKaEx5adl0BHg9vovgIxHKIi6+jHr5m88M9wGZdyS+sUEgyiuBnqn0UZ5KXncw x3X8y1VWrfEJDsqqvQDgu3JPvceS4jJowPqLcgFhm4SSHu3tLRJuGERcAEOji6HEovzR jqfSgU2OnKxNRufLD0m0eW/xEzHmklX1cvPMmSN2ZZRBr2GmjTesvt33JNc/3HUbUTQ/ dSkAmelqqABYnFgvQEa4PuYcBT+UuUI8dWIoVLr4WIndH0PYtFT2ZM88kBbvZlkq6Zk5 dizA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date; bh=425jscTdOENl/IcYfphn9Q48DiS+qua4nYw7KaUJl48=; b=jJE84apnj0sSoVVxM9TGIlGwU83T3mrGVjE0jh9GkKJUDZMpC2kqGJxvdPZ22ZU2wE 5z3UbsDC2D8lYhkwcY6TW9byge21xb6rNkvAHPxvEzmCgh930GrVbAi2J6QwA+YjfLNr 4KFMGnOB8REhTPC1w/0TvXarlxNJSGuPLw75RTtGcZYCT4mbshQAjv8vVdA4+KtKSWOK kaGeK2cNa8YIt0r9Y9XnZjIH29hPnqWxbR7RA64hF8g8DT1DiYCDrtetYZQqE+W8gtOn DdjNko/j9gdELb3pSpWaGd9ngCC1lnfsb9JpeZwd9I9uO2XcB57lUuXLU06j5PRLvo9P pLOw== X-Gm-Message-State: ACrzQf3G7wTUjFzSE6Ivj1PsBc5hQQAesFNIlgk0JZ+G+2c35e6jDe7p 3402QgGmUHKnyspvy/hmZXzkp5ZZSYA= X-Google-Smtp-Source: AMsMyM6jGFLUHGsC+BgYDEkxE8bRmj0ukLJNipfklQFTGpKyH3Ptjbnz5iCduKk3nX6HHBMTkqACiA== X-Received: by 2002:a63:de58:0:b0:439:41e9:dda2 with SMTP id y24-20020a63de58000000b0043941e9dda2mr2770099pgi.331.1663301291358; Thu, 15 Sep 2022 21:08:11 -0700 (PDT) Received: from bobo.ozlabs.ibm.com (193-116-127-167.tpgi.com.au. [193.116.127.167]) by smtp.gmail.com with ESMTPSA id t6-20020a1709027fc600b0017534ffd491sm13696816plb.163.2022.09.15.21.08.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Sep 2022 21:08:10 -0700 (PDT) From: Nicholas Piggin To: linuxppc-dev@lists.ozlabs.org, Michael Ellerman , Christophe Leroy Subject: [PATCH v2 2/7] powerpc/32/build: move got1/got2 sections out of text Date: Fri, 16 Sep 2022 14:07:50 +1000 Message-Id: <20220916040755.2398112-3-npiggin@gmail.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220916040755.2398112-1-npiggin@gmail.com> References: <20220916040755.2398112-1-npiggin@gmail.com> MIME-Version: 1.0 X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Nicholas Piggin Errors-To: linuxppc-dev-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" Following the example from the binutils default linker script, move .got1 and .got2 out of .text, to just after RO_DATA. Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/vmlinux.lds.S | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/arch/powerpc/kernel/vmlinux.lds.S b/arch/powerpc/kernel/vmlinux.lds.S index d81e4392da26..607b17b1e785 100644 --- a/arch/powerpc/kernel/vmlinux.lds.S +++ b/arch/powerpc/kernel/vmlinux.lds.S @@ -122,14 +122,6 @@ SECTIONS *(.sfpr); MEM_KEEP(init.text) MEM_KEEP(exit.text) - -#ifdef CONFIG_PPC32 - *(.got1) - __got2_start = .; - *(.got2) - __got2_end = .; -#endif /* CONFIG_PPC32 */ - } :text . = ALIGN(PAGE_SIZE); @@ -139,7 +131,16 @@ SECTIONS /* Read-only data */ RO_DATA(PAGE_SIZE) -#ifdef CONFIG_PPC64 +#ifdef CONFIG_PPC32 + .got1 : AT(ADDR(.got1) - LOAD_OFFSET) { + *(.got1) + } + .got2 : AT(ADDR(.got2) - LOAD_OFFSET) { + __got2_start = .; + *(.got2) + __got2_end = .; + } +#else /* CONFIG_PPC32 */ SOFT_MASK_TABLE(8) RESTART_TABLE(8) @@ -190,7 +191,7 @@ SECTIONS *(__rfi_flush_fixup) __stop___rfi_flush_fixup = .; } -#endif /* CONFIG_PPC64 */ +#endif /* CONFIG_PPC32 */ #ifdef CONFIG_PPC_BARRIER_NOSPEC . = ALIGN(8); From patchwork Fri Sep 16 04:07:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicholas Piggin X-Patchwork-Id: 1678490 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ozlabs.org (client-ip=2404:9400:2:0:216:3eff:fee1:b9f1; helo=lists.ozlabs.org; envelope-from=linuxppc-dev-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=cveJIIEo; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2404:9400:2:0:216:3eff:fee1:b9f1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4MTLFV2Dd5z1ypy for ; Fri, 16 Sep 2022 14:10:06 +1000 (AEST) Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4MTLFV1N9vz3bxL for ; Fri, 16 Sep 2022 14:10:06 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=cveJIIEo; dkim-atps=neutral X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gmail.com (client-ip=2607:f8b0:4864:20::102d; helo=mail-pj1-x102d.google.com; envelope-from=npiggin@gmail.com; receiver=) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=cveJIIEo; dkim-atps=neutral Received: from mail-pj1-x102d.google.com (mail-pj1-x102d.google.com [IPv6:2607:f8b0:4864:20::102d]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4MTLCP0RQ7z3bbj for ; Fri, 16 Sep 2022 14:08:16 +1000 (AEST) Received: by mail-pj1-x102d.google.com with SMTP id x1-20020a17090ab00100b001fda21bbc90so24389794pjq.3 for ; Thu, 15 Sep 2022 21:08:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date; bh=xqjBga+6XbGptpb0rb3aHgGnjLc0TWSRyuonhzQh2hw=; b=cveJIIEo4vkB5MCyclVdFZ2eSws7U8MayI+qseH4U0KROScly8bUl30Yqc9XXC8r43 iUVhsdnZsBBmB05ejVVMpD/x32a4DkkxKaBxPeUdyPkp2Y6MrN9sGcdQbvnUMOYpjJMD oat/yoxb1yjFQSfEpgoYDXPJMv1hej9ock1o2HN34VyMFUylqyxWJ7DoUEowriwruBv9 2wi6eXfVbFtu45zo5ftX6iDPKSKoMx5ypwIYVS9HND0gzZUVtFmaAzlLcj1qCdpRvGZB XevIRiIg9dJAL453ck/tsRfGFP0emR6J75BbBqC8Et5K/pBvi1QYm9ZWf/pz9BfuriKS 9v1g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date; bh=xqjBga+6XbGptpb0rb3aHgGnjLc0TWSRyuonhzQh2hw=; b=anUKLMQ0654ImVuuroXeoa4MBHNyoUVv2RcJd/SekJIDHy/zVxtbLwwIPK/W8K/VQ0 QBNX72An6RXPxWtq0++N1YdiaJzyo7zNkf5tBoyVIRA+Wc0SFhubIWYON5FYUfhRXUzS UHZy1E+KxYR0/RPWhMT+6zvoIZHCoXsTVD5LICqzhBPrSD9JoLXfZ9GFdFScnCAZ9+Fd dumpEKibRnhRzEIKhTz9aVzIo8yKJDKI/JkJE1yrfLDbdBMpM29fBoyOxtOlRRWbwUcj hcmsI5FXcK9WcHBo1FDhJ7JQE5KD8oZsGDEns/sDbvxiQfP6iRdd7i9tIzoHnizmjvh0 OtLw== X-Gm-Message-State: ACrzQf34Cx1Qt6Ehkpnz3GJPAghtYHP6Hpo8z2YZitCvg+lkuiTKrSID p6vL+3sLuuJVJPzWKDq6qmrJd2SFzd8= X-Google-Smtp-Source: AMsMyM6KXqCb+CbbIY473wKOnw3jXVRJ8gFX9gXe1M6VX9B2/vsZ020QKUn5unzg35oupLIWs99lLg== X-Received: by 2002:a17:90b:254a:b0:200:53f:891d with SMTP id nw10-20020a17090b254a00b00200053f891dmr3388092pjb.168.1663301294458; Thu, 15 Sep 2022 21:08:14 -0700 (PDT) Received: from bobo.ozlabs.ibm.com (193-116-127-167.tpgi.com.au. [193.116.127.167]) by smtp.gmail.com with ESMTPSA id t6-20020a1709027fc600b0017534ffd491sm13696816plb.163.2022.09.15.21.08.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Sep 2022 21:08:13 -0700 (PDT) From: Nicholas Piggin To: linuxppc-dev@lists.ozlabs.org, Michael Ellerman , Christophe Leroy Subject: [PATCH v2 3/7] powerpc/build: move got, toc, plt, branch_lt sections to read-only Date: Fri, 16 Sep 2022 14:07:51 +1000 Message-Id: <20220916040755.2398112-4-npiggin@gmail.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220916040755.2398112-1-npiggin@gmail.com> References: <20220916040755.2398112-1-npiggin@gmail.com> MIME-Version: 1.0 X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Nicholas Piggin Errors-To: linuxppc-dev-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" This moves linker-related tables from .data to read-only area. Relocations are performed at early boot time before memory is protected, after which there should be no modifications required. Signed-off-by: Nicholas Piggin Reported-by: kernel test robot --- arch/powerpc/kernel/vmlinux.lds.S | 42 ++++++++++++++++++++----------- 1 file changed, 27 insertions(+), 15 deletions(-) diff --git a/arch/powerpc/kernel/vmlinux.lds.S b/arch/powerpc/kernel/vmlinux.lds.S index 607b17b1e785..16c4389d498d 100644 --- a/arch/powerpc/kernel/vmlinux.lds.S +++ b/arch/powerpc/kernel/vmlinux.lds.S @@ -131,6 +131,10 @@ SECTIONS /* Read-only data */ RO_DATA(PAGE_SIZE) + .branch_lt : AT(ADDR(.branch_lt) - LOAD_OFFSET) { + *(.branch_lt) + } + #ifdef CONFIG_PPC32 .got1 : AT(ADDR(.got1) - LOAD_OFFSET) { *(.got1) @@ -140,7 +144,30 @@ SECTIONS *(.got2) __got2_end = .; } + .got : AT(ADDR(.got) - LOAD_OFFSET) SPECIAL { + *(.got) + *(.got.plt) + } + .plt : AT(ADDR(.plt) - LOAD_OFFSET) SPECIAL { + /* XXX: is .plt (and .got.plt) required? */ + *(.plt) + } + #else /* CONFIG_PPC32 */ + .toc1 : AT(ADDR(.toc1) - LOAD_OFFSET) { + *(.toc1) + } + + .got : AT(ADDR(.got) - LOAD_OFFSET) ALIGN(256) { + *(.got) +#ifndef CONFIG_RELOCATABLE + __prom_init_toc_start = .; + arch/powerpc/kernel/prom_init.o*(.toc) + __prom_init_toc_end = .; +#endif + *(.toc) + } + SOFT_MASK_TABLE(8) RESTART_TABLE(8) @@ -327,26 +354,11 @@ SECTIONS *(.data.rel*) *(SDATA_MAIN) *(.sdata2) - *(.got.plt) *(.got) - *(.plt) - *(.branch_lt) } #else .data : AT(ADDR(.data) - LOAD_OFFSET) { DATA_DATA *(.data.rel*) - *(.toc1) - *(.branch_lt) - } - - .got : AT(ADDR(.got) - LOAD_OFFSET) ALIGN(256) { - *(.got) -#ifndef CONFIG_RELOCATABLE - __prom_init_toc_start = .; - arch/powerpc/kernel/prom_init.o*(.toc) - __prom_init_toc_end = .; -#endif - *(.toc) } #endif From patchwork Fri Sep 16 04:07:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicholas Piggin X-Patchwork-Id: 1678491 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ozlabs.org (client-ip=2404:9400:2:0:216:3eff:fee1:b9f1; helo=lists.ozlabs.org; envelope-from=linuxppc-dev-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=bK/CMhOa; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2404:9400:2:0:216:3eff:fee1:b9f1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4MTLG81Fnwz1ynm for ; Fri, 16 Sep 2022 14:10:39 +1000 (AEST) Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4MTLG75N1pz3c73 for ; Fri, 16 Sep 2022 14:10:39 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=bK/CMhOa; dkim-atps=neutral X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gmail.com (client-ip=2607:f8b0:4864:20::102d; helo=mail-pj1-x102d.google.com; envelope-from=npiggin@gmail.com; receiver=) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=bK/CMhOa; dkim-atps=neutral Received: from mail-pj1-x102d.google.com (mail-pj1-x102d.google.com [IPv6:2607:f8b0:4864:20::102d]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4MTLCQ2CcMz3bnH for ; Fri, 16 Sep 2022 14:08:18 +1000 (AEST) Received: by mail-pj1-x102d.google.com with SMTP id x1-20020a17090ab00100b001fda21bbc90so24389888pjq.3 for ; Thu, 15 Sep 2022 21:08:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date; bh=8dR4Lohftnx4cWSJ/BDcTN1IRlxOF4hYbEOv5af/wb0=; b=bK/CMhOaxVmrlnb0opzsAqelbHDT2HErOS/db00b2DIgyqtG6ddkLQY0t1BjBxLv5W 3vUDeyju96EwFQgTXeSf4Cdg0dBdHED9c4LCByKzoUVydPPf8kKVj4C7yUPhUsHXdLVx odV8hfQvs3wHCj779ww0tLOEwgwVGeeCP+3GyV+V4jLKS4ZRECLBSoRnCxvf89261+eW NHrn2fuDEfaZxOhQioT4r9u7D/Vw2nd3fkhS5vyPb5nmw23M78CWiNaOdyYacD77PAqz xuvPDFekLH3jsk/DYDp8Fqj6vz08XvF8Z1Yb7NfcgYeVYPGq+sBN7mGjyXbxeS2EEleO BY6g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date; bh=8dR4Lohftnx4cWSJ/BDcTN1IRlxOF4hYbEOv5af/wb0=; b=WhpRqcWbo6Vh0598wTw93QHO/oB6RzT24cO7iiKFYa+v349vEWCQXEXI2pBGgihRcL i8QE/TpCK6LZD4MV6pEK2uZjupa5R+wlM66sWzFYoWWLLjW4Di4PxjU3M9Ugvh8nliKp jf3GeA7Vwvrg71u3Ad4ujXHDb1QQdF09VmPWRuOq+lS222q++Bd4kQr8Ged6dO8zafbE vjz4wh4Olxwhv92oC30rWXxOuXb23sWecM7IYrU7vVfFbupM65/NiWFCLJNPbkplbMsq ao6WJxUo7hVVkBbVyaXyJozCQt70loMCSrDZ0dqI5NG6uu5bluRtr8WcLvTa7yYqZ+R2 ZDuQ== X-Gm-Message-State: ACrzQf3bt0EbBk/6FDe0dRh+lZG/Bs5VgxTAW+HMW6LlLd8plSazyAX/ Rgj0HpE2aQL6p0JBBz1OgRnk/M2U5Jk= X-Google-Smtp-Source: AMsMyM6ZlXyR9vtRoqIzIwWH2usGHPB+Ll1r18Xu96REuoYXFMy5+EYhHlpfWiRypOkp0IK6xtIDjw== X-Received: by 2002:a17:90b:4c92:b0:202:fcca:60ae with SMTP id my18-20020a17090b4c9200b00202fcca60aemr14601629pjb.52.1663301297436; Thu, 15 Sep 2022 21:08:17 -0700 (PDT) Received: from bobo.ozlabs.ibm.com (193-116-127-167.tpgi.com.au. [193.116.127.167]) by smtp.gmail.com with ESMTPSA id t6-20020a1709027fc600b0017534ffd491sm13696816plb.163.2022.09.15.21.08.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Sep 2022 21:08:16 -0700 (PDT) From: Nicholas Piggin To: linuxppc-dev@lists.ozlabs.org, Michael Ellerman , Christophe Leroy Subject: [PATCH v2 4/7] powerpc/build: move .data.rel.ro, .sdata2 to read-only Date: Fri, 16 Sep 2022 14:07:52 +1000 Message-Id: <20220916040755.2398112-5-npiggin@gmail.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220916040755.2398112-1-npiggin@gmail.com> References: <20220916040755.2398112-1-npiggin@gmail.com> MIME-Version: 1.0 X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Nicholas Piggin Errors-To: linuxppc-dev-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" .sdata2 is a readonly small data section for ppc32, and .data.rel.ro is data that needs relocating but is read-only after that so these can both be moved to the read only memory region. Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/vmlinux.lds.S | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/arch/powerpc/kernel/vmlinux.lds.S b/arch/powerpc/kernel/vmlinux.lds.S index 16c4389d498d..ae0814063900 100644 --- a/arch/powerpc/kernel/vmlinux.lds.S +++ b/arch/powerpc/kernel/vmlinux.lds.S @@ -131,6 +131,16 @@ SECTIONS /* Read-only data */ RO_DATA(PAGE_SIZE) +#ifdef CONFIG_PPC32 + .sdata2 : AT(ADDR(.sdata2) - LOAD_OFFSET) { + *(.sdata2) + } +#endif + + .data.rel.ro : AT(ADDR(.data.rel.ro) - LOAD_OFFSET) { + *(.data.rel.ro*) + } + .branch_lt : AT(ADDR(.branch_lt) - LOAD_OFFSET) { *(.branch_lt) } @@ -348,19 +358,13 @@ SECTIONS . = ALIGN(PAGE_SIZE); _sdata = .; -#ifdef CONFIG_PPC32 .data : AT(ADDR(.data) - LOAD_OFFSET) { DATA_DATA *(.data.rel*) +#ifdef CONFIG_PPC32 *(SDATA_MAIN) - *(.sdata2) - } -#else - .data : AT(ADDR(.data) - LOAD_OFFSET) { - DATA_DATA - *(.data.rel*) - } #endif + } /* The initial task and kernel stack */ INIT_TASK_DATA_SECTION(THREAD_ALIGN) From patchwork Fri Sep 16 04:07:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicholas Piggin X-Patchwork-Id: 1678492 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ozlabs.org (client-ip=2404:9400:2:0:216:3eff:fee1:b9f1; helo=lists.ozlabs.org; envelope-from=linuxppc-dev-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=Cp1QREYI; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2404:9400:2:0:216:3eff:fee1:b9f1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4MTLGw3dyWz1ynm for ; Fri, 16 Sep 2022 14:11:20 +1000 (AEST) Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4MTLGw2lFCz3f51 for ; Fri, 16 Sep 2022 14:11:20 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=Cp1QREYI; dkim-atps=neutral X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gmail.com (client-ip=2607:f8b0:4864:20::62f; helo=mail-pl1-x62f.google.com; envelope-from=npiggin@gmail.com; receiver=) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=Cp1QREYI; dkim-atps=neutral Received: from mail-pl1-x62f.google.com (mail-pl1-x62f.google.com [IPv6:2607:f8b0:4864:20::62f]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4MTLCW1rQdz3bxC for ; Fri, 16 Sep 2022 14:08:22 +1000 (AEST) Received: by mail-pl1-x62f.google.com with SMTP id l10so20271881plb.10 for ; Thu, 15 Sep 2022 21:08:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date; bh=YGPP8XImmZTA0T4AZaC5f07EKxjXmelqW985ES55Y9Q=; b=Cp1QREYIQm32QJTF11N0L/3yGymWBsXkuKbEo+NJQ2Gq4OsS3uyQUhRj5GXqQM7DFG YdHuZwSnxIeW/GQHk7UdJJDqoB+BHyQoemiqtzhTCJ+BnT1CwP2nnO5Xs7bz4Sl0jfD/ 4RdPhX6M6TQ1FXf72/BvQLxxjAf6KZTCgEWju4aRVBuoVR4/HkV336Yz8K5t7bJGSNEN yZnvDID5stNG+OgGbU4qIzPp1zQwX/AkWuNBMtiw3UGHZtqaKFXsjsRNkptCopUtkMGB FbFP7CZ4oB08+eIJRO0iN896H/VY6QHl0QR1qD98nt8uXBgkFTYGqOQdTjlm/21EoIQP qeQA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date; bh=YGPP8XImmZTA0T4AZaC5f07EKxjXmelqW985ES55Y9Q=; b=LbKydkPZ+jYQu9FV9fNrYU7iUwicCJpdiP8wZdoQilGmDCy6riHyCcvsPuroJcp8Lu RA1HJR/KNvXbUGfwQhVpsILyFHYIt5gpWDSTBjkTmr8BXp7hUpKbcoMZPx6jHFFIJ1vu gYK6Wh6ynflzjHuHy0tg1sau+qCi6fNsOC/KuuxNBbDCfr2Q6TLNPjq4W0tDMiR8ykJK xSKpE5Za233O7/64OOc3ZHcBjkBiLBnwJq+0e8//xleZdwdSN3aGnIoxIhEGciZcB8pE YuNjN1NorgcL2rRqnrcStfvUXC+Q8RafeeYXqmHfBPuuOqoYNr6dYJSLGQSamiG+LYGA J1XA== X-Gm-Message-State: ACrzQf1UXxXRIlXceZkL8GzqlEJ/+vQKcy1Hvqj1Pp4TJ0HiNd2jWslf r4TL8uxruFyStP9gwPxIp+uWklj9/Qo= X-Google-Smtp-Source: AMsMyM7CUH5SScSeAgLth2fGLSiMlWaIphtbWzkPIzUbtqhHOKuIcN8Ic5WdzSUxANtwubebvtyDDA== X-Received: by 2002:a17:90a:6887:b0:203:5861:fc5d with SMTP id a7-20020a17090a688700b002035861fc5dmr185723pjd.132.1663301300337; Thu, 15 Sep 2022 21:08:20 -0700 (PDT) Received: from bobo.ozlabs.ibm.com (193-116-127-167.tpgi.com.au. [193.116.127.167]) by smtp.gmail.com with ESMTPSA id t6-20020a1709027fc600b0017534ffd491sm13696816plb.163.2022.09.15.21.08.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Sep 2022 21:08:19 -0700 (PDT) From: Nicholas Piggin To: linuxppc-dev@lists.ozlabs.org, Michael Ellerman , Christophe Leroy Subject: [PATCH v2 5/7] powerpc/64/build: only include .opd with ELFv1 Date: Fri, 16 Sep 2022 14:07:53 +1000 Message-Id: <20220916040755.2398112-6-npiggin@gmail.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220916040755.2398112-1-npiggin@gmail.com> References: <20220916040755.2398112-1-npiggin@gmail.com> MIME-Version: 1.0 X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Nicholas Piggin Errors-To: linuxppc-dev-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" ELFv2 does not use function descriptors so .opd is not required. Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/vmlinux.lds.S | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/powerpc/kernel/vmlinux.lds.S b/arch/powerpc/kernel/vmlinux.lds.S index ae0814063900..737825ae2ae0 100644 --- a/arch/powerpc/kernel/vmlinux.lds.S +++ b/arch/powerpc/kernel/vmlinux.lds.S @@ -181,11 +181,13 @@ SECTIONS SOFT_MASK_TABLE(8) RESTART_TABLE(8) +#ifdef CONFIG_PPC64_ELF_ABI_V1 .opd : AT(ADDR(.opd) - LOAD_OFFSET) { __start_opd = .; KEEP(*(.opd)) __end_opd = .; } +#endif . = ALIGN(8); __stf_entry_barrier_fixup : AT(ADDR(__stf_entry_barrier_fixup) - LOAD_OFFSET) { From patchwork Fri Sep 16 04:07:54 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicholas Piggin X-Patchwork-Id: 1678493 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ozlabs.org (client-ip=112.213.38.117; helo=lists.ozlabs.org; envelope-from=linuxppc-dev-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=T2fU/dY0; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4MTLHb50zsz1ynm for ; Fri, 16 Sep 2022 14:11:55 +1000 (AEST) Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4MTLHb48lHz3f8d for ; Fri, 16 Sep 2022 14:11:55 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=T2fU/dY0; dkim-atps=neutral X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gmail.com (client-ip=2607:f8b0:4864:20::42e; helo=mail-pf1-x42e.google.com; envelope-from=npiggin@gmail.com; receiver=) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=T2fU/dY0; dkim-atps=neutral Received: from mail-pf1-x42e.google.com (mail-pf1-x42e.google.com [IPv6:2607:f8b0:4864:20::42e]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4MTLCZ04mmz3c4Y for ; Fri, 16 Sep 2022 14:08:25 +1000 (AEST) Received: by mail-pf1-x42e.google.com with SMTP id b23so20025466pfp.9 for ; Thu, 15 Sep 2022 21:08:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date; bh=UKC/IzsPnIQkIn2U1AVRO3JOd6E9HJwIL20GIQ2shWo=; b=T2fU/dY0Vz5dMlOkffbcBx9hGanADDhJHw1vP65B4q2GnneK7czw5kJ+miwiuarJ/c UULpYNbKFsYdslONiazChwKgx/9h/k7xezyVlVg+bOAQq7CRgeNJEu73+wpqMWak9l7S I+3tMTcwQs3dZsOuKG9c0WpNlRpOAWmUWpD6Kl5tkAOj0BSx4YPxDQYVreYgkdEYD9bP IL+rNhXpzV9OKwdkXKeZvwBxDYwIPzTVLDPMNQbiMPBOzyNViWVwE8L77a63P/y+q1iF VmOjU4zOygTPMpTia2HKCwfPL6lKIXFVnB3TvLBAhJjUgtcp1ofDsFbpIjn4jLVknsL2 T+Fg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date; bh=UKC/IzsPnIQkIn2U1AVRO3JOd6E9HJwIL20GIQ2shWo=; b=A7wCRFfHzaM/+CzuDbxUFqwQu315I6/4cMzApWWDXwkLd9jBvjX6AdwkTyy1v6oDKF Zbd6/fKmzHZ/xB65Q61DruRURbQ0XWNjgXmmXkKOaGcU3vZx6vC2GDUufNkAeJsw154+ USe9L1X+VCQM1qF+b4sQbYX25mi83cmKTbsVLqvyBfses//lYQecQTyL0hlMqS+oBH5I mOrC7qL3ZCMQqnKgQ6MGxEEd8WRw/oIId/diipfH5SuOcFkb5bAD/6pyDT+wEaXs0PS2 looSM6/CGFY7zUmRPVUXt5bX5PfN7CDALGMMn1KTDMkk1RNu6WOzQPg6uDFOCyq5lPCE 3T1A== X-Gm-Message-State: ACrzQf1frTYxp0AZ8qb4/2fHIf0YT/CmrPVMTx9OCSVufP43+4ANyp4X eEs6or2XRxqCWvE1CROppUFSu1azAtg= X-Google-Smtp-Source: AMsMyM4tmqB5LGcBlZOoFlnQhF0RcA9/1MOm9YlZ8BDmqeud2k48GaOXlLC+fNk+Kn9ir2fzQB/nSQ== X-Received: by 2002:a63:e205:0:b0:435:c80:ecd0 with SMTP id q5-20020a63e205000000b004350c80ecd0mr2785943pgh.174.1663301303331; Thu, 15 Sep 2022 21:08:23 -0700 (PDT) Received: from bobo.ozlabs.ibm.com (193-116-127-167.tpgi.com.au. [193.116.127.167]) by smtp.gmail.com with ESMTPSA id t6-20020a1709027fc600b0017534ffd491sm13696816plb.163.2022.09.15.21.08.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Sep 2022 21:08:22 -0700 (PDT) From: Nicholas Piggin To: linuxppc-dev@lists.ozlabs.org, Michael Ellerman , Christophe Leroy Subject: [PATCH v2 6/7] powerpc/64/build: merge .got and .toc input sections Date: Fri, 16 Sep 2022 14:07:54 +1000 Message-Id: <20220916040755.2398112-7-npiggin@gmail.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220916040755.2398112-1-npiggin@gmail.com> References: <20220916040755.2398112-1-npiggin@gmail.com> MIME-Version: 1.0 X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Nicholas Piggin Errors-To: linuxppc-dev-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" Follow the binutils ld internal linker script and merge .got and .toc input sections in the .got output section. Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/vmlinux.lds.S | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/arch/powerpc/kernel/vmlinux.lds.S b/arch/powerpc/kernel/vmlinux.lds.S index 737825ae2ae0..3d96d51c8a5f 100644 --- a/arch/powerpc/kernel/vmlinux.lds.S +++ b/arch/powerpc/kernel/vmlinux.lds.S @@ -169,13 +169,12 @@ SECTIONS } .got : AT(ADDR(.got) - LOAD_OFFSET) ALIGN(256) { - *(.got) + *(.got .toc) #ifndef CONFIG_RELOCATABLE __prom_init_toc_start = .; arch/powerpc/kernel/prom_init.o*(.toc) __prom_init_toc_end = .; #endif - *(.toc) } SOFT_MASK_TABLE(8) From patchwork Fri Sep 16 04:07:55 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicholas Piggin X-Patchwork-Id: 1678494 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ozlabs.org (client-ip=2404:9400:2:0:216:3eff:fee1:b9f1; helo=lists.ozlabs.org; envelope-from=linuxppc-dev-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=n/YfM7Sv; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2404:9400:2:0:216:3eff:fee1:b9f1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4MTLJG6XXMz1ynm for ; Fri, 16 Sep 2022 14:12:30 +1000 (AEST) Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4MTLJG63KKz3fBV for ; Fri, 16 Sep 2022 14:12:30 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=n/YfM7Sv; dkim-atps=neutral X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gmail.com (client-ip=2607:f8b0:4864:20::531; helo=mail-pg1-x531.google.com; envelope-from=npiggin@gmail.com; receiver=) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=n/YfM7Sv; dkim-atps=neutral Received: from mail-pg1-x531.google.com (mail-pg1-x531.google.com [IPv6:2607:f8b0:4864:20::531]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4MTLCd2ZlFz3c6N for ; Fri, 16 Sep 2022 14:08:29 +1000 (AEST) Received: by mail-pg1-x531.google.com with SMTP id r23so10626039pgr.6 for ; Thu, 15 Sep 2022 21:08:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date; bh=FzVeBl6UEwj4BGFvXAQc6ukNXP28RZr0i6SJS1709Xk=; b=n/YfM7Sv4h+ygDRer1ktk6/5A89oxTLmogZiwGSYhK24iFTemo1+LU4ZasacManI0E VhlshWpwF36cdv9hcA3PHE0JwBOS4MsmDVyHkaMIUe4+/ljevbg2FLgnZtaS3/6UvD6T nDsdR6HISwg7kXZvBOlfFUlIx3+xxAoHnIYKn5Xvmd30kzemObEIeC9RQ3vSCn0NyiM8 +nav0kC3hPJjjRchGdIeV1nme3o2af7Jz2C+rDHvI41DnZyfZjEqSB9+j9XVpDl8i00t rkvCa7oRhqHvt6YP8TJKVuNX58mXW7eZ5jJYZ2JlOrMxsrJj24LXa7tR/ivnG+4Xzc8n gdqw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date; bh=FzVeBl6UEwj4BGFvXAQc6ukNXP28RZr0i6SJS1709Xk=; b=nn+N8WF0tc3hgmfthx8ydeaDDoCDyiIKIhu0PGG+QxDQsbAuluGiuo6KDaJH4we82H AeoHgcgrHJYUIb6lzy8BlRdAORZJUjHEs4/d/ZJwx1Im5+ECnYwYF+OWSHRqn7r86YCY ODIQela5iKnzAyAdmd3+UNFwA24SOKVVr6cTfmd8INK/d2UJXZ+sqR0/HCAA2hU4vryr bGJJ42v/sgu2jx1rKQE1GLSTcn3vVq+1dRG/u6gxaL2pLqcSRBKXJx2p6tl0uIi6cjUS a4FjxhFvioo18JSjkSb9uNEXmy3Ud5jpf0J4H0Wk5yaLq2Fi7tX5Y4f1E9dlU8mNGW+J VZWg== X-Gm-Message-State: ACrzQf3TSa67nxgnjDMGQ3EKepp1o0hdbyp+jOQ1hIAONwASrQ51w2lB /3s9wyuhBQzQrBkKMhA/ItHSe9GfrVY= X-Google-Smtp-Source: AMsMyM5dHg4JOQq59j5GFod8A5rxeWlfZ31C8Ime7QFGzcQs5/BQLxBAsp4GRAIzZdew6oC8uXA0mQ== X-Received: by 2002:a63:1349:0:b0:438:fa5a:b6f1 with SMTP id 9-20020a631349000000b00438fa5ab6f1mr2913581pgt.250.1663301306326; Thu, 15 Sep 2022 21:08:26 -0700 (PDT) Received: from bobo.ozlabs.ibm.com (193-116-127-167.tpgi.com.au. [193.116.127.167]) by smtp.gmail.com with ESMTPSA id t6-20020a1709027fc600b0017534ffd491sm13696816plb.163.2022.09.15.21.08.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Sep 2022 21:08:25 -0700 (PDT) From: Nicholas Piggin To: linuxppc-dev@lists.ozlabs.org, Michael Ellerman , Christophe Leroy Subject: [PATCH v2 7/7] powerpc/build: put sys_call_table in .data.rel.ro if RELOCATABLE Date: Fri, 16 Sep 2022 14:07:55 +1000 Message-Id: <20220916040755.2398112-8-npiggin@gmail.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220916040755.2398112-1-npiggin@gmail.com> References: <20220916040755.2398112-1-npiggin@gmail.com> MIME-Version: 1.0 X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Nicholas Piggin Errors-To: linuxppc-dev-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" Const function pointers by convention live in .data.rel.ro if they need to be relocated. Now that .data.rel.ro is linked into the read-only region, put them in the right section. This doesn't make much practical difference, but it will make the C conversion of sys_call_table a smaller change as far as linking goes. Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/systbl.S | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/arch/powerpc/kernel/systbl.S b/arch/powerpc/kernel/systbl.S index cb3358886203..0bec33e86f50 100644 --- a/arch/powerpc/kernel/systbl.S +++ b/arch/powerpc/kernel/systbl.S @@ -12,7 +12,11 @@ #include +#ifdef CONFIG_RELOCATABLE +.section .data.rel.ro,"aw" +#else .section .rodata,"a" +#endif #ifdef CONFIG_PPC64 .p2align 3