[PATCH v2 0/6] TIMESTAMP add expression

Fangrui Song maskray@sourceware.org
Mon Oct 20 06:08:21 GMT 2025
On Tue, Oct 14, 2025 at 9:50 AM <binutils@emagii.com> wrote:
>
> 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

I agree with Jan's point that this feature isn't generic enough and
Joseph's concern that it would introduce a reproducible build pitfall
when SOURCE_DATE_EPOCH is not set.
https://sourceware.org/pipermail/binutils/2025-October/144706.html

I don't think we should proceed with this patch series.


More information about the Binutils mailing list