From patchwork Mon Jul 8 17:49:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Samuelsson X-Patchwork-Id: 93545 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id D4BC138323C1 for ; Mon, 8 Jul 2024 17:50:21 +0000 (GMT) X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from morgoth (host183-192-94.customer.mediateknik.net [193.183.192.94]) by sourceware.org (Postfix) with ESMTP id C6E9F384AB44 for ; Mon, 8 Jul 2024 17:49:34 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org C6E9F384AB44 Authentication-Results: sourceware.org; dmarc=fail (p=none dis=none) header.from=emagii.com Authentication-Results: sourceware.org; spf=none smtp.mailfrom=morgoth ARC-Filter: OpenARC Filter v1.0.0 sourceware.org C6E9F384AB44 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=193.183.192.94 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1720460977; cv=none; b=IinNpkv1iBW9Z0Azgfw0B/g4bzvHunj/ol46+B4uK9jlac8+s4f9eWx31AaauFlYMA68VsSBFdLWwkh8M7CMaOHZo2GqbWBSYB3U9+cxWTrcu+yfm4NarxFYexLKMgunOKU5cWe2xpfrYz1a8Q6fh2GxGauFlRC5cXz7rSpml2w= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1720460977; c=relaxed/simple; bh=+WAfWLo6oUE8AwnkXu7AH07VTi592uEuHXAqxtRXHZ4=; h=From:To:Subject:Date:Message-Id; b=hbAX6tZ3DpvbvP2c8ljn2aMJNEZazFg+mxA4HNv32Fpo5qF8kyL5hpX5nA1xAbYv2DhhX1qihlCThYt2hXA/T2Z/Yo6BN6GngaYrTFs17z4QW1slHwsISredBrpsZVQ4TR63A8shE/mFC94/NxdFk7T4qtgZBE5nlOh8DcGo8oc= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by morgoth (Postfix, from userid 1000) id 1465D340BEE; Mon, 8 Jul 2024 19:49:32 +0200 (CEST) From: binutils@emagii.com To: binutils@sourceware.org Cc: nickc@redhat.com, Ulf Samuelsson Subject: [PATCH v4 5/7] Add testsuite for ASCII command Date: Mon, 8 Jul 2024 19:49:27 +0200 Message-Id: <20240708174929.15137-6-binutils@emagii.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240708174929.15137-1-binutils@emagii.com> References: <20240708174929.15137-1-binutils@emagii.com> X-Spam-Status: No, score=-12.2 required=5.0 tests=BAYES_00, FSL_HELO_NON_FQDN_1, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, HELO_NO_DOMAIN, KAM_DMARC_STATUS, KAM_LAZY_DOMAIN_SECURITY, KHOP_HELO_FCRDNS, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: binutils@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: binutils-bounces~patchwork=sourceware.org@sourceware.org From: Ulf Samuelsson Signed-off-by: Ulf Samuelsson --- ld/testsuite/ld-scripts/ascii.d | 25 ++++++++++++++++++++ ld/testsuite/ld-scripts/ascii.s | 11 +++++++++ ld/testsuite/ld-scripts/ascii.t | 37 ++++++++++++++++++++++++++++++ ld/testsuite/ld-scripts/script.exp | 1 + 4 files changed, 74 insertions(+) create mode 100644 ld/testsuite/ld-scripts/ascii.d create mode 100644 ld/testsuite/ld-scripts/ascii.s create mode 100644 ld/testsuite/ld-scripts/ascii.t diff --git a/ld/testsuite/ld-scripts/ascii.d b/ld/testsuite/ld-scripts/ascii.d new file mode 100644 index 00000000000..ff3bd328c15 --- /dev/null +++ b/ld/testsuite/ld-scripts/ascii.d @@ -0,0 +1,25 @@ +#source: ascii.s +#ld: -T ascii.t +#objdump: -s -j .header +#target: [is_elf_format] [is_coff_format] +#notarget: tic4x-*-* tic54x-*-* + +.*: file format .* + +Contents of section .header: + .... 70726f67 72616d20 6e616d65 00000000 program name.... + .... 656d7074 79000000 00000000 00000000 empty........... + .... 00000000 00000000 00000000 00000000 ................ + .... 00000000 00000000 00000000 00000000 ................ + .... 00000000 00000000 00000000 00000000 ................ + .... 636f6d6d 656e7420 310a0000 00000000 comment 1....... + .... 00000000 00000000 00000000 00000000 ................ + .... 636f6d6d 656e7420 320a0000 00000000 comment 2....... + .... 00000000 00000000 00000000 00000000 ................ + .... 636f6d6d 656e7420 330a0000 00000000 comment 3....... + .... 00000000 00000000 00000000 00000000 ................ + .... 636f6d6d 656e7420 340a0000 00000000 comment 4....... + .... 00000000 00000000 49206d65 616e7420 ........I meant + .... 746f2073 61793a20 54686973 20697320 to say: This is + .... 77617920 746f6f20 6c6f6e67 00000000 way too long.... +#pass diff --git a/ld/testsuite/ld-scripts/ascii.s b/ld/testsuite/ld-scripts/ascii.s new file mode 100644 index 00000000000..af1022dea63 --- /dev/null +++ b/ld/testsuite/ld-scripts/ascii.s @@ -0,0 +1,11 @@ + .extern ecc_start + .section .text +main: + .long 0x45444F43 + .long 0x12345678 + + .section .data + .long 0x9abcdef0 + + .section .bss + .long 0 diff --git a/ld/testsuite/ld-scripts/ascii.t b/ld/testsuite/ld-scripts/ascii.t new file mode 100644 index 00000000000..93bac748834 --- /dev/null +++ b/ld/testsuite/ld-scripts/ascii.t @@ -0,0 +1,37 @@ +_start = 0x000000; + +SECTIONS +{ + . = 0x1000 + SIZEOF_HEADERS; + + .header ALIGN (0x100) (READONLY) : + { + ASCII 16, "program name" + ASCII 64, "empty" + ASCII 4 * 8, "comment 1\n" + ASCII 32, "comment 2\n" + ASCII 32, "comment 3\n" + ASCII 24, "comment 4\n" + ASCII 64, "I meant to say: This is way too long" + } + + .text ALIGN (0x100) : + { + entry = .; + *(.text) + } + + .data : AT (0x400000) + { + *(.data) + } + + . = ALIGN(0x20); + + .bss : + { + *(.bss) + } + + /DISCARD/ : { *(*) } +} diff --git a/ld/testsuite/ld-scripts/script.exp b/ld/testsuite/ld-scripts/script.exp index 213383de962..bc3fffe92d8 100644 --- a/ld/testsuite/ld-scripts/script.exp +++ b/ld/testsuite/ld-scripts/script.exp @@ -228,6 +228,7 @@ foreach test_script $test_script_list { } run_dump_test "asciz" +run_dump_test "ascii" run_dump_test "align-with-input" run_dump_test "pr20302" run_dump_test "output-section-types"