Message ID | d7085880ce094dbb89cb6b512473e6e8995c41ba.1655287429.git.michal.simek@amd.com |
---|---|
State | Superseded |
Delegated to: | Michal Simek |
Headers | show
Return-Path: <u-boot-bounces@lists.denx.de> X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=monstr-eu.20210112.gappssmtp.com header.i=@monstr-eu.20210112.gappssmtp.com header.a=rsa-sha256 header.s=20210112 header.b=NiPlqT7T; dkim-atps=neutral Authentication-Results: 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=<UNKNOWN>) 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 RSA-PSS (2048 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4LNLW82Rm5z9vF7 for <incoming@patchwork.ozlabs.org>; Wed, 15 Jun 2022 20:04:20 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 9A6C68442B; Wed, 15 Jun 2022 12:04:10 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=monstr.eu 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=monstr-eu.20210112.gappssmtp.com header.i=@monstr-eu.20210112.gappssmtp.com header.b="NiPlqT7T"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 4BB8684451; Wed, 15 Jun 2022 12:04:08 +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,DKIM_SIGNED, DKIM_VALID,SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-ej1-x633.google.com (mail-ej1-x633.google.com [IPv6:2a00:1450:4864:20::633]) (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 7202F8442E for <u-boot@lists.denx.de>; Wed, 15 Jun 2022 12:04:05 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=monstr.eu Authentication-Results: phobos.denx.de; spf=none smtp.mailfrom=monstr@monstr.eu Received: by mail-ej1-x633.google.com with SMTP id s12so22189828ejx.3 for <u-boot@lists.denx.de>; Wed, 15 Jun 2022 03:04:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monstr-eu.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=pOtLZs41fHcgECsjEeIPn5fTsem4JqTfqS3y+qxAMRE=; b=NiPlqT7TQqVtCPma1CNxP6knDaO3RZrXKebYezSd7rlZg8Jvr3Hq/OSG5Q8fWhyAyq xjqzyZ9TjjG8AQs1FowqNO+nWY4899lhgIxNoAS+DdZT6aBiiR2aWE8cIU16MgEgudV9 ztr5IA9sU82xOhl0Ryip9SZTpjMliF/dZcLMCjJNwkC6R8lJdtGmRFooPBsODBZzEA3F QiGiVf5gKFzZB5AMwYFda8h6EbPloKAYX8AVLLMbE7m14imyu5uexA9xHAcNFpzn17u1 5zNc+BVCZ5FlBD0RpOeGyFRpS227rDiqaEYQXy6yHnQR+WRGSMKphua5nn+EC1VwTFkl l8dg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=pOtLZs41fHcgECsjEeIPn5fTsem4JqTfqS3y+qxAMRE=; b=CWA9ntGJ/I6HOiKPSu+OMVIKaEfIgb4rVLi/ZaMb8HAMWjE6g6rbMaUQPXzCa5pMnY L9nT4R0eGpio7jMmtHv4wRLgSXpWfWLvW2AGh2o5fne3R/8QZInPi3Lgnr1jrXuOduk7 0w14SsB9DtbzTh/lVNtN9tIZ1xyKCLRBlswyPtwafwTGKk7hSvUSWZxiFdXDJkdrECJS k5bOMJp2VYkUtUypdojQ0ML2WEvZH00jA1CghisKgarLLlubKtaErtxelzqzdtV/uUOI kmGIS00F4qlXIvoF449TavX7Tj3XRBiw+rApxUWm691js8edHNYWa+EW4XfeDFicWDIH n6Jw== X-Gm-Message-State: AOAM5328EhKOZqJ+f4CGAE5oydlkGLnzgVKX/w8X7ka/pcplwOTrIoXS mOYXuAJkyeRYAenBwivS+7u+/OAW4SsNgQ== X-Google-Smtp-Source: ABdhPJxsbhgUqQrm5HjEDRwa5y90Q8JMjyS/J/+8v9oEKdb9+6PVkA5dsxYK+gRyNpGSyvrYNtSGmQ== X-Received: by 2002:a17:907:7eaa:b0:6df:e82c:f84 with SMTP id qb42-20020a1709077eaa00b006dfe82c0f84mr8338540ejc.590.1655287444805; Wed, 15 Jun 2022 03:04:04 -0700 (PDT) Received: from localhost ([2a02:768:2307:40d6::f9e]) by smtp.gmail.com with ESMTPSA id j18-20020a17090643d200b006fe8a4ec62fsm6167695ejn.4.2022.06.15.03.04.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Jun 2022 03:04:04 -0700 (PDT) From: Michal Simek <monstr@monstr.eu> X-Google-Original-From: Michal Simek <michal.simek@amd.com> To: u-boot@lists.denx.de, git@xilinx.com Cc: Alistair Delva <adelva@google.com> Subject: [PATCH v3 01/23] tools: relocate-rela: Open binary u-boot file later Date: Wed, 15 Jun 2022 12:03:38 +0200 Message-Id: <d7085880ce094dbb89cb6b512473e6e8995c41ba.1655287429.git.michal.simek@amd.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <cover.1655287429.git.michal.simek@amd.com> References: <cover.1655287429.git.michal.simek@amd.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion <u-boot.lists.denx.de> List-Unsubscribe: <https://lists.denx.de/options/u-boot>, <mailto:u-boot-request@lists.denx.de?subject=unsubscribe> List-Archive: <https://lists.denx.de/pipermail/u-boot/> List-Post: <mailto:u-boot@lists.denx.de> List-Help: <mailto:u-boot-request@lists.denx.de?subject=help> List-Subscribe: <https://lists.denx.de/listinfo/u-boot>, <mailto:u-boot-request@lists.denx.de?subject=subscribe> Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" <u-boot-bounces@lists.denx.de> X-Virus-Scanned: clamav-milter 0.103.5 at phobos.denx.de X-Virus-Status: Clean |
Series |
microblaze: Add support for full relocation
|
expand
|
diff --git a/tools/relocate-rela.c b/tools/relocate-rela.c index f0bc548617a4..883987111869 100644 --- a/tools/relocate-rela.c +++ b/tools/relocate-rela.c @@ -73,13 +73,6 @@ int main(int argc, char **argv) return 1; } - f = fopen(argv[1], "r+b"); - if (!f) { - fprintf(stderr, "%s: Cannot open %s: %s\n", - argv[0], argv[1], strerror(errno)); - return 2; - } - if (!read_num(argv[2], &text_base) || !read_num(argv[3], &rela_start) || !read_num(argv[4], &rela_end)) { @@ -95,6 +88,13 @@ int main(int argc, char **argv) rela_start -= text_base; rela_end -= text_base; + f = fopen(argv[1], "r+b"); + if (!f) { + fprintf(stderr, "%s: Cannot open %s: %s\n", + argv[0], argv[1], strerror(errno)); + return 2; + } + fseek(f, 0, SEEK_END); file_size = ftell(f); rewind(f);
There is no value to open u-boot binary file so early. Better to check all values first and then open binary file. Signed-off-by: Michal Simek <michal.simek@amd.com> --- (no changes since v1) tools/relocate-rela.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)