Skip to content

Commit c730133

Browse files
author
Vineet Gupta
committed
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 <[email protected]>
1 parent b39e361 commit c730133

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

Makefile.in

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,12 @@ else
243243
GLIBC_SRC_GIT :=
244244
endif
245245

246+
ifneq ("$(wildcard $(GCC_SRCDIR)/.git)","")
247+
GCCPKGVER := g$(shell git -C $(GCC_SRCDIR) describe --always --dirty --exclude '*')
248+
else
249+
GCCPKGVER :=
250+
endif
251+
246252
$(srcdir)/%/.git:
247253
cd $(srcdir) && \
248254
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
396402
$(CONFIGURE_HOST) \
397403
--prefix=$(INSTALL_DIR) \
398404
--with-sysroot=$(SYSROOT) \
405+
--with-pkgversion="$(GCCPKGVER)" \
399406
@with_system_zlib@ \
400407
--enable-shared \
401408
--enable-tls \
@@ -621,6 +628,7 @@ stamps/build-gcc-newlib-stage2: $(GCC_SRCDIR) $(GCC_SRC_GIT) stamps/build-newlib
621628
--disable-shared \
622629
--disable-threads \
623630
--enable-languages=c,c++ \
631+
--with-pkgversion="$(GCCPKGVER)" \
624632
@with_system_zlib@ \
625633
--enable-tls \
626634
--with-newlib \

0 commit comments

Comments
 (0)