[PATCH v2 3/6] ld:TIMESTAMP: testsuite

binutils@emagii.com binutils@emagii.com
Tue Oct 14 16:49:45 GMT 2025


From: Ulf Samuelsson <binutils@emagii.com>

Signed-off-by: Ulf Samuelsson <binutils@emagii.com>
---
 ld/testsuite/ld-scripts/script.exp  |  4 ++++
 ld/testsuite/ld-scripts/timestamp.d | 11 ++++++++++
 ld/testsuite/ld-scripts/timestamp.s |  7 ++++++
 ld/testsuite/ld-scripts/timestamp.t | 33 +++++++++++++++++++++++++++++
 4 files changed, 55 insertions(+)
 create mode 100644 ld/testsuite/ld-scripts/timestamp.d
 create mode 100644 ld/testsuite/ld-scripts/timestamp.s
 create mode 100644 ld/testsuite/ld-scripts/timestamp.t

diff --git a/ld/testsuite/ld-scripts/script.exp b/ld/testsuite/ld-scripts/script.exp
index 7a23f435121..b873edfd9e1 100644
--- a/ld/testsuite/ld-scripts/script.exp
+++ b/ld/testsuite/ld-scripts/script.exp
@@ -245,4 +245,8 @@ run_dump_test "pr33265-1"
 run_dump_test "pr33265-2"
 run_dump_test "pr33265-3"
 
+set env(SOURCE_DATE_EPOCH) 0x0F0F0F0FEFBEADDE
+run_dump_test "timestamp"
+
+
 set LDFLAGS $old_LDFLAGS
diff --git a/ld/testsuite/ld-scripts/timestamp.d b/ld/testsuite/ld-scripts/timestamp.d
new file mode 100644
index 00000000000..e9c4c1b57d3
--- /dev/null
+++ b/ld/testsuite/ld-scripts/timestamp.d
@@ -0,0 +1,11 @@
+#source: timestamp.s
+#ld: -T timestamp.t
+#objdump: -s -j .data
+#target: [is_elf_format] [is_coff_format]
+#notarget: tic4x-*-* tic54x-*-*
+
+.*:     file format .*
+
+Contents of section .data:
+ .... deadbeef 0f0f0f0f f0debc9a 67120000  ............g...
+#pass
diff --git a/ld/testsuite/ld-scripts/timestamp.s b/ld/testsuite/ld-scripts/timestamp.s
new file mode 100644
index 00000000000..eb7fdb16322
--- /dev/null
+++ b/ld/testsuite/ld-scripts/timestamp.s
@@ -0,0 +1,7 @@
+	.section .text
+	.long 0x01010101
+	.section .data
+	.long 0x9abcdef0
+
+	.section .bss
+	.long 0
diff --git a/ld/testsuite/ld-scripts/timestamp.t b/ld/testsuite/ld-scripts/timestamp.t
new file mode 100644
index 00000000000..a2dddadef39
--- /dev/null
+++ b/ld/testsuite/ld-scripts/timestamp.t
@@ -0,0 +1,33 @@
+
+_start = 0x000000;
+SECTIONS
+{
+  . = 0x1000 + SIZEOF_HEADERS;
+
+  .text : AT (0x10000)
+  {
+	_text0 = .;
+	QUAD(TIMESTAMP);
+	_text4 = .;
+	QUAD(4711);
+	_text12 = .;
+	QUAD(TIMESTAMP);
+	QUAD(4711);
+
+	*(.text .text.*)
+  }
+
+  .data           :
+  {
+	QUAD(TIMESTAMP);
+	*(.data .data.*)
+	LONG(4711)
+  }
+  .bss            :
+  {
+   *(.bss .bss.*)
+   . = ALIGN(. != 0 ? 32 / 8 : 1);
+  }
+
+  /DISCARD/ : { *(*) }
+}
-- 
2.17.1



More information about the Binutils mailing list