Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/external/gpl3/gcc/dist/gcc PR/55802: Andreas Gustafsson: Unb...
details: https://anonhg.NetBSD.org/src/rev/3f3e01611c46
branches: trunk
changeset: 946051:3f3e01611c46
user: christos <christos%NetBSD.org@localhost>
date: Sat Nov 14 21:24:03 2020 +0000
description:
PR/55802: Andreas Gustafsson: Unbreak reproducible builds.
For reproducible builds to work we need to have a consistent command
line (because the command line gets recorded in dwarf). So we can't
do:
-ffile-prefix-map=/joe/random/src=/usr/src
because then /joe/random/src gets recorded. We do instead:
-ffile-prefix-map=\$NETBSDSRCDIR=/usr/src
The patch restores the environment variable parsing that got lost
in the last 2 gcc upgrades.
diffstat:
external/gpl3/gcc/dist/gcc/file-prefix-map.c | 26 +++++++++++++++++++++++---
1 files changed, 23 insertions(+), 3 deletions(-)
diffs (44 lines):
diff -r cad5b647cfc2 -r 3f3e01611c46 external/gpl3/gcc/dist/gcc/file-prefix-map.c
--- a/external/gpl3/gcc/dist/gcc/file-prefix-map.c Sat Nov 14 20:07:13 2020 +0000
+++ b/external/gpl3/gcc/dist/gcc/file-prefix-map.c Sat Nov 14 21:24:03 2020 +0000
@@ -40,7 +40,8 @@
add_prefix_map (file_prefix_map *&maps, const char *arg, const char *opt)
{
file_prefix_map *map;
- const char *p;
+ const char *p, *old;
+ size_t oldlen;
/* Note: looking for the last '='. The thinking is we can control the paths
inside our projects but not where the users build them. */
@@ -50,9 +51,28 @@
error ("invalid argument %qs to %qs", arg, opt);
return;
}
+ if (*arg == '$')
+ {
+ char *env = xstrndup (arg + 1, p - (arg + 1));
+ old = getenv(env);
+ if (!old)
+ {
+ warning (0, "environment variable %qs not set in argument to "
+ "%s", env, opt);
+ free(env);
+ return;
+ }
+ oldlen = strlen(old);
+ free(env);
+ }
+ else
+ {
+ old = xstrndup (arg, p - arg);
+ oldlen = p - arg;
+ }
map = XNEW (file_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