From c73013342afb729f07ed12f5827687b40f6b14ad Mon Sep 17 00:00:00 2001 From: Vineet Gupta Date: Thu, 18 Nov 2021 17:08:15 -0800 Subject: [PATCH] gcc: add source SHA1 which shows up in -v This helps identify the exact sources used for building the compiler. | riscv64-unknown-linux-gnu-gcc -v | | Before: gcc version 11.1.0 (GCC) | After : gcc version 11.1.0 (g480822473a4a) Signed-off-by: Vineet Gupta --- Makefile.in | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Makefile.in b/Makefile.in index 38e3a78b..7779dff9 100644 --- a/Makefile.in +++ b/Makefile.in @@ -243,6 +243,12 @@ else GLIBC_SRC_GIT := endif +ifneq ("$(wildcard $(GCC_SRCDIR)/.git)","") +GCCPKGVER := g$(shell git -C $(GCC_SRCDIR) describe --always --dirty --exclude '*') +else +GCCPKGVER := +endif + $(srcdir)/%/.git: cd $(srcdir) && \ flock `git rev-parse --git-dir`/config git submodule init $(dir $@) && \ @@ -396,6 +402,7 @@ stamps/build-gcc-linux-stage2: $(GCC_SRCDIR) $(GCC_SRC_GIT) $(addprefix stamps/b $(CONFIGURE_HOST) \ --prefix=$(INSTALL_DIR) \ --with-sysroot=$(SYSROOT) \ + --with-pkgversion="$(GCCPKGVER)" \ @with_system_zlib@ \ --enable-shared \ --enable-tls \ @@ -621,6 +628,7 @@ stamps/build-gcc-newlib-stage2: $(GCC_SRCDIR) $(GCC_SRC_GIT) stamps/build-newlib --disable-shared \ --disable-threads \ --enable-languages=c,c++ \ + --with-pkgversion="$(GCCPKGVER)" \ @with_system_zlib@ \ --enable-tls \ --with-newlib \