I don't like the approach that is taken here.
- If the build system of a package misses passing flags,
then you don't embed that info into the binaries.
- The four linkers (BFD ld, gold, mold and lld) also
take that data from the environment, and there is
also precedence for taking such data from the
environment, like the TIMESTAMP for the build.
- dpkg-buildflags with the proposed implementation
causes autopkg test regressions with the additional
stderr output (already six regressions with the
tests triggered by dpkg). There will be a lot
more ...
So please set that in the environment instead, it seems to be the more
robust approach.
Matthias