[PATCH v1 0/6] TIMESTAMP output section command
Jan Beulich
jbeulich@suse.com
Thu Oct 9 11:55:27 GMT 2025
On 09.10.2025 11:39, Ulf Samuelsson wrote:
> Den 2025-10-09 kl. 08:03, skrev Hans-Peter Nilsson:
>> On Wed, 8 Oct 2025, Ulf Samuelsson wrote:
>>> Den 2025-10-08 kl. 10:17, skrev Alan Modra:
>>>> You can of course already insert a quad-word entry with the current
>>>> time, so this is really just syntactic sugar. One way is
>>>> INCLUDE timestamp.ld
>>>> in your script somewhere, then just before running the linker, run
>>>> echo ".QUAD `date '+%s'`" > timestamp.ld
>> I'll one-up Alan's suggestion: for your definition of a
>> timestamp, use the ld command-line option
>> "--defsym my_timestamp=`date '+%s'`"
>> and use
>> "QUAD(my_timestamp)" in the
>> linker script. Works with today's version.
>> And yesterday's, and ten years ago: I checked.
> It is possible to do it this way. That does not mean that it is a good
> way to implement it this way.
> The current linker decides on timestamp without having to specify
> something as a command line
> option when you generate the timestamp for an ELF header or similar.
Just to mention - I'm unaware of ELF headers carrying timestamps. PE
and COFF headers do, yes.
>> That it works with today's (and yester-year's) linker version,
>> not requiring any functionality, is important to embedded
>> developers.
>
> Assume that 10,000 projects implements timestamp this way.
> Then, they are forced by regulations to use "SOURCE_DATE_EPOCH" to
> implement timestamps.
> Now you have 10,000 project with a technical debt.
Surely a fair part of them would have found a way to embed timestamps,
and hence ...
> With the suggestion implemented, you have a much smaller technical debt
... it would be extra effort for them to convert to the new linker
script syntax you suggest.
Jan
More information about the Binutils
mailing list