Module Name: src Committed By: christos Date: Tue Dec 22 16:49:08 UTC 2015
Modified Files: src/external/gpl3/gcc/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.1.1.3 -r1.2 src/external/gpl3/gcc/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/dist/gcc/final.c diff -u src/external/gpl3/gcc/dist/gcc/final.c:1.1.1.3 src/external/gpl3/gcc/dist/gcc/final.c:1.2 --- src/external/gpl3/gcc/dist/gcc/final.c:1.1.1.3 Sat Mar 1 03:42:08 2014 +++ src/external/gpl3/gcc/dist/gcc/final.c Tue Dec 22 11:49:08 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);