From patchwork Thu Mar 30 04:20:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 1763219 X-Patchwork-Delegate: uboot@andestech.com 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.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (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 4PnNG20WVWz1yXv for ; Thu, 30 Mar 2023 23:36:40 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 89C0385E35; Thu, 30 Mar 2023 14:36:23 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=tinylab.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by phobos.denx.de (Postfix, from userid 109) id EB97185D8B; Thu, 30 Mar 2023 06:20:41 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_MSPIKE_H2, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from bg4.exmail.qq.com (bg4.exmail.qq.com [43.154.221.58]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id A26E1856E5 for ; Thu, 30 Mar 2023 06:20:36 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=tinylab.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=bmeng@tinylab.org X-QQ-mid: bizesmtp81t1680150026t8203gyw Received: from ubuntu.. ( [111.196.129.125]) by bizesmtp.qq.com (ESMTP) with id ; Thu, 30 Mar 2023 12:20:24 +0800 (CST) X-QQ-SSF: 01200000000000D0E000000A0000000 X-QQ-FEAT: CR3LFp2JE4knx4A2Mrdy2Daqf2xWvocrqKDf7tNHeuQj8aNSVpBedF0x60oSU nXeZU08aXbeULau7lUlXvBPcf3BCL6dMV9TpjmzxHykUSmWa7IQaeqSC6mNDlzyPucbG7er Ri/gd4ElYO0H/v7eO3ZhxLT2WpvBc/gckiQMKFN/pC4FIxC6x4BI/LjcnV/OERJyD26okMn u/+V0Yr6qjEeLbnzoSZxP9VL2mmsrvkdO/sOD9L9aG2SFboAVSZD7bn2w9MhytkBMirYLXj EHZZqHjwUHwAkLONZXNQXIwXHnfRNvxJ69Qb3hU/7LdPhGI+BmMLQMSdDx4U5ph0OoqPcOc 705YHwF X-QQ-GoodBg: 0 X-BIZMAIL-ID: 12853875043017767505 From: Bin Meng To: u-boot@lists.denx.de Cc: Leo , Nikita Shubin , Rick Chen Subject: [PATCH 1/8] riscv: Optimize source end address calculation in start.S Date: Thu, 30 Mar 2023 12:20:17 +0800 Message-Id: <20230330042024.721710-1-bmeng@tinylab.org> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtp:tinylab.org:qybglogicsvr:qybglogicsvr3 X-Mailman-Approved-At: Thu, 30 Mar 2023 14:36:20 +0200 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean The __bss_start is the source end address hence load its address directly into register 't2' for optimization. Signed-off-by: Bin Meng Reviewed-by: Rick Chen --- arch/riscv/cpu/start.S | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/arch/riscv/cpu/start.S b/arch/riscv/cpu/start.S index 4687bca3c9..3c8344c345 100644 --- a/arch/riscv/cpu/start.S +++ b/arch/riscv/cpu/start.S @@ -283,9 +283,7 @@ stack_setup: beq t0, s4, clear_bss /* skip relocation */ mv t1, s4 /* t1 <- scratch for copy_loop */ - la t3, __bss_start - sub t3, t3, t0 /* t3 <- __bss_start_ofs */ - add t2, t0, t3 /* t2 <- source end address */ + la t2, __bss_start /* t2 <- source end address */ copy_loop: LREG t5, 0(t0) From patchwork Thu Mar 30 04:20:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 1763222 X-Patchwork-Delegate: uboot@andestech.com 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.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (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 4PnNHD6G0Pz1yXv for ; Thu, 30 Mar 2023 23:37:44 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id DF4548605E; Thu, 30 Mar 2023 14:36:34 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=tinylab.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by phobos.denx.de (Postfix, from userid 109) id 5F69885A36; Thu, 30 Mar 2023 06:20:46 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_MSPIKE_H2, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from bg4.exmail.qq.com (bg4.exmail.qq.com [43.154.221.58]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 6976B85738 for ; Thu, 30 Mar 2023 06:20:38 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=tinylab.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=bmeng@tinylab.org X-QQ-mid: bizesmtp81t1680150029tlcjslz0 Received: from ubuntu.. ( [111.196.129.125]) by bizesmtp.qq.com (ESMTP) with id ; Thu, 30 Mar 2023 12:20:28 +0800 (CST) X-QQ-SSF: 01200000000000D0E000000A0000000 X-QQ-FEAT: 7RU7PMus3l6e8735tggK9v1GAcB2Gdd8ixcVfBN9on8lKvdQaqtyuwEDSmgLu tfIichsEQVBV+gWo8fjBI74+sZYUBqUZ7Ivo2guSrRTWT67Z1SKZp2V83CShlaN0dbpZMRO CByQNbGfKSl8TnVPDkEw1afMpAjMzxGvOYInR/asD7lTLxq37CCng336OOew0XKZDs7KoTo 79NUSu2ihzLT2q8wcVA0cjz7ydJIqGeePI52Zt6QiLO33LgU3Xdmgez0WimeLipP03x9KkK YafqOKcUNtF3HsoPm67mkRLol6ZlxsonOppRKyLZcB8FVJqyDBdIxTKWY3G5fRv4jYmysH2 GW1t0e0r9lkMai221Dgcs/vG5gdrw== X-QQ-GoodBg: 0 X-BIZMAIL-ID: 13614437465052150269 From: Bin Meng To: u-boot@lists.denx.de Cc: Leo , Nikita Shubin , Rick Chen Subject: [PATCH 2/8] riscv: Optimize loading relocation type Date: Thu, 30 Mar 2023 12:20:18 +0800 Message-Id: <20230330042024.721710-2-bmeng@tinylab.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230330042024.721710-1-bmeng@tinylab.org> References: <20230330042024.721710-1-bmeng@tinylab.org> MIME-Version: 1.0 X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtp:tinylab.org:qybglogicsvr:qybglogicsvr3 X-Mailman-Approved-At: Thu, 30 Mar 2023 14:36:20 +0200 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean 't5' already contains relocation type so don't bother reloading it. Signed-off-by: Bin Meng Reviewed-by: Rick Chen --- arch/riscv/cpu/start.S | 1 - 1 file changed, 1 deletion(-) diff --git a/arch/riscv/cpu/start.S b/arch/riscv/cpu/start.S index 3c8344c345..879bdc1803 100644 --- a/arch/riscv/cpu/start.S +++ b/arch/riscv/cpu/start.S @@ -323,7 +323,6 @@ fix_rela_dyn: add t4, t4, t6 9: - LREG t5, -(REGBYTES*2)(t1) /* t5 <-- relocation info:type */ srli t0, t5, SYM_INDEX /* t0 <--- sym table index */ andi t5, t5, 0xFF /* t5 <--- relocation type */ li t3, RELOC_TYPE From patchwork Thu Mar 30 04:20:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 1763220 X-Patchwork-Delegate: uboot@andestech.com 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.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (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 4PnNGN2SCKz1yXv for ; Thu, 30 Mar 2023 23:37:00 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id CE77685E80; Thu, 30 Mar 2023 14:36:26 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=tinylab.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by phobos.denx.de (Postfix, from userid 109) id 3A857856E5; Thu, 30 Mar 2023 06:20:42 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_MSPIKE_H2, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from bg4.exmail.qq.com (bg4.exmail.qq.com [43.155.65.254]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 38EC485725 for ; Thu, 30 Mar 2023 06:20:36 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=tinylab.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=bmeng@tinylab.org X-QQ-mid: bizesmtp81t1680150032tk6gbc5e Received: from ubuntu.. ( [111.196.129.125]) by bizesmtp.qq.com (ESMTP) with SMTP id 0 for ; Thu, 30 Mar 2023 12:20:31 +0800 (CST) X-QQ-SSF: 01200000000000D0E000000A0000000 X-QQ-FEAT: Z2qCHCq1/93R2UHdfxKlFXQpTzIupQCxNyWQlFjxQwQYKoO7SGEb0pnwglfnz 1u89SUxP7l3DGhhA+SxeJ97LJdJ060GRhWbUQUpKD+ei3gPW8+X/Y3LYl7VSAGNCFA7AptX 5xLlsgFTF71IY8+nR3BS365wSdVYia+j1LfQIgEnq7PVX/J139TnSbELnWHCdXhz4qwr2QL B61u+CRYYgwYWw7wyfBJ569ZSqqStQB4LViuKHfjC09YrLxEKNlDYknGs3yeuvwk+J+cw9C W43vPfQlLimPh4nO3UnihmIjSCH2r80w0t+atFuMYHX2CIgzrJdPSghVrY5RO4AHSaUPsi9 QZIWENxRqJLbySvJz/m67hLhXHzG38llnqTMuaj X-QQ-GoodBg: 0 X-BIZMAIL-ID: 14359555697211511868 From: Bin Meng To: u-boot@lists.denx.de Subject: [PATCH 3/8] tools: prelink-riscv: Cosmetic style fixes Date: Thu, 30 Mar 2023 12:20:19 +0800 Message-Id: <20230330042024.721710-3-bmeng@tinylab.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230330042024.721710-1-bmeng@tinylab.org> References: <20230330042024.721710-1-bmeng@tinylab.org> MIME-Version: 1.0 X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtp:tinylab.org:qybglogicsvr:qybglogicsvr3 X-Mailman-Approved-At: Thu, 30 Mar 2023 14:36:20 +0200 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean Some coding convention fixes. Signed-off-by: Bin Meng Reviewed-by: Rick Chen --- tools/prelink-riscv.inc | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tools/prelink-riscv.inc b/tools/prelink-riscv.inc index f2b5467f5b..d6a58929e9 100644 --- a/tools/prelink-riscv.inc +++ b/tools/prelink-riscv.inc @@ -30,7 +30,7 @@ #define cpu_to_target32 CONCAT3(cpu_to_, PRELINK_BYTEORDER, 32) #define cpu_to_target64 CONCAT3(cpu_to_, PRELINK_BYTEORDER, 64) -static void* get_offset_bonn (void* data, Elf_Phdr* phdrs, size_t phnum, Elf_Addr addr) +static void *get_offset_bonn(void *data, Elf_Phdr *phdrs, size_t phnum, Elf_Addr addr) { Elf_Phdr *p; @@ -67,13 +67,13 @@ static void prelink_bonn(void *data) Elf_Rela *rela_dyn = NULL; size_t rela_count = 0; Elf_Sym *dynsym = NULL; - for (dyn = dyns;; ++dyn) { + for (dyn = dyns; ; ++dyn) { if (targetnn_to_cpu(dyn->d_tag) == DT_NULL) break; else if (targetnn_to_cpu(dyn->d_tag) == DT_RELA) rela_dyn = get_offset_bonn(data, phdrs, target16_to_cpu(ehdr->e_phnum), + targetnn_to_cpu(dyn->d_un.d_ptr)); else if (targetnn_to_cpu(dyn->d_tag) == DT_RELASZ) - rela_count = targetnn_to_cpu(dyn->d_un.d_val) / sizeof(Elf_Rela); + rela_count = targetnn_to_cpu(dyn->d_un.d_val) / sizeof(Elf_Rela); else if (targetnn_to_cpu(dyn->d_tag) == DT_SYMTAB) dynsym = get_offset_bonn(data, phdrs, target16_to_cpu(ehdr->e_phnum), + targetnn_to_cpu(dyn->d_un.d_ptr)); @@ -92,11 +92,11 @@ static void prelink_bonn(void *data) continue; if (ELF_R_TYPE(targetnn_to_cpu(r->r_info)) == R_RISCV_RELATIVE) - *((uintnn_t*) buf) = r->r_addend; + *((uintnn_t*)buf) = r->r_addend; else if (ELF_R_TYPE(targetnn_to_cpu(r->r_info)) == R_RISCV_32) - *((uint32_t*) buf) = cpu_to_target32(targetnn_to_cpu(dynsym[ELF_R_SYM(targetnn_to_cpu(r->r_info))].st_value) + targetnn_to_cpu(r->r_addend)); + *((uint32_t*)buf) = cpu_to_target32(targetnn_to_cpu(dynsym[ELF_R_SYM(targetnn_to_cpu(r->r_info))].st_value) + targetnn_to_cpu(r->r_addend)); else if (ELF_R_TYPE(targetnn_to_cpu(r->r_info)) == R_RISCV_64) - *((uint64_t*) buf) = cpu_to_target64(targetnn_to_cpu(dynsym[ELF_R_SYM(targetnn_to_cpu(r->r_info))].st_value) + targetnn_to_cpu(r->r_addend)); + *((uint64_t*)buf) = cpu_to_target64(targetnn_to_cpu(dynsym[ELF_R_SYM(targetnn_to_cpu(r->r_info))].st_value) + targetnn_to_cpu(r->r_addend)); } } From patchwork Thu Mar 30 04:20:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 1763221 X-Patchwork-Delegate: uboot@andestech.com 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.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (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 4PnNGt1kMxz1yXv for ; Thu, 30 Mar 2023 23:37:26 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 06AC885E83; Thu, 30 Mar 2023 14:36:30 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=tinylab.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by phobos.denx.de (Postfix, from userid 109) id A38C585738; Thu, 30 Mar 2023 06:20:46 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_MSPIKE_H2, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from bg4.exmail.qq.com (bg4.exmail.qq.com [43.154.221.58]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 7ABD885D4A for ; Thu, 30 Mar 2023 06:20:40 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=tinylab.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=bmeng@tinylab.org X-QQ-mid: bizesmtp81t1680150035tcekgouv Received: from ubuntu.. ( [111.196.129.125]) by bizesmtp.qq.com (ESMTP) with id ; Thu, 30 Mar 2023 12:20:34 +0800 (CST) X-QQ-SSF: 01200000000000D0E000000A0000000 X-QQ-FEAT: C46Rb8GPIEeJRaQ+qdQYSq4Q5jPUh481fkFIggrWZoIF5lc5e+rIVNEBZRnIh I5kBVuflKbJkX5ypJSv7yjgTim+RLUTRSUOdt2SlWrIZ2aP8iv7JGEmq0VUTX7xcQN7o6Tr XcDUecYLrzz6noHAkBbco0drtpklTqqGVHcEQV8pKn9DlQ9DTeoUcWBcIQNCOhKagHM2w1N Kv+X4iZBQZHS5YVx2W8XeKSHlKzP2q+uDn8DPyaTnTEHSBSTsN4itwMfGEaLvRHe0aIWfHH Z1kdA4COrCfR5fN4tEk5+1pc/CFGDw/NWOR3HXnoP88xGse5YuRHhY0Rltw9wifrMJMh7A3 0cssKl1+6gFmvBvsd/tGzDzCzyCzCbJCQvKIDXI X-QQ-GoodBg: 0 X-BIZMAIL-ID: 5140976987743705372 From: Bin Meng To: u-boot@lists.denx.de Cc: Leo , Rick Chen Subject: [PATCH 4/8] tools: prelink-riscv: Unmap the ELF image when done Date: Thu, 30 Mar 2023 12:20:20 +0800 Message-Id: <20230330042024.721710-4-bmeng@tinylab.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230330042024.721710-1-bmeng@tinylab.org> References: <20230330042024.721710-1-bmeng@tinylab.org> MIME-Version: 1.0 X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtp:tinylab.org:qybglogicsvr:qybglogicsvr3 X-Mailman-Approved-At: Thu, 30 Mar 2023 14:36:20 +0200 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean The codes forget to call munmap() to unmap the ELF image that was mapped by previous mmap(). Signed-off-by: Bin Meng Reviewed-by: Simon Glass Reviewed-by: Rick Chen --- tools/prelink-riscv.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/prelink-riscv.c b/tools/prelink-riscv.c index b0467949eb..43d6412ee9 100644 --- a/tools/prelink-riscv.c +++ b/tools/prelink-riscv.c @@ -118,5 +118,7 @@ int main(int argc, const char *const *argv) prelink_le32(data); } + munmap(data, st.st_size); + return 0; } From patchwork Thu Mar 30 04:20:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 1763225 X-Patchwork-Delegate: uboot@andestech.com 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.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (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 4PnNJ154N8z1yXv for ; Thu, 30 Mar 2023 23:38:25 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id BCD47860AB; Thu, 30 Mar 2023 14:37:10 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=tinylab.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by phobos.denx.de (Postfix, from userid 109) id 78A4F85B19; Thu, 30 Mar 2023 06:21:06 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_MSPIKE_H2, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from bg4.exmail.qq.com (bg4.exmail.qq.com [43.155.65.254]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id AAC0A85725 for ; Thu, 30 Mar 2023 06:21:01 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=tinylab.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=bmeng@tinylab.org X-QQ-mid: bizesmtp81t1680150039tef4ujd3 Received: from ubuntu.. ( [111.196.129.125]) by bizesmtp.qq.com (ESMTP) with id ; Thu, 30 Mar 2023 12:20:37 +0800 (CST) X-QQ-SSF: 01200000000000D0E000000A0000000 X-QQ-FEAT: UMQM+3VOEYvPnLb9PU25f5F9gxtMgttJFAlDZNsnDTUOMwwDuPAVzW14krvMC yC5il/r1lNFGehbxcwBka4L/ILmJyvKTMt9hdhmQCPlgKdNvo1eSPhLWnmsOG1DqELAzuMj NTZfQmllZs6suBEu2tJ19J0kjWv+4kE2hlcPYcknpPbiZgo/GIi6OYDqbzYOOxR0pWRl3+f SahYn6o9y6qtLPMzmFi5AaVxUYUrGf7oiBb3ryBOMRbw+IcN/pbvG5vXvOSgu6Rd3E2w6PT yfWjNusytjaWXa+RObzN9YqubUUaXyqTB10fFDEcT7PjbjDlkmqO1HLVccQtR+MSTDuUFzx Btx+WXmz33hQWSmSAAVx73KPaFh96D8DLXaMlWz X-QQ-GoodBg: 0 X-BIZMAIL-ID: 1661013085954822930 From: Bin Meng To: u-boot@lists.denx.de Cc: Heinrich Schuchardt , Kever Yang , =?utf-8?q?Marek_Beh=C3=BAn?= , =?utf-8?q?Pali_Roh=C3=A1r?= , Quentin Schulz , Simon Glass Subject: [PATCH 5/8] makefile: riscv: Drop useless argument of prelink-riscv Date: Thu, 30 Mar 2023 12:20:21 +0800 Message-Id: <20230330042024.721710-5-bmeng@tinylab.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230330042024.721710-1-bmeng@tinylab.org> References: <20230330042024.721710-1-bmeng@tinylab.org> MIME-Version: 1.0 X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtp:tinylab.org:qybglogicsvr:qybglogicsvr3 X-Mailman-Approved-At: Thu, 30 Mar 2023 14:36:20 +0200 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean The argv[2] is never used in prelink-riscv. Drop it. Signed-off-by: Bin Meng Reviewed-by: Rick Chen --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index ab93f29fc5..33e54bfa3d 100644 --- a/Makefile +++ b/Makefile @@ -1758,7 +1758,7 @@ ifeq ($(CONFIG_KALLSYMS),y) endif ifeq ($(CONFIG_RISCV),y) - @tools/prelink-riscv $@ 0 + @tools/prelink-riscv $@ endif quiet_cmd_sym ?= SYM $@ From patchwork Thu Mar 30 04:20:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 1763223 X-Patchwork-Delegate: uboot@andestech.com 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.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (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 4PnNHT44LHz1yXv for ; Thu, 30 Mar 2023 23:37:57 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 14BB786074; Thu, 30 Mar 2023 14:36:41 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=tinylab.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by phobos.denx.de (Postfix, from userid 109) id 5E699856E5; Thu, 30 Mar 2023 06:20:57 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_MSPIKE_H2, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from bg4.exmail.qq.com (bg4.exmail.qq.com [43.154.221.58]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 427F385B19 for ; Thu, 30 Mar 2023 06:20:51 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=tinylab.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=bmeng@tinylab.org X-QQ-mid: bizesmtp81t1680150042ti1e2j1l Received: from ubuntu.. ( [111.196.129.125]) by bizesmtp.qq.com (ESMTP) with id ; Thu, 30 Mar 2023 12:20:41 +0800 (CST) X-QQ-SSF: 01200000000000D0E000000A0000000 X-QQ-FEAT: fp7GbACbaw756LB+jyPmW4rm3LD0lj4HCvaQSn1vKbzuABlacRk6oA11Is0dD VxB5tjf6y83X1wS2jsdLroZP4De54TBxSQLDo08Z8Pj0UqwaLVqRU2q10jMb5a3Wk0x9ei7 96pRl1TI+LJlspbQkoQNVaM9p9rqVAeSgs6/jNGCNZ6IGMv45YOzuIImcyJ5suwMs7iDOXU wDGBJVZETdnXETy1hP9Z+lhs2hgh9qeMxdJEAbc6DXnfXMlH8E1YBOV1cXCrC2A+MgJ66yV /vlhZJ7DmtoMv0lzOpChrjdVDhy5VRCuIDXl5I/yOOK3tE/kpx3ARXkuk8LtRuJP7N0Jo2O GtQSfunM2YYIyNgx1SqQWqfOTE0NOBuj0lcKICl X-QQ-GoodBg: 0 X-BIZMAIL-ID: 11615140934973401698 From: Bin Meng To: u-boot@lists.denx.de Cc: Leo , Nikita Shubin , Rick Chen Subject: [PATCH 6/8] riscv: Change to use positive offset to access relocation entries Date: Thu, 30 Mar 2023 12:20:22 +0800 Message-Id: <20230330042024.721710-6-bmeng@tinylab.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230330042024.721710-1-bmeng@tinylab.org> References: <20230330042024.721710-1-bmeng@tinylab.org> MIME-Version: 1.0 X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtp:tinylab.org:qybglogicsvr:qybglogicsvr3 X-Mailman-Approved-At: Thu, 30 Mar 2023 14:36:20 +0200 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean The codes currently skip the very first relocation entry, and have an inaccurate comment "skip first reserved entry" indicating that the first entry is reserved, but later it references the elements in the first relocation entry using a minus offset. Change to use a positive offset so that there is no need to skip the first relocation entry. Signed-off-by: Bin Meng --- arch/riscv/cpu/start.S | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/arch/riscv/cpu/start.S b/arch/riscv/cpu/start.S index 879bdc1803..c09d1cb412 100644 --- a/arch/riscv/cpu/start.S +++ b/arch/riscv/cpu/start.S @@ -302,17 +302,12 @@ fix_rela_dyn: add t1, t1, t6 /* t1 <- rela_dyn_start in RAM */ add t2, t2, t6 /* t2 <- rela_dyn_end in RAM */ -/* - * skip first reserved entry: address, type, addend - */ - j 10f - 6: - LREG t5, -(REGBYTES*2)(t1) /* t5 <-- relocation info:type */ + LREG t5, REGBYTES(t1) /* t5 <-- relocation info:type */ li t3, R_RISCV_RELATIVE /* reloc type R_RISCV_RELATIVE */ bne t5, t3, 8f /* skip non-RISCV_RELOC entries */ - LREG t3, -(REGBYTES*3)(t1) - LREG t5, -(REGBYTES)(t1) /* t5 <-- addend */ + LREG t3, 0(t1) + LREG t5, (REGBYTES * 2)(t1) /* t5 <-- addend */ add t5, t5, t6 /* t5 <-- location to fix up in RAM */ add t3, t3, t6 /* t3 <-- location to fix up in RAM */ SREG t5, 0(t3) @@ -328,19 +323,19 @@ fix_rela_dyn: li t3, RELOC_TYPE bne t5, t3, 10f /* skip non-addned entries */ - LREG t3, -(REGBYTES*3)(t1) + LREG t3, 0(t1) li t5, SYM_SIZE mul t0, t0, t5 add s5, t4, t0 - LREG t0, -(REGBYTES)(t1) /* t0 <-- addend */ + LREG t0, (REGBYTES * 2)(t1) /* t0 <-- addend */ LREG t5, REGBYTES(s5) add t5, t5, t0 add t5, t5, t6 /* t5 <-- location to fix up in RAM */ add t3, t3, t6 /* t3 <-- location to fix up in RAM */ SREG t5, 0(t3) 10: - addi t1, t1, (REGBYTES*3) - ble t1, t2, 6b + addi t1, t1, (REGBYTES * 3) + blt t1, t2, 6b /* * trap update From patchwork Thu Mar 30 04:20:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 1763224 X-Patchwork-Delegate: uboot@andestech.com 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.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (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 4PnNHl4dW6z1yXv for ; Thu, 30 Mar 2023 23:38:11 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id D37DE860A2; Thu, 30 Mar 2023 14:36:51 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=tinylab.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by phobos.denx.de (Postfix, from userid 109) id D082985D7C; Thu, 30 Mar 2023 06:21:05 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_MSPIKE_H2, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from bg4.exmail.qq.com (bg4.exmail.qq.com [43.154.221.58]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id C973885B19 for ; Thu, 30 Mar 2023 06:21:01 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=tinylab.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=bmeng@tinylab.org X-QQ-mid: bizesmtp81t1680150045t6png9qp Received: from ubuntu.. ( [111.196.129.125]) by bizesmtp.qq.com (ESMTP) with id ; Thu, 30 Mar 2023 12:20:44 +0800 (CST) X-QQ-SSF: 01200000000000D0E000000A0000000 X-QQ-FEAT: Z2qCHCq1/907eRCEvXyBl57QrcylrC3aIO3MOHoM5xvvV4hkbQcg5gBlK9b44 oP7CFkk3dvtS1huI1DQZF1peeTtxtmqBH0FIeW3m9M/tsV2wcwS9modp+jBqfBgTiHMpqhS 5cuyGZyNdQAd5ctuiB0WTcKLhrpLkSLZUXTNLE8Ktz/LKwd0X9yWHEXg5of+L2MA+NUfuJX M+HWtSmanVgx0fdOjmgBWhDByumxEd8z0u2zbxp+SMDlXOcSfyH35C2Nom79jDuQ/Qovthh vCym1mRJ7+WEskYiVkfzdCch5GeELCILWdu5sfbVvWAt5tkDr8T1qjKYhwQsRU7Zd2CD8RI UTW9hdEvmKbAJg+VMonTu2pISZ32OHOo8fqsrkn X-QQ-GoodBg: 0 X-BIZMAIL-ID: 14746569424664129575 From: Bin Meng To: u-boot@lists.denx.de Cc: Andrew Scull , Leo , Rick Chen , Simon Glass Subject: [PATCH 7/8] riscv: spl: Remove relocation sections Date: Thu, 30 Mar 2023 12:20:23 +0800 Message-Id: <20230330042024.721710-7-bmeng@tinylab.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230330042024.721710-1-bmeng@tinylab.org> References: <20230330042024.721710-1-bmeng@tinylab.org> MIME-Version: 1.0 X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtp:tinylab.org:qybglogicsvr:qybglogicsvr3 X-Mailman-Approved-At: Thu, 30 Mar 2023 14:36:20 +0200 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean U-Boot SPL is not relocable. Drop these relocation sections. Signed-off-by: Bin Meng --- arch/riscv/cpu/u-boot-spl.lds | 25 ------------------------- 1 file changed, 25 deletions(-) diff --git a/arch/riscv/cpu/u-boot-spl.lds b/arch/riscv/cpu/u-boot-spl.lds index 993536302a..c3b4907905 100644 --- a/arch/riscv/cpu/u-boot-spl.lds +++ b/arch/riscv/cpu/u-boot-spl.lds @@ -32,14 +32,6 @@ SECTIONS } > .spl_mem . = ALIGN(4); - .got : { - __got_start = .; - *(.got.plt) *(.got) - __got_end = .; - } > .spl_mem - - . = ALIGN(4); - __u_boot_list : { KEEP(*(SORT(__u_boot_list*))); } > .spl_mem @@ -54,23 +46,6 @@ SECTIONS . = ALIGN(4); - /DISCARD/ : { *(.rela.plt*) } - .rela.dyn : { - __rel_dyn_start = .; - *(.rela*) - __rel_dyn_end = .; - } > .spl_mem - - . = ALIGN(4); - - .dynsym : { - __dyn_sym_start = .; - *(.dynsym) - __dyn_sym_end = .; - } > .spl_mem - - . = ALIGN(4); - _end = .; _image_binary_end = .; From patchwork Thu Mar 30 04:20:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 1763226 X-Patchwork-Delegate: uboot@andestech.com 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.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (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 4PnNJH38WMz1yXv for ; Thu, 30 Mar 2023 23:38:39 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id E51AD860B0; Thu, 30 Mar 2023 14:37:37 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=tinylab.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by phobos.denx.de (Postfix, from userid 109) id DF90F856E5; Thu, 30 Mar 2023 06:21:10 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_MSPIKE_H2, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from bg4.exmail.qq.com (bg4.exmail.qq.com [43.155.65.254]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 5814D85CD5 for ; Thu, 30 Mar 2023 06:21:04 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=tinylab.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=bmeng@tinylab.org X-QQ-mid: bizesmtp81t1680150049t6p60y3d Received: from ubuntu.. ( [111.196.129.125]) by bizesmtp.qq.com (ESMTP) with id ; Thu, 30 Mar 2023 12:20:48 +0800 (CST) X-QQ-SSF: 01200000000000D0E000000A0000000 X-QQ-FEAT: 239gR2IZrluBVLKQb/lklCVj1RYzvTVU8L0iQa8df1TxFZQSn94oBDBntreBj lVoK+Bl6lGIhFPsmCrR+nKvFB4tPHOe3uTytZSBgdYstymtbKbxnRM/AiK4wZoUuaJVe/Rg 8nDBVB/wJFs9aTHjFfQ8yquLtgCe3OCBqqToUg0J1e1vTVHME9zdeyio6ED8DLS//rAIxMc HJrKa5IsaB1pnpGxKPyeFbqqjba6HwtmUVA6rTcJGVvjB5Clemyj5m4TSLt2PaRGl6RHZXx ggV2S8by35BejC1XfhN+/tkJWMU7rQQf+btGiYxIed6Y97G60cFMJOS6pJWckPIlbYz3zvb Z2j7EZ+xhnBaqteFFugGUDu1o4AC4uCX2DLd5Ph X-QQ-GoodBg: 0 X-BIZMAIL-ID: 14299712074858170546 From: Bin Meng To: u-boot@lists.denx.de Cc: Andrew Scull , Leo , Rick Chen , Simon Glass Subject: [PATCH 8/8] riscv: Update alignment for some sections in linker scripts Date: Thu, 30 Mar 2023 12:20:24 +0800 Message-Id: <20230330042024.721710-8-bmeng@tinylab.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230330042024.721710-1-bmeng@tinylab.org> References: <20230330042024.721710-1-bmeng@tinylab.org> MIME-Version: 1.0 X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtp:tinylab.org:qybglogicsvr:qybglogicsvr3 X-Mailman-Approved-At: Thu, 30 Mar 2023 14:36:20 +0200 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean Some sections in the linker scripts are aligned to 4 bytes, which may cause misaligned exception on some platforms, e.g.: clearing the bss section on 64-bit hardware if __bss_start does not start from a naturally 8 bytes aligned address. Signed-off-by: Bin Meng --- arch/riscv/cpu/u-boot-spl.lds | 2 +- arch/riscv/cpu/u-boot.lds | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/riscv/cpu/u-boot-spl.lds b/arch/riscv/cpu/u-boot-spl.lds index c3b4907905..d1113a59aa 100644 --- a/arch/riscv/cpu/u-boot-spl.lds +++ b/arch/riscv/cpu/u-boot-spl.lds @@ -44,7 +44,7 @@ SECTIONS __binman_sym_end = .; } > .spl_mem - . = ALIGN(4); + . = ALIGN(8); _end = .; _image_binary_end = .; diff --git a/arch/riscv/cpu/u-boot.lds b/arch/riscv/cpu/u-boot.lds index 1c937aebee..15b5cbc585 100644 --- a/arch/riscv/cpu/u-boot.lds +++ b/arch/riscv/cpu/u-boot.lds @@ -57,7 +57,7 @@ SECTIONS __efi_runtime_rel_stop = .; } - . = ALIGN(4); + . = ALIGN(8); /DISCARD/ : { *(.rela.plt*) } .rela.dyn : { @@ -66,7 +66,7 @@ SECTIONS __rel_dyn_end = .; } - . = ALIGN(4); + . = ALIGN(8); .dynsym : { __dyn_sym_start = .; @@ -74,7 +74,7 @@ SECTIONS __dyn_sym_end = .; } - . = ALIGN(4); + . = ALIGN(8); _end = .;