diff --git a/ld/testsuite/ld-scripts/begin_tag.inc b/ld/testsuite/ld-scripts/begin_tag.inc
new file mode 100644
index 0000000000000000000000000000000000000000..ef395bbe7176b37f0209c25c9d0fcee5d3b1ec4a
--- /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 0000000000000000000000000000000000000000..726534d32d9f85377dc9584caa9aac8a916a68aa
--- /dev/null
+++ b/ld/testsuite/ld-scripts/crc32-poly.d
@@ -0,0 +1,26 @@
+#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-*-*
+#skip: ns32k-pc532-macho, pdp11-dec-aout, powerpc-ibm-aix5.2.0
+#skip: rs6000-aix4.3.3, alpha-linuxecoff
+
+.*:     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 0000000000000000000000000000000000000000..e4ffb15af62643be3ae9d0f7ac1c721708baee47
--- /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 0000000000000000000000000000000000000000..a2b7d130ba7051f96a45b2b35c08c068db41e60a
--- /dev/null
+++ b/ld/testsuite/ld-scripts/crc32-poly.t
@@ -0,0 +1,42 @@
+MEMORY {
+  rom : ORIGIN = 0x000000, LENGTH = 0x4000
+  ram : ORIGIN = 0x008000, LENGTH = 0x1000
+}
+
+_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 (0x008000) { *(.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 0000000000000000000000000000000000000000..e35eaf8e53ecd07fcb1f8adaf03b87bf7aed3282
--- /dev/null
+++ b/ld/testsuite/ld-scripts/crc32.d
@@ -0,0 +1,26 @@
+#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-*-*
+#skip: ns32k-pc532-macho, pdp11-dec-aout, powerpc-ibm-aix5.2.0
+#skip: rs6000-aix4.3.3, alpha-linuxecoff
+
+.*:     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 0000000000000000000000000000000000000000..e4ffb15af62643be3ae9d0f7ac1c721708baee47
--- /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 0000000000000000000000000000000000000000..b218ef1424f16142f6879a528f0032d28fdba8c4
--- /dev/null
+++ b/ld/testsuite/ld-scripts/crc32.t
@@ -0,0 +1,41 @@
+MEMORY {
+  rom : ORIGIN = 0x000000, LENGTH = 0x4000
+  ram : ORIGIN = 0x008000, LENGTH = 0x1000
+}
+
+_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 (0x008000) { *(.data) } >ram /* NO default AT>rom */
+  . = ALIGN(0x20);
+  .bss : { *(.bss) } >ram /* NO default AT>rom */
+  /DISCARD/ : { *(*) }
+}
diff --git a/ld/testsuite/ld-scripts/crc64-bad-endian-contents.d b/ld/testsuite/ld-scripts/crc64-bad-endian-contents.d
new file mode 100644
index 0000000000000000000000000000000000000000..09df3cb2bbfab88cc78e5a1dc9c97d35a6dc11bd
--- /dev/null
+++ b/ld/testsuite/ld-scripts/crc64-bad-endian-contents.d
@@ -0,0 +1,6 @@
+#source: crc64-bad-endian-size.s
+#ld: -T crc64-bad-endian-size.t
+# error: .*: bad 'endian' .* in digest label.*
+#skip: tic4x-coff, tic54x-cof
+#skip: ns32k-pc532-macho, pdp11-dec-aout, powerpc-ibm-aix5.2.0
+#skip: rs6000-aix4.3.3, alpha-linuxecoff
diff --git a/ld/testsuite/ld-scripts/crc64-bad-endian-contents.s b/ld/testsuite/ld-scripts/crc64-bad-endian-contents.s
new file mode 100644
index 0000000000000000000000000000000000000000..e4ffb15af62643be3ae9d0f7ac1c721708baee47
--- /dev/null
+++ b/ld/testsuite/ld-scripts/crc64-bad-endian-contents.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-bad-endian-contents.t b/ld/testsuite/ld-scripts/crc64-bad-endian-contents.t
new file mode 100644
index 0000000000000000000000000000000000000000..8eecaf06dc895977ee4ffadbdb1309bb64fc3349
--- /dev/null
+++ b/ld/testsuite/ld-scripts/crc64-bad-endian-contents.t
@@ -0,0 +1,44 @@
+MEMORY {
+  rom : ORIGIN = 0x000000, LENGTH = 0x4000
+  ram : ORIGIN = 0x008000, LENGTH = 0x1000
+}
+
+_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#NE" "CRC64-ECMA" (ecc_start , ecc_end);
+      QUAD(0x0);
+
+      INCLUDE "end_tag.inc"
+
+      INCLUDE "crc_data.inc"
+
+      INCLUDE "digest_table.inc"
+    } > rom
+
+  .data : AT (0x008000) { *(.data) } >ram /* NO default AT>rom */
+  . = ALIGN(0x20);
+  .bss : { *(.bss) } >ram /* NO default AT>rom */
+  /DISCARD/ : { *(*) }
+}
diff --git a/ld/testsuite/ld-scripts/crc64-bad-endian-size.d b/ld/testsuite/ld-scripts/crc64-bad-endian-size.d
new file mode 100644
index 0000000000000000000000000000000000000000..09df3cb2bbfab88cc78e5a1dc9c97d35a6dc11bd
--- /dev/null
+++ b/ld/testsuite/ld-scripts/crc64-bad-endian-size.d
@@ -0,0 +1,6 @@
+#source: crc64-bad-endian-size.s
+#ld: -T crc64-bad-endian-size.t
+# error: .*: bad 'endian' .* in digest label.*
+#skip: tic4x-coff, tic54x-cof
+#skip: ns32k-pc532-macho, pdp11-dec-aout, powerpc-ibm-aix5.2.0
+#skip: rs6000-aix4.3.3, alpha-linuxecoff
diff --git a/ld/testsuite/ld-scripts/crc64-bad-endian-size.s b/ld/testsuite/ld-scripts/crc64-bad-endian-size.s
new file mode 100644
index 0000000000000000000000000000000000000000..e4ffb15af62643be3ae9d0f7ac1c721708baee47
--- /dev/null
+++ b/ld/testsuite/ld-scripts/crc64-bad-endian-size.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-bad-endian-size.t b/ld/testsuite/ld-scripts/crc64-bad-endian-size.t
new file mode 100644
index 0000000000000000000000000000000000000000..8f9cd6007739e0e5e42113b7b97672ca39b4b329
--- /dev/null
+++ b/ld/testsuite/ld-scripts/crc64-bad-endian-size.t
@@ -0,0 +1,44 @@
+MEMORY {
+  rom : ORIGIN = 0x000000, LENGTH = 0x4000
+  ram : ORIGIN = 0x008000, LENGTH = 0x1000
+}
+
+_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#BEG" "CRC64-ECMA" (ecc_start , ecc_end);
+      QUAD(0x0);
+
+      INCLUDE "end_tag.inc"
+
+      INCLUDE "crc_data.inc"
+
+      INCLUDE "digest_table.inc"
+    } > rom
+
+  .data : AT (0x008000) { *(.data) } >ram /* NO default AT>rom */
+  . = ALIGN(0x20);
+  .bss : { *(.bss) } >ram /* NO default AT>rom */
+  /DISCARD/ : { *(*) }
+}
diff --git a/ld/testsuite/ld-scripts/crc64-bad-label-2.d b/ld/testsuite/ld-scripts/crc64-bad-label-2.d
new file mode 100644
index 0000000000000000000000000000000000000000..8e9d1604470d7042c7e71cc74a32e632718467f1
--- /dev/null
+++ b/ld/testsuite/ld-scripts/crc64-bad-label-2.d
@@ -0,0 +1,6 @@
+#source: crc64-bad-label-2.s
+#ld: -T crc64-bad-label-2.t
+# error: .*: Illegal label .* in digest command.*
+#skip: tic4x-coff, tic54x-cof
+#skip: ns32k-pc532-macho, pdp11-dec-aout, powerpc-ibm-aix5.2.0
+#skip: rs6000-aix4.3.3, alpha-linuxecoff
diff --git a/ld/testsuite/ld-scripts/crc64-bad-label-2.s b/ld/testsuite/ld-scripts/crc64-bad-label-2.s
new file mode 100644
index 0000000000000000000000000000000000000000..e4ffb15af62643be3ae9d0f7ac1c721708baee47
--- /dev/null
+++ b/ld/testsuite/ld-scripts/crc64-bad-label-2.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-bad-label-2.t b/ld/testsuite/ld-scripts/crc64-bad-label-2.t
new file mode 100644
index 0000000000000000000000000000000000000000..19782bf827de84813f195ec364aba90377c131bf
--- /dev/null
+++ b/ld/testsuite/ld-scripts/crc64-bad-label-2.t
@@ -0,0 +1,44 @@
+MEMORY {
+  rom : ORIGIN = 0x000000, LENGTH = 0x4000
+  ram : ORIGIN = 0x008000, LENGTH = 0x1000
+}
+
+_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 "_CRC^64#BE" "CRC64-ECMA" (ecc_start , ecc_end);
+      QUAD(0x0);
+
+      INCLUDE "end_tag.inc"
+
+      INCLUDE "crc_data.inc"
+
+      INCLUDE "digest_table.inc"
+    } > rom
+
+  .data : AT (0x008000) { *(.data) } >ram /* NO default AT>rom */
+  . = ALIGN(0x20);
+  .bss : { *(.bss) } >ram /* NO default AT>rom */
+  /DISCARD/ : { *(*) }
+}
diff --git a/ld/testsuite/ld-scripts/crc64-bad-label.d b/ld/testsuite/ld-scripts/crc64-bad-label.d
new file mode 100644
index 0000000000000000000000000000000000000000..9215a10fc8f32a7ad11cf14aaf6612dde2e1cbc6
--- /dev/null
+++ b/ld/testsuite/ld-scripts/crc64-bad-label.d
@@ -0,0 +1,6 @@
+#source: crc64-bad-label.s
+#ld: -T crc64-bad-label.t
+# error: .*: Illegal label .* in digest command.*
+#skip: tic4x-coff, tic54x-cof
+#skip: ns32k-pc532-macho, pdp11-dec-aout, powerpc-ibm-aix5.2.0
+#skip: rs6000-aix4.3.3, alpha-linuxecoff
diff --git a/ld/testsuite/ld-scripts/crc64-bad-label.s b/ld/testsuite/ld-scripts/crc64-bad-label.s
new file mode 100644
index 0000000000000000000000000000000000000000..e4ffb15af62643be3ae9d0f7ac1c721708baee47
--- /dev/null
+++ b/ld/testsuite/ld-scripts/crc64-bad-label.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-bad-label.t b/ld/testsuite/ld-scripts/crc64-bad-label.t
new file mode 100644
index 0000000000000000000000000000000000000000..8c0941c674b5fca2c1ad730e6a57daab9752bd13
--- /dev/null
+++ b/ld/testsuite/ld-scripts/crc64-bad-label.t
@@ -0,0 +1,44 @@
+MEMORY {
+  rom : ORIGIN = 0x000000, LENGTH = 0x4000
+  ram : ORIGIN = 0x008000, LENGTH = 0x1000
+}
+
+_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 "0_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 (0x008000) { *(.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 0000000000000000000000000000000000000000..06b0476e627ccfa1c11bbccee7cf46728d9e085c
--- /dev/null
+++ b/ld/testsuite/ld-scripts/crc64-ecma.d
@@ -0,0 +1,26 @@
+#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-*-*
+#skip: ns32k-pc532-macho, pdp11-dec-aout, powerpc-ibm-aix5.2.0
+#skip: rs6000-aix4.3.3, alpha-linuxecoff
+
+.*:     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 0000000000000000000000000000000000000000..e4ffb15af62643be3ae9d0f7ac1c721708baee47
--- /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 0000000000000000000000000000000000000000..2a82039a93ebf8749b44a024a79984709b2dab9d
--- /dev/null
+++ b/ld/testsuite/ld-scripts/crc64-ecma.t
@@ -0,0 +1,44 @@
+MEMORY {
+  rom : ORIGIN = 0x000000, LENGTH = 0x4000
+  ram : ORIGIN = 0x008000, LENGTH = 0x1000
+}
+
+_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 (0x008000) { *(.data) } >ram /* NO default AT>rom */
+  . = ALIGN(0x20);
+  .bss : { *(.bss) } >ram /* NO default AT>rom */
+  /DISCARD/ : { *(*) }
+}
diff --git a/ld/testsuite/ld-scripts/crc64-in-section.d b/ld/testsuite/ld-scripts/crc64-in-section.d
new file mode 100644
index 0000000000000000000000000000000000000000..6f9d678b7fc6dd7a34ee28aad948b831367229a3
--- /dev/null
+++ b/ld/testsuite/ld-scripts/crc64-in-section.d
@@ -0,0 +1,6 @@
+#source: crc64-in-section.s
+#ld: -T crc64-in-section.t
+#error: .*: CRC located inside checked area
+#skip: tic4x-coff, tic54x-cof
+#skip: ns32k-pc532-macho, pdp11-dec-aout, powerpc-ibm-aix5.2.0
+#skip: rs6000-aix4.3.3, alpha-linuxecoff
diff --git a/ld/testsuite/ld-scripts/crc64-in-section.s b/ld/testsuite/ld-scripts/crc64-in-section.s
new file mode 100644
index 0000000000000000000000000000000000000000..e4ffb15af62643be3ae9d0f7ac1c721708baee47
--- /dev/null
+++ b/ld/testsuite/ld-scripts/crc64-in-section.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-in-section.t b/ld/testsuite/ld-scripts/crc64-in-section.t
new file mode 100644
index 0000000000000000000000000000000000000000..e2e8cd99e8b74aff3adfb42e3a8a563be65aa32c
--- /dev/null
+++ b/ld/testsuite/ld-scripts/crc64-in-section.t
@@ -0,0 +1,45 @@
+MEMORY {
+  rom : ORIGIN = 0x000000, LENGTH = 0x4000
+  ram : ORIGIN = 0x008000, LENGTH = 0x1000
+}
+
+_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 = .;
+      bad_start = .;
+      DIGEST "_CRC64#BE" "CRC64-ECMA" (bad_start , ecc_end);
+      QUAD(0x0);
+
+      INCLUDE "end_tag.inc"
+
+      INCLUDE "crc_data.inc"
+
+      INCLUDE "digest_table.inc"
+    } > rom
+
+  .data : AT (0x008000) { *(.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 0000000000000000000000000000000000000000..11f85c18adf6764b750d120d24b5d97c2174f3f7
--- /dev/null
+++ b/ld/testsuite/ld-scripts/crc64-iso.d
@@ -0,0 +1,26 @@
+#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-*-*
+#skip: ns32k-pc532-macho, pdp11-dec-aout, powerpc-ibm-aix5.2.0
+#skip: rs6000-aix4.3.3, alpha-linuxecoff
+
+.*:     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 0000000000000000000000000000000000000000..e4ffb15af62643be3ae9d0f7ac1c721708baee47
--- /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 0000000000000000000000000000000000000000..20dedc47d12171d325fe08319566e7ff130dc3f3
--- /dev/null
+++ b/ld/testsuite/ld-scripts/crc64-iso.t
@@ -0,0 +1,43 @@
+MEMORY {
+  rom : ORIGIN = 0x000000, LENGTH = 0x4000
+  ram : ORIGIN = 0x008000, LENGTH = 0x1000
+}
+
+_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 (0x008000) { *(.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 0000000000000000000000000000000000000000..e256b414c5d123cc4c36bec8c2f5db9e2fdc597f
--- /dev/null
+++ b/ld/testsuite/ld-scripts/crc64-iso_be.d
@@ -0,0 +1,26 @@
+#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-*-*
+#skip: ns32k-pc532-macho, pdp11-dec-aout, powerpc-ibm-aix5.2.0
+#skip: rs6000-aix4.3.3, alpha-linuxecoff
+
+.*:     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 0000000000000000000000000000000000000000..e4ffb15af62643be3ae9d0f7ac1c721708baee47
--- /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 0000000000000000000000000000000000000000..22cc37ca30402fa501a5323fc975f22592d66505
--- /dev/null
+++ b/ld/testsuite/ld-scripts/crc64-iso_be.t
@@ -0,0 +1,43 @@
+MEMORY {
+  rom : ORIGIN = 0x000000, LENGTH = 0x4000
+  ram : ORIGIN = 0x008000, LENGTH = 0x1000
+}
+
+_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 (0x008000) { *(.data) } >ram /* NO default AT>rom */
+  . = ALIGN(0x20);
+  .bss : { *(.bss) } >ram /* NO default AT>rom */
+  /DISCARD/ : { *(*) }
+}
diff --git a/ld/testsuite/ld-scripts/crc64-multiple-digest.d b/ld/testsuite/ld-scripts/crc64-multiple-digest.d
new file mode 100644
index 0000000000000000000000000000000000000000..5a1e5ccf3ca24f0bd82ace788efeb439654fc2b1
--- /dev/null
+++ b/ld/testsuite/ld-scripts/crc64-multiple-digest.d
@@ -0,0 +1,6 @@
+#source: crc64-multiple-digest.s
+#ld: -T crc64-multiple-digest.t
+# error: .*: Duplicate digest .*
+#skip: tic4x-coff, tic54x-cof
+#skip: ns32k-pc532-macho, pdp11-dec-aout, powerpc-ibm-aix5.2.0
+#skip: rs6000-aix4.3.3, alpha-linuxecoff
diff --git a/ld/testsuite/ld-scripts/crc64-multiple-digest.s b/ld/testsuite/ld-scripts/crc64-multiple-digest.s
new file mode 100644
index 0000000000000000000000000000000000000000..e4ffb15af62643be3ae9d0f7ac1c721708baee47
--- /dev/null
+++ b/ld/testsuite/ld-scripts/crc64-multiple-digest.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-multiple-digest.t b/ld/testsuite/ld-scripts/crc64-multiple-digest.t
new file mode 100644
index 0000000000000000000000000000000000000000..49c1119ad1cfe9d729bbcc02df013dad062d8f15
--- /dev/null
+++ b/ld/testsuite/ld-scripts/crc64-multiple-digest.t
@@ -0,0 +1,45 @@
+MEMORY {
+  rom : ORIGIN = 0x000000, LENGTH = 0x4000
+  ram : ORIGIN = 0x008000, LENGTH = 0x1000
+}
+
+_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 "_CRC64A#BE" "CRC64-ECMA" (ecc_start , ecc_end);
+      DIGEST "_CRC64B#BE" "CRC64-ISO" (ecc_start , ecc_end);
+      QUAD(0x0);
+
+      INCLUDE "end_tag.inc"
+
+      INCLUDE "crc_data.inc"
+
+      INCLUDE "digest_table.inc"
+    } > rom
+
+  .data : AT (0x008000) { *(.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-size.d b/ld/testsuite/ld-scripts/crc64-poly-size.d
new file mode 100644
index 0000000000000000000000000000000000000000..841dd830ff06880e71610d432e5a8e98e74fb326
--- /dev/null
+++ b/ld/testsuite/ld-scripts/crc64-poly-size.d
@@ -0,0 +1,6 @@
+#source: crc64-poly-size.s
+#ld: -T crc64-poly-size.t
+# error: .*: Illegal Size in DIGEST: .*
+#skip: tic4x-coff, tic54x-cof
+#skip: ns32k-pc532-macho, pdp11-dec-aout, powerpc-ibm-aix5.2.0
+#skip: rs6000-aix4.3.3, alpha-linuxecoff
diff --git a/ld/testsuite/ld-scripts/crc64-poly-size.s b/ld/testsuite/ld-scripts/crc64-poly-size.s
new file mode 100644
index 0000000000000000000000000000000000000000..e4ffb15af62643be3ae9d0f7ac1c721708baee47
--- /dev/null
+++ b/ld/testsuite/ld-scripts/crc64-poly-size.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-size.t b/ld/testsuite/ld-scripts/crc64-poly-size.t
new file mode 100644
index 0000000000000000000000000000000000000000..8dad7186b9f28c60b82cc56059c0e7762ae814be
--- /dev/null
+++ b/ld/testsuite/ld-scripts/crc64-poly-size.t
@@ -0,0 +1,43 @@
+MEMORY {
+  rom : ORIGIN = 0x000000, LENGTH = 0x4000
+  ram : ORIGIN = 0x008000, LENGTH = 0x1000
+}
+
+_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(80,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 (0x008000) { *(.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 0000000000000000000000000000000000000000..6be05b6aed87e9d456432e8d7b792692016b0599
--- /dev/null
+++ b/ld/testsuite/ld-scripts/crc64-poly.d
@@ -0,0 +1,26 @@
+#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-*-*
+#skip: ns32k-pc532-macho, pdp11-dec-aout, powerpc-ibm-aix5.2.0
+#skip: rs6000-aix4.3.3, alpha-linuxecoff
+
+.*:     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 0000000000000000000000000000000000000000..e4ffb15af62643be3ae9d0f7ac1c721708baee47
--- /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 0000000000000000000000000000000000000000..fb357caedf9dd89802649a936354a007ed44b442
--- /dev/null
+++ b/ld/testsuite/ld-scripts/crc64-poly.t
@@ -0,0 +1,43 @@
+MEMORY {
+  rom : ORIGIN = 0x000000, LENGTH = 0x4000
+  ram : ORIGIN = 0x008000, LENGTH = 0x1000
+}
+
+_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 (0x008000) { *(.data) } >ram /* NO default AT>rom */
+  . = ALIGN(0x20);
+  .bss : { *(.bss) } >ram /* NO default AT>rom */
+  /DISCARD/ : { *(*) }
+}
diff --git a/ld/testsuite/ld-scripts/crc64-reverse-area.d b/ld/testsuite/ld-scripts/crc64-reverse-area.d
new file mode 100644
index 0000000000000000000000000000000000000000..344e8d28ed9d22d9c3e71fee3eff9de22e49ae24
--- /dev/null
+++ b/ld/testsuite/ld-scripts/crc64-reverse-area.d
@@ -0,0 +1,6 @@
+#source: crc64-reverse-area.s
+#ld: -T crc64-reverse-area.t
+# error: .*: CRC area starts after its end location.*
+#skip: tic4x-coff, tic54x-cof
+#skip: ns32k-pc532-macho, pdp11-dec-aout, powerpc-ibm-aix5.2.0
+#skip: rs6000-aix4.3.3, alpha-linuxecoff
diff --git a/ld/testsuite/ld-scripts/crc64-reverse-area.s b/ld/testsuite/ld-scripts/crc64-reverse-area.s
new file mode 100644
index 0000000000000000000000000000000000000000..e4ffb15af62643be3ae9d0f7ac1c721708baee47
--- /dev/null
+++ b/ld/testsuite/ld-scripts/crc64-reverse-area.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-reverse-area.t b/ld/testsuite/ld-scripts/crc64-reverse-area.t
new file mode 100644
index 0000000000000000000000000000000000000000..27aef4413a078b02ec8e0fdc926fd231a88da0cf
--- /dev/null
+++ b/ld/testsuite/ld-scripts/crc64-reverse-area.t
@@ -0,0 +1,44 @@
+MEMORY {
+  rom : ORIGIN = 0x000000, LENGTH = 0x4000
+  ram : ORIGIN = 0x008000, LENGTH = 0x1000
+}
+
+_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_end, ecc_start);
+      QUAD(0x0);
+
+      INCLUDE "end_tag.inc"
+
+      INCLUDE "crc_data.inc"
+
+      INCLUDE "digest_table.inc"
+    } > rom
+
+  .data : AT (0x008000) { *(.data) } >ram /* NO default AT>rom */
+  . = ALIGN(0x20);
+  .bss : { *(.bss) } >ram /* NO default AT>rom */
+  /DISCARD/ : { *(*) }
+}
diff --git a/ld/testsuite/ld-scripts/crc64-same-section.d b/ld/testsuite/ld-scripts/crc64-same-section.d
new file mode 100644
index 0000000000000000000000000000000000000000..787145a643226d3dacbae9680574c58e1e6ada7e
--- /dev/null
+++ b/ld/testsuite/ld-scripts/crc64-same-section.d
@@ -0,0 +1,6 @@
+#source: crc64-same-section.s
+#ld: -T crc64-same-section.t
+#error: .*: The CRC digest and table should be inside the .*
+#skip: tic4x-coff, tic54x-cof
+#skip: ns32k-pc532-macho, pdp11-dec-aout, powerpc-ibm-aix5.2.0
+#skip: rs6000-aix4.3.3, alpha-linuxecoff
diff --git a/ld/testsuite/ld-scripts/crc64-same-section.s b/ld/testsuite/ld-scripts/crc64-same-section.s
new file mode 100644
index 0000000000000000000000000000000000000000..e4ffb15af62643be3ae9d0f7ac1c721708baee47
--- /dev/null
+++ b/ld/testsuite/ld-scripts/crc64-same-section.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-same-section.t b/ld/testsuite/ld-scripts/crc64-same-section.t
new file mode 100644
index 0000000000000000000000000000000000000000..47c96f556a746985c49a3d9528ec072c5b3cd047
--- /dev/null
+++ b/ld/testsuite/ld-scripts/crc64-same-section.t
@@ -0,0 +1,47 @@
+MEMORY {
+  rom : ORIGIN = 0x000000, LENGTH = 0x4000
+  ram : ORIGIN = 0x008000, LENGTH = 0x1000
+}
+
+_start = 0x000000;
+SECTIONS
+{
+  . = 0x1000 + SIZEOF_HEADERS;
+  .crc ALIGN (0x200) :
+    {
+      crc64 = .;
+      DIGEST "_CRC64#BE" "CRC64-ECMA" (ecc_start , ecc_end);
+    } > rom
+  .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);
+
+      QUAD(0x0);
+
+      INCLUDE "end_tag.inc"
+
+      INCLUDE "crc_data.inc"
+
+      INCLUDE "digest_table.inc"
+    } > rom
+
+  .data : AT (0x008000) { *(.data) } >ram /* NO default AT>rom */
+  . = ALIGN(0x20);
+  .bss : { *(.bss) } >ram /* NO default AT>rom */
+  /DISCARD/ : { *(*) }
+}
diff --git a/ld/testsuite/ld-scripts/crc64-section.d b/ld/testsuite/ld-scripts/crc64-section.d
new file mode 100644
index 0000000000000000000000000000000000000000..16e625b71c9911406098bc34bc6dc6a02ee9bec3
--- /dev/null
+++ b/ld/testsuite/ld-scripts/crc64-section.d
@@ -0,0 +1,26 @@
+#source: crc64-section.s
+#ld: -T crc64-section.t
+#objdump: -s -j .foo
+#target: [is_elf_format] [is_coff_format]
+#notarget: [is_aout_format]
+#xfail: tic4x-*-* tic54x-*-*
+#skip: ns32k-pc532-macho, pdp11-dec-aout, powerpc-ibm-aix5.2.0
+#skip: rs6000-aix4.3.3, alpha-linuxecoff
+
+.*:     file format .*
+
+Contents of section .foo:
+ 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-section.s b/ld/testsuite/ld-scripts/crc64-section.s
new file mode 100644
index 0000000000000000000000000000000000000000..99ff9f8496004fc65629bf8a88823e8390af825d
--- /dev/null
+++ b/ld/testsuite/ld-scripts/crc64-section.s
@@ -0,0 +1,21 @@
+    .extern ecc_start
+	.section .foo
+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-section.t b/ld/testsuite/ld-scripts/crc64-section.t
new file mode 100644
index 0000000000000000000000000000000000000000..7cfcdf7beb4b227e91dcb1bcd77eaeee3163a332
--- /dev/null
+++ b/ld/testsuite/ld-scripts/crc64-section.t
@@ -0,0 +1,56 @@
+MEMORY {
+  rom : ORIGIN = 0x000000, LENGTH = 0x4000
+  ram : ORIGIN = 0x008000, LENGTH = 0x1000
+}
+
+_start = 0x000000;
+SECTIONS
+{
+  . = 0x1000 + SIZEOF_HEADERS;
+  .foo 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"
+
+      ecc_start = .;
+      ASCIZ "123456789"
+      ecc_end = . - 1;
+      . = ALIGN(0x10);
+
+      entry = .;
+      *(.foo)
+      . = ALIGN(0x100);
+      BYTE(1);
+      INCLUDE "digest_table.inc"
+    } > rom
+  .text ALIGN (0x200) :
+    {
+      *(.text)
+      QUAD(0x0)
+    } > rom
+
+  .data : AT (0x008000) { *(.data) } >ram /* NO default AT>rom */
+  . = ALIGN(0x20);
+  .bss : { *(.bss) } >ram /* NO default AT>rom */
+  /DISCARD/ : { *(*) }
+}
diff --git a/ld/testsuite/ld-scripts/crc64-unknown-digest.d b/ld/testsuite/ld-scripts/crc64-unknown-digest.d
new file mode 100644
index 0000000000000000000000000000000000000000..051b06c8879422960b23f60686764eb03f5aab1a
--- /dev/null
+++ b/ld/testsuite/ld-scripts/crc64-unknown-digest.d
@@ -0,0 +1,6 @@
+#source: crc64-unknown-digest.s
+#ld: -T crc64-unknown-digest.t
+# error: .*: Unknown digest.*
+#skip: tic4x-coff, tic54x-cof
+#skip: ns32k-pc532-macho, pdp11-dec-aout, powerpc-ibm-aix5.2.0
+#skip: rs6000-aix4.3.3, alpha-linuxecoff
diff --git a/ld/testsuite/ld-scripts/crc64-unknown-digest.s b/ld/testsuite/ld-scripts/crc64-unknown-digest.s
new file mode 100644
index 0000000000000000000000000000000000000000..e4ffb15af62643be3ae9d0f7ac1c721708baee47
--- /dev/null
+++ b/ld/testsuite/ld-scripts/crc64-unknown-digest.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-unknown-digest.t b/ld/testsuite/ld-scripts/crc64-unknown-digest.t
new file mode 100644
index 0000000000000000000000000000000000000000..9f4c900924c14d14198af61dfdcc77b511d0ae18
--- /dev/null
+++ b/ld/testsuite/ld-scripts/crc64-unknown-digest.t
@@ -0,0 +1,44 @@
+MEMORY {
+  rom : ORIGIN = 0x000000, LENGTH = 0x4000
+  ram : ORIGIN = 0x008000, LENGTH = 0x1000
+}
+
+_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" "TCRC64-ECMA" (ecc_start , ecc_end);
+      QUAD(0x0);
+
+      INCLUDE "end_tag.inc"
+
+      INCLUDE "crc_data.inc"
+
+      INCLUDE "digest_table.inc"
+    } > rom
+
+  .data : AT (0x008000) { *(.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 0000000000000000000000000000000000000000..176a4689493b08ce9b092ace797d67526fdb92cc
--- /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 0000000000000000000000000000000000000000..fb40a4fa02428d7bbd0d961421a2e526ee5dc791
--- /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 0000000000000000000000000000000000000000..eec712d9eff0cc176480dbd29152b2579ee18c0b
--- /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 0000000000000000000000000000000000000000..4c80854b062589a606c0597a0837745592dc0ca5
--- /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 56e12da8e616c566793fc798835e545fb8c8bbe1..64767d87f83b2c5579c16e535ce76842b35cb08b 100644
--- a/ld/testsuite/ld-scripts/script.exp
+++ b/ld/testsuite/ld-scripts/script.exp
@@ -229,6 +229,23 @@ 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 "crc64-reverse-area"
+run_dump_test "crc64-in-section"
+run_dump_test "crc64-same-section"
+run_dump_test "crc64-multiple-digest"
+run_dump_test "crc64-unknown-digest"
+run_dump_test "crc64-poly-size"
+run_dump_test "crc64-bad-label"
+run_dump_test "crc64-bad-label-2"
+run_dump_test "crc64-bad-endian-size"
+run_dump_test "crc64-bad-endian-contents"
+
 run_dump_test "align-with-input"
 run_dump_test "pr20302"
 run_dump_test "output-section-types"