2_22-branch'.
Cherrypick from master 2011-11-08 13:06:03 UTC Alan Modra <amodra@gmail.com> 'bfd/':
gold/testsuite/arm_farcall_arm_arm.s
gold/testsuite/arm_farcall_arm_arm.sh
gold/testsuite/arm_farcall_arm_thumb.s
gold/testsuite/arm_farcall_arm_thumb.sh
gold/testsuite/arm_farcall_thumb_arm.s
gold/testsuite/arm_farcall_thumb_arm.sh
gold/testsuite/arm_farcall_thumb_thumb.s
gold/testsuite/arm_farcall_thumb_thumb.sh
gold/testsuite/arm_fix_1176.s
gold/testsuite/arm_fix_1176.sh
ld/testsuite/ld-powerpc/tocopt.out
--- /dev/null
+@ Test to ensure that a ARM to ARM call exceeding 32Mb generates a stub.
+
+ .global _start
+ .syntax unified
+
+@ We will place the section .text at 0x1000.
+
+ .text
+
+_start:
+ bl bar
+
+@ We will place the section .foo at 0x2001020.
+
+ .section .foo, "xa"
+
+ .type bar, %function
+bar:
+ bx lr
+
--- /dev/null
+#!/bin/sh
+
+# arm_farcall_arm_arm.sh -- a test case for ARM->ARM farcall veneers
+
+# Copyright 2010, 2011, Free Software Foundation, Inc.
+# Written by Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
+# Based upon arm_cortex_a8.sh
+# Written by Doug Kwan <dougkwan@google.com>.
+
+# This file is part of gold.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
+# MA 02110-1301, USA.
+
+check()
+{
+ if ! grep -q "$2" "$1"
+ then
+ echo "Did not find expected instruction in $1:"
+ echo " $2"
+ echo ""
+ echo "Actual instructions below:"
+ cat "$1"
+ exit 1
+ fi
+}
+
+# Check for ARM->ARM default
+check arm_farcall_arm_arm.stdout "1004: .* ldr pc, \[pc, #-4\] .*"
+check arm_farcall_arm_arm.stdout "1008: 02001020"
+
+exit 0
--- /dev/null
+@ Test to ensure that a ARM to Thumb call exceeding 32Mb generates a stub.
+
+ .global _start
+ .global bar
+ .syntax unified
+
+@ We will place the section .text at 0x1000.
+
+ .text
+
+_start:
+ bl bar
+
+@ We will place the section .foo at 0x2001010.
+
+ .section .foo, "xa"
+ .thumb_func
+bar:
+ bx lr
+
--- /dev/null
+#!/bin/sh
+
+# arm_farcall_arm_thumb.sh -- a test case for ARM->Thumb farcall veneers.
+
+# Copyright 2010, 2011, Free Software Foundation, Inc.
+# Written by Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
+# Based upon arm_cortex_a8.sh
+# Written by Doug Kwan <dougkwan@google.com>.
+
+# This file is part of gold.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
+# MA 02110-1301, USA.
+
+check()
+{
+ if ! grep -q "$2" "$1"
+ then
+ echo "Did not find expected instruction in $1:"
+ echo " $2"
+ echo ""
+ echo "Actual instructions below:"
+ cat "$1"
+ exit 1
+ fi
+}
+
+# Check for ARM->Thumb default
+check arm_farcall_arm_thumb.stdout "1004: .* ldr ip, \[pc\]"
+check arm_farcall_arm_thumb.stdout "1008: .* bx ip"
+check arm_farcall_arm_thumb.stdout "100c: 02001015"
+
+# Check for ARM->Thumb with v5t interworking
+chck arm_farcall_arm_thumb_5t.stdout "1004: f004 e51f"
+chck arm_farcall_arm_thumb_5t.stdout "1008: 1015"
+chck arm_farcall_arm_thumb_5t.stdout "100a: 0200"
+
+exit 0
--- /dev/null
+@ Test to ensure that a Thumb to ARM call exceeding 4Mb generates a stub.
+@ Check that we can generate two types of stub in the same section.
+
+ .global _start
+ .syntax unified
+
+@ We will place the section .text at 0x1c01010.
+
+ .text
+ .thumb_func
+_start:
+ .global bar
+ bl bar
+@ This call is close enough to generate a "short branch" stub
+@ or no stub if blx is available.
+ .space 0x0300000
+ bl bar
+
+@ We will place the section .foo at 0x2001014.
+
+ .section .foo, "xa"
+
+ .arm
+ .type bar, %function
+bar:
+ bx lr
+
--- /dev/null
+#!/bin/sh
+
+# arm_farcall_thumb_arm.sh -- a test case for Thumb->ARM farcall veneers.
+
+# Copyright 2010, 2011, Free Software Foundation, Inc.
+# Written by Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
+# Based upon arm_cortex_a8.sh
+# Written by Doug Kwan <dougkwan@google.com>.
+
+# This file is part of gold.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
+# MA 02110-1301, USA.
+
+check()
+{
+ if ! grep -q "$2" "$1"
+ then
+ echo "Did not find expected instruction in $1:"
+ echo " $2"
+ echo ""
+ echo "Actual instructions below:"
+ cat "$1"
+ exit 1
+ fi
+}
+
+# Thumb->ARM
+check arm_farcall_thumb_arm.stdout "1f01018: .* bx pc"
+check arm_farcall_thumb_arm.stdout "1f0101a: .* nop"
+check arm_farcall_thumb_arm.stdout "1f0101c: f004 e51f"
+check arm_farcall_thumb_arm.stdout "1f01020: 1014"
+check arm_farcall_thumb_arm.stdout "1f01022: 0200"
+
+check arm_farcall_thumb_arm.stdout "1f01024: .* bx pc"
+check arm_farcall_thumb_arm.stdout "1f01026: .* nop"
+check arm_farcall_thumb_arm.stdout "1f01028: fff9 ea03"
+
+# Thumb->ARM with v5T interworking
+check arm_farcall_thumb_arm_5t.stdout "1f01018: f004 e51f"
+check arm_farcall_thumb_arm_5t.stdout "1f0101c: 1014"
+check arm_farcall_thumb_arm_5t.stdout "1f0101e: 0200"
+
+exit 0
--- /dev/null
+@ Test to ensure that a Thumb to Thumb call exceeding 4Mb generates a stub.
+
+ .global _start
+ .syntax unified
+
+@ We will place the section .text at 0x1000.
+
+ .text
+ .thumb_func
+_start:
+ bl bar
+
+@ We will place the section .foo at 0x02001014.
+
+ .section .foo, "xa"
+ .thumb_func
+bar:
+ bx lr
+
--- /dev/null
+#!/bin/sh
+
+# arm_farcall_thumb_thumb.sh -- a test case for Thumb->Thumb farcall veneers.
+
+# Copyright 2010, 2011, Free Software Foundation, Inc.
+# Written by Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
+# Based upon arm_cortex_a8.sh
+# Written by Doug Kwan <dougkwan@google.com>.
+
+# This file is part of gold.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
+# MA 02110-1301, USA.
+
+check()
+{
+ if ! grep -q "$2" "$1"
+ then
+ echo "Did not find expected instruction in $1:"
+ echo " $2"
+ echo ""
+ echo "Actual instructions below:"
+ cat "$1"
+ exit 1
+ fi
+}
+
+# Thumb->Thumb default
+check arm_farcall_thumb_thumb.stdout "1004: .* bx pc"
+check arm_farcall_thumb_thumb.stdout "1006: .* nop"
+check arm_farcall_thumb_thumb.stdout "1008: c000"
+check arm_farcall_thumb_thumb.stdout "100a: e59f"
+check arm_farcall_thumb_thumb.stdout "100c: ff1c e12f"
+check arm_farcall_thumb_thumb.stdout "1010: 1015"
+check arm_farcall_thumb_thumb.stdout "1012: 0200"
+
+# Thumb->Thumb with v5T interworking
+check arm_farcall_thumb_thumb_5t.stdout "1004: f004 e51f"
+check arm_farcall_thumb_thumb_5t.stdout "1008: 1015"
+check arm_farcall_thumb_thumb_5t.stdout "100a: 0200"
+
+# Thumb->Thumb on v6-M
+check arm_farcall_thumb_thumb_6m.stdout "1004: .* push {r0}"
+check arm_farcall_thumb_thumb_6m.stdout "1006: .* ldr r0, \\[pc, #8\\]"
+check arm_farcall_thumb_thumb_6m.stdout "1008: .* mov ip, r0"
+check arm_farcall_thumb_thumb_6m.stdout "100a: .* pop {r0}"
+check arm_farcall_thumb_thumb_6m.stdout "100c: .* bx ip"
+check arm_farcall_thumb_thumb_6m.stdout "100e: .* nop"
+check arm_farcall_thumb_thumb_6m.stdout "1010: 1015"
+check arm_farcall_thumb_thumb_6m.stdout "1012: 0200"
+
+# Thumb->Thumb on v7-M
+check arm_farcall_thumb_thumb_6m.stdout "1004: .* push {r0}"
+check arm_farcall_thumb_thumb_6m.stdout "1006: .* ldr r0, \\[pc, #8\\]"
+check arm_farcall_thumb_thumb_6m.stdout "1008: .* mov ip, r0"
+check arm_farcall_thumb_thumb_6m.stdout "100a: .* pop {r0}"
+check arm_farcall_thumb_thumb_6m.stdout "100c: .* bx ip"
+check arm_farcall_thumb_thumb_6m.stdout "100e: .* nop"
+check arm_farcall_thumb_thumb_6m.stdout "1010: 1015"
+check arm_farcall_thumb_thumb_6m.stdout "1012: 0200"
+
+exit 0
--- /dev/null
+ .syntax unified
+ .globl _start
+ .globl func_to_branch_to
+
+ .arm
+ .text
+func_to_branch_to:
+ bx lr
+
+ .thumb
+ .section .foo, "xa"
+ .thumb_func
+_start:
+ bl func_to_branch_to
+
--- /dev/null
+#!/bin/sh
+
+# arm_fix_1176.sh -- a test case for the ARM1176 workaround.
+
+# Copyright 2010, 2011, Free Software Foundation, Inc.
+# Written by Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
+# Based upon arm_cortex_a8.sh
+# Written by Doug Kwan <dougkwan@google.com>.
+
+# This file is part of gold.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
+# MA 02110-1301, USA.
+
+# This file goes with arm_v4bx.s, an ARM assembly source file constructed to
+# have test the handling of R_ARM_V4BX relocation.
+
+check()
+{
+ if ! grep -q "$2" "$1"
+ then
+ echo "Did not find expected instruction in $1:"
+ echo " $2"
+ echo ""
+ echo "Actual instructions below:"
+ cat "$1"
+ exit 1
+ fi
+}
+
+# Check for fix default state on v6Z.
+check arm_fix_1176_default_v6z.stdout "2001014: .* bl 2001018 <.*>"
+
+# Check for fix explicitly on on v6Z.
+check arm_fix_1176_on_v6z.stdout "2001014: .* bl 2001018 <.*>"
+
+# Check for explicitly off on v6Z
+check arm_fix_1176_off_v6z.stdout "2001014: .* blx 2001018 <.*>"
+
+# Check for fix default state on v5TE
+check arm_fix_1176_default_v5te.stdout "2001014: .* bl 2001018 <.*>"
+
+# Check for fix default state on v7A
+check arm_fix_1176_default_v7a.stdout "2001014: .* blx 2001018 <.*>"
+
+# Check for fix default state on ARM1156T2F-S
+check arm_fix_1176_default_1156t2f_s.stdout "2001014: .* blx 2001018 <.*>"
+
+exit 0
--- /dev/null
+.*
+\(\.text\+0x14\): .* 0x3fa00000 .*
+.*
+\(\.text\+0x34\): .* 0x3fa00010 .*