On Tue, May 11, 2021 at 8:46 AM Martin Liška <mli...@suse.cz> wrote: > > On 4/23/21 1:37 PM, Martin Liška wrote: > > On 4/23/21 12:59 PM, Richard Biener wrote: > >> True, the question is on how much detail we have to pay attention to. > > > > Agree with that. > > > >> For us of course the build-id solution works fine. And hopefully the > >> days of PCH are counted... > > > > Yes. > > > > I have a tentative patch that emits the attached checksum.h header file. > > We also include flags in the checksum: > > > > ... > > build/genchecksum$(build_exeext) $(C_OBJS) $(BACKEND) $(LIBDEPS) \ > > > > checksum-options > cc1-checksum.c.tmp && \ > > > > ... > > > > $ cat checksum-options > > > > g++ -no-pie -g -DIN_GCC -fPIC -fno-exceptions -fno-rtti > > -fasynchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings > > -Wcast-qual -Wno-error=format-diag -Wmissing-format-attribute > > -Woverloaded-virtual -pedantic -Wno-long-long -Wno-variadic-macros > > -Wno-overlength-strings -fno-common -DHAVE_CONFIG_H -static-libstdc++ > > -static-libgcc > > > > Can we ignore them in the checksum calculation? > > Martin > > > > Richi, what do you think about this part?
We included the linker options in checksumming when changing from checksumming cc1 to its object files. I can't find any reasoning other than mimicing what was there before. I wonder how the details of the host binary build influence PCH validity - can you make an experiment and (with fixed PCH checksum) try to load a PCH file generated with the stage1 compiler with the stage3 compiler? (thus -O0 vs -O2 or even LTO for LTO bootstrap)? That is, we're concerned about layout and semantics of the data structures participating in PCH but since the layout is exposed no option should change it. Note this also means that we should be able to share the checksum for all stages (removing the odd comparison failures on frontend binaries). Some configury might change the layout so the stage1 PCH could in theory be not compatible with the stage2+ one. I wonder if we can instead upstream the build-id use and conditionalize the checksum stuff on some configury? Some people do seem worried about "weakening" the checksum. Richard. > Thanks, > Martin