From patchwork Tue Jun 7 08:10:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Simek X-Patchwork-Id: 1639863 X-Patchwork-Delegate: monstr@monstr.eu Return-Path: 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=kKQqp7w2; dkim-atps=neutral Authentication-Results: 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 RSA-PSS (2048 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4LHNYJ5wmfz9sFs for ; Tue, 7 Jun 2022 18:19:00 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 255E284347; Tue, 7 Jun 2022 10:18:30 +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="kKQqp7w2"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id E44F3842FC; Tue, 7 Jun 2022 10:18: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-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 AE828842E6 for ; Tue, 7 Jun 2022 10:11:54 +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-ed1-x52a.google.com with SMTP id fd25so21927832edb.3 for ; Tue, 07 Jun 2022 01:11:54 -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=SKe1muC2i5OHwRX9wJjkJhAeLwlHXYHd3vsgogxIbGM=; b=kKQqp7w2FhcqGH24Irxo2XRPEIdVXVl4sgALIPBYBWtOR8pavF+efBb7rV8PLJ9D97 MKWh3xeNy0HnVKZ6c7JVdk3qrfVY3mdulrBoDPo/DJ9/oqF8+aMj7oZWU+URuViuNfmx Doj071RFA/TxYO8DwxQdkZrEgmpTUW6SCO5SbkzzFIdU2XXyppBsYFuXJDklDqYrj0jI nHBJRVCaqvFc1eXOlO2ggYdQqr43ykslZpYmrqwGCiuH0WjahhEeYZDRKpXx8RGT4jzl O9nWgqk/oCHnRdb8GYIJI0RZu0MVVg7h/9F1RjWZCCQKs1upryvWZq9Y0VFDK+GDdF3F Tgew== 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=SKe1muC2i5OHwRX9wJjkJhAeLwlHXYHd3vsgogxIbGM=; b=yy7k0AJBUxYouJ16QSROmEqFXDSWyzbxYTSNEXow0fkjCfomMAbUKyRm+9cRclasaC xjg5MfHcDgvtpUUXb/lJyECCZ7jtu8nyn/10UPrcE5r8BgqqVbKrbLMDsOHklzRhx4mz zM0mzUshM/T2cS8Ojhzf8OtES4co2H43+bdTRVz/x9llw49MJQSbBqfOViAnSXhIXVVf I9ksCrRacuRgmobp70EGlNRxlZzd7AtAGX1mAvvGhk6UzOjzP5p90ZKOgzJnpGpCOl6t M/a2dnsTHrr4zVzVK9sbqD9IXJUAEZOSAXcWEMbG0iIhL9WTbEzg3oFaofWtIqW3HKYh xzBg== X-Gm-Message-State: AOAM532oeSGAF2Ti8VYEjTDph9RI9SgLKA4t03qwvT3w5SAT9ObA2IGk kXbwindQDbXck+emHJOpqJC+W25Gv3LE0w== X-Google-Smtp-Source: ABdhPJywzdpDjcnT1gFjwTwF9iW/iMkvTBgAlUTPC6eLKphfiQew4PhuvjZJTSLkpxetyf2q+Omdug== X-Received: by 2002:a05:6402:11d2:b0:42d:e68a:eae0 with SMTP id j18-20020a05640211d200b0042de68aeae0mr31574063edw.111.1654589483193; Tue, 07 Jun 2022 01:11:23 -0700 (PDT) Received: from localhost ([2a02:768:2307:40d6::f9e]) by smtp.gmail.com with ESMTPSA id f14-20020a170906824e00b006f3ef214debsm7261451ejx.81.2022.06.07.01.11.22 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 07 Jun 2022 01:11:22 -0700 (PDT) From: Michal Simek X-Google-Original-From: Michal Simek To: u-boot@lists.denx.de, git@xilinx.com Cc: Alistair Delva Subject: [PATCH v2 20/23] tools: relocate-rela: Check that relocation works only for EM_AARCH64 Date: Tue, 7 Jun 2022 10:10:37 +0200 Message-Id: <3a8746ee3ebe349b8237b3c6a85c2bf70fdff6f7.1654589430.git.michal.simek@amd.com> X-Mailer: git-send-email 2.36.0 In-Reply-To: References: 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.5 at phobos.denx.de X-Virus-Status: Clean Relocation support is only for EM_AARCH64 that's why check machine type to make sure that the code will never run on any unsupported one. Signed-off-by: Michal Simek --- (no changes since v1) tools/relocate-rela.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tools/relocate-rela.c b/tools/relocate-rela.c index e62247d51e2a..2f7f1796a0ef 100644 --- a/tools/relocate-rela.c +++ b/tools/relocate-rela.c @@ -79,6 +79,11 @@ static int decode_elf64(FILE *felf, char **argv) machine = header.e_machine; debug("Machine\t%d\n", machine); + if (machine != EM_AARCH64) { + fprintf(stderr, "%s: Not supported machine type\n", argv[0]); + return 30; + } + text_base = header.e_entry; section_header_base = header.e_shoff; section_header_size = header.e_shentsize * header.e_shnum;