[PATCH v2 2/6] ld:TIMESTAMP: ldgram.y

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


From: Ulf Samuelsson <ulf@emagii.com>

Add TIMESTAMP to linker.

The TIMESTAMP keyword returns a QUAD-word entry with the current time.
The value is the number of seconds since the Epoch,
1970-01-01 00:00:00 +0000 (UTC)

Signed-off-by: Ulf Samuelsson <ulf@emagii.com>
---
 ld/ldgram.y | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/ld/ldgram.y b/ld/ldgram.y
index 6635e598562..3156fb81b8c 100644
--- a/ld/ldgram.y
+++ b/ld/ldgram.y
@@ -104,6 +104,7 @@ static void yyerror (const char *);
 %type <cname> wildcard_name
 %type <wildcard> section_name_spec filename_spec wildcard_maybe_exclude wildcard_maybe_reverse
 %token <bigint> INT
+%token <bigint> TIMESTAMP
 %token <name> NAME LNAME
 %type <integer> length
 %type <phdr> phdr_qualifiers
@@ -1007,6 +1008,8 @@ exp	:
 			{ $$ = exp_nameop (DEFINED, $3); }
 	|	INT
 			{ $$ = exp_bigintop ($1.integer, $1.str); }
+	|	TIMESTAMP
+			{ $$ = exp_bigintop ($1.integer, $1.str); }
 	|	SIZEOF_HEADERS
 			{ $$ = exp_nameop (SIZEOF_HEADERS,0); }
 
-- 
2.17.1



More information about the Binutils mailing list