On 4/23/21 9:28 AM, Richard Biener wrote:
> On Tue, Apr 20, 2021 at 8:49 PM Martin Liška <mli...@suse.cz> wrote:
>>
>> On 4/20/21 2:46 PM, Richard Biener wrote:
>>> OK.  Can you somehow arrange for trunk to pick up LTO_major from GCC
>>> major automagically then?
>>
>> I have a pretty nice solution for it where I extended (and simplified)
>> the existing gcov-iov.c generator. Doing that we can remove gcc/version.[ch].
>>
>> Using the patch, the following version.h is generated:
>>
>> #ifndef VERSION_H
>> #define VERSION_H
>>
>> /* Generated automatically by genversion.  */
>>
>> #define GCC_major_version 12
>>
>> /* The complete version string, assembled from several pieces.
>> BASEVER, DATESTAMP, DEVPHASE, and REVISION are defined by the
>> Makefile.  */
>>
>> #define version_string "12.0.0 20210420 (experimental)"
>> #define pkgversion_string "(GCC) "
>>
>> /* This is the location of the online document giving instructions for
>> reporting bugs.  If you distribute a modified version of GCC,
>> please configure with --with-bugurl pointing to a document giving
>> instructions for reporting bugs to you, not us.  (You are of course
>> welcome to forward us bugs reported to you, if you determine that
>> they are not bugs in your modifications.)  */
>>
>> #define bug_report_url "<https://gcc.gnu.org/bugs/>"
>>
>> #define GCOV_VERSION ((gcov_unsigned_t)0x42323020)  /* B20  */
>>
>> #endif /* VERSION_H */
>>
>> Ready for master?
> 
> Nice.  This is OK if others do not have further comments.

Thanks, I'm going to install it once GCC 11.1 is released.

> 
> I think we'd want to explore whether we can integrate
> genchecksum.c as well and make the PCH checksum
> based on a set of source files (including the generated
> auto-host.h) - that might allow removing the two-stage

Definitely. I see multiple options:

1) using git, it can make provide a hash for content of a folder:

$ git ls-tree HEAD -- gcc

040000 tree db613554ec17462c63bace2015c877d6bed70bbe    gcc

One can do that per-file as well:
git ls-tree HEAD -- gcc/c/*.c

100644 blob bae5757ad137c0af58dbe66229d4201a45094aca    gcc/c/c-aux-info.c

100644 blob d0035a31723447657a04c2ef79c9fd7c0ddc7568    gcc/c/c-convert.c

100644 blob 3ea4708c5075d9274601a0676f86a6900a9345b0    gcc/c/c-decl.c

100644 blob de98958ceabac9d631f937f9f28547d8aed26af2    gcc/c/c-errors.c

100644 blob 68c74cc1eb2ef908545b36e2dbff65606f756e15    gcc/c/c-fold.c

...

That needs to be combined with the generated auto-host.h header file.
>From which locations do you want to build the hash? Any other $objdir
files except auto-host.h?

Note 'git archive' can append arbitrary non-git files.

2) Doing checksum of *.[cC] in a given folder + auto-host.h.

3) Using git hash (+ auto-host.h), but it's likely too gross, right?

> link and my "hack" to re-use the version from prev-gcc
> as well as our openSUSE "hack" for reproducible builds
> which elides genchecksum.c for the use of the build-id
> in the actual executables.

What a hack. The binary is reading it's buildid right from the memory,
right?

Thoughts?

Martin

> 
> Richard.
> 
>> Thanks,
>> Martin

Reply via email to