Boris Kolpackov:
> Ximin Luo <infini...@pwned.gg> writes:
> 
>> Higher-level build scripts sometimes like to save CFLAGS etc into the build 
>> output, making the overall build output unreproducible even if GCC is 
>> playing 
>> nicely. Rather than add logic to strip -f{file,debug,macro,...}-prefix-map, 
>> into all possible higher-level programs that might want to save CFLAGS, it is
>> simpler if GCC could read it from a user-specified environment variable.
> 
> This does feel like we are trying to fix the issue in the wrong place.
> Also, won't such broken packages normally store all options (including
> -I) rather than just CFLAGS? And if the answer is no, then perhaps you
> could put -ffile-prefix-map into CPPFLAGS instead of CFLAGS? Kind of
> even feels right seeing that it affects the preprocessor.
> 

The broad issue affects -fdebug-prefix-map as well, not just __FILE__.

Such packages are not "broken"; GCC itself stores command-line arguments in 
DW_AT_producer and as mentioned there was a bug to special-case filtering 
-fdebug-prefix-map out of that.

Now we'll have to add exceptions for -ffile-prefix-map and all the other flags 
you added, and everything else that might be added in future.

The same goes for all possible buildsystems / Makefile / etc that are affected 
by the issue.

Therefore, I concluded that the best and most appropriate solution was to fix 
it at the source. That is, allow it to be read from an environment variable, to 
"cancel out" the information that is already read from the filesystem - rather 
than forcing this build-specific non-deterministic information to be added to 
the command-line.

X

-- 
GPG: ed25519/56034877E1F87C35
GPG: rsa4096/1318EFAC5FBBDBCE
https://github.com/infinity0/pubkeys.git

Reply via email to