This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH, libgcc] Make possible to disable JCR in crtstuff.c


Current crtstuff.c checks if JCR_SECTION_NAME is defined to decide whether
do work for JCR. However, defaults.h always defines JCR_SECTION_NAME:

#ifndef JCR_SECTION_NAME
#define JCR_SECTION_NAME ".jcr"
#endif

So it is impossible to disable JCR related code in crtbegin.o, which can
save some bytes for every applications that doesn't need java. 

This patch revise the check of JCR_SECTION_NAME to TARGET_USE_JCR_SECTION.
By defining latter to zero disable JCR in crtstuff. This change doesn't
impact logic of any target given following defines in defaults.h:

#ifndef TARGET_USE_JCR_SECTION
#ifdef JCR_SECTION_NAME
#define TARGET_USE_JCR_SECTION 1
#else
#define TARGET_USE_JCR_SECTION 0
#endif
#endif

Again, this patch doesn't impact libgcc on any target, unless
TARGET_USE_JCR_SECTION is explicitly defined to 0 with make
CFLAGS_FOR_TARGET=-DTARGET_USE_JCR_SECTION=0. AIX defines
TARGET_USE_JCR_SECTION to 0, but it has no crtbegin/end stuff. So also no
impact.

OK to trunk?

2012-09-21  Joey Ye  <joey.ye@arm.com>

	* crtstuff.c: Check TARGET_USE_JCR_SECTION.

Index: libgcc/crtstuff.c
===================================================================
--- libgcc/crtstuff.c	(revision 190556)
+++ libgcc/crtstuff.c	(working copy)
@@ -256,13 +256,13 @@
      = { };
 #endif /* USE_EH_FRAME_REGISTRY */
 
-#ifdef JCR_SECTION_NAME
+#if TARGET_USE_JCR_SECTION && defined (JCR_SECTION_NAME)
 /* Stick a label at the beginning of the java class registration info
    so we can register them properly.  */
 STATIC void *__JCR_LIST__[]
   __attribute__ ((used, section(JCR_SECTION_NAME), aligned(sizeof(void*))))
   = { };
-#endif /* JCR_SECTION_NAME */
+#endif /* TARGET_USE_JCR_SECTION && JCR_SECTION_NAME */
 
 #if USE_TM_CLONE_REGISTRY
 STATIC func_ptr __TMC_LIST__[]
@@ -438,7 +438,7 @@
 #endif
 
 #if defined(USE_EH_FRAME_REGISTRY) \
-    || defined(JCR_SECTION_NAME) \
+    || defined(TARGET_USE_JCR_SECTION) \
     || defined(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
@@ -461,7 +461,7 @@
 #endif /* CRT_GET_RFIB_DATA */
 #endif /* USE_EH_FRAME_REGISTRY */
 
-#ifdef JCR_SECTION_NAME
+#if TARGET_USE_JCR_SECTION
   if (__JCR_LIST__[0])
     {
       void (*register_classes) (void *) = _Jv_RegisterClasses;
@@ -469,7 +469,7 @@
       if (register_classes)
 	register_classes (__JCR_LIST__);
     }
-#endif /* JCR_SECTION_NAME */
+#endif /* TARGET_USE_JCR_SECTION */
 
 #if USE_TM_CLONE_REGISTRY
   register_tm_clones ();
@@ -483,7 +483,7 @@
   __attribute__ ((__used__, section(".init_array"),
aligned(sizeof(func_ptr))))
   = { frame_dummy };
 #endif /* !defined(INIT_SECTION_ASM_OP) */
-#endif /* USE_EH_FRAME_REGISTRY || JCR_SECTION_NAME ||
USE_TM_CLONE_REGISTRY */
+#endif /* USE_EH_FRAME_REGISTRY || TARGET_USE_JCR_SECTION ||
USE_TM_CLONE_REGISTRY */
 
 #else  /* OBJECT_FORMAT_ELF */
 
@@ -551,7 +551,7 @@
 }
 
 #if defined(USE_EH_FRAME_REGISTRY) \
-    || defined(JCR_SECTION_NAME) \
+    || defined(TARGET_USE_JCR_SECTION) \
     || defined(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.
@@ -566,7 +566,7 @@
     __register_frame_info (__EH_FRAME_BEGIN__, &object);
 #endif
 
-#ifdef JCR_SECTION_NAME
+#if TARGET_USE_JCR_SECTION
   if (__JCR_LIST__[0])
     {
       void (*register_classes) (void *) = _Jv_RegisterClasses;
@@ -580,7 +580,7 @@
   register_tm_clones ();
 #endif /* USE_TM_CLONE_REGISTRY */
 }
-#endif /* USE_EH_FRAME_REGISTRY || JCR_SECTION_NAME ||
USE_TM_CLONE_REGISTRY */
+#endif /* USE_EH_FRAME_REGISTRY || TARGET_USE_JCR_SECTION ||
USE_TM_CLONE_REGISTRY */
 
 #else /* ! INIT_SECTION_ASM_OP && ! HAS_INIT_SECTION */
 #error "What are you doing with crtstuff.c, then?"
@@ -656,13 +656,13 @@
      = { 0 };
 #endif /* EH_FRAME_SECTION_NAME */
 
-#ifdef JCR_SECTION_NAME
+#if TARGET_USE_JCR_SECTION && defined (JCR_SECTION_NAME)
 /* Null terminate the .jcr section array.  */
 STATIC void *__JCR_END__[1]
    __attribute__ ((used, section(JCR_SECTION_NAME),
 		   aligned(sizeof(void *))))
    = { 0 };
-#endif /* JCR_SECTION_NAME */
+#endif /* TARGET_USE_JCR_SECTION && JCR_SECTION_NAME */
 
 #if USE_TM_CLONE_REGISTRY
 # ifndef HAVE_GAS_HIDDEN
@@ -742,7 +742,7 @@
 {
   func_ptr *p;
 #if defined(USE_EH_FRAME_REGISTRY) \
-    || defined(JCR_SECTION_NAME) \
+    || defined(TARGET_USE_JCR_SECTION) \
     || defined(USE_TM_CLONE_REGISTRY)
   __do_global_ctors_1();
 #endif





Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]