Hello,
This patch adds libgcc configuration option to disable TM clone
registry. This option helps to reduce code size for embedded targets
which do not need transactional memory support.
Tested on x86_64 and riscv64-unknown-elf-gcc, the last is with the
option enabled.
If the change is Ok with you, please commit it since I have no write
access to gcc repository.
Best regards,
Ilia.
libgcc/ChangeLog:
* Makefile.in: Add @use_tm_clone_registry@.
* configure: Regenerate.
* configure.ac: Add --disable-tm-clone-registry option.
gcc/ChangeLog:
* doc/install.texi: Document --disable-tm-clone-registry.
diff --git a/gcc/doc/install.texi b/gcc/doc/install.texi
index 29d0470..1a0e8c7 100644
--- a/gcc/doc/install.texi
+++ b/gcc/doc/install.texi
@@ -1284,6 +1284,11 @@ assumptions made by the configure test are incorrect.
Specify that the target does not support TLS.
This is an alias for @option{--enable-tls=no}.
+@item --disable-tm-clone-registry
+Disable TM clone registry in libgcc. It is enabled in libgcc by default.
+This option helps to reduce code size for embedded targets which do
+not use transactional memory.
+
@item --with-cpu=@var{cpu}
@itemx --with-cpu-32=@var{cpu}
@itemx --with-cpu-64=@var{cpu}
diff --git a/libgcc/Makefile.in b/libgcc/Makefile.in
index fb77881..189f9ff 100644
--- a/libgcc/Makefile.in
+++ b/libgcc/Makefile.in
@@ -259,6 +259,8 @@ PICFLAG = @PICFLAG@
CET_FLAGS = @CET_FLAGS@
+USE_TM_CLONE_REGISTRY = @use_tm_clone_registry@
+
# Defined in libgcc2.c, included only in the static library.
LIB2FUNCS_ST = _eprintf __gcc_bcmp
@@ -299,7 +301,7 @@ CRTSTUFF_CFLAGS = -O2 $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) -g0 \
$(NO_PIE_CFLAGS) -finhibit-size-directive -fno-inline -fno-exceptions \
-fno-zero-initialized-in-bss -fno-toplevel-reorder -fno-tree-vectorize \
-fbuilding-libgcc -fno-stack-protector $(FORCE_EXPLICIT_EH_REGISTRY) \
- $(INHIBIT_LIBC_CFLAGS)
+ $(INHIBIT_LIBC_CFLAGS) $(USE_TM_CLONE_REGISTRY)
# Extra flags to use when compiling crt{begin,end}.o.
CRTSTUFF_T_CFLAGS =
diff --git a/libgcc/configure.ac b/libgcc/configure.ac
index 5f11455..b1b90d2 100644
--- a/libgcc/configure.ac
+++ b/libgcc/configure.ac
@@ -261,6 +261,16 @@ fi
])
AC_SUBST([force_explicit_eh_registry])
+AC_ARG_ENABLE([tm-clone-registry],
+[ --disable-tm-clone-registry disable TM clone registry],
+[
+use_tm_clone_registry=
+if test "$enable_tm_clone_registry" = no; then
+ use_tm_clone_registry=-DUSE_TM_CLONE_REGISTRY=0
+fi
+])
+AC_SUBST([use_tm_clone_registry])
+
AC_LIB_PROG_LD_GNU
AC_MSG_CHECKING([for thread model used by GCC])