From patchwork Sat Aug 24 13:23:06 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1152638 X-Patchwork-Delegate: sjg@chromium.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="DZ5/c4HD"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 46Fzth5DKRz9s7T for ; Sat, 24 Aug 2019 23:41:00 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 17309C21EE4; Sat, 24 Aug 2019 13:34:20 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 75B52C21C51; Sat, 24 Aug 2019 13:32:13 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 7337FC21DD7; Sat, 24 Aug 2019 13:27:55 +0000 (UTC) Received: from mail-io1-f65.google.com (mail-io1-f65.google.com [209.85.166.65]) by lists.denx.de (Postfix) with ESMTPS id 71A52C21E26 for ; Sat, 24 Aug 2019 13:27:51 +0000 (UTC) Received: by mail-io1-f65.google.com with SMTP id q22so26701479iog.4 for ; Sat, 24 Aug 2019 06:27:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=R2KEcGgxdLIP4OMlxCkLe6Jet7aktuhlr5iza7XhX3A=; b=DZ5/c4HDxzK0Jnc4j4SuCTN7HDJ5MGS/jNXeyFQnMgdjGVknpweTslRxac4P46CPBt K0cOAQXzGl6bEa4Zj8TJt/ipYk0RwBbYXrV1oIn6+1XFCOOhqrZDJS7B16IhMjoUMyJ6 zXMHlZPPODT27B914uHlbVRRs0EKp+DaKHJmU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=R2KEcGgxdLIP4OMlxCkLe6Jet7aktuhlr5iza7XhX3A=; b=K7+jkYVR3Pn3IsAGndgWdjDagBA6CWsAMr0lO72xgujOKQ5KDtoGnJPt2DlDkloYae LIh4DABTxawZl+9wdJEr9ZxZCq/w7iYj3oNtZ3GvioljLecfCeqpAqgLzxt1UmyVfJzn J/m8LJaCoPf87dajf89+IwA5iA0t150ukzVIdspJfxirsBME4wHUxgFS/f/4MHM3FQ8m eyzq8FZ76XVMbVXTMcDr82EmnE94ZhbN+T8nx1hhBMgfvJSv2iuuatxVHCnysKeVqLcn 8t12ZRG44mQlUMo4lpIUWSND4wD1gHalZmtIxmnE9OuEjhNNTPnfvYjaNC67xa2j7ctJ A9EQ== X-Gm-Message-State: APjAAAUY6dV51MVAN5YDU+zD8PQD6HInwljaeAXvOyq5yPDUMBH9BTDg FS5xIQbE+IqC9fPg0RCz+laW4Qj42jw= X-Google-Smtp-Source: APXvYqyzCPVXqLNdAPGvKV8baIY4D9+h1uq/DfYvCUQVOePBC6lBgMMIvza5LoL0GmdsxR4Eoj5QKg== X-Received: by 2002:a5d:87c2:: with SMTP id q2mr9326495ios.268.1566653270359; Sat, 24 Aug 2019 06:27:50 -0700 (PDT) Received: from kiwi.bld.corp.google.com ([2620:15c:183:0:8223:87c:a681:66aa]) by smtp.gmail.com with ESMTPSA id l2sm8881790ioq.83.2019.08.24.06.27.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 24 Aug 2019 06:27:50 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Date: Sat, 24 Aug 2019 07:23:06 -0600 Message-Id: <20190824132315.53130-27-sjg@chromium.org> X-Mailer: git-send-email 2.23.0.187.g17f5b7556c-goog In-Reply-To: <20190824132315.53130-1-sjg@chromium.org> References: <20190824132315.53130-1-sjg@chromium.org> MIME-Version: 1.0 Subject: [U-Boot] [PATCH 26/34] binman: Correct symbol calculation with non-zero image base X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 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" At present binman adds the image base address to the symbol value before it writes it to the binary. This is not correct since the symbol value itself (e.g. image position) has no relationship to the image base. Fix this and update the tests to cover this case. Signed-off-by: Simon Glass Signed-off-by: Simon Glass --- tools/binman/elf.py | 4 +--- tools/binman/test/u_boot_binman_syms.lds | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/tools/binman/elf.py b/tools/binman/elf.py index 7bc7cf61b5..0c1a5b44b6 100644 --- a/tools/binman/elf.py +++ b/tools/binman/elf.py @@ -135,9 +135,7 @@ def LookupAndWriteSymbols(elf_fname, entry, section): # Look up the symbol in our entry tables. value = section.LookupSymbol(name, sym.weak, msg) - if value is not None: - value += base.address - else: + if value is None: value = -1 pack_string = pack_string.lower() value_bytes = struct.pack(pack_string, value) diff --git a/tools/binman/test/u_boot_binman_syms.lds b/tools/binman/test/u_boot_binman_syms.lds index 926df873cb..825fc3f649 100644 --- a/tools/binman/test/u_boot_binman_syms.lds +++ b/tools/binman/test/u_boot_binman_syms.lds @@ -9,7 +9,7 @@ ENTRY(_start) SECTIONS { - . = 0x00000000; + . = 0x00000010; _start = .; . = ALIGN(4);