[GOLD][PATCH] exempt ARM from test initpri3b

Doug Kwan (關振德) dougkwan@google.com
Fri Mar 16 20:08:00 GMT 2012


Hi

   This is a revised patch.  It just disables the test unconditionally.

-Doug

2012-03-16  Doug Kwan  <dougkwan@google.com>

        * testsuite/Makefile.am: Disable test initpri3b.
        * testsuite/Makefile.in: Regenerate.


On Fri, Mar 16, 2012 at 6:42 AM, Ian Lance Taylor <iant@google.com> wrote:
> "Doug Kwan (關振德)" <dougkwan@google.com> writes:
>
>>     This patch make the test initpri3b a no-op for the ARM target.
>> The test uses the --no-ctors-in-init-array option.  This test cannot
>> pass on ARM target because it does not use .ctors and .dtors sections.
>>  The function  __do_global_ctors_aux() in crtBegin*.o does not check
>> the constructor on ARM because all constructors should be in the
>> .init_array section.
>>
>> #ifdef INIT_ARRAY_SECTION_ASM_OP
>>
>> /* If we are using .init_array, there is nothing to do.  */
>>
>> #elif defined(INIT_SECTION_ASM_OP)
>>
>> #ifdef OBJECT_FORMAT_ELF
>> static void __attribute__((used))
>> __do_global_ctors_aux (void)
>> {
>>   func_ptr *p;
>>   for (p = __CTOR_END__ - 1; *p != (func_ptr) -1; p--)
>>     (*p) ();
>> }
>>
>> The macro  INIT_ARRAY_SECTION_ASM_OP is defined in gcc/config/arm/bpabi.h:
>>
>> /* The BPABI specifies the use of .{init,fini}_array.  Therefore, we
>>    do not want GCC to put anything into the .{init,fini} sections.  */
>> #undef INIT_SECTION_ASM_OP
>> #undef FINI_SECTION_ASM_OP
>> #define INIT_ARRAY_SECTION_ASM_OP ARM_EABI_CTORS_SECTION_OP
>> #define FINI_ARRAY_SECTION_ASM_OP ARM_EABI_DTORS_SECTION_OP
>
>
> Thanks--the truth is we need a better fix here, because even on non-ARM
> platforms gcc may be configured to put all constructors into the
> .init_array section.  So this test really needs a configure test to see
> whether it works at all.
>
> Given that gcc is moving toward using .init_array in all cases I think
> we should probably just comment out the test with a comment explaining
> why.  I'll preapprove that patch if you want to write it.
>
> Ian
-------------- next part --------------
? gold/autom4te.cache
Index: gold/testsuite/Makefile.am
===================================================================
RCS file: /cvs/src/src/gold/testsuite/Makefile.am,v
retrieving revision 1.188
diff -u -u -p -r1.188 Makefile.am
--- gold/testsuite/Makefile.am	16 Feb 2012 19:37:33 -0000	1.188
+++ gold/testsuite/Makefile.am	16 Mar 2012 19:51:26 -0000
@@ -873,11 +873,16 @@ initpri3a_DEPENDENCIES = gcctestdir/ld
 initpri3a_LDFLAGS = -Bgcctestdir/
 initpri3a_LDADD =
 
-check_PROGRAMS += initpri3b
-initpri3b_SOURCES = initpri3.c
-initpri3b_DEPENDENCIES = gcctestdir/ld
-initpri3b_LDFLAGS = -Bgcctestdir/ -Wl,--no-ctors-in-init-array
-initpri3b_LDADD =
+# This test fails on targets not using .ctors and .dtors sections (e.g. ARM
+# EABI). Given that gcc is moving towards using .init_array in all cases,
+# this test is commented out.  A better fix would be checking whether gcc
+# uses .ctors or .init_array sections in configure.
+
+# check_PROGRAMS += initpri3b
+# initpri3b_SOURCES = initpri3.c
+# initpri3b_DEPENDENCIES = gcctestdir/ld
+# initpri3b_LDFLAGS = -Bgcctestdir/ -Wl,--no-ctors-in-init-array
+# initpri3b_LDADD =
 
 # Test --detect-odr-violations
 check_SCRIPTS += debug_msg.sh


More information about the Binutils mailing list