This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [GOLD][PATCH] exempt ARM from test initpri3b
"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