Commit: LD: Document use of SOURCE_DATE_EPOCH in Environment section

Message ID 87r09ald27.fsf@redhat.com
State New
Headers
Series Commit: LD: Document use of SOURCE_DATE_EPOCH in Environment section |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_binutils_build--master-arm warning Patch is already merged
linaro-tcwg-bot/tcwg_binutils_build--master-aarch64 warning Patch is already merged

Commit Message

Nick Clifton Sept. 23, 2024, 1:22 p.m. UTC
  Hi Guys,

  I am applying the patch below to update the linker's documentation,
  adding an entry to the Environment Variables section mentioning the
  potential use of the SOURCE_DATE_EPOCH variable.  (Something that I
  should have done when I added the code to use SOURCE_DATE_EPOCH in the
  first place, but I forgot).

Cheers
  Nick
  

Comments

Torbjörn SVENSSON Sept. 23, 2024, 1:30 p.m. UTC | #1
Hi Nick,

On 2024-09-23 15:22, Nick Clifton wrote:
> Hi Guys,
> 
>    I am applying the patch below to update the linker's documentation,
>    adding an entry to the Environment Variables section mentioning the
>    potential use of the SOURCE_DATE_EPOCH variable.  (Something that I
>    should have done when I added the code to use SOURCE_DATE_EPOCH in the
>    first place, but I forgot).>
> Cheers
>    Nick
> 
> diff --git a/ld/ld.texi b/ld/ld.texi
> index 89e3913317a..24dcf9db919 100644
> --- a/ld/ld.texi
> +++ b/ld/ld.texi
> @@ -4048,6 +4048,13 @@ a similar fashion by the @code{gcc} linker wrapper program.  The default
>   may be overridden by the @samp{--demangle} and @samp{--no-demangle}
>   options.
>   
> +@kindex SOURCE_DATE_EPOCH
> +@cindex timestamps
> +If the PE/COFF specific @option{--insert-timestamp} is active and the
> +@env{SOURCE_DATE_EPOCH} environment variable is defined, then the
> +timestamp value in this variable will be inserted into the COFF header
> +instead of the current time.
> +
>   @c man end
>   @end ifset
>   
> 

While this might not be the common use-case, in Eclipse CDT, we are 
using this environment variable slightly different than documented above.
To allow for a reproducible builds on the CI, we are not storing a 
timestamp, but rather the checksum of the sources. This allows us to 
have the binaries committed in the tree, while still having the CI 
checking that the binaries matches the input sources.

For more info, take a look at 
https://github.com/eclipse-cdt/cdt/blob/c51cecd75ad87cddf96368500f0648aef0c84ace/releng/scripts/reproducible_build_wrapper.py#L67 
and 
https://github.com/eclipse-cdt/cdt/blob/c51cecd75ad87cddf96368500f0648aef0c84ace/native/org.eclipse.cdt.native.serial/native_src/Makefile#L76

Kind regards,
Torbjörn
  

Patch

diff --git a/ld/ld.texi b/ld/ld.texi
index 89e3913317a..24dcf9db919 100644
--- a/ld/ld.texi
+++ b/ld/ld.texi
@@ -4048,6 +4048,13 @@  a similar fashion by the @code{gcc} linker wrapper program.  The default
 may be overridden by the @samp{--demangle} and @samp{--no-demangle}
 options.
 
+@kindex SOURCE_DATE_EPOCH
+@cindex timestamps
+If the PE/COFF specific @option{--insert-timestamp} is active and the
+@env{SOURCE_DATE_EPOCH} environment variable is defined, then the
+timestamp value in this variable will be inserted into the COFF header
+instead of the current time.
+
 @c man end
 @end ifset