* elf32-arm.c (elf32_arm_check_relocs): Check needs_plt rather than
h->needs_plt when deciding whether to record a possible dynamic reloc.
ld/testsuite/
* ld-arm/arm-rel32.s, ld-arm/arm-rel32.d: New testcase.
* ld-arm/arm-elf.exp: Run it.
* elf32-arm.c (elf32_arm_gc_sweep_hook): Remove all registered
dynamic relocs for the removed section.
ld/testsuite/
* ld-arm/gc-thumb-lib.s, ld-arm/gc-thumb.s,
ld-arm/gc-thumb.d: New test.
* ld-arm/arm-elf.exp: Run it.
* elf32-arm.c (struct a8_erratum_reloc): Add hash member. Move
sym_name to improve packing.
(cortex_a8_erratum_scan): Check for PLT entries.
(elf32_arm_size_stubs): Save the target symbol for a8 relocs.
ld/testsuite/
* ld-arm/cortex-a8-fix-bl-rel-plt.d: New file.
* ld-arm/arm-elf.exp (armelftests): Run cortex-a8-fix-bl-rel-plt.d.
* ld/testsuite/ld-arm/arm-merge-incompatiblea.s: Likewise.
* ld/testsuite/ld-arm/arm-merge-incompatibleb.s: Likewise.
* ld/testsuite/ld-arm/arm-elf.exp: Run the new test.
* bfd/elf32-arm.c (elf32_arm_merge_eabi_attributes): Add a check of the
return value from the call to _bfd_elf_merge_object_attributes.
Alan Modra <amodra@gmail.com>
bfd/
* elf32-arm.c (a8_erratum_fix): Add st_type field to record the
destination mode of the a8 stub.
(elf32_arm_link_hash_table): Add top_id field.
(elf32_arm_link_hash_table_create): Initialize top_id.
(arm_type_of_stub): Update prototype, st_type can now be updated
by this function. Actual destination address in case of PLT is
computed here, to help factorizing code.
(elf32_arm_stub_name): Update prototype, use stub_type additional
parameter to build stub name.
(elf32_arm_get_stub_entry): Update prototype, use stub_type
additional parameter to build stub entry.
(arm_build_one_stub): Use bfd_put_16/bfd_put_32 instead of
put_thumb_insn/put_arm_insn as BE8 encoding is now handled later.
Call elf32_arm_final_link_relocate to process all in-stub
relocations.
(elf32_arm_setup_section_lists): Update top_id.
(cortex_a8_erratum_scan): Record stub destination mode.
(elf32_arm_size_stubs): Update call to arm_type_of_stub according
to new prototype.
(elf32_arm_final_link_relocate): Enable processing of in-stub
REL32 relocations. Rely on arm_type_of_stub to detect if a stub is
needed, enabling code factorization.
(elf32_arm_final_link): Process stub sections.
(elf32_arm_output_map_sym): Add entry to code/data map.
ld/testsuite/
* ld-arm/arm-elf.exp: Change .text start address for
farcall-thumb-arm tests. Add v4t variant for farcall-mixed-lib
test.
* ld-arm/farcall-mixed-lib-v4t.d: New test.
* ld-arm/farcall-mixed-lib1.s: Don't force armv5t.
* ld-arm/farcall-mixed-lib2.s: Likewise.
* ld-arm/arm-call.d: Update expected results.
* ld-arm/cortex-a8-far.d: Likewise.
* ld-arm/farcall-group-size2.d: Likewise.
* ld-arm/farcall-group.d: Likewise.
* ld-arm/farcall-mix.d: Likewise.
* ld-arm/farcall-mix2.d: Likewise.
* ld-arm/farcall-mixed-app-v5.d: Likewise.
* ld-arm/farcall-mixed-app.d: Likewise.
* ld-arm/farcall-mixed-lib.d: Likewise.
* ld-arm/farcall-thumb-arm.d: Likewise.
* ld-arm/farcall-thumb-arm-blx.d: Likewise.
* ld-arm/farcall-thumb-arm-pic-veneer.d: Likewise.
* ld-arm/farcall-thumb-arm-blx-pic-veneer.d: Likewise.
* ld-arm/farcall-thumb-arm.s: Update test. Add a new call to
potentially generate different types of stubs.
* ld/testsuite/ld-arm/arm-elf.exp (armelftests): Only dump executable sections in
group-relocs test.
* ld/testsuite/ld-arm/reloc-boundaries.d: Fix test to work on Linux targets.
bfd/
* elf32-arm.c (elf32_arm_output_arch_local_syms): add
missing mapping symbol to data only sections.
ld/testsuite/
* ld-arm/arm-elf.exp (armelftests): New test case added.
* ld-arm/data-only-map.s: New file.
* ld-arm/data-only-map.d: New file.
* ld-arm/data-only-map.ld: New file.
* elf32-arm.c (elf32_arm_final_link_relocate): limits
fixed.
ld/testsuite/
* ld-arm/arm-elf.exp (armelftests): New test case added.
* ld-arm/reloc-boundaries.s: New file.
* ld-arm/reloc-boundaries.d: New file.
* elf32-arm.c (elf32_arm_stub_type): Add arm_stub_a8_veneer_lwm.
(arm_build_one_stub): Build a8 veneers as a separate pass.
(cortex_a8_erratum_scan): Add prev_num_a8_fixes and stub_changed_p
parameters. Use them to check if we create a different a8 fixup
than the previous pass.
(elf32_arm_size_stubs): Move scope of stub_changed and
prev_num_a8_fixes into main loop.
(elf32_arm_build_stubs): Build a8 veneers in a second pass.
ld/testsuite/
* ld-arm/cortex-a8-far-1.s: New.
* ld-arm/cortex-a8-far-2.s: New.
* ld-arm/cortex-a8-far.d: New.
* ld-arm/arm-elf.exp: Add new test.
* elf32-arm.c (elf32_arm_check_relocs): Give errors for absolute
MOVW and MOVT relocations in a shared library link.
ld/testsuite:
* ld-arm/movw-shared-1.d, ld-arm/movw-shared-1.s,
ld-arm/movw-shared-2.d, ld-arm/movw-shared-2.s,
ld-arm/movw-shared-3.d, ld-arm/movw-shared-3.s,
ld-arm/movw-shared-4.d, ld-arm/movw-shared-4.s: New tests.
* ld-arm/arm-elf.exp: Run these new tests.
bfd/
* elf32-arm.c (elf32_arm_size_stubs): Handle long branches through
PLT entries to an undefined symbol when generating a shared
library.
testsuite/
* ld-arm/arm-elf.exp: Add new test farcall-mixed-lib.
* ld-arm/farcall-mixed-lib.d: Update expected output.
* ld-arm/farcall-mixed-lib1.s: New file.
* ld-arm/farcall-mixed-lib2.s: New file.
bfd/
* elf32-arm.c (elf32_arm_final_link_relocate): Don't convert ARM
branch to an undef weak symbol into a jump to next instruction if
a PLT entry will be created.
testsuite/
* ld-arm/arm-elf.exp: Add 1 more test to check undef weak
reference with PLT in ARM mode.
* ld-arm/thumb2-bl-undefweak1.d, ld-arm/thumb2-bl-undefweak1.s:
New files.
opcodes/
* arm-dis.c (print_insn): Print BE8 opcodes in little endianness.
ld/testsuite/
* ld-arm/arm-elf.exp: BE8 tests expect the same output as the
default ones.
* ld-arm/arm-be8.d: Print opcodes in little endian.
* ld-arm/farcall-thumb-arm-be8.d: Removed useless expected result.
* ld-arm/farcall-arm-arm-be8.d: Likewise.
bfd/
* elf32-arm.c (group_sections): Take next section size into
account before accepting to group it.
testsuite/
* ld-arm/arm-elf.exp: Add new farcall-group-limit test.
* ld-arm/farcall-group-limit.d: New file.
* ld-arm/farcall-group3.s: New file.
* ld-arm/farcall-group4.s: New file.
bfd/
* elf32-arm.c (stub_reloc_type): Removed.
(insn_sequence): Renamed reloc_type field to r_type.
(elf32_arm_stub_long_branch_v4t_arm_thumb_pic): New stub.
(elf32_arm_stub_long_branch_v4t_thumb_arm_pic): Likewise.
(elf32_arm_stub_long_branch_thumb_only_pic): Likewise.
(elf32_arm_stub_type): Add new enum entries for the new stubs.
(arm_stub_is_thumb): Catch new stubs.
(arm_type_of_stub): Handle new stubs.
(arm_size_one_stub): Use ARRAY_SIZE. Handle new stubs.
(bfd_elf32_arm_process_before_allocation): Remove useless
condition.
testsuite/
* ld-arm/arm-elf.exp: Add 3 tests for the 3 new stubs.
* ld-arm/farcall-thumb-arm-pic-veneer.d: New expected result, the
test is now expected to pass.
* ld-arm/farcall-thumb-thumb-m-pic-veneer.d: Likewise.
* ld-arm/farcall-thumb-thumb-pic-veneer.d: Likewise.
bfd/
* elf32-arm.c (PREV_SEC): Update comment.
(group_sections): Rename argument to stubs_always_after_branch.
Reverse the list and place stubs at the end of input sections.
Undefine NEXT_SEC.
(elf32_arm_size_stubs): Update to use stubs_always_after_branch.
ld/
* ld.texinfo (ARM): Document changed meaning of --stub-group-size.
* emultempl/armelf.em (hook_in_stub): Insert after the input section.
(elf32_arm_add_stub_section): Update comment.
(PARSE_AND_LIST_OPTIONS): Update help for --stub-group-size.
2009-02-24 Daniel Jacobowitz <dan@codesourcery.com>
ld/testsuite/
* ld-arm/arm-elf.exp (armeabitests): Update duplicate test names.
Use normal output files for big-endian.
* ld-arm/farcall-arm-arm-be.d, ld-arm/farcall-thumb-arm-be.d: Delete.
* ld-arm/farcall-arm-arm-be8.d, ld-arm/farcall-arm-arm-pic-veneer.d,
ld-arm/farcall-arm-arm.d, ld-arm/farcall-arm-thumb-blx-pic-veneer.d,
ld-arm/farcall-arm-thumb-blx.d, ld-arm/farcall-arm-thumb-pic-veneer.d,
ld-arm/farcall-arm-thumb.d, ld-arm/farcall-group-size2.d,
ld-arm/farcall-group.d, ld-arm/farcall-mix.d, ld-arm/farcall-mix2.d,
ld-arm/farcall-thumb-arm-be8.d,
ld-arm/farcall-thumb-arm-blx-pic-veneer.d,
ld-arm/farcall-thumb-arm-blx.d, ld-arm/farcall-thumb-arm-short.d,
ld-arm/farcall-thumb-arm.d,
ld-arm/farcall-thumb-thumb-blx-pic-veneer.d,
ld-arm/farcall-thumb-thumb-blx.d, ld-arm/farcall-thumb-thumb-m.d,
ld-arm/farcall-thumb-thumb.d, ld-arm/thumb2-bl-as-thumb1-bad.d,
ld-arm/thumb2-bl-bad.d: Update for moved stubs.
bfd/
* elf32-arm.c (stub_insn_type): New type.
(stub_reloc_type): Likewise.
(insn_sequence): Likewise.
(elf32_arm_stub_long_branch_any_any): Encode using insn_sequence.
(elf32_arm_stub_long_branch_v4t_arm_thumb): Likewise.
(elf32_arm_stub_long_branch_thumb_only): Likewise.
(elf32_arm_stub_long_branch_v4t_thumb_arm): Likewise.
(elf32_arm_stub_short_branch_v4t_thumb_arm): Likewise.
(elf32_arm_stub_long_branch_any_any_pic): Likewise.
(elf32_arm_stub_hash_entry): Add new helper fields.
(stub_hash_newfunc): Initialize these new fields.
(arm_build_one_stub): Encode Arm and Thumb instructions separately
to take endianness into account.
(arm_size_one_stub): Compute size of stubs using insn_sequence.
(arm_map_one_stub): Code is now more generic, thanks to
insn_sequence.
ld/testsuite/
* ld-arm/arm-elf.exp: Add new farcall-thumb-arm-be8 test.
* ld-arm/farcall-thumb-arm-be8.d: New expected result.
* ld-arm/farcall-arm-arm-be8.d: Replace wildcards by instructions.
bfd/
* elf32-arm.c (elf32_arm_stub_long_branch_thumb_only): Fix stub
code.
(elf32_arm_stub_long_branch_v4t_thumb_arm): Likewise.
(arm_type_of_stub): Use Thumb-only long branch stub (non-PIC) when
BLX is not available. Fix typo in warning message. Add comments
and improve formatting.
(arm_build_one_stub): Adjust to new
elf32_arm_stub_long_branch_v4t_thumb_arm stub.
(arm_map_one_stub): Likewise.
testsuite/
* ld-arm/arm-elf.exp: Rewrite non-EABI variants of
thumb2-bl-as-thumb1-bad and thumb2-bl-bad tests, which now
pass. farcall-thumb-thumb now passes in EABI mode.
* ld-arm/farcall-thumb-arm-pic-veneer.d: Fixed name, source, as
and ld flags to match intended test.
* ld-arm/farcall-thumb-arm.d: New expected result.
* ld-arm/farcall-thumb-thumb-m.d: Likewise.
* ld-arm/farcall-thumb-thumb-m-pic-veneer.d: Fixed name and ld
flags.
* ld-arm/farcall-thumb-thumb-pic-veneer.d: Likewise.
* ld-arm/farcall-thumb-thumb.d: New expected result, this test is
now expected to pass.
* ld-arm/thumb2-bl-as-thumb1-bad-noeabi.d: Likewise.
* ld-arm/thumb2-bl-bad-noeabi.d: Likewise.
* ld-arm/thumb2-bl-as-thumb1-bad.d: Update addresses according to
new use.
* ld-arm/thumb2-bl-as-thumb1-bad.s: Update comment.
* elf32-arm.c (elf32_arm_final_link_relocate): Do not turn
branches to undefine weak symbols into branches to the next
instruction if creating PLT entries for those symbols.
ld/testsuite:
* ld-arm/thumb2-bl-undefweak.d, ld-arm/thumb2-bl-undefweak.s: New.
* ld-arm/arm-elf.exp: Run thumb2-bl-undefweak test.
* bfd-in.h (bfd_elf32_arm_set_target_relocs): Add new parameter.
* bfd-in2.h: Regenerate.
* elf32-arm.c (struct elf_arm_obj_tdata): Add field
no_wchar_size_warning.
(bfd_elf32_arm_set_target_relocs): Add new parameter
no_wchar_warn.
(elf32_arm_merge_eabi_attributes): Give a warning, not an error,
for conflicting wchar_t attributes. Do not warn if
--no-wchar-size-warning. Make diagnostic text more specific.
ld:
* ld.texinfo (--no-wchar-size-warning): Document new ARM option.
* emultempl/armelf.em (no_wchar_size_warning): New.
(arm_elf_create_output_section_statements): Pass
no_wchar_size_warning to arm_elf_create_output_section_statements.
(OPTION_NO_WCHAR_SIZE_WARNING): New.
(PARSE_AND_LIST_LONGOPTS): Add no-wchar-size-warning.
(PARSE_AND_LIST_OPTIONS): List --no-wchar-size-warning.
(PARSE_AND_LIST_ARGS_CASES): Handle --no-wchar-size-warning.
ld/testsuite:
* ld-arm/attr-merge-wchar-0.s,ld-arm/attr-merge-wchar-2.s,
ld-arm/attr-merge-wchar-4.s, ld-arm/attr-merge-wchar-00-nowarn.d,
ld-arm/attr-merge-wchar-00.d, ld-arm/attr-merge-wchar-02-nowarn.d,
ld-arm/attr-merge-wchar-02.d, ld-arm/attr-merge-wchar-04-nowarn.d,
ld-arm/attr-merge-wchar-04.d, ld-arm/attr-merge-wchar-20-nowarn.d,
ld-arm/attr-merge-wchar-20.d, ld-arm/attr-merge-wchar-22-nowarn.d,
ld-arm/attr-merge-wchar-22.d, ld-arm/attr-merge-wchar-24-nowarn.d,
ld-arm/attr-merge-wchar-24.d, ld-arm/attr-merge-wchar-40-nowarn.d,
ld-arm/attr-merge-wchar-40.d, ld-arm/attr-merge-wchar-42-nowarn.d,
ld-arm/attr-merge-wchar-42.d, ld-arm/attr-merge-wchar-44-nowarn.d,
ld-arm/attr-merge-wchar-44.d: New.
* ld-arm/arm-elf.exp: Run new tests.
* ld-arm/arm-elf.exp: Skip farcalls tests for non-ARM-EABI
targets.
* ld-arm/thumb2-bl-as-thumb1-bad-noeabi.d: New file.
* ld-arm/thumb2-bl-bad-noeabi.d: Likewise.
ld/
* ld.texinfo: State that farcalls stubs are supported for ARM-EABI
only.
(_bfd_elf_canonicalize_dynamic_reloc): Find dynamic relocations
even if they are not loaded.
* elflink.c (_bfd_elf_init_2_index_sections): Set data_index_section
first.
* ld-arm/symbian-seg1.s, ld-arm/symbian-seg1.d: New files.
* ld-arm/arm-elf.exp: Run symbian-seg1.
bfd/
* elf32-arm.c (elf32_arm_howto_table_1): Fix bitmasks for MOVW and
MOVT relocations.
(elf32_arm_final_link_relocate): Fix off by one MOVW/MOVT sign
extension.
(elf32_arm_relocate_section): Handle MOVW and MOVT
relocations. Improve safety check for other weird relocations.
(elf32_arm_check_relocs): Only set h->needs_plt for branch/call
relocations.
gas/
* config/tc-arm.c (md_apply_fix): Use correct offset range.
ld/testsuite/
* ld-arm/arm-elf.exp (armelftests): Add movw-merge and arm-app-movw.
* ld-arm/arm-app-movw.s: New test.
* ld-arm/arm-app.r: Update expected output.
* ld-arm/movw-merge.d: New test.
* ld-arm/movw-merge.s: New test.