From patchwork Sun Mar 5 17:49:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ovidiu Panait X-Patchwork-Id: 1751953 X-Patchwork-Delegate: monstr@monstr.eu 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=) 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=qDWIsA1Y; dkim-atps=neutral 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 4PV8Nz2mpQz23j7 for ; Mon, 6 Mar 2023 04:49:53 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 4E21785D79; Sun, 5 Mar 2023 18:49:38 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="qDWIsA1Y"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 3F41485B9A; Sun, 5 Mar 2023 18:49:36 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-ed1-x52a.google.com (mail-ed1-x52a.google.com [IPv6:2a00:1450:4864:20::52a]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id C69D48567B for ; Sun, 5 Mar 2023 18:49:33 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=ovpanait@gmail.com Received: by mail-ed1-x52a.google.com with SMTP id x3so29569334edb.10 for ; Sun, 05 Mar 2023 09:49:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1678038573; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=plmjt3uko1BrJId5a0p0JfUgJOT6PL3FpKude8CpI68=; b=qDWIsA1YhqapbgoE/Y//jUAnJZu9Ho508+SF97jaOWpOp5+PlOBFooIvEB55gtsBSx s7n4QQDyC/6+Kd4c8Z4lSrFEURW7oRxCnRBuNFsAY4P67LLScSopA1Lqu2x9E9XntoP/ f3zJPLjs8iOlSitQsZKlAXTJZmMs1q7ffK8dFG26l8SUZYXAfN9BcmiGIY0jdEHAWpns gXBJSyn4Oah2ZC9FhBBwrpLYs7Q68TqXrnd7NDGrs0LIv1hoISQ+pkhXctoHNDKiGGNC 3SCLiB7Out07zj4elrJhpST+8TF7k+jBNIHwdVE+J3TRohtAMwXmgbyQrTdYPr5uvNX0 jadg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678038573; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=plmjt3uko1BrJId5a0p0JfUgJOT6PL3FpKude8CpI68=; b=dJ3KsXcWFK6CVuu0rp+bkEJn4MypVmTlsXs6vajL618121fS4PYIwf10ft5wH7CGf7 rP/06hP7x7dfvSzERPQd4L9tnzkYOdbqp60zIFmtaj/0E6miWXD95v9jr+bKaSfGU5JJ +co0gfhYd06F+SJakkOR/lAkwLoawK1O4tcGIhSP2eDfJLNtSfS/o+OkNqun+lBXFdo3 DXArDDgT+1wvrE4cvrKUDgJhY+DixfDOp/ecdAWakb6HsrPgVwR4vW7Q4eUv9pWhFqce MUCtb5aprn43hkAYGdsBHHjlSLNSFsRJkc2SXs4b4KzgokfgesPTzs9B7WGyNFS6d+NA ZbXQ== X-Gm-Message-State: AO0yUKVcacR3Od/hWYarurisUhzDYFzV5i44tJHww/gTrT4pqXDY6rLo gga711x3LxRuYlzy9Slkks1NHI6IQac= X-Google-Smtp-Source: AK7set+FqHH8VrrOVQfqTMK8OMSQiXexXzbLw1haQSCY0MYZ4ldtwbJ/m+/tEC0qV/PoGvObbQaMRw== X-Received: by 2002:a17:907:6d20:b0:878:5bce:291a with SMTP id sa32-20020a1709076d2000b008785bce291amr11522779ejc.36.1678038573265; Sun, 05 Mar 2023 09:49:33 -0800 (PST) Received: from localhost.localdomain ([2a02:2f0e:c915:3800:3ec7:a5bc:2321:4538]) by smtp.gmail.com with ESMTPSA id l26-20020a170906231a00b008b69aa62efcsm3464985eja.62.2023.03.05.09.49.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 05 Mar 2023 09:49:33 -0800 (PST) From: Ovidiu Panait To: u-boot@lists.denx.de Cc: Ovidiu Panait , Michal Simek , Samuel Holland Subject: [PATCH 1/5] tools: relocate-rela: adjust le64_to_cpu -> le32_to_cpu in decode_elf32() Date: Sun, 5 Mar 2023 19:49:15 +0200 Message-Id: <20230305174919.293393-1-ovpanait@gmail.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 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.6 at phobos.denx.de X-Virus-Status: Clean The sh_addr/sh_offset/sh_size fields in Elf32_Shdr are 32-bits wide, so use le32_to_cpu() instead of the 64-bit variant. Fixes: 5e0e1a86d327 ("tools: relocate-rela: Fix ELF decoding on big-endian hosts") Signed-off-by: Ovidiu Panait Reviewed-by: Michal Simek --- tools/relocate-rela.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/relocate-rela.c b/tools/relocate-rela.c index 2d2a2ed277..689e2d4655 100644 --- a/tools/relocate-rela.c +++ b/tools/relocate-rela.c @@ -316,9 +316,9 @@ static int decode_elf32(FILE *felf, char **argv) debug("%s\n", sh_name); - sh_addr = le64_to_cpu(sh_table[i].sh_addr); - sh_offset = le64_to_cpu(sh_table[i].sh_offset); - sh_size = le64_to_cpu(sh_table[i].sh_size); + sh_addr = le32_to_cpu(sh_table[i].sh_addr); + sh_offset = le32_to_cpu(sh_table[i].sh_offset); + sh_size = le32_to_cpu(sh_table[i].sh_size); if (!strcmp(".rela.dyn", sh_name)) { debug("Found section\t\".rela_dyn\"\n"); From patchwork Sun Mar 5 17:49:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ovidiu Panait X-Patchwork-Id: 1751954 X-Patchwork-Delegate: monstr@monstr.eu 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=) 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=agUWiOGT; dkim-atps=neutral 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 4PV8P40RkLz23j7 for ; Mon, 6 Mar 2023 04:50:00 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 17AB68567B; Sun, 5 Mar 2023 18:49:46 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="agUWiOGT"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 67D6185B9A; Sun, 5 Mar 2023 18:49:37 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-ed1-x534.google.com (mail-ed1-x534.google.com [IPv6:2a00:1450:4864:20::534]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id CAE7F85A1F for ; Sun, 5 Mar 2023 18:49:34 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=ovpanait@gmail.com Received: by mail-ed1-x534.google.com with SMTP id k10so5791782edk.13 for ; Sun, 05 Mar 2023 09:49:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1678038574; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=xrnD502X8acJ/pm1S09EDnKL+3aciiXuif+/b0bf/34=; b=agUWiOGT4wi6VnQjnkW2Ffw7CEQty8nvWXTHFKRvPRqosNSoaX7A5/e+l/ARlxQ/qh OK0lAhCdIfJ7VV7tN/5KUr1awQ2Mt7IqxFOUbwBFwywsnx3FJwcwpNvXLYSNW2Ux+/Ci /9EQoszW5dpYxJd6mjOfAfgLbhVMKIsgVdlv/4vQV3lIwPfYqLfhwOmwDa9hpAxyOxXJ IUGolEEIPSmY6xp3PFmJKbPPw+fAWQSWYGM+blGvjl+EzdDg7lmna8kfyFKOld72/Cjt piO+1gRxeIUJOUtlYk63+nJFsm4A7+4hciDgFZ1nVjOytGEK8BOpzKR04TFFZjDvTYec uh2A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678038574; 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:message-id:reply-to; bh=xrnD502X8acJ/pm1S09EDnKL+3aciiXuif+/b0bf/34=; b=ln5Z3luiWN9k/UCc3y9QCA1VndeC38+9jJHhxkYMqDhUKWXrma1nZ1rdNGTZ3WmwPq vRG1ROEJu23ffM2DV2tQPdJ1CS5YeicesMABNVfU9B999AO/HD61nIwggYx1lOzmCsR9 HjqA9QER2QBQf81dbKcuD9N6Os6jeLrM5gDpCW40F96qYZ9jdJpqEv/xd5xKdDXXTRB8 uVQMRnQjt7rjbVpx0Lk95rjZ1e1yh7M1RIMSwnrHhzBjl4cOQ050AkLwBwBA9/KVUFcQ Pir7qlN4MuyYVO8Tg28t6xm14PSeoLiKg/xP8vMff0q246K9EYOeoakgo+vL9aZu8OK0 nhTQ== X-Gm-Message-State: AO0yUKVB8UeavSvKOJeSrC6kjW9tNCTNJMC7Jr4fjYAciyB0rhKrmgEj wB4bk7CHlAm7jjypeUwpbacDAQKOpiY= X-Google-Smtp-Source: AK7set9ELZkOl0d1ujyxAHMKECr9La9PHnCGtf/5vNE5JvIpGxnzRK2b3HoUgbc0L1TuNDbFpF5cmA== X-Received: by 2002:a17:906:590:b0:886:ec6e:4c1 with SMTP id 16-20020a170906059000b00886ec6e04c1mr9899216ejn.59.1678038574269; Sun, 05 Mar 2023 09:49:34 -0800 (PST) Received: from localhost.localdomain ([2a02:2f0e:c915:3800:3ec7:a5bc:2321:4538]) by smtp.gmail.com with ESMTPSA id l26-20020a170906231a00b008b69aa62efcsm3464985eja.62.2023.03.05.09.49.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 05 Mar 2023 09:49:34 -0800 (PST) From: Ovidiu Panait To: u-boot@lists.denx.de Cc: Ovidiu Panait , Michal Simek , Samuel Holland Subject: [PATCH 2/5] tools: relocate-rela: introduce elf16_to_cpu() and elf32_to_cpu() Date: Sun, 5 Mar 2023 19:49:16 +0200 Message-Id: <20230305174919.293393-2-ovpanait@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230305174919.293393-1-ovpanait@gmail.com> References: <20230305174919.293393-1-ovpanait@gmail.com> MIME-Version: 1.0 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.6 at phobos.denx.de X-Virus-Status: Clean Add elf16_to_cpu() and elf32_to_cpu() functions that allow to read data in both big-endian and little-endian formats. Signed-off-by: Ovidiu Panait --- tools/relocate-rela.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/tools/relocate-rela.c b/tools/relocate-rela.c index 689e2d4655..84531b23a6 100644 --- a/tools/relocate-rela.c +++ b/tools/relocate-rela.c @@ -45,6 +45,7 @@ #endif static int ei_class; +static int ei_data; static uint64_t rela_start, rela_end, text_base, dyn_start; @@ -61,6 +62,22 @@ static void debug(const char *fmt, ...) } } +static uint16_t elf16_to_cpu(uint16_t data) +{ + if (ei_data == 0x01) + return le16_to_cpu(data); + + return be16_to_cpu(data); +} + +static uint32_t elf32_to_cpu(uint32_t data) +{ + if (ei_data == 0x01) + return le32_to_cpu(data); + + return be32_to_cpu(data); +} + static bool supported_rela(Elf64_Rela *rela) { uint64_t mask = 0xffffffffULL; /* would be different on 32-bit */ @@ -384,6 +401,9 @@ static int decode_elf(char **argv) ei_class = e_ident[4]; debug("EI_CLASS(1=32bit, 2=64bit) %d\n", ei_class); + ei_data = e_ident[5]; + debug("EI_DATA(1=little endian, 2=big endian) %d\n", ei_data); + if (ei_class == 2) return decode_elf64(felf, argv); From patchwork Sun Mar 5 17:49:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ovidiu Panait X-Patchwork-Id: 1751955 X-Patchwork-Delegate: monstr@monstr.eu 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=) 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=FA5j7S13; dkim-atps=neutral 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 4PV8PL4B8Cz23hX for ; Mon, 6 Mar 2023 04:50:14 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 2452B84EEF; Sun, 5 Mar 2023 18:49:49 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="FA5j7S13"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id F237A85B9A; Sun, 5 Mar 2023 18:49:39 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-ed1-x52f.google.com (mail-ed1-x52f.google.com [IPv6:2a00:1450:4864:20::52f]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id AA31185B92 for ; Sun, 5 Mar 2023 18:49:35 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=ovpanait@gmail.com Received: by mail-ed1-x52f.google.com with SMTP id s11so29650601edy.8 for ; Sun, 05 Mar 2023 09:49:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1678038575; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=UMklEZJ0tdzsdewlfd6YKUJbMWe58LKWfNhfHTP8FZk=; b=FA5j7S13zESeOor6e1t/aNteV/vUy1SP51My1C52PQXNTcX3o8hU7PiCk2RDjy7pWL u1bd1reLz+CzH+EofnhWFfzXqwpyKoKSHiD1wFCJeoVsxfipl7vqR8f2wOrc91+T7/o3 DJlpJMwiJ6VUrfGWnalH5f0JPw9YBy+YxI7lUByjIJ2ryOrYbTmYEUmfNv/7Sqgyf7Jx O9vPWh3wKOJYoQbsO9lbhu9Mzif2nJBjiuFIYF404JChTBJzVlNOJq7QbzHZkgdXm/+o jnJpw4sHrY7Dfgz/IrN4SWlPrja/dLA1ljWPFay4zCJunsSAJO26kmsMqO4BYugCBDs3 y7jw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678038575; 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:message-id:reply-to; bh=UMklEZJ0tdzsdewlfd6YKUJbMWe58LKWfNhfHTP8FZk=; b=p7F2LD9fx7V4TP3k9DWgsVRgRtEOrBjfFEoECU6ScLAkwTDuxBaN3S7+wYDAfbHkAM AGO8AAg7LZS1YMde5+LmltvoIASwNvpSq47HXsKwIFkPK5fk/QQtncbR2BnUrDR+1T4e Z1r/pLaV1aV0VgO1DSFOrDHMiEqxXxBve0FCe538d3GPcOQbye6QQzCe5Rx/pmyEl9FS IfHWRdgNZ12VGzOtzfm9xjttSoJqG3haK3LbEYXQKnwwuqX0obpmvkj1BJPfQW90e5+/ HKjMnHc5viWyMbkQ8UFaXlomA8vd3050EzxJArxkj0PbZVPQE10shmIjvVMff6mLrx0d Vbng== X-Gm-Message-State: AO0yUKVw4SlGaEbOFfMIqHDhCG10Af6fw1iWr+pZ5vZpjjpFw5sT4b60 z7ZNGxDagaDb7ybIV7bvcjAiWTm7hig= X-Google-Smtp-Source: AK7set/x38QdbUxk4u7c+3UYtHdm8/0uW3G+4yFnkkMvRNFfbYMzPJaPL1teMPtXQwDlwtKhxArf9A== X-Received: by 2002:a05:6402:b1c:b0:4bc:b40:108b with SMTP id bm28-20020a0564020b1c00b004bc0b40108bmr7912976edb.9.1678038575281; Sun, 05 Mar 2023 09:49:35 -0800 (PST) Received: from localhost.localdomain ([2a02:2f0e:c915:3800:3ec7:a5bc:2321:4538]) by smtp.gmail.com with ESMTPSA id l26-20020a170906231a00b008b69aa62efcsm3464985eja.62.2023.03.05.09.49.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 05 Mar 2023 09:49:35 -0800 (PST) From: Ovidiu Panait To: u-boot@lists.denx.de Cc: Ovidiu Panait , Michal Simek , Samuel Holland Subject: [PATCH 3/5] tools: relocate-rela: add support for handling 32-bit big endian files Date: Sun, 5 Mar 2023 19:49:17 +0200 Message-Id: <20230305174919.293393-3-ovpanait@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230305174919.293393-1-ovpanait@gmail.com> References: <20230305174919.293393-1-ovpanait@gmail.com> MIME-Version: 1.0 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.6 at phobos.denx.de X-Virus-Status: Clean Currently, a microblaze build with CONFIG_SYS_BIG_ENDIAN=y and CONFIG_STATIC_RELA=y fails with: tools/relocate-rela: Not supported machine type ELF decoding failed make[2]: *** [u-boot/Makefile:1306: u-boot-nodtb.bin] Error 1 To fix this, convert the 32-bit codepath to use the previously added elf{16,32}_to_cpu() functions. The aarch64 codepath is left untouched. This commit ensures that CI doesn't fail for the next patches which enable runtime relocation by default for microblaze. Signed-off-by: Ovidiu Panait Reviewed-by: Michal Simek --- tools/relocate-rela.c | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/tools/relocate-rela.c b/tools/relocate-rela.c index 84531b23a6..2bc46a12d7 100644 --- a/tools/relocate-rela.c +++ b/tools/relocate-rela.c @@ -251,7 +251,7 @@ static int decode_elf32(FILE *felf, char **argv) return 25; } - machine = le16_to_cpu(header.e_machine); + machine = elf16_to_cpu(header.e_machine); debug("Machine %d\n", machine); if (machine != EM_MICROBLAZE) { @@ -259,10 +259,10 @@ static int decode_elf32(FILE *felf, char **argv) return 30; } - text_base = le32_to_cpu(header.e_entry); - section_header_base = le32_to_cpu(header.e_shoff); - section_header_size = le16_to_cpu(header.e_shentsize) * - le16_to_cpu(header.e_shnum); + text_base = elf32_to_cpu(header.e_entry); + section_header_base = elf32_to_cpu(header.e_shoff); + section_header_size = elf16_to_cpu(header.e_shentsize) * + elf16_to_cpu(header.e_shnum); sh_table = malloc(section_header_size); if (!sh_table) { @@ -290,8 +290,8 @@ static int decode_elf32(FILE *felf, char **argv) return 27; } - sh_index = le16_to_cpu(header.e_shstrndx); - sh_size = le32_to_cpu(sh_table[sh_index].sh_size); + sh_index = elf16_to_cpu(header.e_shstrndx); + sh_size = elf32_to_cpu(sh_table[sh_index].sh_size); debug("e_shstrndx %x, sh_size %lx\n", sh_index, sh_size); sh_str = malloc(sh_size); @@ -306,8 +306,8 @@ static int decode_elf32(FILE *felf, char **argv) * Specifies the byte offset from the beginning of the file * to the first byte in the section. */ - sh_offset = le32_to_cpu(sh_table[sh_index].sh_offset); - sh_num = le16_to_cpu(header.e_shnum); + sh_offset = elf32_to_cpu(sh_table[sh_index].sh_offset); + sh_num = elf16_to_cpu(header.e_shnum); ret = fseek(felf, sh_offset, SEEK_SET); if (ret) { @@ -329,13 +329,13 @@ static int decode_elf32(FILE *felf, char **argv) } for (i = 0; i < sh_num; i++) { - char *sh_name = sh_str + le32_to_cpu(sh_table[i].sh_name); + char *sh_name = sh_str + elf32_to_cpu(sh_table[i].sh_name); debug("%s\n", sh_name); - sh_addr = le32_to_cpu(sh_table[i].sh_addr); - sh_offset = le32_to_cpu(sh_table[i].sh_offset); - sh_size = le32_to_cpu(sh_table[i].sh_size); + sh_addr = elf32_to_cpu(sh_table[i].sh_addr); + sh_offset = elf32_to_cpu(sh_table[i].sh_offset); + sh_size = elf32_to_cpu(sh_table[i].sh_size); if (!strcmp(".rela.dyn", sh_name)) { debug("Found section\t\".rela_dyn\"\n"); @@ -540,9 +540,9 @@ static int rela_elf32(char **argv, FILE *f) PRIu32 " r_addend:\t%" PRIx32 "\n", rela.r_offset, rela.r_info, rela.r_addend); - swrela.r_offset = le32_to_cpu(rela.r_offset); - swrela.r_info = le32_to_cpu(rela.r_info); - swrela.r_addend = le32_to_cpu(rela.r_addend); + swrela.r_offset = elf32_to_cpu(rela.r_offset); + swrela.r_info = elf32_to_cpu(rela.r_info); + swrela.r_addend = elf32_to_cpu(rela.r_addend); debug("SWRela:\toffset:\t%" PRIx32 " r_info:\t%" PRIu32 " r_addend:\t%" PRIx32 "\n", From patchwork Sun Mar 5 17:49:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ovidiu Panait X-Patchwork-Id: 1751957 X-Patchwork-Delegate: monstr@monstr.eu 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=) 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=Lyx39a/a; dkim-atps=neutral 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 4PV8Pm1Pkhz23hX for ; Mon, 6 Mar 2023 04:50:36 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id F30A985DA8; Sun, 5 Mar 2023 18:50:04 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="Lyx39a/a"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id D024685B96; Sun, 5 Mar 2023 18:49:40 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-ed1-x52e.google.com (mail-ed1-x52e.google.com [IPv6:2a00:1450:4864:20::52e]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 09D5C8567B for ; Sun, 5 Mar 2023 18:49:37 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=ovpanait@gmail.com Received: by mail-ed1-x52e.google.com with SMTP id a25so29935548edb.0 for ; Sun, 05 Mar 2023 09:49:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1678038576; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=+yAJK9BZxBe57HR6yOelYF6DvTLPdlkvsLStZtIOzCw=; b=Lyx39a/aGPDNuXw0VwptdswwDGZJXRbE4IvLgRWkogXdk/edxGRwbRu0t5nY/6Oc46 X3BkGq5MyJ417zA7oJ41JLk8/JqlhxQTEnqsx/FrMZI4azFUnDSL8Mo0pG3ukPumkYGe /RFu7Dh2nWcUoFIVdSNVZP9wCm2ZYhsnNQSY6xeX5FXMQAopf1CcTzx31i6pHOmLLGWB YJGb/1NkedloGLQAOSJ0O4IOQxc6knpDFAsOFE1nTKDk1CJJPfzGDt2QKa+WdNNOhJAq CTe0yRS+IgM+RY0y8VG2OvOXGqx0tDEcyG+r7qPI0mcRO7/NKfMUf1zIrxnmHyenyyMG aCWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678038576; 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:message-id:reply-to; bh=+yAJK9BZxBe57HR6yOelYF6DvTLPdlkvsLStZtIOzCw=; b=Hf3NHPparhVD42OFGYVi4pIHgWjI7mTGtdlkw3mqAQSCCMvNdn+ZPis1S8oe2m3zyO e/06U1rdBbqR16M7cllVWD67+1+y8BikvyIi6Z36DTU/1SUGCW4/yVVpFpUrqjvE/a2v s99kivu2gCpHc/soiL29WdnTF83EOEPY9bO6iLwGvgAb/gzZ0227V4nwP/AoMPgw3Gwt QNMc+0qw72QOjv0OwZImq/WqHx+YqSGt3BNr0E+cZ76ONy0LoXE5LVBXZJeIC89FS/Du zA2rcnHh5bXViQdI3mSBbAQAWbXZSqmpHZgE1gCPE1M4rPePnRmAqbQ+m1ZOyhovA5YQ 0ZuQ== X-Gm-Message-State: AO0yUKW4ryNY8UgNO7jZgbiqzug3kG7LW1jh+QEK9n30KCeuNzbDQlrB 6cAY7daN3n92udbZEwSzjfuztRLpcgY= X-Google-Smtp-Source: AK7set9NWLTALTOn6KwyUIL+R/lxLOJ7ZyLcyRPY1ETEb0Qect7QScfDMSOUE4n6rgCZUj4giOi0zw== X-Received: by 2002:a17:906:4809:b0:878:5f35:b8d6 with SMTP id w9-20020a170906480900b008785f35b8d6mr7354534ejq.51.1678038576380; Sun, 05 Mar 2023 09:49:36 -0800 (PST) Received: from localhost.localdomain ([2a02:2f0e:c915:3800:3ec7:a5bc:2321:4538]) by smtp.gmail.com with ESMTPSA id l26-20020a170906231a00b008b69aa62efcsm3464985eja.62.2023.03.05.09.49.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 05 Mar 2023 09:49:36 -0800 (PST) From: Ovidiu Panait To: u-boot@lists.denx.de Cc: Ovidiu Panait , Michal Simek , Michal Simek Subject: [PATCH 4/5] microblaze: drop CONFIG_NEEDS_MANUAL_RELOC Date: Sun, 5 Mar 2023 19:49:18 +0200 Message-Id: <20230305174919.293393-4-ovpanait@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230305174919.293393-1-ovpanait@gmail.com> References: <20230305174919.293393-1-ovpanait@gmail.com> MIME-Version: 1.0 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.6 at phobos.denx.de X-Virus-Status: Clean Microblaze and m68k are the only remaining architectures that still enable CONFIG_NEEDS_MANUAL_RELOC by default. Microblaze has had runtime relocation support using CONFIG_STATIC_RELA for quite some time, since commit d58c007498 ("microblaze: Add support for run time relocation"). Drop support for CONFIG_NEEDS_MANUAL_RELOC and make runtime relocation the default, as the rest of the architectures do. Signed-off-by: Ovidiu Panait Reviewed-by: Michal Simek --- arch/microblaze/Kconfig | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/arch/microblaze/Kconfig b/arch/microblaze/Kconfig index ce157a79cc..e38c9f6d71 100644 --- a/arch/microblaze/Kconfig +++ b/arch/microblaze/Kconfig @@ -4,19 +4,8 @@ menu "MicroBlaze architecture" config SYS_ARCH default "microblaze" -config NEEDS_MANUAL_RELOC - bool "Disable position-independent pre-relocation code" - default y - help - U-Boot expects to be linked to a specific hard-coded address, and to - be loaded to and run from that address. This option lifts that - restriction, thus allowing the code to be loaded to and executed from - almost any 4K aligned address. This logic relies on the relocation - information that is embedded in the binary to support U-Boot - relocating itself to the top-of-RAM later during execution. - config STATIC_RELA - def_bool y if !NEEDS_MANUAL_RELOC + def_bool y choice prompt "Target select" From patchwork Sun Mar 5 17:49:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ovidiu Panait X-Patchwork-Id: 1751956 X-Patchwork-Delegate: monstr@monstr.eu 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=) 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=GlMtGb33; dkim-atps=neutral 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 4PV8PX3qn1z23hX for ; Mon, 6 Mar 2023 04:50:24 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id F109F85DB6; Sun, 5 Mar 2023 18:49:54 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="GlMtGb33"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id EBDC984F3E; Sun, 5 Mar 2023 18:49:41 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-ed1-x52e.google.com (mail-ed1-x52e.google.com [IPv6:2a00:1450:4864:20::52e]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id E8BF385A1F for ; Sun, 5 Mar 2023 18:49:37 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=ovpanait@gmail.com Received: by mail-ed1-x52e.google.com with SMTP id j11so10157253edq.4 for ; Sun, 05 Mar 2023 09:49:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1678038577; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=cLD3go4pi19BVd9g7EXoZj5abT43m8kiVgS/4cQT3Uc=; b=GlMtGb33zL96s8yrn5ZsirREUpuJH9snMdTD7U59lHN0jRQHUbcI6bkDOiMdiovmZd Afvb/1+DdFk0pEJcrbZEjjSBv0PpVHZqNh0tkprKFs0aYcMwRssDh4mjlKbW879y7JoW YwZlPVox+5N7tJudDW6OaEm125mLIwJ0pGbVyWoJwESzBKiwh8M0lYe2UUqmITGYAoEm 9930dQ6bl1oji+PIq6eCMod7u/s1LqQ7DMCUDQknCgpLBi0IFmlyAiUoFDlHKFf/mnKF w1NnkJjKwcrUi7EcJuuEALna0YE6SETSBSaDjjTL+09fuGEGfZdGIOOKZw9pmLEcKXvO hW4A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678038577; 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:message-id:reply-to; bh=cLD3go4pi19BVd9g7EXoZj5abT43m8kiVgS/4cQT3Uc=; b=aCITa0HDnbtJfIJ5mElzAg9nPFFtoKK4edpdj6l2wnj16ETCBBZnem+J+P5GO8mWis fb3nsIA9VSWTszhxFoNyeC8ZqwO7M6Ja0VPFnYOaJSuNkYxzgoZleUFv75L4vzavVk+I HdAvdt3DsMqzKYCbl1lmHtzylJH6zC9maRTP41xu67Pf6lNn8vuY7nXfi8xynIctedEs /4J6N+NENfjebRwRgPwKuH9kijETD0pB6GQq0u/Tc4WVktmzXJe3J/o+t8IXsW9Mi2/Y gnrhzG9X3S4iRaa4DZ9+64vDcxSCpGTfcMkTW3Dx7SmDecuFeYhrCb2bv9MKMWWCANwb Vv+g== X-Gm-Message-State: AO0yUKUSzrDe6see5MARR14i6IEZvD6DaR6Il51iGh9B3op6vYunba68 8kcyF9cmiILjOAflM+ILPcquOEVeDKQ= X-Google-Smtp-Source: AK7set8rojCrOE/0gSDyoEZJUEudEgr41YWzQhGIBETo4gwFR3QmFAie/f8tQ1HCsi/M2+OTZPErFQ== X-Received: by 2002:a17:906:32d9:b0:8aa:bf4e:7b2c with SMTP id k25-20020a17090632d900b008aabf4e7b2cmr9028429ejk.21.1678038577437; Sun, 05 Mar 2023 09:49:37 -0800 (PST) Received: from localhost.localdomain ([2a02:2f0e:c915:3800:3ec7:a5bc:2321:4538]) by smtp.gmail.com with ESMTPSA id l26-20020a170906231a00b008b69aa62efcsm3464985eja.62.2023.03.05.09.49.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 05 Mar 2023 09:49:37 -0800 (PST) From: Ovidiu Panait To: u-boot@lists.denx.de Cc: Ovidiu Panait , Michal Simek , Michal Simek , Simon Glass Subject: [PATCH 5/5] microblaze: drop remnants of manual reloc Date: Sun, 5 Mar 2023 19:49:19 +0200 Message-Id: <20230305174919.293393-5-ovpanait@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230305174919.293393-1-ovpanait@gmail.com> References: <20230305174919.293393-1-ovpanait@gmail.com> MIME-Version: 1.0 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.6 at phobos.denx.de X-Virus-Status: Clean Runtime relocation has been made the default for microblaze, so do the following cleanups: - drop all manual reloc codepaths in start.S - drop all STATIC_RELA ifdefs, as it is now enabled unconditionally in Kconfig Signed-off-by: Ovidiu Panait Reviewed-by: Michal Simek --- arch/microblaze/config.mk | 4 ---- arch/microblaze/cpu/Makefile | 3 +-- arch/microblaze/cpu/start.S | 28 ---------------------------- 3 files changed, 1 insertion(+), 34 deletions(-) diff --git a/arch/microblaze/config.mk b/arch/microblaze/config.mk index 467c5ca1b1..64c3f31319 100644 --- a/arch/microblaze/config.mk +++ b/arch/microblaze/config.mk @@ -13,10 +13,6 @@ LDFLAGS_FINAL += --gc-sections ifeq ($(CONFIG_SPL_BUILD),) PLATFORM_CPPFLAGS += -fPIC -endif - -ifeq ($(CONFIG_STATIC_RELA),y) -PLATFORM_CPPFLAGS += -fPIC LDFLAGS_u-boot += -pic endif diff --git a/arch/microblaze/cpu/Makefile b/arch/microblaze/cpu/Makefile index 1c586a7de0..b8c1dcbe14 100644 --- a/arch/microblaze/cpu/Makefile +++ b/arch/microblaze/cpu/Makefile @@ -5,7 +5,6 @@ extra-y = start.o obj-y = irq.o -obj-y += interrupts.o cache.o exception.o cpuinfo.o -obj-$(CONFIG_STATIC_RELA) += relocate.o +obj-y += interrupts.o cache.o exception.o cpuinfo.o relocate.o obj-$(CONFIG_XILINX_MICROBLAZE0_PVR) += pvr.o obj-$(CONFIG_SPL_BUILD) += spl.o diff --git a/arch/microblaze/cpu/start.S b/arch/microblaze/cpu/start.S index 7079d9e170..c1e0fcda0a 100644 --- a/arch/microblaze/cpu/start.S +++ b/arch/microblaze/cpu/start.S @@ -10,16 +10,11 @@ #include #include -#if defined(CONFIG_STATIC_RELA) #define SYM_ADDR(reg, reg_add, symbol) \ mfs r20, rpc; \ addik r20, r20, _GLOBAL_OFFSET_TABLE_ + 8; \ lwi reg, r20, symbol@GOT; \ addk reg, reg reg_add; -#else -#define SYM_ADDR(reg, reg_add, symbol) \ - addi reg, reg_add, symbol -#endif .text .global _start @@ -35,7 +30,6 @@ _start: addi r1, r0, CONFIG_SPL_STACK #else add r1, r0, r20 -#if defined(CONFIG_STATIC_RELA) bri 1f /* Force alignment for easier ASM code below */ @@ -67,7 +61,6 @@ uboot_sym_start: brlid r15, mb_fix_rela nop -#endif #endif addi r1, r1, -4 /* Decrement SP to top of memory */ @@ -310,7 +303,6 @@ relocate_code: brlid r15, __setup_exceptions nop -#if defined(CONFIG_STATIC_RELA) /* reloc_offset is current location */ SYM_ADDR(r10, r0, _start) @@ -331,27 +323,7 @@ relocate_code: add r9, r9, r5 brlid r15, mb_fix_rela nop - /* end of code which does relocation */ -#else - /* Check if GOT exist */ - addik r21, r23, _got_start - addik r22, r23, _got_end - cmpu r12, r21, r22 - beqi r12, 2f /* No GOT table - jump over */ - - /* Skip last 3 entries plus 1 because of loop boundary below */ - addik r22, r22, -0x10 - - /* Relocate the GOT. */ -3: lw r12, r21, r0 /* Load entry */ - addk r12, r12, r23 /* Add reloc offset */ - sw r12, r21, r0 /* Save entry back */ - - cmpu r12, r21, r22 /* Check if this cross boundary */ - bneid r12, 3b - addik r21. r21, 4 -#endif /* Flush caches to ensure consistency */ brlid r15, flush_cache_all