[v3,5/7] Add testsuite for ASCII command

Message ID 20240708150422.4926-6-binutils@emagii.com
State New
Headers
Series ASCII output section command |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_binutils_build--master-arm success Build passed
linaro-tcwg-bot/tcwg_binutils_build--master-aarch64 success Build passed
linaro-tcwg-bot/tcwg_binutils_check--master-aarch64 success Test passed
linaro-tcwg-bot/tcwg_binutils_check--master-arm success Test passed

Commit Message

Ulf Samuelsson July 8, 2024, 3:04 p.m. UTC
  From: Ulf Samuelsson <ulf@emagii.com>

Signed-off-by: Ulf Samuelsson <ulf@emagii.com>
---
 ld/testsuite/ld-scripts/ascii.d    | 25 ++++++++++++++++++++
 ld/testsuite/ld-scripts/ascii.s    | 11 +++++++++
 ld/testsuite/ld-scripts/ascii.t    | 38 ++++++++++++++++++++++++++++++
 ld/testsuite/ld-scripts/script.exp |  1 +
 4 files changed, 75 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
  

Comments

Jens Remus July 8, 2024, 4:23 p.m. UTC | #1
Am 08.07.2024 um 17:04 schrieb binutils@emagii.com:
> From: Ulf Samuelsson <ulf@emagii.com>
> 
> Signed-off-by: Ulf Samuelsson <ulf@emagii.com>
> ---
>   ld/testsuite/ld-scripts/ascii.d    | 25 ++++++++++++++++++++
>   ld/testsuite/ld-scripts/ascii.s    | 11 +++++++++
>   ld/testsuite/ld-scripts/ascii.t    | 38 ++++++++++++++++++++++++++++++
>   ld/testsuite/ld-scripts/script.exp |  1 +
>   4 files changed, 75 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.s b/ld/testsuite/ld-scripts/ascii.s
> new file mode 100644
> index 00000000000..a1b6148dc79
> --- /dev/null
> +++ b/ld/testsuite/ld-scripts/ascii.s
> @@ -0,0 +1,11 @@
> +        .extern ecc_start

Nit: Use a tab instead of the 8 spaces for indentation.

> +	.section .text
> +main:
> +	.long 0x45444F43
> +	.long 0x12345678
> +	
> +	.section .data
> +	.long 0x9abcdef0
> +	
> +	.section .bss
> +	.long 0

...

Regards,
Jens
  

Patch

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..a1b6148dc79
--- /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..dd7249ff8a2
--- /dev/null
+++ b/ld/testsuite/ld-scripts/ascii.t
@@ -0,0 +1,38 @@ 
+_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"