Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A58EFC433F5 for ; Tue, 8 Feb 2022 18:52:59 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 3A24083E04; Tue, 8 Feb 2022 19:51:11 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="YgPyA+gQ"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 190D283DA5; Tue, 8 Feb 2022 19:50:47 +0100 (CET) Received: from mail-il1-x12a.google.com (mail-il1-x12a.google.com [IPv6:2607:f8b0:4864:20::12a]) (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 89B8883D91 for ; Tue, 8 Feb 2022 19:50:40 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-il1-x12a.google.com with SMTP id o10so14823620ilh.0 for ; Tue, 08 Feb 2022 10:50:40 -0800 (PST) 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=dlX2r/V3RnW819/c+UU6GBvW0f0+gLqm5WKSOLJ4OtI=; b=YgPyA+gQ+8Jp8mSr/BOeEJhEloRoNm6hngAztUGOnbd7EmVT47J9Tp8j2iKtQ/nU1n XAiSBt1VgGtdcM8aX8EwYQ+9bLtQE9a7Vj+pyXVjcCSOKC2MJZ19ZZYum5gVJ1mtemKA auXot7ZzbknsBqiomBkCK6WCOXUfeySPN1V9o= 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=dlX2r/V3RnW819/c+UU6GBvW0f0+gLqm5WKSOLJ4OtI=; b=eMDfzwXpFpM3T7HH7qMatSG7Y3f/wpNV0COZ9E2BSgu7+7Srs4f9ihzvg3DiCDMP8z /GVCmPFLptvJoQRHGcS0NFfANcJl4Uehv6b76WoKhX+qILbAFekqDW35loR1dm5Ma3hm tBqiT8yljjwXBrZINwR729Epb4k8ArsGPNNvx93SbfQ8WLnm+RcTQXUo8K4C167Qe+zg ei88j/157eBeoYFY0ITWLjO/cFszVKxTn8YLUBJ8sypHAJeFLT2DbkHX2znOVHAhKRqn FOL7suya7PfnyWKUtwU6PLUwFOTWA9SC1jG5F+XJfSe3bxTMpOgbf+UTrvWVIHqXfcne N0GQ== X-Gm-Message-State: AOAM532Ji6u7NS2RkUiqSVUasj/ubHOD6X3nF8NBHb/I21PV6MmqHLY1 XQf0nB4p7h8HRFOE4iZEFNYxHWJvMKRkmw== X-Google-Smtp-Source: ABdhPJzrswGjev0Vwktbp50DlzRsXFDmXKCIpK9eTRFsNs3KkM7ja18HMjxGAa7GthxEfpzrl9k2JQ== X-Received: by 2002:a05:6e02:1a09:: with SMTP id s9mr2773525ild.73.1644346239166; Tue, 08 Feb 2022 10:50:39 -0800 (PST) Received: from kiwi.bld.corp.google.com (c-67-190-101-114.hsd1.co.comcast.net. [67.190.101.114]) by smtp.gmail.com with ESMTPSA id q2sm2911844ilt.33.2022.02.08.10.50.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Feb 2022 10:50:38 -0800 (PST) From: Simon Glass To: U-Boot Mailing List Cc: huang lin , Jeffy Chen , Simon Glass , Kever Yang , Philipp Tomsich , Alper Nebi Yasak , Tom Rini , Roger Quadros , Philippe Reynes , Ivan Mikhaylov Subject: [PATCH 15/24] binman: Add a ELF test file with disjoint text sections Date: Tue, 8 Feb 2022 11:49:59 -0700 Message-Id: <20220208185008.35843-14-sjg@chromium.org> X-Mailer: git-send-email 2.35.0.263.gb82422642f-goog In-Reply-To: <20220208185008.35843-1-sjg@chromium.org> References: <20220208185008.35843-1-sjg@chromium.org> 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 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 Add a file that has two text sections at different addresses, so we can test this behaviour in binman, once added. Signed-off-by: Simon Glass --- tools/binman/test/Makefile | 6 +++++- tools/binman/test/elf_sections.c | 20 +++++++++++++++++++ tools/binman/test/elf_sections.lds | 31 ++++++++++++++++++++++++++++++ 3 files changed, 56 insertions(+), 1 deletion(-) create mode 100644 tools/binman/test/elf_sections.c create mode 100644 tools/binman/test/elf_sections.lds diff --git a/tools/binman/test/Makefile b/tools/binman/test/Makefile index 387ba16335..57057e2d58 100644 --- a/tools/binman/test/Makefile +++ b/tools/binman/test/Makefile @@ -29,11 +29,12 @@ LDS_BINMAN := -T $(SRC)u_boot_binman_syms.lds LDS_BINMAN_BAD := -T $(SRC)u_boot_binman_syms_bad.lds LDS_BINMAN_X86 := -T $(SRC)u_boot_binman_syms_x86.lds LDS_BINMAN_EMBED := -T $(SRC)u_boot_binman_embed.lds +LDS_EFL_SECTIONS := -T $(SRC)elf_sections.lds TARGETS = u_boot_ucode_ptr u_boot_no_ucode_ptr bss_data \ u_boot_binman_syms u_boot_binman_syms.bin u_boot_binman_syms_bad \ u_boot_binman_syms_size u_boot_binman_syms_x86 embed_data \ - u_boot_binman_embed u_boot_binman_embed_sm + u_boot_binman_embed u_boot_binman_embed_sm elf_sections all: $(TARGETS) @@ -70,6 +71,9 @@ u_boot_binman_embed: u_boot_binman_embed.c u_boot_binman_embed_sm: CFLAGS += $(LDS_BINMAN_EMBED) u_boot_binman_embed_sm: u_boot_binman_embed_sm.c +elf_sections: CFLAGS += $(LDS_EFL_SECTIONS) +elf_sections: elf_sections.c + clean: rm -f $(TARGETS) diff --git a/tools/binman/test/elf_sections.c b/tools/binman/test/elf_sections.c new file mode 100644 index 0000000000..9bcce9af02 --- /dev/null +++ b/tools/binman/test/elf_sections.c @@ -0,0 +1,20 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Copyright 2022 Google LLC + * + * Program containing two text sections + */ + +int __attribute__((section(".sram_data"))) data[29]; + +int __attribute__((section(".sram_code"))) calculate(int x) +{ + data[0] = x; + + return x * x; +} + +int main(void) +{ + return calculate(123); +} diff --git a/tools/binman/test/elf_sections.lds b/tools/binman/test/elf_sections.lds new file mode 100644 index 0000000000..7b6e932592 --- /dev/null +++ b/tools/binman/test/elf_sections.lds @@ -0,0 +1,31 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* + * Copyright (c) 2016 Google, Inc + */ + +OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386") +OUTPUT_ARCH(i386) +ENTRY(_start) + +SECTIONS +{ + . = 0x00000010; + _start = .; + + . = ALIGN(4); + .text : + { + *(.text*) + } + + . = 0x00001000; + .sram : + { + *(.sram*) + } + + /DISCARD/ : { + *(.comment) + *(.dyn*) + } +} -- 2.35.0.263.gb82422642f-goog