PING. On Sat, Aug 6, 2011 at 7:40 AM, H.J. Lu <hjl.to...@gmail.com> wrote: > PING. > > On Fri, Jul 22, 2011 at 7:06 AM, H.J. Lu <hjl.to...@gmail.com> wrote: >> On Fri, Jul 22, 2011 at 7:00 AM, H.J. Lu <hjl.to...@gmail.com> wrote: >>> On Fri, Jul 22, 2011 at 6:03 AM, H.J. Lu <hjl.to...@gmail.com> wrote: >>>> On Fri, Jul 22, 2011 at 5:30 AM, Jakub Jelinek <ja...@redhat.com> wrote: >>>>> On Fri, Jul 22, 2011 at 04:59:28AM -0700, H.J. Lu wrote: >>>>>> @@ -2660,6 +2664,7 @@ esac >>>>>> case ${target} in >>>>>> i[34567]86-*-linux* | x86_64-*-linux*) >>>>>> tmake_file="${tmake_file} i386/t-pmm_malloc i386/t-i386" >>>>>> + use_initfini_array=yes >>>>>> ;; >>>>>> i[34567]86-*-* | x86_64-*-*) >>>>>> tmake_file="${tmake_file} i386/t-gmm_malloc i386/t-i386" >>>>> >>>>> What is i?86/x86_64 specific on it? Don't most other glibc targets >>>>> want to use it too, perhaps with some arch specific tweaks? >>>> >>>> I do have a patch for all ELF targets: >>>> >>>> http://gcc.gnu.org/ml/gcc-patches/2011-06/msg01416.html >>>> >>>> It touches many targets. . But I only have one feedback from one >>>> target maintainer. I don't know how long it will take to review it. >>>> >>>> >>>>>> --- /dev/null >>>>>> +++ b/gcc/config/initfini-array.c >>>>> >>>>> This is ugly. varasm.c already has lots of ELF specific code, simply >>>>> put them there as well and only let configury set some macro which will >>>>> allow targets to choose which of the implementations in the generic code >>>>> they want to use (or if they want their own which e.g. calls the generic >>>>> routine and does something additional to it etc.). The sections probably >>>>> can be created only the first time you actually need them. >>>> >>>> I will do that. >>>> >>>>>> --- a/gcc/crtstuff.c >>>>>> +++ b/gcc/crtstuff.c >>>>>> @@ -189,6 +190,9 @@ typedef void (*func_ptr) (void); >>>>>> refer to only the __CTOR_END__ symbol in crtend.o and the >>>>>> __DTOR_LIST__ >>>>>> symbol in crtbegin.o, where they are defined. */ >>>>>> >>>>>> +/* No need for .ctors/.dtors section if linker can place them in >>>>>> + .init_array/.fini_array section. */ >>>>>> +#ifndef NO_CTORS_DTORS_SECTIONS >>>>>> /* The -1 is a flag to __do_global_[cd]tors indicating that this table >>>>>> does not start with a count of elements. */ >>>>>> #ifdef CTOR_LIST_BEGIN >>>>>> @@ -219,6 +223,7 @@ STATIC func_ptr __DTOR_LIST__[1] >>>>>> __attribute__((section(".dtors"), aligned(sizeof(func_ptr)))) >>>>>> = { (func_ptr) (-1) }; >>>>>> #endif /* __DTOR_LIST__ alternatives */ >>>>>> +#endif /* NO_CTORS_DTORS_SECTIONS */ >>>>>> >>>>>> #ifdef USE_EH_FRAME_REGISTRY >>>>>> /* Stick a label at the beginning of the frame unwind info so we can >>>>>> register >>>>>> @@ -489,6 +494,9 @@ __do_global_ctors_1(void) >>>>>> >>>>>> #elif defined(CRT_END) /* ! CRT_BEGIN */ >>>>>> >>>>>> +/* No need for .ctors/.dtors section if linker can place them in >>>>>> + .init_array/.fini_array section. */ >>>>>> +#ifndef NO_CTORS_DTORS_SECTIONS >>>>>> /* Put a word containing zero at the end of each of our two lists of >>>>>> function >>>>>> addresses. Note that the words defined here go into the .ctors and >>>>>> .dtors >>>>>> sections of the crtend.o file, and since that file is always linked >>>>>> in >>>>>> @@ -534,6 +542,7 @@ STATIC func_ptr __DTOR_END__[1] >>>>>> __attribute__((used, section(".dtors"), aligned(sizeof(func_ptr)))) >>>>>> = { (func_ptr) 0 }; >>>>>> #endif >>>>>> +#endif /* NO_CTORS_DTORS_SECTIONS */ >>>>>> >>>>>> #ifdef EH_FRAME_SECTION_NAME >>>>>> /* Terminate the frame unwind info section with a 4byte 0 as a sentinel; >>>>> >>>>> I don't see how you can do this. It would IMO break any time you link >>>>> code >>>>> built by different gcc versions where some code emitted by the older gcc >>>>> used .ctors or .dtors. >>>> >>>> crtstuff.c is used to generate crt*.o, which is the part of GCC. You only >>>> use >>>> it with the GCC you are using. Since your GCC doesn't put anything in >>>> .ctors/.dtors section, you don't need them. As for .o files generated by >>>> old GCCs, that is the linker test, use_initfini_array, is for. The newer >>>> linker >>>> can put input .ctors/.dtors sections in output .init_array/,fini_array >>>> sections. >>>> >>>> >>> >>> Here is the updated patch. Any comments? >>> >>> Thanks. >>> >>> -- >>> H.J. >>> --- >>> 2011-07-22 H.J. Lu <hongjiu...@intel.com> >>> >>> PR target/46770 >>> * config.gcc (use_initfini_array): New variable. >>> Use .init_arary/.fini_array if they are supported. >>> >>> * crtstuff.c: Don't generate .ctors nor .dtors sections if >>> USE_INITFINI_ARRAY is defined. >>> >>> * output.h (default_initfini_array_init_sections): New. >>> * varasm.c (elf_init_array_section): Likewise. >>> (elf_fini_array_section): Likewise. >>> (get_elf_initfini_array_priority_section): Likewise. >>> (default_elf_init_array_asm_out_constructor): Likewise. >>> (default_elf_fini_array_asm_out_destructor): Likewise. >>> (default_initfini_array_init_sections): Likewise. >>> >>> * config/initfini-array.h: New. >>> * config/t-initfini-array: Likewise. >>> >> >> No need for config/t-initfini-array. Here is the updated patch. >> >> >> -- >> H.J. >> ---- >> 2011-07-22 H.J. Lu <hongjiu...@intel.com> >> >> PR target/46770 >> * config.gcc (use_initfini_array): New variable. >> Use .init_arary/.fini_array if they are supported. >> >> * crtstuff.c: Don't generate .ctors nor .dtors sections if >> USE_INITFINI_ARRAY is defined. >> >> * output.h (default_initfini_array_init_sections): New. >> * varasm.c (elf_init_array_section): Likewise. >> (elf_fini_array_section): Likewise. >> (get_elf_initfini_array_priority_section): Likewise. >> (default_elf_init_array_asm_out_constructor): Likewise. >> (default_elf_fini_array_asm_out_destructor): Likewise. >> (default_initfini_array_init_sections): Likewise. >> >> * config/initfini-array.h: New. >> >> * config/arm/arm.c (arm_asm_init_sections): Call >> default_initfini_array_init_sections. >> * config/avr/avr.c (avr_asm_init_sections): Likewise. >> * config/ia64/ia64.c (ia64_asm_init_sections): Likewise. >> * config/mep/mep.c (mep_asm_init_sections): Likewise. >> * config/microblaze/microblaze.c (microblaze_elf_asm_init_sections): >> Likewise. >> * config/rs6000/rs6000.c (rs6000_elf_asm_init_sections): Likewise. >> * config/stormy16/stormy16.c (xstormy16_asm_init_sections): >> Likewise. >> * config/v850/v850.c (v850_asm_init_sections): Likewise. >> > > > > -- > H.J. >
-- H.J.