Module Name: src Committed By: christos Date: Tue Dec 22 16:48:44 UTC 2015
Modified Files: src/external/gpl3/gcc.old/dist/gcc: final.c Log Message: 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 To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/external/gpl3/gcc.old/dist/gcc/final.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/external/gpl3/gcc.old/dist/gcc/final.c diff -u src/external/gpl3/gcc.old/dist/gcc/final.c:1.3 src/external/gpl3/gcc.old/dist/gcc/final.c:1.4 --- src/external/gpl3/gcc.old/dist/gcc/final.c:1.3 Tue Sep 22 23:39:10 2015 +++ src/external/gpl3/gcc.old/dist/gcc/final.c Tue Dec 22 11:48:44 2015 @@ -1492,6 +1492,9 @@ add_debug_prefix_map (const char *arg) { debug_prefix_map *map; const char *p; + char *env; + const char *old; + size_t oldlen; p = strchr (arg, '='); if (!p) @@ -1499,9 +1502,29 @@ add_debug_prefix_map (const char *arg) 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);