public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* RE: [PATCH, libgcc] Make possible to disable JCR in crtstuff.c
@ 2012-11-20  2:09 Joey Ye
  2012-11-27  3:20 ` Joey Ye
  0 siblings, 1 reply; 15+ messages in thread
From: Joey Ye @ 2012-11-20  2:09 UTC (permalink / raw)
  To: gcc-patches; +Cc: Joey Ye

Ping, as Joseph Prostko is saying that this patch shall solve the same
problem he's facing.

> -----Original Message-----
> From: Joey Ye [mailto:joey.ye@arm.com]
> Sent: Friday, September 21, 2012 15:42
> To: gcc-patches@gcc.gnu.org
> Subject: [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




^ permalink raw reply	[flat|nested] 15+ messages in thread

* RE: [PATCH, libgcc] Make possible to disable JCR in crtstuff.c
  2012-11-20  2:09 [PATCH, libgcc] Make possible to disable JCR in crtstuff.c Joey Ye
@ 2012-11-27  3:20 ` Joey Ye
  0 siblings, 0 replies; 15+ messages in thread
From: Joey Ye @ 2012-11-27  3:20 UTC (permalink / raw)
  To: Joey Ye, gcc-patches

Ping^2

> -----Original Message-----
> From: Joey Ye
> Sent: Tuesday, November 20, 2012 10:09
> To: gcc-patches@gcc.gnu.org
> Cc: Joey Ye
> Subject: RE: [PATCH, libgcc] Make possible to disable JCR in crtstuff.c
> 
> Ping, as Joseph Prostko is saying that this patch shall solve the same
> problem he's facing.
> 
> > -----Original Message-----
> > From: Joey Ye [mailto:joey.ye@arm.com]
> > Sent: Friday, September 21, 2012 15:42
> > To: gcc-patches@gcc.gnu.org
> > Subject: [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
> 
> 




^ permalink raw reply	[flat|nested] 15+ messages in thread

* RE: [PATCH, libgcc] Make possible to disable JCR in crtstuff.c
  2012-12-18  4:09                 ` H.J. Lu
@ 2012-12-19  7:58                   ` Joey Ye
  0 siblings, 0 replies; 15+ messages in thread
From: Joey Ye @ 2012-12-19  7:58 UTC (permalink / raw)
  To: 'H.J. Lu', Joseph Prostko; +Cc: gcc-patches



> -----Original Message-----
> From: H.J. Lu [mailto:hjl.tools@gmail.com]
> Sent: Tuesday, December 18, 2012 12:10
> To: Joseph Prostko
> Cc: Joey Ye; gcc-patches@gcc.gnu.org
> Subject: Re: [PATCH, libgcc] Make possible to disable JCR in crtstuff.c
> 
> On Mon, Dec 17, 2012 at 5:23 PM, Joseph Prostko <joe.prostko@gmail.com>
> wrote:
> > On Mon, Dec 17, 2012 at 2:28 PM, H.J. Lu <hjl.tools@gmail.com> wrote:
> >> On Mon, Dec 17, 2012 at 1:50 AM, Joey Ye <joey.ye@arm.com> wrote:
> >
> >>>       * libgcc/Makefile.in: Include TARGET_USE_JCR_SECTION in CFLAGS.
> >>>       * libgcc/configure.ac (use_jcr_section): New variable.
> >>>       * libgcc/configure: Regenerated.
> >>>       * libgcc/crtstuff.c: Check TARGET_USE_JCR_SECTION.
> >>
> >>
> >> I would use JAVA_IS_ENABLED instead of TARGET_USE_JCR_SECTION.
> >> But it is only my personal preference.
> >
> > I believe Joey did that to be consistent with the
> > TARGET_USE_JCR_SECTION macro used in gcc/defaults.h that can be turned
> > on or off for targets that specify it .  If JAVA_IS_ENABLED is used
> > instead, should TARGET_USE_JCR_SECTION be deprecated?
> >
> 
> TARGET_USE_JCR_SECTION determines whether to use the JCR section
> to register Java classes. We don't need to do anything for Java if Java
> isn't enabled. The change can be as simple as
> 
> #ifndef JAVA_IS_ENABLED
> #undef JCR_SECTION_NAME
> #endif
> 
> in crtstuff.c.  Can you give it a try?
Tried and it simply worked. But undef JCR_SECTION_NAME here is very hacking.

> 
> 
> --
> H.J.




^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH, libgcc] Make possible to disable JCR in crtstuff.c
  2012-12-18  1:24               ` Joseph Prostko
@ 2012-12-18  4:09                 ` H.J. Lu
  2012-12-19  7:58                   ` Joey Ye
  0 siblings, 1 reply; 15+ messages in thread
From: H.J. Lu @ 2012-12-18  4:09 UTC (permalink / raw)
  To: Joseph Prostko; +Cc: Joey Ye, gcc-patches

On Mon, Dec 17, 2012 at 5:23 PM, Joseph Prostko <joe.prostko@gmail.com> wrote:
> On Mon, Dec 17, 2012 at 2:28 PM, H.J. Lu <hjl.tools@gmail.com> wrote:
>> On Mon, Dec 17, 2012 at 1:50 AM, Joey Ye <joey.ye@arm.com> wrote:
>
>>>       * libgcc/Makefile.in: Include TARGET_USE_JCR_SECTION in CFLAGS.
>>>       * libgcc/configure.ac (use_jcr_section): New variable.
>>>       * libgcc/configure: Regenerated.
>>>       * libgcc/crtstuff.c: Check TARGET_USE_JCR_SECTION.
>>
>>
>> I would use JAVA_IS_ENABLED instead of TARGET_USE_JCR_SECTION.
>> But it is only my personal preference.
>
> I believe Joey did that to be consistent with the
> TARGET_USE_JCR_SECTION macro used in gcc/defaults.h that can be turned
> on or off for targets that specify it .  If JAVA_IS_ENABLED is used
> instead, should TARGET_USE_JCR_SECTION be deprecated?
>

TARGET_USE_JCR_SECTION determines whether to use the JCR section
to register Java classes. We don't need to do anything for Java if Java
isn't enabled. The change can be as simple as

#ifndef JAVA_IS_ENABLED
#undef JCR_SECTION_NAME
#endif

in crtstuff.c.  Can you give it a try?


-- 
H.J.

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH, libgcc] Make possible to disable JCR in crtstuff.c
  2012-12-17 19:28             ` H.J. Lu
@ 2012-12-18  1:24               ` Joseph Prostko
  2012-12-18  4:09                 ` H.J. Lu
  0 siblings, 1 reply; 15+ messages in thread
From: Joseph Prostko @ 2012-12-18  1:24 UTC (permalink / raw)
  To: H.J. Lu; +Cc: Joey Ye, gcc-patches

On Mon, Dec 17, 2012 at 2:28 PM, H.J. Lu <hjl.tools@gmail.com> wrote:
> On Mon, Dec 17, 2012 at 1:50 AM, Joey Ye <joey.ye@arm.com> wrote:

>>       * libgcc/Makefile.in: Include TARGET_USE_JCR_SECTION in CFLAGS.
>>       * libgcc/configure.ac (use_jcr_section): New variable.
>>       * libgcc/configure: Regenerated.
>>       * libgcc/crtstuff.c: Check TARGET_USE_JCR_SECTION.
>
>
> I would use JAVA_IS_ENABLED instead of TARGET_USE_JCR_SECTION.
> But it is only my personal preference.

I believe Joey did that to be consistent with the
TARGET_USE_JCR_SECTION macro used in gcc/defaults.h that can be turned
on or off for targets that specify it .  If JAVA_IS_ENABLED is used
instead, should TARGET_USE_JCR_SECTION be deprecated?

- joe

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH, libgcc] Make possible to disable JCR in crtstuff.c
       [not found]           ` <50ceeb26.26d5440a.4827.0ac9SMTPIN_ADDED_BROKEN@mx.google.com>
@ 2012-12-17 19:28             ` H.J. Lu
  2012-12-18  1:24               ` Joseph Prostko
  0 siblings, 1 reply; 15+ messages in thread
From: H.J. Lu @ 2012-12-17 19:28 UTC (permalink / raw)
  To: Joey Ye; +Cc: gcc-patches, Joseph Prostko

On Mon, Dec 17, 2012 at 1:50 AM, Joey Ye <joey.ye@arm.com> wrote:
>> Can't you do
>>
>> +# Disable jcr section if we're not building java
>> +case ,${enable_languages}, in
>> +  *java*)
>> +    use_jcr_section=1
>> +    ;;
>> +  *)
>> +    use_jcr_section=0
>> +    ;;
>> +esac
>>
>> in libgcc/configure.ac?
>>
>> BTW, checking *,java,* is wrong for
>>
>> --enable-languages=c,c++,java
> Oh yes, it works. I didn't expect top level configure expands
> --enable-languages=all to individual languages. Patch simplified.
>
> However, I noticed that patterns like "*,java,*)" are widely used in
> configure and they do work. Can you explain more why it is wrong?

Yes,  "*,java,*)" works since java is always placed between c++
and lto.

>       * libgcc/Makefile.in: Include TARGET_USE_JCR_SECTION in CFLAGS.
>       * libgcc/configure.ac (use_jcr_section): New variable.
>       * libgcc/configure: Regenerated.
>       * libgcc/crtstuff.c: Check TARGET_USE_JCR_SECTION.


I would use JAVA_IS_ENABLED instead of TARGET_USE_JCR_SECTION.
But it is only my personal preference.

-- 
H.J.

^ permalink raw reply	[flat|nested] 15+ messages in thread

* RE: [PATCH, libgcc] Make possible to disable JCR in crtstuff.c
  2012-12-14 17:19         ` H.J. Lu
@ 2012-12-17  9:51           ` Joey Ye
       [not found]           ` <50ceeb26.26d5440a.4827.0ac9SMTPIN_ADDED_BROKEN@mx.google.com>
  1 sibling, 0 replies; 15+ messages in thread
From: Joey Ye @ 2012-12-17  9:51 UTC (permalink / raw)
  To: 'H.J. Lu'; +Cc: gcc-patches, Joseph Prostko

[-- Attachment #1: Type: text/plain, Size: 1084 bytes --]



> -----Original Message-----
> From: H.J. Lu [mailto:hjl.tools@gmail.com]
> Sent: Saturday, December 15, 2012 01:20
> To: Joey Ye
> Cc: gcc-patches@gcc.gnu.org; Joseph Prostko
> Subject: Re: [PATCH, libgcc] Make possible to disable JCR in crtstuff.c
> Can't you do
> 
> +# Disable jcr section if we're not building java
> +case ,${enable_languages}, in
> +  *java*)
> +    use_jcr_section=1
> +    ;;
> +  *)
> +    use_jcr_section=0
> +    ;;
> +esac
> 
> in libgcc/configure.ac?
> 
> BTW, checking *,java,* is wrong for
> 
> --enable-languages=c,c++,java
Oh yes, it works. I didn't expect top level configure expands
--enable-languages=all to individual languages. Patch simplified.

However, I noticed that patterns like "*,java,*)" are widely used in
configure and they do work. Can you explain more why it is wrong?

      * libgcc/Makefile.in: Include TARGET_USE_JCR_SECTION in CFLAGS.
      * libgcc/configure.ac (use_jcr_section): New variable.
      * libgcc/configure: Regenerated.
      * libgcc/crtstuff.c: Check TARGET_USE_JCR_SECTION.

[-- Attachment #2: jcr_diable_non_java-1217.patch --]
[-- Type: application/octet-stream, Size: 5316 bytes --]

Index: libgcc/Makefile.in
===================================================================
--- libgcc/Makefile.in	(revision 194467)
+++ libgcc/Makefile.in	(working copy)
@@ -281,7 +281,8 @@
   -finhibit-size-directive -fno-inline -fno-exceptions \
   -fno-zero-initialized-in-bss -fno-toplevel-reorder -fno-tree-vectorize \
   -fno-stack-protector \
-  $(INHIBIT_LIBC_CFLAGS)
+  $(INHIBIT_LIBC_CFLAGS) \
+  -DTARGET_USE_JCR_SECTION=@use_jcr_section@
 
 # Extra flags to use when compiling crt{begin,end}.o.
 CRTSTUFF_T_CFLAGS =
Index: libgcc/configure.ac
===================================================================
--- libgcc/configure.ac	(revision 194467)
+++ libgcc/configure.ac	(working copy)
@@ -204,6 +204,17 @@
    esac],
   [enable_sjlj_exceptions=auto])
 
+# Disable jcr section if we are not building java
+case ,${enable_languages}, in
+  *,java,*)
+    use_jcr_section=1
+    ;;
+  *)
+    use_jcr_section=0
+    ;;
+esac
+AC_SUBST(use_jcr_section)
+
 AC_CACHE_CHECK([whether to use setjmp/longjmp exceptions],
 [libgcc_cv_lib_sjlj_exceptions],
 [AC_LANG_CONFTEST(
Index: libgcc/crtstuff.c
===================================================================
--- libgcc/crtstuff.c	(revision 194467)
+++ 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: libgcc/configure
===================================================================
--- libgcc/configure	(revision 194467)
+++ libgcc/configure	(working copy)
@@ -566,6 +566,7 @@
 set_use_emutls
 set_have_cc_tls
 vis_hide
+use_jcr_section
 fixed_point
 enable_decimal_float
 decimal_float
@@ -4191,6 +4192,17 @@
 fi
 
 
+# Disable jcr section if we are not building java
+case ,${enable_languages}, in
+  *,java,*)
+    use_jcr_section=1
+    ;;
+  *)
+    use_jcr_section=0
+    ;;
+esac
+
+
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to use setjmp/longjmp exceptions" >&5
 $as_echo_n "checking whether to use setjmp/longjmp exceptions... " >&6; }
 if test "${libgcc_cv_lib_sjlj_exceptions+set}" = set; then :

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH, libgcc] Make possible to disable JCR in crtstuff.c
       [not found]       ` <50cacddc.014b420a.1bb8.65abSMTPIN_ADDED_BROKEN@mx.google.com>
@ 2012-12-14 17:19         ` H.J. Lu
  2012-12-17  9:51           ` Joey Ye
       [not found]           ` <50ceeb26.26d5440a.4827.0ac9SMTPIN_ADDED_BROKEN@mx.google.com>
  0 siblings, 2 replies; 15+ messages in thread
From: H.J. Lu @ 2012-12-14 17:19 UTC (permalink / raw)
  To: Joey Ye; +Cc: gcc-patches, Joseph Prostko

On Thu, Dec 13, 2012 at 10:56 PM, Joey Ye <Joey.Ye@arm.com> wrote:
>> -----Original Message-----
>> From: H.J. Lu [mailto:hjl.tools@gmail.com]
>> Sent: Friday, December 14, 2012 11:55
>> To: Joey Ye
>> Cc: gcc-patches@gcc.gnu.org; Joseph Prostko
>> Subject: Re: [PATCH, libgcc] Make possible to disable JCR in crtstuff.c
>>
>> > 2012-12-12  Joey Ye  <joey.ye@arm.com>
>> >
>> >      * configure.ac (enable-jcr-section): New target_configargs.
>> >      * configure: Regenerated.
>> >      * libgcc/Makefile.in: Include TARGET_USE_JCR_SECTION in CFLAGS.
>> >      * libgcc/configure.ac (use_jcr_section): New variable.
>> >      * libgcc/configure: Regenerated.
>> >      * libgcc/crtstuff.c: Check TARGET_USE_JCR_SECTION.
>>
>> Why do we need a new configure option at toplevel?
>> Can't you check --enable-languages=.. in libgcc?
> Although --enable-languages=... is passed to sub-configure, it needs a whole
> bunch of code to process with consideration of --disable-languages and
> targets. These code doesn't exist in libgcc/configure, and I intend not to
> duplicate them.
>

Can't you do

+# Disable jcr section if we're not building java
+case ,${enable_languages}, in
+  *java*)
+    use_jcr_section=1
+    ;;
+  *)
+    use_jcr_section=0
+    ;;
+esac

in libgcc/configure.ac?

BTW, checking *,java,* is wrong for

--enable-languages=c,c++,java

-- 
H.J.

^ permalink raw reply	[flat|nested] 15+ messages in thread

* RE: [PATCH, libgcc] Make possible to disable JCR in crtstuff.c
  2012-12-14  3:55     ` H.J. Lu
@ 2012-12-14  6:57       ` Joey Ye
       [not found]       ` <50cacddc.014b420a.1bb8.65abSMTPIN_ADDED_BROKEN@mx.google.com>
  1 sibling, 0 replies; 15+ messages in thread
From: Joey Ye @ 2012-12-14  6:57 UTC (permalink / raw)
  To: 'H.J. Lu'; +Cc: gcc-patches, 'Joseph Prostko'

> -----Original Message-----
> From: H.J. Lu [mailto:hjl.tools@gmail.com]
> Sent: Friday, December 14, 2012 11:55
> To: Joey Ye
> Cc: gcc-patches@gcc.gnu.org; Joseph Prostko
> Subject: Re: [PATCH, libgcc] Make possible to disable JCR in crtstuff.c
> 
> > 2012-12-12  Joey Ye  <joey.ye@arm.com>
> >
> >      * configure.ac (enable-jcr-section): New target_configargs.
> >      * configure: Regenerated.
> >      * libgcc/Makefile.in: Include TARGET_USE_JCR_SECTION in CFLAGS.
> >      * libgcc/configure.ac (use_jcr_section): New variable.
> >      * libgcc/configure: Regenerated.
> >      * libgcc/crtstuff.c: Check TARGET_USE_JCR_SECTION.
> 
> Why do we need a new configure option at toplevel?
> Can't you check --enable-languages=.. in libgcc?
Although --enable-languages=... is passed to sub-configure, it needs a whole
bunch of code to process with consideration of --disable-languages and
targets. These code doesn't exist in libgcc/configure, and I intend not to
duplicate them.

- Joey



^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH, libgcc] Make possible to disable JCR in crtstuff.c
       [not found]   ` <50ca9f88.676bb40a.3a71.ffffb7b2SMTPIN_ADDED_BROKEN@mx.google.com>
@ 2012-12-14  3:55     ` H.J. Lu
  2012-12-14  6:57       ` Joey Ye
       [not found]       ` <50cacddc.014b420a.1bb8.65abSMTPIN_ADDED_BROKEN@mx.google.com>
  0 siblings, 2 replies; 15+ messages in thread
From: H.J. Lu @ 2012-12-14  3:55 UTC (permalink / raw)
  To: Joey Ye; +Cc: gcc-patches, Joseph Prostko

On Thu, Dec 13, 2012 at 7:39 PM, Joey Ye <joey.ye@arm.com> wrote:
>> -----Original Message-----
>> From: H.J. Lu [mailto:hjl.tools@gmail.com]
>> Sent: Tuesday, November 27, 2012 12:56
>> To: Joey Ye
>> Cc: gcc-patches@gcc.gnu.org
>> Subject: Re: [PATCH, libgcc] Make possible to disable JCR in crtstuff.c
>> >> >
>> >> > OK to trunk?
>> >> >
>> >> > 2012-09-21  Joey Ye  <joey.ye@arm.com>
>> >> >
>> >> >     * crtstuff.c: Check TARGET_USE_JCR_SECTION.
>> >> >
>>
>> Since we have --enable-languages=.., can't we disable
>> JCR_SECTION section if java isn't enabled?
> Updated configure disabling jcr section usage if not configured with java.
>
> 2012-12-12  Joey Ye  <joey.ye@arm.com>
>
>      * configure.ac (enable-jcr-section): New target_configargs.
>      * configure: Regenerated.
>      * libgcc/Makefile.in: Include TARGET_USE_JCR_SECTION in CFLAGS.
>      * libgcc/configure.ac (use_jcr_section): New variable.
>      * libgcc/configure: Regenerated.
>      * libgcc/crtstuff.c: Check TARGET_USE_JCR_SECTION.

Why do we need a new configure option at toplevel?
Can't you check --enable-languages=.. in libgcc?

-- 
H.J.

^ permalink raw reply	[flat|nested] 15+ messages in thread

* RE: [PATCH, libgcc] Make possible to disable JCR in crtstuff.c
  2012-11-27  4:56 ` H.J. Lu
  2012-11-27  7:44   ` Joseph Prostko
@ 2012-12-14  3:39   ` Joey Ye
       [not found]   ` <50ca9f88.676bb40a.3a71.ffffb7b2SMTPIN_ADDED_BROKEN@mx.google.com>
  2 siblings, 0 replies; 15+ messages in thread
From: Joey Ye @ 2012-12-14  3:39 UTC (permalink / raw)
  To: 'H.J. Lu'; +Cc: gcc-patches, 'Joseph Prostko'

[-- Attachment #1: Type: text/plain, Size: 945 bytes --]

> -----Original Message-----
> From: H.J. Lu [mailto:hjl.tools@gmail.com]
> Sent: Tuesday, November 27, 2012 12:56
> To: Joey Ye
> Cc: gcc-patches@gcc.gnu.org
> Subject: Re: [PATCH, libgcc] Make possible to disable JCR in crtstuff.c
> >> >
> >> > OK to trunk?
> >> >
> >> > 2012-09-21  Joey Ye  <joey.ye@arm.com>
> >> >
> >> >     * crtstuff.c: Check TARGET_USE_JCR_SECTION.
> >> >
> 
> Since we have --enable-languages=.., can't we disable
> JCR_SECTION section if java isn't enabled?
Updated configure disabling jcr section usage if not configured with java.

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

     * configure.ac (enable-jcr-section): New target_configargs.
     * configure: Regenerated.
     * libgcc/Makefile.in: Include TARGET_USE_JCR_SECTION in CFLAGS.
     * libgcc/configure.ac (use_jcr_section): New variable.
     * libgcc/configure: Regenerated.
     * libgcc/crtstuff.c: Check TARGET_USE_JCR_SECTION.

[-- Attachment #2: jcr_diable_non_java-1212.patch --]
[-- Type: application/octet-stream, Size: 6365 bytes --]

Index: configure.ac
===================================================================
--- configure.ac	(revision 192756)
+++ configure.ac	(working copy)
@@ -1991,6 +1991,16 @@
     ;;
 esac
 
+# Disable jcr section if we're not building java
+case ,${enable_languages}, in
+  *,java,*)
+    target_configargs+=--enable-jcr-section
+    ;;
+  *)
+    target_configargs+=--disable-jcr-section
+    ;;
+esac
+
 # Remove the entries in $skipdirs and $noconfigdirs from $configdirs,
 # $build_configdirs and $target_configdirs.
 # If we have the source for $noconfigdirs entries, add them to $notsupp.
Index: configure
===================================================================
--- configure	(revision 192756)
+++ configure	(working copy)
@@ -6413,6 +6413,16 @@
     ;;
 esac
 
+# Disable jcr section if we're not building java
+case ,${enable_languages}, in
+  *,java,*)
+    target_configargs+=--enable-jcr-section
+    ;;
+  *)
+    target_configargs+=--disable-jcr-section
+    ;;
+esac
+
 # Remove the entries in $skipdirs and $noconfigdirs from $configdirs,
 # $build_configdirs and $target_configdirs.
 # If we have the source for $noconfigdirs entries, add them to $notsupp.
Index: libgcc/Makefile.in
===================================================================
--- libgcc/Makefile.in	(revision 192756)
+++ libgcc/Makefile.in	(working copy)
@@ -281,7 +281,8 @@
   -finhibit-size-directive -fno-inline -fno-exceptions \
   -fno-zero-initialized-in-bss -fno-toplevel-reorder -fno-tree-vectorize \
   -fno-stack-protector \
-  $(INHIBIT_LIBC_CFLAGS)
+  $(INHIBIT_LIBC_CFLAGS) \
+  -DTARGET_USE_JCR_SECTION=@use_jcr_section@
 
 # Extra flags to use when compiling crt{begin,end}.o.
 CRTSTUFF_T_CFLAGS =
Index: libgcc/configure.ac
===================================================================
--- libgcc/configure.ac	(revision 192756)
+++ libgcc/configure.ac	(working copy)
@@ -204,6 +204,13 @@
    esac],
   [enable_sjlj_exceptions=auto])
 
+if test "x$enable_jcr_section" = "xyes"; then
+  use_jcr_section=1
+else
+  use_jcr_section=0
+fi
+AC_SUBST(use_jcr_section)
+
 AC_CACHE_CHECK([whether to use setjmp/longjmp exceptions],
 [libgcc_cv_lib_sjlj_exceptions],
 [AC_LANG_CONFTEST(
Index: libgcc/crtstuff.c
===================================================================
--- libgcc/crtstuff.c	(revision 192756)
+++ 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: libgcc/configure
===================================================================
--- libgcc/configure	(revision 192756)
+++ libgcc/configure	(working copy)
@@ -566,6 +566,7 @@
 set_use_emutls
 set_have_cc_tls
 vis_hide
+use_jcr_section
 fixed_point
 enable_decimal_float
 decimal_float
@@ -4190,6 +4191,13 @@
 fi
 
 
+if test "x$enable_jcr_section" = "xyes"; then
+  use_jcr_section=1
+else
+  use_jcr_section=0
+fi
+
+
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to use setjmp/longjmp exceptions" >&5
 $as_echo_n "checking whether to use setjmp/longjmp exceptions... " >&6; }
 if test "${libgcc_cv_lib_sjlj_exceptions+set}" = set; then :

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH, libgcc] Make possible to disable JCR in crtstuff.c
  2012-11-27  4:56 ` H.J. Lu
@ 2012-11-27  7:44   ` Joseph Prostko
  2012-12-14  3:39   ` Joey Ye
       [not found]   ` <50ca9f88.676bb40a.3a71.ffffb7b2SMTPIN_ADDED_BROKEN@mx.google.com>
  2 siblings, 0 replies; 15+ messages in thread
From: Joseph Prostko @ 2012-11-27  7:44 UTC (permalink / raw)
  To: gcc-patches

On Mon, Nov 26, 2012 at 11:55 PM, H.J. Lu <hjl.tools@gmail.com> wrote:
> On Mon, Nov 26, 2012 at 7:19 PM, Joey Ye <joey.ye@arm.com> wrote:
>> Ping^2
>>
>>> -----Original Message-----
>>> From: Joey Ye
>>> Sent: Tuesday, November 20, 2012 10:09
>>> To: gcc-patches@gcc.gnu.org
>>> Cc: Joey Ye
>>> Subject: RE: [PATCH, libgcc] Make possible to disable JCR in crtstuff.c

> Since we have --enable-languages=.., can't we disable
> JCR_SECTION section if java isn't enabled?

I suppose that is certainly another option.  My main goal is to not
have _Jv_RegisterClasses show up in crtbegin.o, as it simply isn't
needed or desired in the case of Haiku.  Right now we only enable C
and C++, and it simply makes no sense to have anything Java-related
show up in our crtbegin.o.

- joe

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH, libgcc] Make possible to disable JCR in crtstuff.c
       [not found] <50b4317c.494f420a.4523.ffffdc1fSMTPIN_ADDED_BROKEN@mx.google.com>
@ 2012-11-27  7:36 ` Joseph Prostko
  0 siblings, 0 replies; 15+ messages in thread
From: Joseph Prostko @ 2012-11-27  7:36 UTC (permalink / raw)
  To: gcc-patches

On Mon, Nov 26, 2012 at 10:19 PM, Joey Ye <joey.ye@arm.com> wrote:
> Ping^2
>
>> -----Original Message-----
>> From: Joey Ye
>> Sent: Tuesday, November 20, 2012 10:09
>> To: gcc-patches@gcc.gnu.org
>> Cc: Joey Ye
>> Subject: RE: [PATCH, libgcc] Make possible to disable JCR in crtstuff.c
>>
>> Ping, as Joseph Prostko is saying that this patch shall solve the same
>> problem he's facing.

Indeed.  I am working on updating Haiku's GCC port to GCC 4.7.2, and
in the past we always ended up editing defaults.h to not define
JCR_SECTION_NAME as a way to get around this issue.  Basically, in
Haiku, we don't want _Jv_RegisterClasses to end up in crtbegin.o so we
patched things in what I consider an unsatisfactory manner.  I hope to
get Haiku's GCC changes upstreamed at some point, and I admit our
current fix wouldn't stand any chance at being upstreamed compared to
Joey's suggested fix.

- joe

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH, libgcc] Make possible to disable JCR in crtstuff.c
       [not found] <50b4317e.044d420a.1632.ffffd2f7SMTPIN_ADDED_BROKEN@mx.google.com>
@ 2012-11-27  4:56 ` H.J. Lu
  2012-11-27  7:44   ` Joseph Prostko
                     ` (2 more replies)
  0 siblings, 3 replies; 15+ messages in thread
From: H.J. Lu @ 2012-11-27  4:56 UTC (permalink / raw)
  To: Joey Ye; +Cc: gcc-patches

On Mon, Nov 26, 2012 at 7:19 PM, Joey Ye <joey.ye@arm.com> wrote:
> Ping^2
>
>> -----Original Message-----
>> From: Joey Ye
>> Sent: Tuesday, November 20, 2012 10:09
>> To: gcc-patches@gcc.gnu.org
>> Cc: Joey Ye
>> Subject: RE: [PATCH, libgcc] Make possible to disable JCR in crtstuff.c
>>
>> Ping, as Joseph Prostko is saying that this patch shall solve the same
>> problem he's facing.
>>
>> > -----Original Message-----
>> > From: Joey Ye [mailto:joey.ye@arm.com]
>> > Sent: Friday, September 21, 2012 15:42
>> > To: gcc-patches@gcc.gnu.org
>> > Subject: [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.
>> >

Since we have --enable-languages=.., can't we disable
JCR_SECTION section if java isn't enabled?

-- 
H.J.

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [PATCH, libgcc] Make possible to disable JCR in crtstuff.c
@ 2012-09-21  8:48 Joey Ye
  0 siblings, 0 replies; 15+ messages in thread
From: Joey Ye @ 2012-09-21  8:48 UTC (permalink / raw)
  To: gcc-patches

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




^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2012-12-19  7:58 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-11-20  2:09 [PATCH, libgcc] Make possible to disable JCR in crtstuff.c Joey Ye
2012-11-27  3:20 ` Joey Ye
     [not found] <50b4317c.494f420a.4523.ffffdc1fSMTPIN_ADDED_BROKEN@mx.google.com>
2012-11-27  7:36 ` Joseph Prostko
     [not found] <50b4317e.044d420a.1632.ffffd2f7SMTPIN_ADDED_BROKEN@mx.google.com>
2012-11-27  4:56 ` H.J. Lu
2012-11-27  7:44   ` Joseph Prostko
2012-12-14  3:39   ` Joey Ye
     [not found]   ` <50ca9f88.676bb40a.3a71.ffffb7b2SMTPIN_ADDED_BROKEN@mx.google.com>
2012-12-14  3:55     ` H.J. Lu
2012-12-14  6:57       ` Joey Ye
     [not found]       ` <50cacddc.014b420a.1bb8.65abSMTPIN_ADDED_BROKEN@mx.google.com>
2012-12-14 17:19         ` H.J. Lu
2012-12-17  9:51           ` Joey Ye
     [not found]           ` <50ceeb26.26d5440a.4827.0ac9SMTPIN_ADDED_BROKEN@mx.google.com>
2012-12-17 19:28             ` H.J. Lu
2012-12-18  1:24               ` Joseph Prostko
2012-12-18  4:09                 ` H.J. Lu
2012-12-19  7:58                   ` Joey Ye
  -- strict thread matches above, loose matches on Subject: below --
2012-09-21  8:48 Joey Ye

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).