public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: binutils@emagii.com
To: binutils@sourceware.org
Cc: nickc@redhat.com, Ulf Samuelsson <ulf@emagii.com>
Subject: [PATCH v6 04/11] DIGEST: testsuite
Date: Wed,  1 Mar 2023 15:47:49 +0100	[thread overview]
Message-ID: <20230301144756.1847278-5-binutils@emagii.com> (raw)
In-Reply-To: <20230301144756.1847278-1-binutils@emagii.com>

From: Ulf Samuelsson <ulf@emagii.com>

Signed-off-by: Ulf Samuelsson <ulf@emagii.com>
---
 ld/testsuite/ld-scripts/begin_tag.inc       |  9 +++++
 ld/testsuite/ld-scripts/crc32-poly.d        | 24 +++++++++++
 ld/testsuite/ld-scripts/crc32-poly.s        | 21 ++++++++++
 ld/testsuite/ld-scripts/crc32-poly.t        | 42 ++++++++++++++++++++
 ld/testsuite/ld-scripts/crc32.d             | 24 +++++++++++
 ld/testsuite/ld-scripts/crc32.s             | 21 ++++++++++
 ld/testsuite/ld-scripts/crc32.t             | 41 +++++++++++++++++++
 ld/testsuite/ld-scripts/crc64-ecma.d        | 24 +++++++++++
 ld/testsuite/ld-scripts/crc64-ecma.s        | 21 ++++++++++
 ld/testsuite/ld-scripts/crc64-ecma.t        | 44 +++++++++++++++++++++
 ld/testsuite/ld-scripts/crc64-iso.d         | 24 +++++++++++
 ld/testsuite/ld-scripts/crc64-iso.s         | 21 ++++++++++
 ld/testsuite/ld-scripts/crc64-iso.t         | 43 ++++++++++++++++++++
 ld/testsuite/ld-scripts/crc64-iso_be.d      | 24 +++++++++++
 ld/testsuite/ld-scripts/crc64-iso_be.s      | 21 ++++++++++
 ld/testsuite/ld-scripts/crc64-iso_be.t      | 43 ++++++++++++++++++++
 ld/testsuite/ld-scripts/crc64-poly.d        | 24 +++++++++++
 ld/testsuite/ld-scripts/crc64-poly.s        | 21 ++++++++++
 ld/testsuite/ld-scripts/crc64-poly.t        | 43 ++++++++++++++++++++
 ld/testsuite/ld-scripts/crc_data.inc        |  9 +++++
 ld/testsuite/ld-scripts/digest_table.inc    |  6 +++
 ld/testsuite/ld-scripts/digest_table_be.inc |  6 +++
 ld/testsuite/ld-scripts/end_tag.inc         |  9 +++++
 ld/testsuite/ld-scripts/script.exp          |  7 ++++
 24 files changed, 572 insertions(+)
 create mode 100644 ld/testsuite/ld-scripts/begin_tag.inc
 create mode 100644 ld/testsuite/ld-scripts/crc32-poly.d
 create mode 100644 ld/testsuite/ld-scripts/crc32-poly.s
 create mode 100644 ld/testsuite/ld-scripts/crc32-poly.t
 create mode 100644 ld/testsuite/ld-scripts/crc32.d
 create mode 100644 ld/testsuite/ld-scripts/crc32.s
 create mode 100644 ld/testsuite/ld-scripts/crc32.t
 create mode 100644 ld/testsuite/ld-scripts/crc64-ecma.d
 create mode 100644 ld/testsuite/ld-scripts/crc64-ecma.s
 create mode 100644 ld/testsuite/ld-scripts/crc64-ecma.t
 create mode 100644 ld/testsuite/ld-scripts/crc64-iso.d
 create mode 100644 ld/testsuite/ld-scripts/crc64-iso.s
 create mode 100644 ld/testsuite/ld-scripts/crc64-iso.t
 create mode 100644 ld/testsuite/ld-scripts/crc64-iso_be.d
 create mode 100644 ld/testsuite/ld-scripts/crc64-iso_be.s
 create mode 100644 ld/testsuite/ld-scripts/crc64-iso_be.t
 create mode 100644 ld/testsuite/ld-scripts/crc64-poly.d
 create mode 100644 ld/testsuite/ld-scripts/crc64-poly.s
 create mode 100644 ld/testsuite/ld-scripts/crc64-poly.t
 create mode 100644 ld/testsuite/ld-scripts/crc_data.inc
 create mode 100644 ld/testsuite/ld-scripts/digest_table.inc
 create mode 100644 ld/testsuite/ld-scripts/digest_table_be.inc
 create mode 100644 ld/testsuite/ld-scripts/end_tag.inc

diff --git a/ld/testsuite/ld-scripts/begin_tag.inc b/ld/testsuite/ld-scripts/begin_tag.inc
new file mode 100644
index 00000000000..ef395bbe717
--- /dev/null
+++ b/ld/testsuite/ld-scripts/begin_tag.inc
@@ -0,0 +1,9 @@
+      BYTE(0x43);
+      BYTE(0x4F);
+      BYTE(0x44);
+      BYTE(0x45);
+      BYTE(0xDE);
+      BYTE(0xAD);
+      BYTE(0xBE);
+      BYTE(0xEF);
+      QUAD(0);
diff --git a/ld/testsuite/ld-scripts/crc32-poly.d b/ld/testsuite/ld-scripts/crc32-poly.d
new file mode 100644
index 00000000000..028ef14460f
--- /dev/null
+++ b/ld/testsuite/ld-scripts/crc32-poly.d
@@ -0,0 +1,24 @@
+#source: crc32-poly.s
+#ld: -T crc32-poly.t
+#objdump: -s -j .text
+#target: [is_elf_format] [is_coff_format]
+#notarget: [is_aout_format]
+#xfail: tic4x-*-* tic54x-*-*
+
+.*:     file format .*
+
+Contents of section .text:
+ 1200 434f4445 deadbeef 00000000 00000000  CODE............
+ 1210 cbf43926 00000000 00000000 00000000  ..9&............
+ 1220 cbf43926 00000000 00000000 00000000  ..9&............
+ 1230 00000000 00000000 deadbeef 434f4445  ............CODE
+ 1240 31323334 35363738 3900ffff ffffffff  123456789.......
+ 1250 434f4445 00000000 00000000 00000000  CODE............
+ 1260 ffffffff ffffffff ffffffff ffffffff  .*
+#...
+ 17e0 434f4445 deadbeef 00000000 00000000  CODE............
+ 17f0 44494745 53542054 41424c45 00000000  DIGEST TABLE....
+#...
+ 1c00 454e4420 5441424c 45000000 00000000  END TABLE.......
+ 1c10 00000000 00000000 deadbeef 434f4445  ............CODE
+#pass
diff --git a/ld/testsuite/ld-scripts/crc32-poly.s b/ld/testsuite/ld-scripts/crc32-poly.s
new file mode 100644
index 00000000000..e4ffb15af62
--- /dev/null
+++ b/ld/testsuite/ld-scripts/crc32-poly.s
@@ -0,0 +1,21 @@
+    .extern ecc_start
+	.section .text
+main:
+	.byte 0x43
+	.byte 0x4F
+	.byte 0x44
+	.byte 0x45
+    .long 0
+    .long 0
+    .long 0
+	.section .data
+    .byte 0xde
+    .byte 0xad
+    .byte 0xde
+    .byte 0xad
+    .byte 0xde
+    .byte 0xad
+    .byte 0xbe
+    .byte 0xef
+	.section .bss
+	.long 0
diff --git a/ld/testsuite/ld-scripts/crc32-poly.t b/ld/testsuite/ld-scripts/crc32-poly.t
new file mode 100644
index 00000000000..15acfa54500
--- /dev/null
+++ b/ld/testsuite/ld-scripts/crc32-poly.t
@@ -0,0 +1,42 @@
+MEMORY {
+  rom : ORIGIN = 0x000000, LENGTH = 0x400000
+  ram : ORIGIN = 0x400000, LENGTH = 0x10000
+}
+
+_start = 0x000000;
+SECTIONS
+{
+  . = 0x1000 + SIZEOF_HEADERS;
+  .text ALIGN (0x200) :
+
+    {
+      FILL(0xFF)
+      header = .;
+      INCLUDE "begin_tag.inc"
+
+      expected = .;
+      BYTE(0xCB);
+      BYTE(0xF4);
+      BYTE(0x39);
+      BYTE(0x26);
+      LONG(0x0);
+      QUAD(0x0);
+
+
+      crc32 = .;
+      DIGEST "_CRC32.BE" POLY(32, 0x04C11DB7, 0xFFFFFFFF,0xFFFFFFFF,1,1,0 )(ecc_start , ecc_end)
+      LONG(0);
+      QUAD(0);
+
+      INCLUDE "end_tag.inc"
+
+      INCLUDE "crc_data.inc"
+
+      INCLUDE "digest_table.inc"
+    } > 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/crc32.d b/ld/testsuite/ld-scripts/crc32.d
new file mode 100644
index 00000000000..c154fb579f4
--- /dev/null
+++ b/ld/testsuite/ld-scripts/crc32.d
@@ -0,0 +1,24 @@
+#source: crc32.s
+#ld: -T crc32.t
+#objdump: -s -j .text
+#target: [is_elf_format] [is_coff_format]
+#notarget: [is_aout_format]
+#xfail: tic4x-*-* tic54x-*-*
+
+.*:     file format .*
+
+Contents of section .text:
+ 1200 434f4445 deadbeef 00000000 00000000  CODE............
+ 1210 cbf43926 00000000 00000000 00000000  ..9&............
+ 1220 cbf43926 00000000 00000000 00000000  ..9&............
+ 1230 00000000 00000000 deadbeef 434f4445  ............CODE
+ 1240 31323334 35363738 3900ffff ffffffff  123456789.......
+ 1250 434f4445 00000000 00000000 00000000  CODE............
+ 1260 ffffffff ffffffff ffffffff ffffffff  .*
+#...
+ 17e0 434f4445 deadbeef 00000000 00000000  CODE............
+ 17f0 44494745 53542054 41424c45 00000000  DIGEST TABLE....
+#...
+ 1c00 454e4420 5441424c 45000000 00000000  END TABLE.......
+ 1c10 00000000 00000000 deadbeef 434f4445  ............CODE
+#pass
diff --git a/ld/testsuite/ld-scripts/crc32.s b/ld/testsuite/ld-scripts/crc32.s
new file mode 100644
index 00000000000..e4ffb15af62
--- /dev/null
+++ b/ld/testsuite/ld-scripts/crc32.s
@@ -0,0 +1,21 @@
+    .extern ecc_start
+	.section .text
+main:
+	.byte 0x43
+	.byte 0x4F
+	.byte 0x44
+	.byte 0x45
+    .long 0
+    .long 0
+    .long 0
+	.section .data
+    .byte 0xde
+    .byte 0xad
+    .byte 0xde
+    .byte 0xad
+    .byte 0xde
+    .byte 0xad
+    .byte 0xbe
+    .byte 0xef
+	.section .bss
+	.long 0
diff --git a/ld/testsuite/ld-scripts/crc32.t b/ld/testsuite/ld-scripts/crc32.t
new file mode 100644
index 00000000000..0320f27356e
--- /dev/null
+++ b/ld/testsuite/ld-scripts/crc32.t
@@ -0,0 +1,41 @@
+MEMORY {
+  rom : ORIGIN = 0x000000, LENGTH = 0x400000
+  ram : ORIGIN = 0x400000, LENGTH = 0x10000
+}
+
+_start = 0x000000;
+SECTIONS
+{
+  . = 0x1000 + SIZEOF_HEADERS;
+  .text ALIGN (0x200) :
+
+    {
+      FILL(0xFF)
+      header = .;
+      INCLUDE "begin_tag.inc"
+
+      expected = .;
+      BYTE(0xCB);
+      BYTE(0xF4);
+      BYTE(0x39);
+      BYTE(0x26);
+      LONG(0x0);
+      QUAD(0x0);
+
+      crc32 = .;
+      DIGEST "_CRC32.BE" "CRC32" (ecc_start , ecc_end);
+      LONG(0);
+      QUAD(0);
+      
+      INCLUDE "end_tag.inc"
+
+      INCLUDE "crc_data.inc"
+
+      INCLUDE "digest_table.inc"
+    } > 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/crc64-ecma.d b/ld/testsuite/ld-scripts/crc64-ecma.d
new file mode 100644
index 00000000000..d30d6a7cd7e
--- /dev/null
+++ b/ld/testsuite/ld-scripts/crc64-ecma.d
@@ -0,0 +1,24 @@
+#source: crc64-ecma.s
+#ld: -T crc64-ecma.t
+#objdump: -s -j .text
+#target: [is_elf_format] [is_coff_format]
+#notarget: [is_aout_format]
+#xfail: tic4x-*-* tic54x-*-*
+
+.*:     file format .*
+
+Contents of section .text:
+ 1200 434f4445 deadbeef 00000000 00000000  CODE............
+ 1210 6c40df5f 0b497347 00000000 00000000  l@._.IsG........
+ 1220 6c40df5f 0b497347 00000000 00000000  l@._.IsG........
+ 1230 00000000 00000000 deadbeef 434f4445  ............CODE
+ 1240 31323334 35363738 3900ffff ffffffff  123456789.......
+ 1250 434f4445 00000000 00000000 00000000  CODE............
+ 1260 ffffffff ffffffff ffffffff ffffffff  .*
+#...
+ 17e0 434f4445 deadbeef 00000000 00000000  CODE............
+ 17f0 44494745 53542054 41424c45 00000000  DIGEST TABLE....
+#...
+ 2000 454e4420 5441424c 45000000 00000000  END TABLE.......
+ 2010 00000000 00000000 deadbeef 434f4445  ............CODE
+#pass
diff --git a/ld/testsuite/ld-scripts/crc64-ecma.s b/ld/testsuite/ld-scripts/crc64-ecma.s
new file mode 100644
index 00000000000..e4ffb15af62
--- /dev/null
+++ b/ld/testsuite/ld-scripts/crc64-ecma.s
@@ -0,0 +1,21 @@
+    .extern ecc_start
+	.section .text
+main:
+	.byte 0x43
+	.byte 0x4F
+	.byte 0x44
+	.byte 0x45
+    .long 0
+    .long 0
+    .long 0
+	.section .data
+    .byte 0xde
+    .byte 0xad
+    .byte 0xde
+    .byte 0xad
+    .byte 0xde
+    .byte 0xad
+    .byte 0xbe
+    .byte 0xef
+	.section .bss
+	.long 0
diff --git a/ld/testsuite/ld-scripts/crc64-ecma.t b/ld/testsuite/ld-scripts/crc64-ecma.t
new file mode 100644
index 00000000000..5d63e2000ba
--- /dev/null
+++ b/ld/testsuite/ld-scripts/crc64-ecma.t
@@ -0,0 +1,44 @@
+MEMORY {
+  rom : ORIGIN = 0x000000, LENGTH = 0x400000
+  ram : ORIGIN = 0x400000, LENGTH = 0x10000
+}
+
+_start = 0x000000;
+SECTIONS
+{
+  . = 0x1000 + SIZEOF_HEADERS;
+  .text ALIGN (0x200) :
+
+    {
+      FILL(0xFF)
+      header = .;
+      INCLUDE "begin_tag.inc"
+
+      expected = .;
+      BYTE(0x6C);
+      BYTE(0x40);
+      BYTE(0xDF);
+      BYTE(0x5F);
+      BYTE(0x0B);
+      BYTE(0x49);
+      BYTE(0x73);
+      BYTE(0x47);
+
+      QUAD(0x0);
+
+      crc64 = .;
+      DIGEST "_CRC64.BE" "CRC64-ECMA" (ecc_start , ecc_end);
+      QUAD(0x0);
+
+      INCLUDE "end_tag.inc"
+
+      INCLUDE "crc_data.inc"
+
+      INCLUDE "digest_table.inc"
+    } > 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/crc64-iso.d b/ld/testsuite/ld-scripts/crc64-iso.d
new file mode 100644
index 00000000000..12b9d319a61
--- /dev/null
+++ b/ld/testsuite/ld-scripts/crc64-iso.d
@@ -0,0 +1,24 @@
+#source: crc64-iso.s
+#ld: -T crc64-iso.t
+#objdump: -s -j .text
+#target: [is_elf_format] [is_coff_format]
+#notarget: [is_aout_format]
+#xfail: tic4x-*-* tic54x-*-*
+
+.*:     file format .*
+
+Contents of section .text:
+ 1200 434f4445 deadbeef 00000000 00000000  CODE............
+ 1210 b90956c7 75a41001 00000000 00000000  ..V.u...........
+ 1220 b90956c7 75a41001 00000000 00000000  ..V.u...........
+ 1230 00000000 00000000 deadbeef 434f4445  ............CODE
+ 1240 31323334 35363738 3900ffff ffffffff  123456789.......
+ 1250 434f4445 00000000 00000000 00000000  CODE............
+ 1260 ffffffff ffffffff ffffffff ffffffff  .*
+#...
+ 17e0 434f4445 deadbeef 00000000 00000000  CODE............
+ 17f0 44494745 53542054 41424c45 00000000  DIGEST TABLE....
+#...
+ 2000 454e4420 5441424c 45000000 00000000  END TABLE.......
+ 2010 00000000 00000000 deadbeef 434f4445  ............CODE
+#pass
diff --git a/ld/testsuite/ld-scripts/crc64-iso.s b/ld/testsuite/ld-scripts/crc64-iso.s
new file mode 100644
index 00000000000..e4ffb15af62
--- /dev/null
+++ b/ld/testsuite/ld-scripts/crc64-iso.s
@@ -0,0 +1,21 @@
+    .extern ecc_start
+	.section .text
+main:
+	.byte 0x43
+	.byte 0x4F
+	.byte 0x44
+	.byte 0x45
+    .long 0
+    .long 0
+    .long 0
+	.section .data
+    .byte 0xde
+    .byte 0xad
+    .byte 0xde
+    .byte 0xad
+    .byte 0xde
+    .byte 0xad
+    .byte 0xbe
+    .byte 0xef
+	.section .bss
+	.long 0
diff --git a/ld/testsuite/ld-scripts/crc64-iso.t b/ld/testsuite/ld-scripts/crc64-iso.t
new file mode 100644
index 00000000000..18f0a2ce34b
--- /dev/null
+++ b/ld/testsuite/ld-scripts/crc64-iso.t
@@ -0,0 +1,43 @@
+MEMORY {
+  rom : ORIGIN = 0x000000, LENGTH = 0x400000
+  ram : ORIGIN = 0x400000, LENGTH = 0x10000
+}
+
+_start = 0x000000;
+SECTIONS
+{
+  . = 0x1000 + SIZEOF_HEADERS;
+  .text ALIGN (0x200) :
+
+    {
+      FILL(0xFF)
+      header = .;
+      INCLUDE "begin_tag.inc"
+
+      expected = .;
+      BYTE(0xb9);
+      BYTE(0x09);
+      BYTE(0x56);
+      BYTE(0xc7);
+      BYTE(0x75);
+      BYTE(0xa4);
+      BYTE(0x10);
+      BYTE(0x01);
+      QUAD(0x0);
+
+      crc64 = .;
+      DIGEST "_CRC64.BE" "CRC64-GO-ISO" (ecc_start , ecc_end)
+      QUAD(0x0);
+
+      INCLUDE "end_tag.inc"
+
+      INCLUDE "crc_data.inc"
+
+      INCLUDE "digest_table.inc"
+    } > 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/crc64-iso_be.d b/ld/testsuite/ld-scripts/crc64-iso_be.d
new file mode 100644
index 00000000000..131116d4305
--- /dev/null
+++ b/ld/testsuite/ld-scripts/crc64-iso_be.d
@@ -0,0 +1,24 @@
+#source: crc64-iso_be.s
+#ld: -T crc64-iso_be.t
+#objdump: -s -j .text
+#target: [is_elf_format] [is_coff_format]
+#notarget: [is_aout_format]
+#xfail: tic4x-*-* tic54x-*-*
+
+.*:     file format .*
+
+Contents of section .text:
+ 1200 434f4445 deadbeef 00000000 00000000  CODE............
+ 1210 0110a475 c75609b9 00000000 00000000  ...u.V..........
+ 1220 0110a475 c75609b9 00000000 00000000  ...u.V..........
+ 1230 00000000 00000000 deadbeef 434f4445  ............CODE
+ 1240 31323334 35363738 3900ffff ffffffff  123456789.......
+ 1250 434f4445 00000000 00000000 00000000  CODE............
+ 1260 ffffffff ffffffff ffffffff ffffffff  .*
+#...
+ 17e0 434f4445 deadbeef 00000000 00000000  CODE............
+ 17f0 44494745 53542054 41424c45 00000000  DIGEST TABLE....
+#...
+ 2000 454e4420 5441424c 45000000 00000000  END TABLE.......
+ 2010 00000000 00000000 deadbeef 434f4445  ............CODE
+#pass
diff --git a/ld/testsuite/ld-scripts/crc64-iso_be.s b/ld/testsuite/ld-scripts/crc64-iso_be.s
new file mode 100644
index 00000000000..e4ffb15af62
--- /dev/null
+++ b/ld/testsuite/ld-scripts/crc64-iso_be.s
@@ -0,0 +1,21 @@
+    .extern ecc_start
+	.section .text
+main:
+	.byte 0x43
+	.byte 0x4F
+	.byte 0x44
+	.byte 0x45
+    .long 0
+    .long 0
+    .long 0
+	.section .data
+    .byte 0xde
+    .byte 0xad
+    .byte 0xde
+    .byte 0xad
+    .byte 0xde
+    .byte 0xad
+    .byte 0xbe
+    .byte 0xef
+	.section .bss
+	.long 0
diff --git a/ld/testsuite/ld-scripts/crc64-iso_be.t b/ld/testsuite/ld-scripts/crc64-iso_be.t
new file mode 100644
index 00000000000..5893b0f6948
--- /dev/null
+++ b/ld/testsuite/ld-scripts/crc64-iso_be.t
@@ -0,0 +1,43 @@
+MEMORY {
+  rom : ORIGIN = 0x000000, LENGTH = 0x400000
+  ram : ORIGIN = 0x400000, LENGTH = 0x10000
+}
+
+_start = 0x000000;
+SECTIONS
+{
+  . = 0x1000 + SIZEOF_HEADERS;
+  .text ALIGN (0x200) :
+
+    {
+      FILL(0xFF)
+      header = .;
+      INCLUDE "begin_tag.inc"
+
+      expected = .;
+      BYTE(0x01);
+      BYTE(0x10);
+      BYTE(0xa4);
+      BYTE(0x75);
+      BYTE(0xc7);
+      BYTE(0x56);
+      BYTE(0x09);
+      BYTE(0xb9);
+      QUAD(0x0);
+
+      crc64 = .;
+      DIGEST "_CRC64" "CRC64-GO-ISO" (ecc_start , ecc_end)
+      QUAD(0x0);
+
+      INCLUDE "end_tag.inc"
+
+      INCLUDE "crc_data.inc"
+
+      INCLUDE "digest_table_be.inc"
+    } > 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/crc64-poly.d b/ld/testsuite/ld-scripts/crc64-poly.d
new file mode 100644
index 00000000000..d683d8b0058
--- /dev/null
+++ b/ld/testsuite/ld-scripts/crc64-poly.d
@@ -0,0 +1,24 @@
+#source: crc64-poly.s
+#ld: -T crc64-poly.t
+#objdump: -s -j .text
+#target: [is_elf_format] [is_coff_format]
+#notarget: [is_aout_format]
+#xfail: tic4x-*-* tic54x-*-*
+
+.*:     file format .*
+
+Contents of section .text:
+ 1200 434f4445 deadbeef 00000000 00000000  CODE............
+ 1210 6c40df5f 0b497347 00000000 00000000  l@._.IsG........
+ 1220 6c40df5f 0b497347 00000000 00000000  l@._.IsG........
+ 1230 00000000 00000000 deadbeef 434f4445  ............CODE
+ 1240 31323334 35363738 3900ffff ffffffff  123456789.......
+ 1250 434f4445 00000000 00000000 00000000  CODE............
+ 1260 ffffffff ffffffff ffffffff ffffffff  .*
+#...
+ 17e0 434f4445 deadbeef 00000000 00000000  CODE............
+ 17f0 44494745 53542054 41424c45 00000000  DIGEST TABLE....
+#...
+ 2000 454e4420 5441424c 45000000 00000000  END TABLE.......
+ 2010 00000000 00000000 deadbeef 434f4445  ............CODE
+#pass
diff --git a/ld/testsuite/ld-scripts/crc64-poly.s b/ld/testsuite/ld-scripts/crc64-poly.s
new file mode 100644
index 00000000000..e4ffb15af62
--- /dev/null
+++ b/ld/testsuite/ld-scripts/crc64-poly.s
@@ -0,0 +1,21 @@
+    .extern ecc_start
+	.section .text
+main:
+	.byte 0x43
+	.byte 0x4F
+	.byte 0x44
+	.byte 0x45
+    .long 0
+    .long 0
+    .long 0
+	.section .data
+    .byte 0xde
+    .byte 0xad
+    .byte 0xde
+    .byte 0xad
+    .byte 0xde
+    .byte 0xad
+    .byte 0xbe
+    .byte 0xef
+	.section .bss
+	.long 0
diff --git a/ld/testsuite/ld-scripts/crc64-poly.t b/ld/testsuite/ld-scripts/crc64-poly.t
new file mode 100644
index 00000000000..6519b71c684
--- /dev/null
+++ b/ld/testsuite/ld-scripts/crc64-poly.t
@@ -0,0 +1,43 @@
+MEMORY {
+  rom : ORIGIN = 0x000000, LENGTH = 0x400000
+  ram : ORIGIN = 0x400000, LENGTH = 0x10000
+}
+
+_start = 0x000000;
+SECTIONS
+{
+  . = 0x1000 + SIZEOF_HEADERS;
+  .text ALIGN (0x200) :
+
+    {
+      FILL(0xFF)
+      header = .;
+      INCLUDE "begin_tag.inc"
+
+      expected = .;
+      BYTE(0x6C);
+      BYTE(0x40);
+      BYTE(0xDF);
+      BYTE(0x5F);
+      BYTE(0x0B);
+      BYTE(0x49);
+      BYTE(0x73);
+      BYTE(0x47);
+      QUAD(0x0);
+
+      crc64 = .;
+      DIGEST "_CRC64.BE" POLY(64,0x42F0E1EBA9EA3693,0,0,0,0,0)(ecc_start , ecc_end)
+      QUAD(0x0);
+
+      INCLUDE "end_tag.inc"
+
+      INCLUDE "crc_data.inc"
+
+      INCLUDE "digest_table.inc"
+    } > 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/crc_data.inc b/ld/testsuite/ld-scripts/crc_data.inc
new file mode 100644
index 00000000000..176a4689493
--- /dev/null
+++ b/ld/testsuite/ld-scripts/crc_data.inc
@@ -0,0 +1,9 @@
+      ecc_start = .;
+      ASCIZ "123456789"
+      ecc_end = . - 1;
+      . = ALIGN(0x10);
+
+      entry = .;
+      *(.text)
+      . = ALIGN(0x100);
+      BYTE(1);
diff --git a/ld/testsuite/ld-scripts/digest_table.inc b/ld/testsuite/ld-scripts/digest_table.inc
new file mode 100644
index 00000000000..fb40a4fa024
--- /dev/null
+++ b/ld/testsuite/ld-scripts/digest_table.inc
@@ -0,0 +1,6 @@
+      . = ALIGN(2048) - 32;
+      INCLUDE "begin_tag.inc"
+      ASCII (16) "DIGEST TABLE"
+      DIGEST TABLE "CRCTAB"
+      ASCII (16) "END TABLE"
+      INCLUDE "end_tag.inc"
diff --git a/ld/testsuite/ld-scripts/digest_table_be.inc b/ld/testsuite/ld-scripts/digest_table_be.inc
new file mode 100644
index 00000000000..eec712d9eff
--- /dev/null
+++ b/ld/testsuite/ld-scripts/digest_table_be.inc
@@ -0,0 +1,6 @@
+      . = ALIGN(2048) - 32;
+      INCLUDE "begin_tag.inc"
+      ASCII (16) "DIGEST TABLE"
+      DIGEST TABLE "CRCTAB.BE"
+      ASCII (16) "END TABLE"
+      INCLUDE "end_tag.inc"
diff --git a/ld/testsuite/ld-scripts/end_tag.inc b/ld/testsuite/ld-scripts/end_tag.inc
new file mode 100644
index 00000000000..4c80854b062
--- /dev/null
+++ b/ld/testsuite/ld-scripts/end_tag.inc
@@ -0,0 +1,9 @@
+      QUAD(0);
+      BYTE(0xDE);
+      BYTE(0xAD);
+      BYTE(0xBE);
+      BYTE(0xEF);
+      BYTE(0x43);
+      BYTE(0x4F);
+      BYTE(0x44);
+      BYTE(0x45);
diff --git a/ld/testsuite/ld-scripts/script.exp b/ld/testsuite/ld-scripts/script.exp
index 56e12da8e61..38cb0f9fe66 100644
--- a/ld/testsuite/ld-scripts/script.exp
+++ b/ld/testsuite/ld-scripts/script.exp
@@ -229,6 +229,13 @@ foreach test_script $test_script_list {
 
 run_dump_test "asciz"
 run_dump_test "ascii"
+run_dump_test "crc64-ecma"
+run_dump_test "crc64-iso"
+run_dump_test "crc64-iso_be"
+run_dump_test "crc64-poly"
+run_dump_test "crc32"
+run_dump_test "crc32-poly"
+
 run_dump_test "align-with-input"
 run_dump_test "pr20302"
 run_dump_test "output-section-types"
-- 
2.34.1


  parent reply	other threads:[~2023-03-01 14:48 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-01 14:47 [PATCH v6 0/11 Add support for CRC64 generation in linker binutils
2023-03-01 14:47 ` [PATCH v6 01/11] DIGEST: LICENSING binutils
2023-03-01 15:04   ` Nick Clifton
2023-03-01 15:30     ` Ulf Samuelsson
2023-03-01 17:15       ` Nick Clifton
2023-03-01 17:19         ` Ian Lance Taylor
2023-03-01 14:47 ` [PATCH v6 02/11] DIGEST: NEWS binutils
2023-03-01 14:57   ` Ulf Samuelsson
2023-03-01 14:47 ` [PATCH v6 03/11] DIGEST: Documentation binutils
2023-03-01 14:47 ` binutils [this message]
2023-03-01 16:48   ` [PATCH v6 04/11] DIGEST: testsuite Nick Clifton
2023-03-01 17:33     ` Ulf Samuelsson
2023-03-01 14:47 ` [PATCH v6 05/11] DIGEST: ldlex.l binutils
2023-03-01 14:47 ` [PATCH v6 06/11] DIGEST: ldgram.y binutils
2023-03-01 14:47 ` [PATCH v6 07/11] DIGEST: ldmain.c binutils
2023-03-01 14:47 ` [PATCH v6 08/11] DIGEST: ldlang.*: add timestamp binutils
2023-03-01 14:47 ` [PATCH v6 09/11] DIGEST: calculation binutils
2023-03-01 14:47 ` [PATCH v6 10/11] DIGEST: Makefile.* binutils
2023-03-01 14:47 ` [PATCH v6 11/11] Build ldint binutils
2023-03-01 14:53 ` [PATCH v6 0/11 Add support for CRC64 generation in linker Ulf Samuelsson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230301144756.1847278-5-binutils@emagii.com \
    --to=binutils@emagii.com \
    --cc=binutils@sourceware.org \
    --cc=nickc@redhat.com \
    --cc=ulf@emagii.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).