[GOLD][PATCH] exempt ARM from test initpri3b
Doug Kwan (關振德)
dougkwan@google.com
Fri Mar 16 09:40:00 GMT 2012
Hi Ian,
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
-Doug
-----------------------------------------------
2012-03-16 Doug Kwan <dougkwan@google.com>
* testsuite/Makefile.am (initpri3b_CFLAGS): New.
* testsuite/Makefile.in: Regenerate.
* testsuite/initpri3.c: Skip check for ARM target if
--no-ctors-in-init-array linker option is used.
-------------- next part --------------
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 09:11:51 -0000
@@ -875,6 +875,7 @@ initpri3a_LDADD =
check_PROGRAMS += initpri3b
initpri3b_SOURCES = initpri3.c
+initpri3b_CFLAGS = -DNO_CTORS_IN_INIT_ARRAY
initpri3b_DEPENDENCIES = gcctestdir/ld
initpri3b_LDFLAGS = -Bgcctestdir/ -Wl,--no-ctors-in-init-array
initpri3b_LDADD =
Index: gold/testsuite/initpri3.c
===================================================================
RCS file: /cvs/src/src/gold/testsuite/initpri3.c,v
retrieving revision 1.1
diff -u -u -p -r1.1 initpri3.c
--- gold/testsuite/initpri3.c 25 Jun 2011 00:40:56 -0000 1.1
+++ gold/testsuite/initpri3.c 16 Mar 2012 09:11:51 -0000
@@ -75,6 +75,10 @@ void (*dtors[]) (void)
int
main (void)
{
+ /* ARM does not use .ctors and .dtors sections. This test
+ fails if --no-ctors-in-init-array is used. */
+#if !defined(__arm__) || !defined(NO_CTORS_IN_INIT_ARRAY)
assert (i == 3);
+#endif
return 0;
}
More information about the Binutils
mailing list