From patchwork Sat Aug 24 13:22:56 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1152643 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="QJMz+0Ye"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 46Fzx40pL0z9s7T for ; Sat, 24 Aug 2019 23:43:03 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 9B151C21D8A; Sat, 24 Aug 2019 13:33:38 +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 2AA7EC21E45; Sat, 24 Aug 2019 13:30:58 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 9E4C8C21E45; Sat, 24 Aug 2019 13:27:39 +0000 (UTC) Received: from mail-io1-f41.google.com (mail-io1-f41.google.com [209.85.166.41]) by lists.denx.de (Postfix) with ESMTPS id 576AFC21DFA for ; Sat, 24 Aug 2019 13:27:35 +0000 (UTC) Received: by mail-io1-f41.google.com with SMTP id e20so26588432iob.9 for ; Sat, 24 Aug 2019 06:27:35 -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=jWYOmvzKk+E2453wiKqYKlFCEsexGByouL4QZqUrstc=; b=QJMz+0Ye3dtxDC4BT1sNBjaFTuEEb5qEl7D1hqk403oPJiTqZBoWJ5zpZLCqrlV8LD 19FyOF9ZF1bPQXTogcIHO3P49qFQ74MhafLtgcy3APykKT0e6qOS/ptIMvgo3cwmmcyd RbGKeOXAZDoENA/H0+BBiRn0bmGDbQnac4814= 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=jWYOmvzKk+E2453wiKqYKlFCEsexGByouL4QZqUrstc=; b=mb0+im3aDamF/JAS9KBN+wULhhJ0n3HsMuX4Fyew3XEDw/dR1MbCwwYZAOAuNry325 7KRQJLbtXdKD8bfrzdFN/Y30MTBuqMZS1WPLFhZB2gXgSyjJs868fgKzTexs8bGfzZHF +aN6rsd0mmbQh4eRp2iHwNDmJ4IFSpOwlCyep6T6zJ/t+K1Yc8ij/A2HHZ9txbBvIFeX cBcITKM9X01+e2bqF+z099oIAMwPEFxsI/p6DihKWX3jiHbRCwP49GsbzI6C0ljxiKB8 kmD1iS9CEV/CvwKl4OpbC+6GBGbGlfxdNp+zjpWy8ZwAY4MSNOEzs9Dut1jegHRvduJU cgfw== X-Gm-Message-State: APjAAAWnN9m9DiUvGbv4FmaXVGtvLJk0JamY4OihsywbfiqqJWtCyCBL CDC/38D0qxYJUsxJ0jI8x8QWe4qdirg= X-Google-Smtp-Source: APXvYqwE3vX0gxX4pGnUl0c3bnm6yx2Z9WFDpGDn2fU8mZc8bzs32u7P2vwEtbs36LGla1bYVcOb3g== X-Received: by 2002:a02:cc50:: with SMTP id i16mr9682525jaq.50.1566653254113; Sat, 24 Aug 2019 06:27:34 -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.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 24 Aug 2019 06:27:33 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Date: Sat, 24 Aug 2019 07:22:56 -0600 Message-Id: <20190824132315.53130-17-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 16/34] binman: Use the Makefile for u_boot_binman_syms 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" Remove this file from git and instead build it using the Makefile. With this change a few things need to be adjusted: 1. The 'notes' section no-longer appears at the start of the ELF file (before the code), so update testSymbols to adjust the offsets. 2. The dynamic linker is disabled to avoid errors like: "Not enough room for program headers, try linking with -N" 3. The interpreter note is moved to the end of the image, so that the binman symbols appear first. Signed-off-by: Simon Glass Signed-off-by: Simon Glass --- tools/binman/elf_test.py | 9 +++++---- tools/binman/ftest.py | 7 ++++--- tools/binman/test/Makefile | 5 +++-- tools/binman/test/u_boot_binman_syms | Bin 4924 -> 0 bytes tools/binman/test/u_boot_binman_syms.lds | 1 + 5 files changed, 13 insertions(+), 9 deletions(-) delete mode 100755 tools/binman/test/u_boot_binman_syms diff --git a/tools/binman/elf_test.py b/tools/binman/elf_test.py index c7f51bb86a..ff036cb655 100644 --- a/tools/binman/elf_test.py +++ b/tools/binman/elf_test.py @@ -70,7 +70,8 @@ def BuildElfTestFiles(target_dir): del os.environ['MAKEFLAGS'] tools.Run('make', '-C', target_dir, '-f', os.path.join(testdir, 'Makefile'), 'SRC=%s/' % testdir, - 'bss_data', 'u_boot_ucode_ptr', 'u_boot_no_ucode_ptr') + 'bss_data', 'u_boot_ucode_ptr', 'u_boot_no_ucode_ptr', + 'u_boot_binman_syms', 'u_boot_binman_syms.bin') class TestElf(unittest.TestCase): @@ -118,7 +119,7 @@ class TestElf(unittest.TestCase): """Test a symbol which extends outside the entry area is detected""" entry = FakeEntry(10) section = FakeSection() - elf_fname = os.path.join(binman_dir, 'test', 'u_boot_binman_syms') + elf_fname = self.ElfTestFile('u_boot_binman_syms') with self.assertRaises(ValueError) as e: syms = elf.LookupAndWriteSymbols(elf_fname, entry, section) self.assertIn('entry_path has offset 4 (size 8) but the contents size ' @@ -158,7 +159,7 @@ class TestElf(unittest.TestCase): """ entry = FakeEntry(20) section = FakeSection(sym_value=None) - elf_fname = os.path.join(binman_dir, 'test', 'u_boot_binman_syms') + elf_fname = self.ElfTestFile('u_boot_binman_syms') syms = elf.LookupAndWriteSymbols(elf_fname, entry, section) self.assertEqual(tools.GetBytes(255, 16) + tools.GetBytes(ord('a'), 4), entry.data) @@ -169,7 +170,7 @@ class TestElf(unittest.TestCase): tout.Init(tout.DEBUG) entry = FakeEntry(20) section = FakeSection() - elf_fname = os.path.join(binman_dir, 'test', 'u_boot_binman_syms') + elf_fname = self.ElfTestFile('u_boot_binman_syms') with test_util.capture_sys_output() as (stdout, stderr): syms = elf.LookupAndWriteSymbols(elf_fname, entry, section) self.assertTrue(len(stdout.getvalue()) > 0) diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py index 30a8b0b14c..507c481881 100644 --- a/tools/binman/ftest.py +++ b/tools/binman/ftest.py @@ -489,7 +489,8 @@ class TestFunctional(unittest.TestCase): Filename of ELF file to use as SPL """ # TODO(sjg@chromium.org): Drop this when all Elf files use ElfTestFile() - if src_fname in ['bss_data', 'u_boot_ucode_ptr', 'u_boot_no_ucode_ptr']: + if src_fname in ['bss_data', 'u_boot_ucode_ptr', 'u_boot_no_ucode_ptr', + 'u_boot_binman_syms']: fname = cls.ElfTestFile(src_fname) else: fname = cls.TestFile(src_fname) @@ -1223,14 +1224,14 @@ class TestFunctional(unittest.TestCase): def testSymbols(self): """Test binman can assign symbols embedded in U-Boot""" - elf_fname = self.TestFile('u_boot_binman_syms') + elf_fname = self.ElfTestFile('u_boot_binman_syms') syms = elf.GetSymbols(elf_fname, ['binman', 'image']) addr = elf.GetSymbolAddress(elf_fname, '__image_copy_start') self.assertEqual(syms['_binman_u_boot_spl_prop_offset'].address, addr) self._SetupSplElf('u_boot_binman_syms') data = self._DoReadFile('053_symbols.dts') - sym_values = struct.pack('b@{x4c zE5;WsFm2Hg^@?wr9YU~>YH4`}5c1&&ByC=kmIE-njg7@cOGNIMMrEqY*0%Jew;7a^sB_W@r02_y_o5))_MHhhw82$s+oLkVEs6T@@=QIAe5MwG*swm5} ziUw&Crm7exh3p9vPRSx4ZmE2fu9lN4Ibsc9FJs@4 ncxM85*3jr@_lETl{jT6ScUlE_F7M+JFyC(j{k|b*%=G&MuziL^ diff --git a/tools/binman/test/u_boot_binman_syms.lds b/tools/binman/test/u_boot_binman_syms.lds index 29cf9d0e54..926df873cb 100644 --- a/tools/binman/test/u_boot_binman_syms.lds +++ b/tools/binman/test/u_boot_binman_syms.lds @@ -25,5 +25,6 @@ SECTIONS KEEP(*(SORT(.binman_sym*))); __binman_sym_end = .; } + .interp : { *(.interp*) } }