[COMMITTED] Fix incorrect use of USE_TM_CLONE_REGISTRY in crtstuff.c

Message ID 20191104125319.47affce7@jozef-kubuntu
State New
Headers show
Series
  • [COMMITTED] Fix incorrect use of USE_TM_CLONE_REGISTRY in crtstuff.c
Related show

Commit Message

Jozef Lawrynowicz Nov. 4, 2019, 12:53 p.m.
r272769 added the --disable-tm-clone-registry configure option. This expects
defining USE_TM_CLONE_REGISTRY to 0 to remove blocks of code from
libgcc/crtstuff.c.

However, some #if blocks in crtstuff.c only check whether USE_TM_CLONE_REGISTRY
is defined, so when it is defined to 0, these will still be true.

The attached patch changes the remaining instances of "#if
defined(USE_TM_CLONE_REGISTRY)" to merely check "#if USE_TM_CLONE_REGISTRY".

A new clause at the top of the file ensures the macro is always defined to a
value.

Successfully bootstrapped and regtested for x86-64-pc-linux-gnu.
Successfully regtested for msp430-elf.

Committed as obvious.

Patch

From 47a6db26ddbedccf6a9270718421e54a681868ee Mon Sep 17 00:00:00 2001
From: jozefl <jozefl@138bc75d-0d04-0410-961f-82ee72b054a4>
Date: Mon, 4 Nov 2019 12:41:56 +0000
Subject: [PATCH] libgcc: Fix incorrect use of USE_TM_CLONE_REGISTRY

2019-11-04  Jozef Lawrynowicz  <jozef.l@mittosystems.com>

	* crtstuff.c: Define USE_TM_CLONE_REGISTRY to 0 if it's undefined and
	the target output object format is not ELF.
	s/defined(USE_TM_CLONE_REGISTRY)/USE_TM_CLONE_REGISTRY.


git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@277775 138bc75d-0d04-0410-961f-82ee72b054a4
---
 libgcc/ChangeLog  |  6 ++++++
 libgcc/crtstuff.c | 11 +++++------
 2 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/libgcc/ChangeLog b/libgcc/ChangeLog
index 806d048f5d1..c528cec2db3 100644
--- a/libgcc/ChangeLog
+++ b/libgcc/ChangeLog
@@ -1,3 +1,9 @@ 
+2019-11-04  Jozef Lawrynowicz  <jozef.l@mittosystems.com>
+
+	* crtstuff.c: Define USE_TM_CLONE_REGISTRY to 0 if it's undefined and
+	the target output object format is not ELF.
+	s/defined(USE_TM_CLONE_REGISTRY)/USE_TM_CLONE_REGISTRY.
+
 2019-11-03  Oleg Endo  <olegendo@gcc.gnu.org>
 
 	PR libgcc/78804
diff --git a/libgcc/crtstuff.c b/libgcc/crtstuff.c
index c93e1cbcaca..ae6328d317d 100644
--- a/libgcc/crtstuff.c
+++ b/libgcc/crtstuff.c
@@ -153,6 +153,8 @@  call_ ## FUNC (void)					\
 
 #if !defined(USE_TM_CLONE_REGISTRY) && defined(OBJECT_FORMAT_ELF)
 # define USE_TM_CLONE_REGISTRY 1
+#elif !defined(USE_TM_CLONE_REGISTRY)
+# define USE_TM_CLONE_REGISTRY 0
 #endif
 
 /* We do not want to add the weak attribute to the declarations of these
@@ -450,8 +452,7 @@  CRT_CALL_STATIC_FUNCTION (__LIBGCC_INIT_SECTION_ASM_OP__,
 			  __do_global_dtors_aux_1)
 #endif
 
-#if defined(USE_EH_FRAME_REGISTRY) \
-    || defined(USE_TM_CLONE_REGISTRY)
+#if defined(USE_EH_FRAME_REGISTRY) || USE_TM_CLONE_REGISTRY
 /* Stick a call to __register_frame_info into the .init section.  For some
    reason calls with no arguments work more reliably in .init, so stick the
    call in another function.  */
@@ -560,8 +561,7 @@  __do_global_dtors (void)
 #endif
 }
 
-#if defined(USE_EH_FRAME_REGISTRY) \
-    || defined(USE_TM_CLONE_REGISTRY)
+#if defined(USE_EH_FRAME_REGISTRY) || USE_TM_CLONE_REGISTRY
 /* A helper function for __do_global_ctors, which is in crtend.o.  Here
    in crtbegin.o, we can reference a couple of symbols not visible there.
    Plus, since we're before libgcc.a, we have no problems referencing
@@ -733,8 +733,7 @@  void
 __do_global_ctors (void)
 {
   func_ptr *p;
-#if defined(USE_EH_FRAME_REGISTRY) \
-    || defined(USE_TM_CLONE_REGISTRY)
+#if defined(USE_EH_FRAME_REGISTRY) || USE_TM_CLONE_REGISTRY
   __do_global_ctors_1();
 #endif
   for (p = __CTOR_END__ - 1; *p != (func_ptr) -1; p--)
-- 
2.17.1