]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Make module files reproducible
authorAlastair McKinstry <alastair.mckinstry@sceal.ie>
Tue, 13 Feb 2018 08:06:02 +0000 (08:06 +0000)
committerJanne Blomqvist <jb@gcc.gnu.org>
Tue, 13 Feb 2018 08:06:02 +0000 (10:06 +0200)
Using lbasename ensures that the build path does not end up in the
module file.

Regtested on x86_64-pc-linux-gnu. Backport from trunk.

2018-02-13  Alastair McKinstry  <alastair.mckinstry@sceal.ie>
    Janne Blomqvist  <jb@gcc.gnu.org>

* module.c (dump_module): Use lbasename to ensure that module
files are reproducible.

Co-Authored-By: Janne Blomqvist <jb@gcc.gnu.org>
From-SVN: r257615

gcc/fortran/ChangeLog
gcc/fortran/module.c

index 486b7d41394d917c067a52db64282c1dabaa1a01..49930c72b0321f921e73801d629e70bf85578132 100644 (file)
@@ -1,3 +1,9 @@
+2018-02-13  Alastair McKinstry  <alastair.mckinstry@sceal.ie>
+           Janne Blomqvist  <jb@gcc.gnu.org>
+
+       * module.c (dump_module): Use lbasename to ensure that module
+       files are reproducible.
+
 2018-02-12  Thomas Koenig  <tkoenig@gcc.gnu.org>
 
        PR fortran/68560
index 29bcaf37bf9a10bf1ac0a4ef6830ca716643f224..a77337be668fda997ad3549c5a1c89a08d08a49a 100644 (file)
@@ -6080,8 +6080,10 @@ dump_module (const char *name, int dump_flag)
     gfc_fatal_error ("Can't open module file %qs for writing at %C: %s",
                     filename_tmp, xstrerror (errno));
 
+  /* Use lbasename to ensure module files are reproducible regardless
+     of the build path (see the reproducible builds project).  */
   gzprintf (module_fp, "GFORTRAN module version '%s' created from %s\n",
-           MOD_VERSION, gfc_source_file);
+           MOD_VERSION, lbasename (gfc_source_file));
 
   /* Write the module itself.  */
   iomode = IO_OUTPUT;