Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/external/gpl3 For reproducible builds, allow the source of t...



details:   https://anonhg.NetBSD.org/src/rev/c24e272eb7a7
branches:  trunk
changeset: 812593:c24e272eb7a7
user:      christos <christos%NetBSD.org@localhost>
date:      Tue Dec 22 16:48:44 2015 +0000

description:
For reproducible builds, allow the source of the map to be set from the
environment, so that DW_at_producer is the same no matter what the actual
underlying source and destination directories are. See:
    https://gcc.gnu.org/ml/gcc-patches/2015-12/msg01168.html

diffstat:

 external/gpl3/gcc.old/dist/gcc/final.c |  27 +++++++++++++++++++++++++--
 external/gpl3/gcc/dist/gcc/final.c     |  27 +++++++++++++++++++++++++--
 2 files changed, 50 insertions(+), 4 deletions(-)

diffs (90 lines):

diff -r d1d885bac057 -r c24e272eb7a7 external/gpl3/gcc.old/dist/gcc/final.c
--- a/external/gpl3/gcc.old/dist/gcc/final.c    Tue Dec 22 16:46:56 2015 +0000
+++ b/external/gpl3/gcc.old/dist/gcc/final.c    Tue Dec 22 16:48:44 2015 +0000
@@ -1492,6 +1492,9 @@
 {
   debug_prefix_map *map;
   const char *p;
+  char *env;
+  const char *old;
+  size_t oldlen;
 
   p = strchr (arg, '=');
   if (!p)
@@ -1499,9 +1502,29 @@
       error ("invalid argument %qs to -fdebug-prefix-map", arg);
       return;
     }
+  if (*arg == '$')
+    {
+      env = xstrndup (arg+1, p - (arg+1));
+      old = getenv(env);
+      if (!old)
+       {
+         warning (0, "environment variable %qs not set in argument to "
+                  "-fdebug-prefix-map", env);
+         free(env);
+         return;
+       }
+      oldlen = strlen(old);
+      free(env);
+    }
+  else
+    {
+      old = xstrndup (arg, p - arg);
+      oldlen = p - arg;
+    }
+
   map = XNEW (debug_prefix_map);
-  map->old_prefix = xstrndup (arg, p - arg);
-  map->old_len = p - arg;
+  map->old_prefix = old;
+  map->old_len = oldlen;
   p++;
   map->new_prefix = xstrdup (p);
   map->new_len = strlen (p);
diff -r d1d885bac057 -r c24e272eb7a7 external/gpl3/gcc/dist/gcc/final.c
--- a/external/gpl3/gcc/dist/gcc/final.c        Tue Dec 22 16:46:56 2015 +0000
+++ b/external/gpl3/gcc/dist/gcc/final.c        Tue Dec 22 16:48:44 2015 +0000
@@ -1492,6 +1492,9 @@
 {
   debug_prefix_map *map;
   const char *p;
+  char *env;
+  const char *old;
+  size_t oldlen;
 
   p = strchr (arg, '=');
   if (!p)
@@ -1499,9 +1502,29 @@
       error ("invalid argument %qs to -fdebug-prefix-map", arg);
       return;
     }
+  if (*arg == '$')
+    {
+      env = xstrndup (arg+1, p - (arg+1));
+      old = getenv(env);
+      if (!old)
+       {
+         warning (0, "environment variable %qs not set in argument to "
+                  "-fdebug-prefix-map", env);
+         free(env);
+         return;
+       }
+      oldlen = strlen(old);
+      free(env);
+    }
+  else
+    {
+      old = xstrndup (arg, p - arg);
+      oldlen = p - arg;
+    }
+
   map = XNEW (debug_prefix_map);
-  map->old_prefix = xstrndup (arg, p - arg);
-  map->old_len = p - arg;
+  map->old_prefix = old;
+  map->old_len = oldlen;
   p++;
   map->new_prefix = xstrdup (p);
   map->new_len = strlen (p);



Home | Main Index | Thread Index | Old Index