diff options
author | Nick Clifton <nickc@redhat.com> | 2013-07-18 11:24:11 +0000 |
---|---|---|
committer | Nick Clifton <nickc@redhat.com> | 2013-07-18 11:24:11 +0000 |
commit | 7a89b94e91a52b13d59638ca8d733f841c7fdbdb (patch) | |
tree | 06f28bcfe1bb523193a89ed01ac9791bc7551c96 | |
parent | 9f758fdc2205450850c83e10a231cc434807c333 (diff) | |
download | ppe42-binutils-7a89b94e91a52b13d59638ca8d733f841c7fdbdb.tar.gz ppe42-binutils-7a89b94e91a52b13d59638ca8d733f841c7fdbdb.zip |
* elf32-arm.c (elf32_arm_stub_long_branch_arm_nacl): New variable.
(elf32_arm_stub_long_branch_arm_nacl_pic): New variable.
(arm_build_one_stub): Increase MAXRELOCS to 3.
(arm_type_of_stub): Use them if GLOBALS->nacl_p.
(struct elf32_arm_link_hash_table): Give add_stub_section member's
pointee type a third argument.
(elf32_arm_create_or_find_stub_sec): Update caller.
(elf32_arm_size_stubs): Update argument type.
* bfd-in.h (elf32_arm_size_stubs): Update decl.
* bfd-in2.h: Regenerate.
* libbfd.h: Regenerate.
* emultempl/armelf.em (elf32_arm_add_stub_section): Take third
argument ALIGNMENT_POWER, use it instead of constant 3.
* ld-arm/farcall-arm-nacl.d: New file.
* ld-arm/farcall-arm-nacl-pic.d: New file.
* ld-arm/farcall-data-nacl.d: New file.
* ld-arm/arm-elf.exp (armeabitests_common): Add extra element to
"action" lists for those cases to use a different dump file for NaCl
targets.
Massage $armeabitests_common to drop the extra element or the one
before it, depending on [istarget "arm*-*-nacl*"].
* ld-arm/arm-elf.exp (armelftests_common): Move all "Cortex-A8
erratum fix", Thumb-only and interworking cases to ...
(armelftests_nonacl): ... here.
(armeabitests_common): Move all "erratum 760522 fix", Thumb-only
and interworking cases to ...
(armeabitests_nonacl): ... here.
-rw-r--r-- | bfd/ChangeLog | 14 | ||||
-rw-r--r-- | bfd/bfd-in.h | 10 | ||||
-rw-r--r-- | bfd/bfd-in2.h | 10 | ||||
-rw-r--r-- | bfd/elf32-arm.c | 51 | ||||
-rw-r--r-- | ld/ChangeLog | 5 | ||||
-rw-r--r-- | ld/emultempl/armelf.em | 11 | ||||
-rw-r--r-- | ld/testsuite/ChangeLog | 18 | ||||
-rw-r--r-- | ld/testsuite/ld-arm/arm-elf.exp | 372 | ||||
-rw-r--r-- | ld/testsuite/ld-arm/farcall-arm-nacl-pic.d | 20 | ||||
-rw-r--r-- | ld/testsuite/ld-arm/farcall-arm-nacl.d | 20 | ||||
-rw-r--r-- | ld/testsuite/ld-arm/farcall-data-nacl.d | 24 |
11 files changed, 360 insertions, 195 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 153dc1f1e8..28572a5093 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,17 @@ +2013-07-18 Roland McGrath <mcgrathr@google.com> + + * elf32-arm.c (elf32_arm_stub_long_branch_arm_nacl): New variable. + (elf32_arm_stub_long_branch_arm_nacl_pic): New variable. + (arm_build_one_stub): Increase MAXRELOCS to 3. + (arm_type_of_stub): Use them if GLOBALS->nacl_p. + (struct elf32_arm_link_hash_table): Give add_stub_section member's + pointee type a third argument. + (elf32_arm_create_or_find_stub_sec): Update caller. + (elf32_arm_size_stubs): Update argument type. + * bfd-in.h (elf32_arm_size_stubs): Update decl. + * bfd-in2.h: Regenerate. + * libbfd.h: Regenerate. + 2013-07-15 Maciej W. Rozycki <macro@codesourcery.com> * elfxx-mips.c (mips_elf_merge_obj_attributes): Replace hardcoded diff --git a/bfd/bfd-in.h b/bfd/bfd-in.h index 579b007f31..36db67bf74 100644 --- a/bfd/bfd-in.h +++ b/bfd/bfd-in.h @@ -1,8 +1,6 @@ /* Main header file for the bfd library -- portable access to object files. - Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, - 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, - 2012 Free Software Foundation, Inc. + Copyright 1990-2013 2013 Free Software Foundation, Inc. Contributed by Cygnus Support. @@ -911,7 +909,8 @@ extern void elf32_arm_next_input_section (struct bfd_link_info *, struct bfd_section *); extern bfd_boolean elf32_arm_size_stubs (bfd *, bfd *, struct bfd_link_info *, bfd_signed_vma, - struct bfd_section * (*) (const char *, struct bfd_section *), void (*) (void)); + struct bfd_section * (*) (const char *, struct bfd_section *, unsigned int), + void (*) (void)); extern bfd_boolean elf32_arm_build_stubs (struct bfd_link_info *); @@ -1009,6 +1008,5 @@ struct coff_comdat_info long symbol; }; -extern struct coff_comdat_info *bfd_coff_get_comdat_section +extern struct coff_comdat_info * bfd_coff_get_comdat_section (bfd *, struct bfd_section *); - diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h index 1712f12c15..0cf9a2966c 100644 --- a/bfd/bfd-in2.h +++ b/bfd/bfd-in2.h @@ -7,9 +7,7 @@ /* Main header file for the bfd library -- portable access to object files. - Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, - 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, - 2012 Free Software Foundation, Inc. + Copyright 1990-2013 2013 Free Software Foundation, Inc. Contributed by Cygnus Support. @@ -918,7 +916,8 @@ extern void elf32_arm_next_input_section (struct bfd_link_info *, struct bfd_section *); extern bfd_boolean elf32_arm_size_stubs (bfd *, bfd *, struct bfd_link_info *, bfd_signed_vma, - struct bfd_section * (*) (const char *, struct bfd_section *), void (*) (void)); + struct bfd_section * (*) (const char *, struct bfd_section *, unsigned int), + void (*) (void)); extern bfd_boolean elf32_arm_build_stubs (struct bfd_link_info *); @@ -1016,9 +1015,8 @@ struct coff_comdat_info long symbol; }; -extern struct coff_comdat_info *bfd_coff_get_comdat_section +extern struct coff_comdat_info * bfd_coff_get_comdat_section (bfd *, struct bfd_section *); - /* Extracted from init.c. */ void bfd_init (void); diff --git a/bfd/elf32-arm.c b/bfd/elf32-arm.c index eef1b1361a..427ac6d1c0 100644 --- a/bfd/elf32-arm.c +++ b/bfd/elf32-arm.c @@ -2415,6 +2415,33 @@ static const insn_sequence elf32_arm_stub_long_branch_v4t_thumb_tls_pic[] = DATA_WORD (0, R_ARM_REL32, -4), /* dcd R_ARM_REL32(X) */ }; +/* NaCl ARM -> ARM long branch stub. */ +static const insn_sequence elf32_arm_stub_long_branch_arm_nacl[] = +{ + ARM_INSN (0xe59fc00c), /* ldr ip, [pc, #12] */ + ARM_INSN (0xe3ccc13f), /* bic ip, ip, #0xc000000f */ + ARM_INSN (0xe12fff1c), /* bx ip */ + ARM_INSN (0xe320f000), /* nop */ + ARM_INSN (0xe125be70), /* bkpt 0x5be0 */ + DATA_WORD (0, R_ARM_ABS32, 0), /* dcd R_ARM_ABS32(X) */ + DATA_WORD (0, R_ARM_NONE, 0), /* .word 0 */ + DATA_WORD (0, R_ARM_NONE, 0), /* .word 0 */ +}; + +/* NaCl ARM -> ARM long branch stub, PIC. */ +static const insn_sequence elf32_arm_stub_long_branch_arm_nacl_pic[] = +{ + ARM_INSN (0xe59fc00c), /* ldr ip, [pc, #12] */ + ARM_INSN (0xe08cc00f), /* add ip, ip, pc */ + ARM_INSN (0xe3ccc13f), /* bic ip, ip, #0xc000000f */ + ARM_INSN (0xe12fff1c), /* bx ip */ + ARM_INSN (0xe125be70), /* bkpt 0x5be0 */ + DATA_WORD (0, R_ARM_REL32, 8), /* dcd R_ARM_REL32(X+8) */ + DATA_WORD (0, R_ARM_NONE, 0), /* .word 0 */ + DATA_WORD (0, R_ARM_NONE, 0), /* .word 0 */ +}; + + /* Cortex-A8 erratum-workaround stubs. */ /* Stub used for conditional branches (which may be beyond +/-1MB away, so we @@ -2491,6 +2518,8 @@ static const insn_sequence elf32_arm_stub_a8_veneer_blx[] = DEF_STUB(long_branch_thumb_only_pic) \ DEF_STUB(long_branch_any_tls_pic) \ DEF_STUB(long_branch_v4t_thumb_tls_pic) \ + DEF_STUB(long_branch_arm_nacl) \ + DEF_STUB(long_branch_arm_nacl_pic) \ DEF_STUB(a8_veneer_b_cond) \ DEF_STUB(a8_veneer_b) \ DEF_STUB(a8_veneer_bl) \ @@ -2983,7 +3012,7 @@ struct elf32_arm_link_hash_table bfd *stub_bfd; /* Linker call-backs. */ - asection * (*add_stub_section) (const char *, asection *); + asection * (*add_stub_section) (const char *, asection *, unsigned int); void (*layout_sections_again) (void); /* Array to keep track of which stub sections have been created, and @@ -3772,9 +3801,13 @@ arm_type_of_stub (struct bfd_link_info *info, ? (r_type == R_ARM_TLS_CALL /* TLS PIC Stub */ ? arm_stub_long_branch_any_tls_pic - : arm_stub_long_branch_any_arm_pic) + : (globals->nacl_p + ? arm_stub_long_branch_arm_nacl_pic + : arm_stub_long_branch_any_arm_pic)) /* non-PIC stubs. */ - : arm_stub_long_branch_any_any; + : (globals->nacl_p + ? arm_stub_long_branch_arm_nacl + : arm_stub_long_branch_any_any); } } } @@ -3910,7 +3943,8 @@ elf32_arm_create_or_find_stub_sec (asection **link_sec_p, asection *section, memcpy (s_name, link_sec->name, namelen); memcpy (s_name + namelen, STUB_SUFFIX, sizeof (STUB_SUFFIX)); - stub_sec = (*htab->add_stub_section) (s_name, link_sec); + stub_sec = (*htab->add_stub_section) (s_name, link_sec, + htab->nacl_p ? 4 : 3); if (stub_sec == NULL) return NULL; htab->stub_group[link_sec->id].stub_sec = stub_sec; @@ -4043,6 +4077,10 @@ arm_stub_required_alignment (enum elf32_arm_stub_type stub_type) case arm_stub_a8_veneer_blx: return 4; + case arm_stub_long_branch_arm_nacl: + case arm_stub_long_branch_arm_nacl_pic: + return 16; + default: abort (); /* Should be unreachable. */ } @@ -4052,7 +4090,7 @@ static bfd_boolean arm_build_one_stub (struct bfd_hash_entry *gen_entry, void * in_arg) { -#define MAXRELOCS 2 +#define MAXRELOCS 3 struct elf32_arm_stub_hash_entry *stub_entry; struct elf32_arm_link_hash_table *globals; struct bfd_link_info *info; @@ -4864,7 +4902,8 @@ elf32_arm_size_stubs (bfd *output_bfd, bfd *stub_bfd, struct bfd_link_info *info, bfd_signed_vma group_size, - asection * (*add_stub_section) (const char *, asection *), + asection * (*add_stub_section) (const char *, asection *, + unsigned int), void (*layout_sections_again) (void)) { bfd_size_type stub_group_size; diff --git a/ld/ChangeLog b/ld/ChangeLog index 08ac0857ea..f5671b4e99 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,8 @@ +2013-07-18 Roland McGrath <mcgrathr@google.com> + + * emultempl/armelf.em (elf32_arm_add_stub_section): Take third + argument ALIGNMENT_POWER, use it instead of constant 3. + 2013-07-08 Jeff Law <law@redhat.com> * scripttempl/elf.sc: Handle function names and other text after diff --git a/ld/emultempl/armelf.em b/ld/emultempl/armelf.em index 7f7d2cc00f..eee6af1259 100644 --- a/ld/emultempl/armelf.em +++ b/ld/emultempl/armelf.em @@ -1,7 +1,5 @@ # This shell script emits a C file. -*- C -*- -# Copyright 1991, 1993, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, -# 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 -# Free Software Foundation, Inc. +# Copyright 1991-2013 Free Software Foundation, Inc. # # This file is part of the GNU Binutils. # @@ -184,8 +182,9 @@ hook_in_stub (struct hook_stub_info *info, lang_statement_union_type **lp) immediately after INPUT_SECTION. */ static asection * -elf32_arm_add_stub_section (const char *stub_sec_name, - asection *input_section) +elf32_arm_add_stub_section (const char * stub_sec_name, + asection * input_section, + unsigned int alignment_power) { asection *stub_sec; flagword flags; @@ -201,7 +200,7 @@ elf32_arm_add_stub_section (const char *stub_sec_name, if (stub_sec == NULL) goto err_ret; - bfd_set_section_alignment (stub_file->the_bfd, stub_sec, 3); + bfd_set_section_alignment (stub_file->the_bfd, stub_sec, alignment_power); output_section = input_section->output_section; secname = bfd_get_section_name (output_section->owner, output_section); diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog index febe691042..652474d7f3 100644 --- a/ld/testsuite/ChangeLog +++ b/ld/testsuite/ChangeLog @@ -1,3 +1,21 @@ +2013-07-18 Roland McGrath <mcgrathr@google.com> + + * ld-arm/farcall-arm-nacl.d: New file. + * ld-arm/farcall-arm-nacl-pic.d: New file. + * ld-arm/farcall-data-nacl.d: New file. + * ld-arm/arm-elf.exp (armeabitests_common): Add extra element to + "action" lists for those cases to use a different dump file for NaCl + targets. + Massage $armeabitests_common to drop the extra element or the one + before it, depending on [istarget "arm*-*-nacl*"]. + + * ld-arm/arm-elf.exp (armelftests_common): Move all "Cortex-A8 + erratum fix", Thumb-only and interworking cases to ... + (armelftests_nonacl): ... here. + (armeabitests_common): Move all "erratum 760522 fix", Thumb-only + and interworking cases to ... + (armeabitests_nonacl): ... here. + 2013-07-12 Maciej W. Rozycki <macro@codesourcery.com> * ld-mips-elf/nan-2008.d: New test. diff --git a/ld/testsuite/ld-arm/arm-elf.exp b/ld/testsuite/ld-arm/arm-elf.exp index fd8a5993a9..dda9251a46 100644 --- a/ld/testsuite/ld-arm/arm-elf.exp +++ b/ld/testsuite/ld-arm/arm-elf.exp @@ -70,9 +70,6 @@ set armelftests_common { {"Group relocations" "-Ttext 0x8000 --section-start zero=0x0 --section-start alpha=0xeef0 --section-start beta=0xffeef0" "" "" {group-relocs.s} {{objdump -dr group-relocs.d}} "group-relocs"} - {"Thumb-1 BL" "-Ttext 0x1000 --section-start .foo=0x401000" "" "" {thumb1-bl.s} - {{objdump -dr thumb1-bl.d}} - "thumb1-bl"} {"Indirect cross-library function reference (set-up)" "-shared" "" "" {arm-lib-plt-2a.s} {} @@ -144,12 +141,6 @@ set armelftests_common { {"TLS local PIC symbol static link" "-T arm.ld" "" "" {tls-local-static.s} {{objdump -fdw tls-local-static.d}} "tls-local-static"} - {"Thumb entry point" "-T arm.ld" "" "" {thumb-entry.s} - {{readelf -h thumb-entry.d}} - "thumb-entry"} - {"thumb-rel32" "-static -T arm.ld" "" "" {thumb-rel32.s} - {{objdump -s thumb-rel32.d}} - "thumb-rel32"} {"MOVW/MOVT" "-static -T arm.ld" "" "" {arm-movwt.s} {{objdump -dw arm-movwt.d}} "arm-movwt"} @@ -168,79 +159,9 @@ set armelftests_common { "-EL --vfp11-denorm-fix=scalar -Ttext=0x8000" "" "-EL -mfpu=vfpxd" {vfp11-fix-none.s} {{objdump -dr vfp11-fix-none.d}} "vfp11-fix-none"} - {"Cortex-A8 erratum fix, b.w" - "-EL -Ttext=0x8f00 --fix-cortex-a8" "" "-EL" {cortex-a8-fix-b.s} - {{objdump -dr cortex-a8-fix-b.d}} - "cortex-a8-fix-b"} - {"Cortex-A8 erratum fix, bl.w" - "-EL -Ttext=0x8f00 --fix-cortex-a8" "" "-EL" {cortex-a8-fix-bl.s} - {{objdump -dr cortex-a8-fix-bl.d}} - "cortex-a8-fix-bl"} - {"Cortex-A8 erratum fix, bcc.w" - "-EL -Ttext=0x8f00 --fix-cortex-a8" "" "-EL" {cortex-a8-fix-bcc.s} - {{objdump -dr cortex-a8-fix-bcc.d}} - "cortex-a8-fix-bcc"} - {"Cortex-A8 erratum fix, blx.w" - "-EL -Ttext=0x8f00 --fix-cortex-a8" "" "-EL" {cortex-a8-fix-blx.s} - {{objdump -dr cortex-a8-fix-blx.d}} - "cortex-a8-fix-blx"} - {"Cortex-A8 erratum fix, relocate b.w to ARM" - "-EL -Ttext=0x8f00 --fix-cortex-a8" "" "-EL" {cortex-a8-arm-target.s cortex-a8-fix-b-rel.s} - {{objdump -dr cortex-a8-fix-b-rel-arm.d}} - "cortex-a8-fix-b-rel-arm"} - {"Cortex-A8 erratum fix, relocate b.w to Thumb" - "-EL -Ttext=0x8f00 --fix-cortex-a8" "" "-EL" {cortex-a8-thumb-target.s cortex-a8-fix-b-rel.s} - {{objdump -dr cortex-a8-fix-b-rel-thumb.d}} - "cortex-a8-fix-b-rel-thumb"} - {"Cortex-A8 erratum fix, relocate bl.w to ARM" - "-EL -Ttext=0x8f00 --fix-cortex-a8" "" "-EL" {cortex-a8-arm-target.s cortex-a8-fix-bl-rel.s} - {{objdump -dr cortex-a8-fix-bl-rel-arm.d}} - "cortex-a8-fix-bl-rel-arm"} - {"Cortex-A8 erratum fix, relocate bl.w to Thumb" - "-EL -Ttext=0x8f00 --fix-cortex-a8" "" "-EL" {cortex-a8-thumb-target.s cortex-a8-fix-bl-rel.s} - {{objdump -dr cortex-a8-fix-bl-rel-thumb.d}} - "cortex-a8-fix-bl-rel-thumb"} - {"Cortex-A8 erratum fix, relocate b<cond>.w to Thumb" - "-EL -Ttext=0x8f00 --fix-cortex-a8" "" "-EL" {cortex-a8-thumb-target.s cortex-a8-fix-bcc-rel.s} - {{objdump -dr cortex-a8-fix-bcc-rel-thumb.d}} - "cortex-a8-fix-bcc-rel-thumb"} - {"Cortex-A8 erratum fix, relocate blx.w to ARM" - "-EL -Ttext=0x8f00 --fix-cortex-a8" "" "-EL" {cortex-a8-arm-target.s cortex-a8-fix-blx-rel.s} - {{objdump -dr cortex-a8-fix-blx-rel-arm.d}} - "cortex-a8-fix-blx-rel-arm"} - {"Cortex-A8 erratum fix, relocate blx.w to Thumb" - "-EL -Ttext=0x8f00 --fix-cortex-a8" "" "-EL" {cortex-a8-thumb-target.s cortex-a8-fix-blx-rel.s} - {{objdump -dr cortex-a8-fix-blx-rel-thumb.d}} - "cortex-a8-fix-blx-rel-thumb"} - {"Cortex-A8 erratum fix, relocate bl.w and far call" - "-EL -Ttext=0x00 --fix-cortex-a8 --defsym _start=0" "" - "-EL -mcpu=cortex-a8" {cortex-a8-far-1.s cortex-a8-far-2.s cortex-a8-far-3.s} - {{objdump -dr cortex-a8-far.d}} - "cortex-a8-far"} - {"Cortex-A8 erratum fix, headers" - "-EL --fix-cortex-a8 -T cortex-a8-fix-hdr.t" "" - "-EL -mcpu=cortex-a8" {cortex-a8-fix-hdr.s} - {{objdump -dr cortex-a8-fix-hdr.d}} - "cortex-a8-fix-hdr"} - {"Cortex-A8 erratum fix, blx.w and b<cond>.w together" - "-EL -Ttext=0x8f00 --fix-cortex-a8" "" "-EL" {cortex-a8-fix-blx-bcond.s} - {{objdump -dr cortex-a8-fix-blx-bcond.d}} - "cortex-a8-fix-blx-bcond"} {"Unwinding and -gc-sections" "-gc-sections" "" "" {gc-unwind.s} {{objdump -sj.data gc-unwind.d}} "gc-unwind"} - {"Thumb and -gc-sections" "-shared -T arm-dyn.ld" "" "" {gc-thumb-lib.s} - {} - "gc-thumb-lib.so"} - {"Thumb and -gc-sections" "-pie -T arm.ld -gc-sections tmpdir/gc-thumb-lib.so" "" "" {gc-thumb.s} - {{readelf --relocs gc-thumb.d}} - "gc-thumb"} - {"arm-pic-veneer" "-static -T arm.ld --pic-veneer" "" "" {arm-pic-veneer.s} - {{objdump -d arm-pic-veneer.d}} - "arm-pic-veneer"} - {"jump19" "-static -T arm.ld" "" "" {jump19.s} - {{objdump -dr jump19.d}} - "jump19"} {"script-type" "-static -T script-type.ld" "" "" {script-type.s} {{readelf -s script-type.sym}} "script-type"} @@ -291,6 +212,28 @@ set armelftests_common { } set armelftests_nonacl { + {"Thumb-1 BL" "-Ttext 0x1000 --section-start .foo=0x401000" "" "" {thumb1-bl.s} + {{objdump -dr thumb1-bl.d}} + "thumb1-bl"} + {"Thumb entry point" "-T arm.ld" "" "" {thumb-entry.s} + {{readelf -h thumb-entry.d}} + "thumb-entry"} + {"thumb-rel32" "-static -T arm.ld" "" "" {thumb-rel32.s} + {{objdump -s thumb-rel32.d}} + "thumb-rel32"} + {"jump19" "-static -T arm.ld" "" "" {jump19.s} + {{objdump -dr jump19.d}} + "jump19"} + {"Thumb and -gc-sections" "-shared -T arm-dyn.ld" "" "" {gc-thumb-lib.s} + {} + "gc-thumb-lib.so"} + {"Thumb and -gc-sections" "-pie -T arm.ld -gc-sections tmpdir/gc-thumb-lib.so" "" "" {gc-thumb.s} + {{readelf --relocs gc-thumb.d}} + "gc-thumb"} + {"arm-pic-veneer" "-static -T arm.ld --pic-veneer" "" "" {arm-pic-veneer.s} + {{objdump -d arm-pic-veneer.d}} + "arm-pic-veneer"} + {"Simple non-PIC shared library" "-shared" "" "" {arm-lib.s} {{objdump -fdw arm-lib.d} {objdump -Rw arm-lib.r}} "arm-lib.so"} @@ -343,6 +286,64 @@ set armelftests_nonacl { {"TLS shared library gdesc local" "--no-fix-arm1176 -shared -T arm-dyn.ld" "" "" {tls-lib-loc.s} {{objdump -fdw tls-lib-loc.d} {objdump -Rw tls-lib-loc.r}} "tls-lib-loc.so"} + {"Cortex-A8 erratum fix, b.w" + "-EL -Ttext=0x8f00 --fix-cortex-a8" "" "-EL" {cortex-a8-fix-b.s} + {{objdump -dr cortex-a8-fix-b.d}} + "cortex-a8-fix-b"} + {"Cortex-A8 erratum fix, bl.w" + "-EL -Ttext=0x8f00 --fix-cortex-a8" "" "-EL" {cortex-a8-fix-bl.s} + {{objdump -dr cortex-a8-fix-bl.d}} + "cortex-a8-fix-bl"} + {"Cortex-A8 erratum fix, bcc.w" + "-EL -Ttext=0x8f00 --fix-cortex-a8" "" "-EL" {cortex-a8-fix-bcc.s} + {{objdump -dr cortex-a8-fix-bcc.d}} + "cortex-a8-fix-bcc"} + {"Cortex-A8 erratum fix, blx.w" + "-EL -Ttext=0x8f00 --fix-cortex-a8" "" "-EL" {cortex-a8-fix-blx.s} + {{objdump -dr cortex-a8-fix-blx.d}} + "cortex-a8-fix-blx"} + {"Cortex-A8 erratum fix, relocate b.w to ARM" + "-EL -Ttext=0x8f00 --fix-cortex-a8" "" "-EL" {cortex-a8-arm-target.s cortex-a8-fix-b-rel.s} + {{objdump -dr cortex-a8-fix-b-rel-arm.d}} + "cortex-a8-fix-b-rel-arm"} + {"Cortex-A8 erratum fix, relocate b.w to Thumb" + "-EL -Ttext=0x8f00 --fix-cortex-a8" "" "-EL" {cortex-a8-thumb-target.s cortex-a8-fix-b-rel.s} + {{objdump -dr cortex-a8-fix-b-rel-thumb.d}} + "cortex-a8-fix-b-rel-thumb"} + {"Cortex-A8 erratum fix, relocate bl.w to ARM" + "-EL -Ttext=0x8f00 --fix-cortex-a8" "" "-EL" {cortex-a8-arm-target.s cortex-a8-fix-bl-rel.s} + {{objdump -dr cortex-a8-fix-bl-rel-arm.d}} + "cortex-a8-fix-bl-rel-arm"} + {"Cortex-A8 erratum fix, relocate bl.w to Thumb" + "-EL -Ttext=0x8f00 --fix-cortex-a8" "" "-EL" {cortex-a8-thumb-target.s cortex-a8-fix-bl-rel.s} + {{objdump -dr cortex-a8-fix-bl-rel-thumb.d}} + "cortex-a8-fix-bl-rel-thumb"} + {"Cortex-A8 erratum fix, relocate b<cond>.w to Thumb" + "-EL -Ttext=0x8f00 --fix-cortex-a8" "" "-EL" {cortex-a8-thumb-target.s cortex-a8-fix-bcc-rel.s} + {{objdump -dr cortex-a8-fix-bcc-rel-thumb.d}} + "cortex-a8-fix-bcc-rel-thumb"} + {"Cortex-A8 erratum fix, relocate blx.w to ARM" + "-EL -Ttext=0x8f00 --fix-cortex-a8" "" "-EL" {cortex-a8-arm-target.s cortex-a8-fix-blx-rel.s} + {{objdump -dr cortex-a8-fix-blx-rel-arm.d}} + "cortex-a8-fix-blx-rel-arm"} + {"Cortex-A8 erratum fix, relocate blx.w to Thumb" + "-EL -Ttext=0x8f00 --fix-cortex-a8" "" "-EL" {cortex-a8-thumb-target.s cortex-a8-fix-blx-rel.s} + {{objdump -dr cortex-a8-fix-blx-rel-thumb.d}} + "cortex-a8-fix-blx-rel-thumb"} + {"Cortex-A8 erratum fix, relocate bl.w and far call" + "-EL -Ttext=0x00 --fix-cortex-a8 --defsym _start=0" "" + "-EL -mcpu=cortex-a8" {cortex-a8-far-1.s cortex-a8-far-2.s cortex-a8-far-3.s} + {{objdump -dr cortex-a8-far.d}} + "cortex-a8-far"} + {"Cortex-A8 erratum fix, headers" + "-EL --fix-cortex-a8 -T cortex-a8-fix-hdr.t" "" + "-EL -mcpu=cortex-a8" {cortex-a8-fix-hdr.s} + {{objdump -dr cortex-a8-fix-hdr.d}} + "cortex-a8-fix-hdr"} + {"Cortex-A8 erratum fix, blx.w and b<cond>.w together" + "-EL -Ttext=0x8f00 --fix-cortex-a8" "" "-EL" {cortex-a8-fix-blx-bcond.s} + {{objdump -dr cortex-a8-fix-blx-bcond.d}} + "cortex-a8-fix-blx-bcond"} {"Cortex-A8 erratum fix, b.w to PLT" "-EL -Tcortex-a8-fix-plt.ld --fix-cortex-a8 -shared" "" "-EL" {cortex-a8-fix-b-plt.s} @@ -494,7 +495,13 @@ if { ![istarget "arm*-*-*eabi*"] && ![istarget "arm*-*-nacl*"] } { return } -# Farcalls stubs are fully supported for ARM-EABI only +# Farcalls stubs are fully supported for ARM-EABI only. +# This list is massaged below into run_ld_link_tests standard format. +# The source list is almost that same format. The one difference is +# that each "action" (elements of element 5) might have four elements +# instead of three; in that case, the fourth element is the name of +# the dump file to use for arm*-*nacl* targets instead of the canonical +# dump file (the third element). set armeabitests_common { {"EABI attribute merging" "-r" "" "" {attr-merge.s attr-merge.s} {{readelf -A attr-merge.attr}} @@ -532,114 +539,29 @@ set armeabitests_common { {"EABI attribute arch merging 2 reversed" "-r" "" "" {arch-v6.s arch-v6k.s} {{readelf -A attr-merge-arch-2.attr}} "attr-merge-arch-2r"} - {"Thumb-2 BL" "-Ttext 0x1000 --section-start .foo=0x1001000" "" "" {thumb2-bl.s} - {{objdump -dr thumb2-bl.d}} - "thumb2-bl"} - {"Thumb-2 Interworked branch" "-T arm.ld" "" "" {thumb2-b-interwork.s} - {{objdump -dr thumb2-b-interwork.d}} - "thumb2-b-interwork"} - {"BL/BLX interworking" "-T arm.ld" "" "" {thumb2-bl-blx-interwork.s} - {{objdump -dr thumb2-bl-blx-interwork.d}} - "thumb2-bl-blx-interwork"} - {"ARMv4 interworking" "-static -T arm.ld --fix-v4bx-interworking" "" "--fix-v4bx -meabi=4" {armv4-bx.s} - {{objdump -d armv4-bx.d}} - "armv4-bx"} {"MOVW/MOVT and merged sections" "-T arm.ld" "" "" {movw-merge.s} {{objdump -dw movw-merge.d}} "movw-merge"} {"MOVW/MOVT against shared libraries" "tmpdir/arm-lib.so" "" "" {arm-app-movw.s} {{objdump -Rw arm-app.r}} "arm-app-movw"} - {"Thumb-2-as-Thumb-1 BL" "--no-fix-arm1176 -Ttext 0x1000 --section-start .foo=0x100100c" "" "" {thumb2-bl-as-thumb1-bad.s} - {{objdump -d thumb2-bl-as-thumb1-bad.d}} - "thumb2-bl-as-thumb1-bad"} - {"Thumb-2 BL" "-Ttext 0x1000 --section-start .foo=0x100100c" "" "" {thumb2-bl-bad.s} - {{objdump -d thumb2-bl-bad.d}} - "thumb2-bl-bad"} - {"Branch to linker script symbol with BL for thumb-only target" "-T branch-lks-sym.ld" "" "" {thumb-bl-lks-sym.s} - {{objdump -d thumb-bl-lks-sym.d}} - "thumb-bl-lks-sym"} - {"Branch to linker script symbol with B for thumb-only target" "-T branch-lks-sym.ld" "" "" {thumb-b-lks-sym.s} - {{objdump -d thumb-b-lks-sym.d}} - "thumb-b-lks-sym"} {"ARM-ARM farcall" "-Ttext 0x1000 --section-start .foo=0x2001020" "" "" {farcall-arm-arm.s} - {{objdump -d farcall-arm-arm.d}} + {{objdump -d farcall-arm-arm.d farcall-arm-nacl.d}} "farcall-arm-arm"} {"ARM-ARM farcall (PIC veneer)" "-Ttext 0x1000 --section-start .foo=0x2001020 --pic-veneer" "" "" {farcall-arm-arm.s} - {{objdump -d farcall-arm-arm-pic-veneer.d}} + {{objdump -d farcall-arm-arm-pic-veneer.d farcall-arm-nacl-pic.d}} "farcall-arm-arm-pic-veneer"} {"ARM-ARM farcall (BE8)" "-Ttext 0x1000 --section-start .foo=0x2001020 -EB --be8" "" "-EB" {farcall-arm-arm.s} - {{objdump -d farcall-arm-arm.d}} + {{objdump -d farcall-arm-arm.d farcall-arm-nacl.d}} "farcall-arm-arm-be8"} {"ARM-ARM farcall (BE)" "-Ttext 0x1000 --section-start .foo=0x2001020 -EB" "" "-EB" {farcall-arm-arm.s} - {{objdump -d farcall-arm-arm.d}} + {{objdump -d farcall-arm-arm.d farcall-arm-nacl.d}} "farcall-arm-arm-be"} - {"Multiple farcalls" "-Ttext 0x1000 --section-start .foo=0x2002020" "" "" {farcall-mix.s} - {{objdump -d farcall-mix.d}} - "farcall-mix"} - {"Multiple farcalls from several sections" "-Ttext 0x1000 --section-start .mytext=0x2000 --section-start .foo=0x2003020" "" "" {farcall-mix2.s} - {{objdump -d farcall-mix2.d}} - "farcall-mix2"} - - {"Default group size" "-Ttext 0x1000 --section-start .foo=0x2003020" "" "" {farcall-group.s farcall-group2.s} - {{objdump -d farcall-group.d}} - "farcall-group-default"} - {"Group size=2" "-Ttext 0x1000 --section-start .foo=0x2003020 --stub-group-size=2" "" "" {farcall-group.s farcall-group2.s} - {{objdump -d farcall-group-size2.d}} - "farcall-group-size2"} - {"Group size limit" "-Ttext 0x1000 --section-start .far=0x2003020" "" "" {farcall-group3.s farcall-group4.s} - {{objdump -d farcall-group-limit.d}} - "farcall-group-limit"} - {"Long branch with mixed text and data" "-T arm.ld" "" "" {farcall-data.s} - {{objdump -dr farcall-data.d}} + {{objdump -dr farcall-data.d farcall-data-nacl.d}} "farcall-data"} - - {"R_ARM_THM_JUMP24 Relocation veneers: Short 1" - "--no-fix-arm1176 --section-start destsect=0x00009000 --section-start .text=0x8000" "" - "-march=armv7-a -mthumb" - {jump-reloc-veneers.s} - {{objdump -d jump-reloc-veneers-short1.d}} - "jump-reloc-veneers-short1"} - {"R_ARM_THM_JUMP24 Relocation veneers: Short 2" - "--no-fix-arm1176 --section-start destsect=0x00900000 --section-start .text=0x8000" "" - "-march=armv7-a -mthumb" - {jump-reloc-veneers.s} - {{objdump -d jump-reloc-veneers-short2.d}} - "jump-reloc-veneers-short2"} - {"R_ARM_THM_JUMP24 Relocation veneers: Long" - "--no-fix-arm1176 --section-start destsect=0x09000000 --section-start .text=0x8000" "" - "-march=armv7-a -mthumb" - {jump-reloc-veneers.s} - {{objdump -d jump-reloc-veneers-long.d}} - "jump-reloc-veneers-long"} - - {"erratum 760522 fix (default for v6z)" "--section-start=.foo=0x2001014" "" - "-march=armv6z" {fix-arm1176.s} - {{objdump -d fix-arm1176-on.d}} - "fix-arm1176-1"} - {"erratum 760522 fix (explicitly on at v6z)" "--section-start=.foo=0x2001014 --fix-arm1176" "" - "-march=armv6z" {fix-arm1176.s} - {{objdump -d fix-arm1176-on.d}} - "fix-arm1176-2"} - {"erratum 760522 fix (explicitly off at v6z)" "--section-start=.foo=0x2001014 --no-fix-arm1176" "" - "-march=armv6z" {fix-arm1176.s} - {{objdump -d fix-arm1176-off.d}} - "fix-arm1176-3"} - {"erratum 760522 fix (default for v5)" "--section-start=.foo=0x2001014 " "" - "-march=armv5te" {fix-arm1176.s} - {{objdump -d fix-arm1176-on.d}} - "fix-arm1176-4"} - {"erratum 760522 fix (default for v7-a)" "--section-start=.foo=0x2001014 " "" - "-march=armv7-a" {fix-arm1176.s} - {{objdump -d fix-arm1176-off.d}} - "fix-arm1176-5"} - {"erratum 760522 fix (default for ARM1156)" "--section-start=.foo=0x2001014 " "" - "-mcpu=arm1156t2f-s" {fix-arm1176.s} - {{objdump -d fix-arm1176-off.d}} - "fix-arm1176-6"} } set armeabitests_nonacl { @@ -700,6 +622,13 @@ set armeabitests_nonacl { {{objdump -d farcall-thumb-arm-pic-veneer.d}} "farcall-thumb-arm-pic-veneer"} + {"Multiple farcalls" "-Ttext 0x1000 --section-start .foo=0x2002020" "" "" {farcall-mix.s} + {{objdump -d farcall-mix.d}} + "farcall-mix"} + {"Multiple farcalls from several sections" "-Ttext 0x1000 --section-start .mytext=0x2000 --section-start .foo=0x2003020" "" "" {farcall-mix2.s} + {{objdump -d farcall-mix2.d}} + "farcall-mix2"} + {"Mixed ARM/Thumb dynamic application with farcalls" "tmpdir/mixed-lib.so -T arm-dyn.ld --section-start .far_arm=0x2100000 --section-start .far_thumb=0x2200000" "" "" {farcall-mixed-app.s} {{objdump -fdw farcall-mixed-app.d} {objdump -Rw farcall-mixed-app.r} @@ -721,6 +650,86 @@ set armeabitests_nonacl { {{objdump -fdw farcall-mixed-lib.d}} "farcall-mixed-lib.so"} + {"Thumb-2-as-Thumb-1 BL" "--no-fix-arm1176 -Ttext 0x1000 --section-start .foo=0x100100c" "" "" {thumb2-bl-as-thumb1-bad.s} + {{objdump -d thumb2-bl-as-thumb1-bad.d}} + "thumb2-bl-as-thumb1-bad"} + {"Thumb-2 BL" "-Ttext 0x1000 --section-start .foo=0x100100c" "" "" {thumb2-bl-bad.s} + {{objdump -d thumb2-bl-bad.d}} + "thumb2-bl-bad"} + {"Branch to linker script symbol with BL for thumb-only target" "-T branch-lks-sym.ld" "" "" {thumb-bl-lks-sym.s} + {{objdump -d thumb-bl-lks-sym.d}} + "thumb-bl-lks-sym"} + {"Branch to linker script symbol with B for thumb-only target" "-T branch-lks-sym.ld" "" "" {thumb-b-lks-sym.s} + {{objdump -d thumb-b-lks-sym.d}} + "thumb-b-lks-sym"} + + {"erratum 760522 fix (default for v6z)" "--section-start=.foo=0x2001014" "" + "-march=armv6z" {fix-arm1176.s} + {{objdump -d fix-arm1176-on.d}} + "fix-arm1176-1"} + {"erratum 760522 fix (explicitly on at v6z)" "--section-start=.foo=0x2001014 --fix-arm1176" "" + "-march=armv6z" {fix-arm1176.s} + {{objdump -d fix-arm1176-on.d}} + "fix-arm1176-2"} + {"erratum 760522 fix (explicitly off at v6z)" "--section-start=.foo=0x2001014 --no-fix-arm1176" "" + "-march=armv6z" {fix-arm1176.s} + {{objdump -d fix-arm1176-off.d}} + "fix-arm1176-3"} + {"erratum 760522 fix (default for v5)" "--section-start=.foo=0x2001014 " "" + "-march=armv5te" {fix-arm1176.s} + {{objdump -d fix-arm1176-on.d}} + "fix-arm1176-4"} + {"erratum 760522 fix (default for v7-a)" "--section-start=.foo=0x2001014 " "" + "-march=armv7-a" {fix-arm1176.s} + {{objdump -d fix-arm1176-off.d}} + "fix-arm1176-5"} + {"erratum 760522 fix (default for ARM1156)" "--section-start=.foo=0x2001014 " "" + "-mcpu=arm1156t2f-s" {fix-arm1176.s} + {{objdump -d fix-arm1176-off.d}} + "fix-arm1176-6"} + + {"Thumb-2 BL" "-Ttext 0x1000 --section-start .foo=0x1001000" "" "" {thumb2-bl.s} + {{objdump -dr thumb2-bl.d}} + "thumb2-bl"} + {"Thumb-2 Interworked branch" "-T arm.ld" "" "" {thumb2-b-interwork.s} + {{objdump -dr thumb2-b-interwork.d}} + "thumb2-b-interwork"} + {"BL/BLX interworking" "-T arm.ld" "" "" {thumb2-bl-blx-interwork.s} + {{objdump -dr thumb2-bl-blx-interwork.d}} + "thumb2-bl-blx-interwork"} + {"ARMv4 interworking" "-static -T arm.ld --fix-v4bx-interworking" "" "--fix-v4bx -meabi=4" {armv4-bx.s} + {{objdump -d armv4-bx.d}} + "armv4-bx"} + + {"R_ARM_THM_JUMP24 Relocation veneers: Short 1" + "--no-fix-arm1176 --section-start destsect=0x00009000 --section-start .text=0x8000" "" + "-march=armv7-a -mthumb" + {jump-reloc-veneers.s} + {{objdump -d jump-reloc-veneers-short1.d}} + "jump-reloc-veneers-short1"} + {"R_ARM_THM_JUMP24 Relocation veneers: Short 2" + "--no-fix-arm1176 --section-start destsect=0x00900000 --section-start .text=0x8000" "" + "-march=armv7-a -mthumb" + {jump-reloc-veneers.s} + {{objdump -d jump-reloc-veneers-short2.d}} + "jump-reloc-veneers-short2"} + {"R_ARM_THM_JUMP24 Relocation veneers: Long" + "--no-fix-arm1176 --section-start destsect=0x09000000 --section-start .text=0x8000" "" + "-march=armv7-a -mthumb" + {jump-reloc-veneers.s} + {{objdump -d jump-reloc-veneers-long.d}} + "jump-reloc-veneers-long"} + + {"Default group size" "-Ttext 0x1000 --section-start .foo=0x2003020" "" "" {farcall-group.s farcall-group2.s} + {{objdump -d farcall-group.d}} + "farcall-group-default"} + {"Group size=2" "-Ttext 0x1000 --section-start .foo=0x2003020 --stub-group-size=2" "" "" {farcall-group.s farcall-group2.s} + {{objdump -d farcall-group-size2.d}} + "farcall-group-size2"} + {"Group size limit" "-Ttext 0x1000 --section-start .far=0x2003020" "" "" {farcall-group3.s farcall-group4.s} + {{objdump -d farcall-group-limit.d}} + "farcall-group-limit"} + {"TLS gnu shared library" "--no-fix-arm1176 -shared -T arm-dyn.ld" "" "" {tls-gdesc.s} {{objdump -fdw tls-gdesc.d} {objdump -Rw tls-gdesc.r}} "tls-lib2.so"} @@ -738,8 +747,29 @@ set armeabitests_nonacl { "tls-thumb1"} } +# Massage the $armeabitests_common list into run_ld_link_tests standard form. +# See the comment before 'set armeabitests_common', above. +set elide_action_elt 3 +set is_nacl [istarget "arm*-*-nacl*"] +if {$is_nacl} { + set elide_action_elt 2 +} +set neabi_common [llength $armeabitests_common] +for {set i 0} {$i < $neabi_common} {incr i} { + set case [lindex $armeabitests_common $i] + set actions [lindex $case 5] + set nactions [llength $actions] + for {set j 0} {$j < $nactions} {incr j} { + set action [lindex $actions $j] + if {[llength $action] == 4} { + set action [lreplace $action $elide_action_elt $elide_action_elt] + lset armeabitests_common $i 5 $j $action + } + } +} + run_ld_link_tests $armeabitests_common -if { ![istarget "arm*-*-nacl*"] } { +if { !$is_nacl } { run_ld_link_tests $armeabitests_nonacl } diff --git a/ld/testsuite/ld-arm/farcall-arm-nacl-pic.d b/ld/testsuite/ld-arm/farcall-arm-nacl-pic.d new file mode 100644 index 0000000000..62d342121f --- /dev/null +++ b/ld/testsuite/ld-arm/farcall-arm-nacl-pic.d @@ -0,0 +1,20 @@ +.*: file format .* + +Disassembly of section \.text: + +0+1000 <_start>: +\s*1000:\s+eb000002\s+bl\s+1010 <__bar_veneer> +#... + +0+1010 <__bar_veneer>: +\s*1010:\s+e59fc00c\s+ldr\s+ip, \[pc, #12\]\s+; 1024 <__bar_veneer\+0x14> +\s*1014:\s+e08cc00f\s+add\s+ip, ip, pc +\s*1018:\s+e3ccc13f\s+bic\s+ip, ip, #-1073741809\s+; 0xc000000f +\s*101c:\s+e12fff1c\s+bx\s+ip +\s*1020:\s+e125be70\s+bkpt\s+0x5be0 +\s*1024:\s+02000004\s+.word\s+0x02000004 +#... + +\s*Disassembly of section \.foo: +\s*02001020 <bar>: +\s*2001020:\s+e12fff1e\s+bx\s+lr diff --git a/ld/testsuite/ld-arm/farcall-arm-nacl.d b/ld/testsuite/ld-arm/farcall-arm-nacl.d new file mode 100644 index 0000000000..58f2a58c4b --- /dev/null +++ b/ld/testsuite/ld-arm/farcall-arm-nacl.d @@ -0,0 +1,20 @@ +.*: file format .* + +Disassembly of section \.text: + +0+1000 <_start>: +\s*1000:\s+eb000002\s+bl\s+1010 <__bar_veneer> +#... + +0+1010 <__bar_veneer>: +\s*1010:\s+e59fc00c\s+ldr\s+ip, \[pc, #12\]\s+; 1024 <__bar_veneer\+0x14> +\s*1014:\s+e3ccc13f\s+bic\s+ip, ip, #-1073741809\s+; 0xc000000f +\s*1018:\s+e12fff1c\s+bx\s+ip +\s*101c:\s+e320f000\s+nop\s+\{0\} +\s*1020:\s+e125be70\s+bkpt\s+0x5be0 +\s*1024:\s+02001020\s+.word\s+0x02001020 +#... + +\s*Disassembly of section \.foo: +\s*02001020 <bar>: +\s*2001020:\s+e12fff1e\s+bx\s+lr diff --git a/ld/testsuite/ld-arm/farcall-data-nacl.d b/ld/testsuite/ld-arm/farcall-data-nacl.d new file mode 100644 index 0000000000..1524fa67ab --- /dev/null +++ b/ld/testsuite/ld-arm/farcall-data-nacl.d @@ -0,0 +1,24 @@ +.*: file format .* + +Disassembly of section .text: + +0+8000 <_start>: +\s*8000:\s+ea000002\s+b\s+8010 <__far_veneer> +#... + +0+8010 <__far_veneer>: +\s*8010:\s+e59fc00c\s+ldr\s+ip, \[pc, #12\]\s+; 8024 <__far_veneer\+0x14> +\s*8014:\s+e3ccc13f\s+bic\s+ip, ip, #-1073741809\s+; 0xc000000f +\s*8018:\s+e12fff1c\s+bx\s+ip +\s*801c:\s+e320f000\s+nop\s+\{0\} +\s*8020:\s+e125be70\s+bkpt\s+0x5be0 +\s*8024:\s+12340000\s+.word\s+0x12340000 +#... + +0+8030 <after>: +\s*8030:\s+11111111\s+\.word\s+0x11111111 + +Disassembly of section \.far: + +12340000 <far>: +12340000:\s+e12fff1e\s+bx\s+lr |