[PATCH v2 0/6] TIMESTAMP add expression

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


From: binutils@emagii.com
Reply-To: 
Subject: [PATCH v2 0/6] TIMESTAMP add expression
In-Reply-To: 

ld:TIMESTAMP expression

Was: "TIMESTAMP output section command"

Add TIMESTAMP expression to linker.
    
The TIMESTAMP expression can be used to insert a timestamp 
in an output section.

Example:
	QUAD TIMESTAMP

Will insert the timestamp into the image at the current location.

The value is retreived using bfd_get_current_time which is 
how the linker gets timestamp for other things.

If the SOURCE_DATE_EPOCH environment variable exist,
the value of that will be used if it has a sane value
or otherwise the timestamp will be 0.
If the SOURCE_DATE_EPOCH does not exist, then the 
current time will be used.
Itis the number of seconds since the Epoch,
1970-01-01 00:00:00 +0000 (UTC)

The main purpose for this is for application headers
in embedded systems which often require a timestamp to be able to
exactly identify the build.

For now, it is a patchset of 6 patches.
Can be merged into a single patch if/when accepted.

[PATCH v2 1/6] ld:TIMESTAMP: ldlex.l
[PATCH v2 2/6] ld:TIMESTAMP: ldgram.y
[PATCH v2 3/6] ld:TIMESTAMP: testsuite
[PATCH v2 4/6] ld:TIMESTAMP: ld.texi
[PATCH v2 5/6] ld:TIMESTAMP: NEWS
[PATCH v2 6/6] ld:TIMESTAMP: ChangeLog



More information about the Binutils mailing list