diff mbox

[roland/arm-aeabi] ARM: Move more aeabi routine magic out of Linux-specific directories

Message ID 20140626214443.B9EC92C39BC@topped-with-meat.com
State New
Headers show

Commit Message

Roland McGrath June 26, 2014, 9:44 p.m. UTC
The AEABI magic is not really Linux-specific.  With this, a non-linux ARM
configuration is obliged to supply an aeabi_read_tp.S file, but the rest of
the related stuff is OS-independent.

Verified on arm-linux-gnueabihf that no code changes.

OK?


Thanks,
Roland


	* sysdeps/unix/sysv/linux/arm/libc-aeabi_read_tp.S: Moved ...
	* sysdeps/arm/libc-aeabi_read_tp.S: ... here.
	* sysdeps/arm/Makefile [$(subdir) = csu]
	(aeabi_routines): Add aeabi_read_tp and libc-aeabi_read_tp here.
	(static-only-routines): Add aeabi_read_tp here.
	(shared-only-routines): Add libc-aeabi_read_tp here.
	(CFLAGS-libc-start.c): Add -fexceptions here.
	* sysdeps/unix/sysv/linux/arm/Makefile [$(subdir) = csu]
	(sysdep_routines, static-only-routines, shared-only-routines):
	Don't add to these here.
	(CFLAGS-libc-start.c): Likewise.

	* sysdeps/unix/sysv/linux/arm/nptl-aeabi_unwind_cpp_pr1.c: Moved ...
	* sysdeps/arm/nptl-aeabi_unwind_cpp_pr1.c: ... here.
	* sysdeps/unix/sysv/linux/arm/rt-aeabi_unwind_cpp_pr1.c: Moved ...
	* sysdeps/arm/rt-aeabi_unwind_cpp_pr1.c: ... here.
	* sysdeps/arm/Makefile [$(subdir) = rt]
	(librt-sysdep_routines, librt-shared-only-routines):
	Append rt-aeabi_unwind_cpp_pr1 here.
	* sysdeps/unix/sysv/linux/arm/Makefile [$(subdir) = rt]
	(librt-sysdep_routines, librt-shared-only-routines): Don't do it here.
	* sysdeps/arm/nptl/Makefile [$(subdir) = nptl]
	(libpthread-sysdep_routines, libpthread-shared-only-routines):
	Append nptl-aeabi_unwind_cpp_pr1 here.
	(tests): Filter out tst-cleanupx4 here.
	* sysdeps/unix/sysv/linux/arm/Makefile [$(subdir) = nptl]
	(libpthread-sysdep_routines, libpthread-shared-only-routines, tests):
	Don't do those here.

Comments

Joseph Myers June 26, 2014, 10:03 p.m. UTC | #1
On Thu, 26 Jun 2014, Roland McGrath wrote:

> diff --git a/sysdeps/arm/nptl/Makefile b/sysdeps/arm/nptl/Makefile
> index 143850e..2c31e76 100644
> --- a/sysdeps/arm/nptl/Makefile
> +++ b/sysdeps/arm/nptl/Makefile
> @@ -18,3 +18,16 @@
>  ifeq ($(subdir),csu)
>  gen-as-const-headers += tcb-offsets.sym
>  endif
> +
> +ifeq ($(subdir),nptl)
> +libpthread-sysdep_routines += nptl-aeabi_unwind_cpp_pr1
> +libpthread-shared-only-routines += nptl-aeabi_unwind_cpp_pr1
> +
> +# This test relies on compiling part of the binary with EH information,
> +# part without, and unwinding through.  The .ARM.exidx tables have
> +# start addresses for EH regions, but no end addresses.  Every
> +# region an exception needs to propogate through must have unwind
> +# information, or a previous function's unwind table may be used
> +# by mistake.
> +tests := $(filter-out tst-cleanupx4,$(tests))

You appear to be copying this tests change, and the libpthread-* 
additions, from sysdeps/unix/sysv/linux/arm/Makefile but without removing 
it from that file, so leaving duplicate copies.  OK with the duplicates 
removed (of course the libc-do-syscall additions to libpthread-* need to 
remain behind in sysdeps/unix/sysv/linux/arm/Makefile), presuming that 
works.

(The unwind info issue described shouldn't apply with binutils postdating

2009-05-05  Paul Brook  <paul@codesourcery.com>

        * bfd-in.h (elf32_arm_fix_exidx_coverage): Add prototype.
        * bfd-in2.h: Regenerate.
        * elf32-arm.c (arm_unwind_edit_type, arm_unwind_table_edit): Define.
        (_arm_elf_section_data): Add text and exidx fields.
        (add_unwind_table_edit, get_arm_elf_section_data, adjust_exidx_size,
        insert_cantunwind_after, elf32_arm_fix_exidx_coverage, offset_prel31,
        copy_exidx_entry): New functions.
        (elf32_arm_write_section): Fixup .ARM.exidx contents.

which includes all supported binutils versions - but that's a separate 
matter, and it may be that the explicit cantunwind markers on intermediate 
frames aren't sufficient for the test to work, just for it not to use 
other functions' unwind info accidentally.)
Roland McGrath June 26, 2014, 10:10 p.m. UTC | #2
> You appear to be copying this tests change, and the libpthread-* 
> additions, from sysdeps/unix/sysv/linux/arm/Makefile but without removing 
> it from that file, so leaving duplicate copies.  OK with the duplicates 
> removed (of course the libc-do-syscall additions to libpthread-* need to 
> remain behind in sysdeps/unix/sysv/linux/arm/Makefile), presuming that 
> works.

Oops.  Removed those and committed.

> (The unwind info issue described shouldn't apply with binutils postdating
> 
> 2009-05-05  Paul Brook  <paul@codesourcery.com>
> 
>         * bfd-in.h (elf32_arm_fix_exidx_coverage): Add prototype.
>         * bfd-in2.h: Regenerate.
>         * elf32-arm.c (arm_unwind_edit_type, arm_unwind_table_edit): Define.
>         (_arm_elf_section_data): Add text and exidx fields.
>         (add_unwind_table_edit, get_arm_elf_section_data, adjust_exidx_size,
>         insert_cantunwind_after, elf32_arm_fix_exidx_coverage, offset_prel31,
>         copy_exidx_entry): New functions.
>         (elf32_arm_write_section): Fixup .ARM.exidx contents.
> 
> which includes all supported binutils versions - but that's a separate 
> matter, and it may be that the explicit cantunwind markers on intermediate 
> frames aren't sufficient for the test to work, just for it not to use 
> other functions' unwind info accidentally.)

OK.  That is indeed orthogonal.  If it's unnecessary and can be removed,
then please do that later.


Thanks,
Roland
diff mbox

Patch

diff --git a/sysdeps/arm/Makefile b/sysdeps/arm/Makefile
index a138048..db60a17 100644
--- a/sysdeps/arm/Makefile
+++ b/sysdeps/arm/Makefile
@@ -38,11 +38,18 @@  ifeq ($(subdir),csu)
 gen-as-const-headers += rtld-global-offsets.sym tlsdesc.sym
 aeabi_constants = aeabi_lcsts aeabi_sighandlers aeabi_math
 aeabi_routines = aeabi_assert aeabi_localeconv aeabi_errno_addr \
-	aeabi_mb_cur_max aeabi_atexit aeabi_memclr aeabi_memcpy \
-	aeabi_memmove aeabi_memset
+		 aeabi_mb_cur_max aeabi_atexit aeabi_memclr aeabi_memcpy \
+		 aeabi_memmove aeabi_memset \
+		 aeabi_read_tp libc-aeabi_read_tp
 
 sysdep_routines += $(aeabi_constants) $(aeabi_routines)
-static-only-routines += $(aeabi_constants)
+static-only-routines += $(aeabi_constants) aeabi_read_tp
+shared-only-routines += libc-aeabi_read_tp
+
+# In order for unwinding to fail when it falls out of main, we need a
+# cantunwind marker.  There's one in start.S.  To make sure we reach it, add
+# unwind tables for __libc_start_main.
+CFLAGS-libc-start.c += -fexceptions
 endif
 
 ifeq ($(subdir),gmon)
@@ -52,3 +59,8 @@  endif
 ifeq ($(subdir),debug)
 CFLAGS-backtrace.c += -funwind-tables
 endif
+
+ifeq ($(subdir),rt)
+librt-sysdep_routines += rt-aeabi_unwind_cpp_pr1
+librt-shared-only-routines += rt-aeabi_unwind_cpp_pr1
+endif
diff --git a/sysdeps/unix/sysv/linux/arm/libc-aeabi_read_tp.S b/sysdeps/arm/libc-aeabi_read_tp.S
similarity index 100%
rename from sysdeps/unix/sysv/linux/arm/libc-aeabi_read_tp.S
rename to sysdeps/arm/libc-aeabi_read_tp.S
diff --git a/sysdeps/unix/sysv/linux/arm/nptl-aeabi_unwind_cpp_pr1.c b/sysdeps/arm/nptl-aeabi_unwind_cpp_pr1.c
similarity index 100%
rename from sysdeps/unix/sysv/linux/arm/nptl-aeabi_unwind_cpp_pr1.c
rename to sysdeps/arm/nptl-aeabi_unwind_cpp_pr1.c
diff --git a/sysdeps/arm/nptl/Makefile b/sysdeps/arm/nptl/Makefile
index 143850e..2c31e76 100644
--- a/sysdeps/arm/nptl/Makefile
+++ b/sysdeps/arm/nptl/Makefile
@@ -18,3 +18,16 @@ 
 ifeq ($(subdir),csu)
 gen-as-const-headers += tcb-offsets.sym
 endif
+
+ifeq ($(subdir),nptl)
+libpthread-sysdep_routines += nptl-aeabi_unwind_cpp_pr1
+libpthread-shared-only-routines += nptl-aeabi_unwind_cpp_pr1
+
+# This test relies on compiling part of the binary with EH information,
+# part without, and unwinding through.  The .ARM.exidx tables have
+# start addresses for EH regions, but no end addresses.  Every
+# region an exception needs to propogate through must have unwind
+# information, or a previous function's unwind table may be used
+# by mistake.
+tests := $(filter-out tst-cleanupx4,$(tests))
+endif
diff --git a/sysdeps/unix/sysv/linux/arm/rt-aeabi_unwind_cpp_pr1.c b/sysdeps/arm/rt-aeabi_unwind_cpp_pr1.c
similarity index 100%
rename from sysdeps/unix/sysv/linux/arm/rt-aeabi_unwind_cpp_pr1.c
rename to sysdeps/arm/rt-aeabi_unwind_cpp_pr1.c
diff --git a/sysdeps/unix/sysv/linux/arm/Makefile b/sysdeps/unix/sysv/linux/arm/Makefile
index 38275cd..142bca3 100644
--- a/sysdeps/unix/sysv/linux/arm/Makefile
+++ b/sysdeps/unix/sysv/linux/arm/Makefile
@@ -1,14 +1,3 @@ 
-ifeq ($(subdir),csu)
-# In order for unwinding to fail when it falls out of main, we need a
-# cantunwind marker.  There's one in start.S.  To make sure we reach it, add
-# unwind tables for __libc_start_main.
-CFLAGS-libc-start.c += -fexceptions
-
-sysdep_routines += aeabi_read_tp libc-aeabi_read_tp
-static-only-routines += aeabi_read_tp
-shared-only-routines += libc-aeabi_read_tp
-endif
-
 ifeq ($(subdir),elf)
 sysdep-rtld-routines += aeabi_read_tp libc-do-syscall
 endif
@@ -37,8 +26,8 @@  libcrypt-sysdep_routines += libc-do-syscall
 endif
 
 ifeq ($(subdir),rt)
-librt-sysdep_routines += libc-do-syscall rt-aeabi_unwind_cpp_pr1
-librt-shared-only-routines += libc-do-syscall rt-aeabi_unwind_cpp_pr1
+librt-sysdep_routines += libc-do-syscall
+librt-shared-only-routines += libc-do-syscall
 endif
 
 ifeq ($(subdir),nptl)