2010-03-22 Doug Kwan <dougkwan@google.com>
* arm.cc (Arm_relocate_functions::abs8,
Arm_relocate_functions::abs16): Use correct check for overflow
specified in the ARM ELF specs.
(Arm_relocate_functions): thumb_branch_common. Handle bit 1 of branch
target of a BLX instruction specially.
(Reloc_stub::stub_type_for_reloc): Ditto.
(Relocate::relocate): Use symbolic names instead of numeric relocation
codes to report error.
(Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
workaround.
* testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
thumb2_blx_out_of_range.stdout
(thumb_bl_out_of_range, thumb_bl_out_of_range.o,
thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
(thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
thumb2_blx_in_range, thumb2_blx_in_range.o,
thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
thumb2_blx_out_of_range.o): New rules.
(MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
thumb2_blx_in_range and thumb2_blx_out_of_range.
* testsuite/Makefile.in: Regenerate.
* arm_branch_in_range.sh: Add tests for THUMB BLX.
* testsuite/thumb_blx_in_range.s: New file.
* testsuite/thumb_blx_out_of_range.s: New file.
2010-03-23 06:48:05 +08:00
|
|
|
# thumb_blx_out_of_range.s
|
|
|
|
# Test THUMB/THUMB-2 blx instructions just out of the branch range limits.
|
|
|
|
.syntax unified
|
|
|
|
|
|
|
|
.section .text.pre,"x"
|
|
|
|
|
|
|
|
# Add padding so that target is just output of branch range.
|
2010-09-16 01:39:57 +08:00
|
|
|
.space 4
|
2010-03-22 Doug Kwan <dougkwan@google.com>
* arm.cc (Arm_relocate_functions::abs8,
Arm_relocate_functions::abs16): Use correct check for overflow
specified in the ARM ELF specs.
(Arm_relocate_functions): thumb_branch_common. Handle bit 1 of branch
target of a BLX instruction specially.
(Reloc_stub::stub_type_for_reloc): Ditto.
(Relocate::relocate): Use symbolic names instead of numeric relocation
codes to report error.
(Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
workaround.
* testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
thumb2_blx_out_of_range.stdout
(thumb_bl_out_of_range, thumb_bl_out_of_range.o,
thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
(thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
thumb2_blx_in_range, thumb2_blx_in_range.o,
thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
thumb2_blx_out_of_range.o): New rules.
(MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
thumb2_blx_in_range and thumb2_blx_out_of_range.
* testsuite/Makefile.in: Regenerate.
* arm_branch_in_range.sh: Add tests for THUMB BLX.
* testsuite/thumb_blx_in_range.s: New file.
* testsuite/thumb_blx_out_of_range.s: New file.
2010-03-23 06:48:05 +08:00
|
|
|
|
|
|
|
.global _forward_target
|
|
|
|
.global _backward_target
|
|
|
|
.type _backword_target, %function
|
|
|
|
_backward_target:
|
|
|
|
bx lr
|
|
|
|
.size _backward_target, .-_backward_target
|
|
|
|
|
|
|
|
.text
|
2010-09-09 07:54:51 +08:00
|
|
|
# Use 256-byte alignment so that we know where the stubs start.
|
|
|
|
.align 8
|
2010-03-22 Doug Kwan <dougkwan@google.com>
* arm.cc (Arm_relocate_functions::abs8,
Arm_relocate_functions::abs16): Use correct check for overflow
specified in the ARM ELF specs.
(Arm_relocate_functions): thumb_branch_common. Handle bit 1 of branch
target of a BLX instruction specially.
(Reloc_stub::stub_type_for_reloc): Ditto.
(Relocate::relocate): Use symbolic names instead of numeric relocation
codes to report error.
(Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
workaround.
* testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
thumb2_blx_out_of_range.stdout
(thumb_bl_out_of_range, thumb_bl_out_of_range.o,
thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
(thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
thumb2_blx_in_range, thumb2_blx_in_range.o,
thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
thumb2_blx_out_of_range.o): New rules.
(MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
thumb2_blx_in_range and thumb2_blx_out_of_range.
* testsuite/Makefile.in: Regenerate.
* arm_branch_in_range.sh: Add tests for THUMB BLX.
* testsuite/thumb_blx_in_range.s: New file.
* testsuite/thumb_blx_out_of_range.s: New file.
2010-03-23 06:48:05 +08:00
|
|
|
|
|
|
|
# Define _start so that linker does not complain.
|
|
|
|
.align 2
|
|
|
|
.global _start
|
|
|
|
.code 32
|
|
|
|
.type _start, %function
|
|
|
|
_start:
|
|
|
|
bx lr
|
|
|
|
.size _start, .-_start
|
|
|
|
|
|
|
|
.global _backward_test
|
|
|
|
.code 16
|
|
|
|
.thumb_func
|
|
|
|
.type _backward_test, %function
|
|
|
|
_backward_test:
|
|
|
|
bl _backward_target
|
|
|
|
.size _backward_test, .-_backward_test
|
|
|
|
|
|
|
|
.align 2
|
|
|
|
.global _forward_test
|
|
|
|
.code 16
|
|
|
|
.thumb_func
|
|
|
|
.type _forward_test, %function
|
|
|
|
_forward_test:
|
|
|
|
# Bit 1 of the BLX target comes from bit 1 of branch base address,
|
|
|
|
# which is BLX instruction's address + 4. We intentionally put this
|
|
|
|
# forward BLX at an address n*4 + 2 so that the branch offset is
|
|
|
|
# bumped up by 2.
|
|
|
|
nop.n
|
|
|
|
bl _forward_target
|
|
|
|
.size _forward_test, .-_forward_test
|
2010-09-09 07:54:51 +08:00
|
|
|
|
|
|
|
# switch back to ARM mode so that stubs are disassembled correctly.
|
2010-03-22 Doug Kwan <dougkwan@google.com>
* arm.cc (Arm_relocate_functions::abs8,
Arm_relocate_functions::abs16): Use correct check for overflow
specified in the ARM ELF specs.
(Arm_relocate_functions): thumb_branch_common. Handle bit 1 of branch
target of a BLX instruction specially.
(Reloc_stub::stub_type_for_reloc): Ditto.
(Relocate::relocate): Use symbolic names instead of numeric relocation
codes to report error.
(Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
workaround.
* testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
thumb2_blx_out_of_range.stdout
(thumb_bl_out_of_range, thumb_bl_out_of_range.o,
thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
(thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
thumb2_blx_in_range, thumb2_blx_in_range.o,
thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
thumb2_blx_out_of_range.o): New rules.
(MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
thumb2_blx_in_range and thumb2_blx_out_of_range.
* testsuite/Makefile.in: Regenerate.
* arm_branch_in_range.sh: Add tests for THUMB BLX.
* testsuite/thumb_blx_in_range.s: New file.
* testsuite/thumb_blx_out_of_range.s: New file.
2010-03-23 06:48:05 +08:00
|
|
|
.code 32
|
2010-09-09 07:54:51 +08:00
|
|
|
nop
|
2010-03-22 Doug Kwan <dougkwan@google.com>
* arm.cc (Arm_relocate_functions::abs8,
Arm_relocate_functions::abs16): Use correct check for overflow
specified in the ARM ELF specs.
(Arm_relocate_functions): thumb_branch_common. Handle bit 1 of branch
target of a BLX instruction specially.
(Reloc_stub::stub_type_for_reloc): Ditto.
(Relocate::relocate): Use symbolic names instead of numeric relocation
codes to report error.
(Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
workaround.
* testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
thumb2_blx_out_of_range.stdout
(thumb_bl_out_of_range, thumb_bl_out_of_range.o,
thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
(thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
thumb2_blx_in_range, thumb2_blx_in_range.o,
thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
thumb2_blx_out_of_range.o): New rules.
(MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
thumb2_blx_in_range and thumb2_blx_out_of_range.
* testsuite/Makefile.in: Regenerate.
* arm_branch_in_range.sh: Add tests for THUMB BLX.
* testsuite/thumb_blx_in_range.s: New file.
* testsuite/thumb_blx_out_of_range.s: New file.
2010-03-23 06:48:05 +08:00
|
|
|
|
|
|
|
.section .text.post,"x"
|
|
|
|
|
|
|
|
# Add padding so that target is just out of branch range.
|
|
|
|
.space 12
|
|
|
|
.align 2
|
|
|
|
.code 32
|
|
|
|
.global _forward_target
|
|
|
|
.type _forward_target, %function
|
|
|
|
_forward_target:
|
|
|
|
bx lr
|
|
|
|
.size _forward_target, .-_forward_target
|