From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from emagii.se (www.emagii.com [185.133.207.17]) by sourceware.org (Postfix) with ESMTPS id 80E063858C60 for ; Wed, 15 Feb 2023 11:41:08 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 80E063858C60 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=emagii.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=emagii.com Received: from valinor.ownit.se (84-55-68-216.customers.ownit.se [84.55.68.216]) by emagii.se (Postfix) with ESMTPSA id 6CF1C1201DD; Wed, 15 Feb 2023 12:41:06 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=emagii.com; s=default; t=1676461266; bh=GUoBZoExlcyzx8wxpw7SbKtZfvkMeEgYpLaVajDLYPA=; h=From:To:Subject; b=hiDfaSq4WmmUT8551lBDtQFLJNb4AImNSjDluXmHrBTld5TnVIys1arrIS72IvxLy 9yIb6LGR5T1wbPWmRXGTWL4LfarioUqtja6tuqHNatvOwecIaYfPfsYlbf1lJWk2iw OqsafTefx0UKXOD2f7817RoZvzh/6GDAqUC2EPes= Authentication-Results: emagii.beebytevps.io; spf=pass (sender IP is 84.55.68.216) smtp.mailfrom=binutils@emagii.com smtp.helo=valinor.ownit.se Received-SPF: pass (emagii.beebytevps.io: connection is authenticated) From: binutils@emagii.com To: binutils@sourceware.org Cc: nickc@redhat.com, Ulf Samuelsson Subject: [PATCH v0 1/6] Add testsuite for ASCII command Date: Wed, 15 Feb 2023 12:40:47 +0100 Message-Id: <20230215114052.28292-2-binutils@emagii.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230215114052.28292-1-binutils@emagii.com> References: <20230215114052.28292-1-binutils@emagii.com> X-PPP-Message-ID: <167646126674.3837018.2439332211072668019@localhost.localdomain> X-PPP-Vhost: emagii.com X-Spam-Status: No, score=-11.9 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,SPF_HELO_FAIL,SPF_PASS,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 List-Id: From: Ulf Samuelsson Signed-off-by: Ulf Samuelsson --- ld/testsuite/ld-scripts/ascii.d | 155 +++++++++++++++++++++++++++++ ld/testsuite/ld-scripts/ascii.s | 9 ++ ld/testsuite/ld-scripts/ascii.t | 51 ++++++++++ ld/testsuite/ld-scripts/header.inc | 34 +++++++ 4 files changed, 249 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 create mode 100755 ld/testsuite/ld-scripts/header.inc diff --git a/ld/testsuite/ld-scripts/ascii.d b/ld/testsuite/ld-scripts/ascii.d new file mode 100644 index 00000000000..9c59896ff1d --- /dev/null +++ b/ld/testsuite/ld-scripts/ascii.d @@ -0,0 +1,155 @@ +#source: ascii.s +#ld: -T ascii.t +#objdump: -s -j .text +#notarget: [is_aout_format] +#xfail: tic4x-*-* tic54x-*-* + +.*: file format .* + +Contents of section .text: + 1100 434f4445 deadbeef 00000000 00000000 CODE............ + 1110 00120000 f1080000 00000000 00000000 ................ + 1120 01020304 17000000 00004711 deadbeef ..........G..... + 1130 70726f67 72616d20 6e616d65 00000000 program name.... + 1140 656d7074 79000000 00000000 00000000 empty........... + 1150 00000000 00000000 00000000 00000000 ................ + 1160 00000000 00000000 00000000 00000000 ................ + 1170 00000000 00000000 00000000 00000000 ................ + 1180 636f6d6d 656e7420 315c6e00 00000000 comment 1\n..... + 1190 00000000 00000000 00000000 00000000 ................ + 11a0 636f6d6d 656e7420 325c6e00 00000000 comment 2\n..... + 11b0 00000000 00000000 00000000 00000000 ................ + 11c0 636f6d6d 656e7420 335c6e00 00000000 comment 3\n..... + 11d0 00000000 00000000 00000000 00000000 ................ + 11e0 636f6d6d 656e7420 345c6e00 00000000 comment 4\n..... + 11f0 00000000 00000000 deadbeef 434f4445 ............CODE + 1200 434f4445 10110000 ffffffff ffffffff CODE............ + 1210 ffffffff ffffffff ffffffff ffffffff ................ + 1220 ffffffff ffffffff ffffffff ffffffff ................ + 1230 ffffffff ffffffff ffffffff ffffffff ................ + 1240 ffffffff ffffffff ffffffff ffffffff ................ + 1250 ffffffff ffffffff ffffffff ffffffff ................ + 1260 ffffffff ffffffff ffffffff ffffffff ................ + 1270 ffffffff ffffffff ffffffff ffffffff ................ + 1280 ffffffff ffffffff ffffffff ffffffff ................ + 1290 ffffffff ffffffff ffffffff ffffffff ................ + 12a0 ffffffff ffffffff ffffffff ffffffff ................ + 12b0 ffffffff ffffffff ffffffff ffffffff ................ + 12c0 ffffffff ffffffff ffffffff ffffffff ................ + 12d0 ffffffff ffffffff ffffffff ffffffff ................ + 12e0 ffffffff ffffffff ffffffff ffffffff ................ + 12f0 ffffffff ffffffff ffffffff ffffffff ................ + 1300 54686973 20697320 61207374 72696e67 This is a string + 1310 2c203132 38206279 7465206c 6f6e6700 , 128 byte long. + 1320 00000000 00000000 00000000 00000000 ................ + 1330 00000000 00000000 00000000 00000000 ................ + 1340 00000000 00000000 00000000 00000000 ................ + 1350 00000000 00000000 00000000 00000000 ................ + 1360 00000000 00000000 00000000 00000000 ................ + 1370 00000000 00000000 00000000 00000000 ................ + 1380 10110000 ffffffff ffffffff ffffffff ................ + 1390 54686973 20697320 616e2075 6e616c69 This is an unali + 13a0 676e6564 20737472 696e6700 01020304 gned string..... + 13b0 04070101 ffffffff ffffffff ffffffff ................ + 13c0 01ffffff ffffffff ffffffff ffffffff ................ + 13d0 54686973 20697300 ffffffff ffffffff This is......... + 13e0 49206d65 616e7420 746f2073 61793a20 I meant to say: + 13f0 54686973 20697320 77617920 746f6f20 This is way too + 1400 6c6f6e67 00000000 00000000 00000000 long............ + 1410 00000000 00000000 00000000 00000000 ................ + 1420 ffffffff ffffffff ffffffff ffffffff ................ + 1430 ffffffff ffffffff ffffffff ffffffff ................ + 1440 ffffffff ffffffff ffffffff ffffffff ................ + 1450 ffffffff ffffffff ffffffff ffffffff ................ + 1460 ffffffff ffffffff ffffffff ffffffff ................ + 1470 ffffffff ffffffff ffffffff ffffffff ................ + 1480 ffffffff ffffffff ffffffff ffffffff ................ + 1490 ffffffff ffffffff ffffffff ffffffff ................ + 14a0 ffffffff ffffffff ffffffff ffffffff ................ + 14b0 ffffffff ffffffff ffffffff ffffffff ................ + 14c0 ffffffff ffffffff ffffffff ffffffff ................ + 14d0 ffffffff ffffffff ffffffff ffffffff ................ + 14e0 ffffffff ffffffff ffffffff ffffffff ................ + 14f0 ffffffff ffffffff ffffffff ffffffff ................ + 1500 ffffffff ffffffff ffffffff ffffffff ................ + 1510 ffffffff ffffffff ffffffff ffffffff ................ + 1520 ffffffff ffffffff ffffffff ffffffff ................ + 1530 ffffffff ffffffff ffffffff ffffffff ................ + 1540 ffffffff ffffffff ffffffff ffffffff ................ + 1550 ffffffff ffffffff ffffffff ffffffff ................ + 1560 ffffffff ffffffff ffffffff ffffffff ................ + 1570 ffffffff ffffffff ffffffff ffffffff ................ + 1580 ffffffff ffffffff ffffffff ffffffff ................ + 1590 ffffffff ffffffff ffffffff ffffffff ................ + 15a0 ffffffff ffffffff ffffffff ffffffff ................ + 15b0 ffffffff ffffffff ffffffff ffffffff ................ + 15c0 ffffffff ffffffff ffffffff ffffffff ................ + 15d0 ffffffff ffffffff ffffffff ffffffff ................ + 15e0 ffffffff ffffffff ffffffff ffffffff ................ + 15f0 ffffffff ffffffff ffffffff ffffffff ................ + 1600 ffffffff ffffffff ffffffff ffffffff ................ + 1610 ffffffff ffffffff ffffffff ffffffff ................ + 1620 ffffffff ffffffff ffffffff ffffffff ................ + 1630 ffffffff ffffffff ffffffff ffffffff ................ + 1640 ffffffff ffffffff ffffffff ffffffff ................ + 1650 ffffffff ffffffff ffffffff ffffffff ................ + 1660 ffffffff ffffffff ffffffff ffffffff ................ + 1670 ffffffff ffffffff ffffffff ffffffff ................ + 1680 ffffffff ffffffff ffffffff ffffffff ................ + 1690 ffffffff ffffffff ffffffff ffffffff ................ + 16a0 ffffffff ffffffff ffffffff ffffffff ................ + 16b0 ffffffff ffffffff ffffffff ffffffff ................ + 16c0 ffffffff ffffffff ffffffff ffffffff ................ + 16d0 ffffffff ffffffff ffffffff ffffffff ................ + 16e0 ffffffff ffffffff ffffffff ffffffff ................ + 16f0 ffffffff ffffffff ffffffff ffffffff ................ + 1700 ffffffff ffffffff ffffffff ffffffff ................ + 1710 ffffffff ffffffff ffffffff ffffffff ................ + 1720 ffffffff ffffffff ffffffff ffffffff ................ + 1730 ffffffff ffffffff ffffffff ffffffff ................ + 1740 ffffffff ffffffff ffffffff ffffffff ................ + 1750 ffffffff ffffffff ffffffff ffffffff ................ + 1760 ffffffff ffffffff ffffffff ffffffff ................ + 1770 ffffffff ffffffff ffffffff ffffffff ................ + 1780 ffffffff ffffffff ffffffff ffffffff ................ + 1790 ffffffff ffffffff ffffffff ffffffff ................ + 17a0 ffffffff ffffffff ffffffff ffffffff ................ + 17b0 ffffffff ffffffff ffffffff ffffffff ................ + 17c0 ffffffff ffffffff ffffffff ffffffff ................ + 17d0 ffffffff ffffffff ffffffff ffffffff ................ + 17e0 ffffffff ffffffff ffffffff ffffffff ................ + 17f0 ffffffff ffffffff ffffffff ffffffff ................ + 1800 41207665 7279206c 6f6e6720 73747269 A very long stri + 1810 6e672066 6f6c6c6f 77656420 62792061 ng followed by a + 1820 20273031 27000000 00000000 00000000 '01'........... + 1830 00000000 00000000 00000000 00000000 ................ + 1840 00000000 00000000 00000000 00000000 ................ + 1850 00000000 00000000 00000000 00000000 ................ + 1860 00000000 00000000 00000000 00000000 ................ + 1870 00000000 00000000 00000000 00000000 ................ + 1880 00000000 00000000 00000000 00000000 ................ + 1890 00000000 00000000 00000000 00000000 ................ + 18a0 00000000 00000000 00000000 00000000 ................ + 18b0 00000000 00000000 00000000 00000000 ................ + 18c0 00000000 00000000 00000000 00000000 ................ + 18d0 00000000 00000000 00000000 00000000 ................ + 18e0 00000000 00000000 00000000 00000000 ................ + 18f0 00000000 00000000 00000000 00000000 ................ + 1900 00000000 00000000 00000000 00000000 ................ + 1910 00000000 00000000 00000000 00000000 ................ + 1920 00000000 00000000 00000000 00000000 ................ + 1930 00000000 00000000 00000000 00000000 ................ + 1940 00000000 00000000 00000000 00000000 ................ + 1950 00000000 00000000 00000000 00000000 ................ + 1960 00000000 00000000 00000000 00000000 ................ + 1970 00000000 00000000 00000000 00000000 ................ + 1980 00000000 00000000 00000000 00000000 ................ + 1990 00000000 00000000 00000000 00000000 ................ + 19a0 00000000 00000000 00000000 00000000 ................ + 19b0 00000000 00000000 00000000 00000000 ................ + 19c0 00000000 00000000 00000000 00000000 ................ + 19d0 00000000 00000000 00000000 00000000 ................ + 19e0 00000000 00000000 00000000 00000000 ................ + 19f0 00000000 00000000 00000000 00000000 ................ + 1a00 01 . +#pass diff --git a/ld/testsuite/ld-scripts/ascii.s b/ld/testsuite/ld-scripts/ascii.s new file mode 100644 index 00000000000..704b492ae61 --- /dev/null +++ b/ld/testsuite/ld-scripts/ascii.s @@ -0,0 +1,9 @@ + .extern ecc_start + .section .text +main: + .long 0x45444F43 + .long ecc_start + .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..14e01ca5c60 --- /dev/null +++ b/ld/testsuite/ld-scripts/ascii.t @@ -0,0 +1,51 @@ +MEMORY { + rom : ORIGIN = 0x000000, LENGTH = 0x400000 + ram : ORIGIN = 0x400000, LENGTH = 0x10000 +} + +_start = 0x000000; +SECTIONS +{ + . = 0x1000 + SIZEOF_HEADERS; + .text ALIGN (0x100) : + + { + INCLUDE "header.inc" + + FILL(0xFF) + entry = .; + *(.text) + . = ALIGN(0x100); + ASCII (128) "This is a string, 128 byte long" +/* ASCII 32,"This is a string" */ + LONG(ecc_start) + . = ALIGN(16); + align_label = .; + ASCIZ "This is an unaligned string" + unalign_label = .; + BYTE(1) + BYTE(2) + BYTE(3) + BYTE(4) + BYTE(4) + BYTE(7) + BYTE(1) + BYTE(1) + . = ALIGN(16); + BYTE(1) + . = ALIGN(16); + ASCII (8) "This is way too long" + . = ALIGN(16); + ASCII (64) "I meant to say: This is way too long" + . = ALIGN(1024); + ASCII (512) "A very long string followed by a '01'" + BYTE(1) + ecc_end = .; + } > rom + + .data : AT (0x400000) { *(.data) } >ram /* NO default AT>rom */ + . = ALIGN(0x20); + .bss : { *(.bss) } >ram /* NO default AT>rom */ + /DISCARD/ : { *(*) } +} + diff --git a/ld/testsuite/ld-scripts/header.inc b/ld/testsuite/ld-scripts/header.inc new file mode 100755 index 00000000000..8376d332226 --- /dev/null +++ b/ld/testsuite/ld-scripts/header.inc @@ -0,0 +1,34 @@ + /* HEADER */ + FILL(0xFF) + QUAD(0xEFBEADDE45444F43); + crc64 = .; + QUAD(0) + ecc_start = .; + /* Program Entry */ + LONG(entry) + + /* Program size */ + LONG(ecc_end - ecc_start) + + /* Time Stamp */ + time_since_epoch = .; + QUAD(0) + + /* 32 bytes here */ + /* Version info */ + BYTE(1) + BYTE(2) + BYTE(3) + BYTE(4) + LONG(0x17) + LONG(0x11470000) + LONG(0xEFBEADDE) + /* 48 bytes here */ + ASCII (16) "program name" + /* 64 bytes here */ + ASCII (64) "empty" + ASCII (32) "comment 1\n" + ASCII (32) "comment 2\n" + ASCII (32) "comment 3\n" + ASCII (24) "comment 4\n" + QUAD(0x45444F43EFBEADDE); -- 2.17.1