]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gold/testsuite/aarch64_relocs.sh
Update year range in copyright notice of binutils files
[thirdparty/binutils-gdb.git] / gold / testsuite / aarch64_relocs.sh
CommitLineData
8769bc4b
HS
1#!/bin/sh
2
3# aarch64_relocs.sh -- test AArch64 relocations.
4
250d07de 5# Copyright (C) 2016-2021 Free Software Foundation, Inc.
8769bc4b
HS
6# Written by Igor Kudrin <ikudrin@accesssoftek.com>
7
8# This file is part of gold.
9
10# This program is free software; you can redistribute it and/or modify
11# it under the terms of the GNU General Public License as published by
12# the Free Software Foundation; either version 3 of the License, or
13# (at your option) any later version.
14
15# This program is distributed in the hope that it will be useful,
16# but WITHOUT ANY WARRANTY; without even the implied warranty of
17# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18# GNU General Public License for more details.
19
20# You should have received a copy of the GNU General Public License
21# along with this program; if not, write to the Free Software
22# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
23# MA 02110-1301, USA.
24
25check()
26{
27 file=$1
28 lbl=$2
29 line=$3
30 pattern=$4
31
32 found=`grep "<$lbl>:" $file`
33 if test -z "$found"; then
34 echo "Label $lbl not found."
35 exit 1
36 fi
37
38 match_pattern=`grep "<$lbl>:" -A$line $file | tail -n 1 | grep -e "$pattern"`
39 if test -z "$match_pattern"; then
40 echo "Expected pattern did not found in line $line after label $lbl:"
41 echo " $pattern"
42 echo ""
43 echo "Extract:"
44 grep "<$lbl>:" -A$line $file
45 echo ""
46 echo "Actual output below:"
47 cat "$file"
48 exit 1
49 fi
50}
51
52check "aarch64_relocs.stdout" "test_R_AARCH64_MOVW_UABS_G0" 1 "\<mov[[:space:]]\+x4,[[:space:]]\+#0x1234\b"
53check "aarch64_relocs.stdout" "test_R_AARCH64_MOVW_UABS_G0" 2 "\<R_AARCH64_MOVW_UABS_G0[[:space:]]\+abs_0x1234\b"
54check "aarch64_relocs.stdout" "test_R_AARCH64_MOVW_UABS_G0" 3 "\<mov[[:space:]]\+x4,[[:space:]]\+#0x1238\b"
55check "aarch64_relocs.stdout" "test_R_AARCH64_MOVW_UABS_G0" 4 "\<R_AARCH64_MOVW_UABS_G0[[:space:]]\+abs_0x1234+0x4\b"
56
57check "aarch64_relocs.stdout" "test_R_AARCH64_MOVW_UABS_G0_NC" 1 "\<mov[[:space:]]\+x4,[[:space:]]\+#0x1234\b"
58check "aarch64_relocs.stdout" "test_R_AARCH64_MOVW_UABS_G0_NC" 2 "\<R_AARCH64_MOVW_UABS_G0_NC[[:space:]]\+abs_0x1234\b"
59check "aarch64_relocs.stdout" "test_R_AARCH64_MOVW_UABS_G0_NC" 3 "\<mov[[:space:]]\+x4,[[:space:]]\+#0x6234\b"
60check "aarch64_relocs.stdout" "test_R_AARCH64_MOVW_UABS_G0_NC" 4 "\<R_AARCH64_MOVW_UABS_G0_NC[[:space:]]\+abs_0x1234+0x45000\b"
61
62check "aarch64_relocs.stdout" "test_R_AARCH64_MOVW_UABS_G1" 1 "\<movz[[:space:]]\+x4,[[:space:]]\+#0x0, lsl #16\b"
63check "aarch64_relocs.stdout" "test_R_AARCH64_MOVW_UABS_G1" 2 "\<R_AARCH64_MOVW_UABS_G1[[:space:]]\+abs_0x1234-0x4\b"
64check "aarch64_relocs.stdout" "test_R_AARCH64_MOVW_UABS_G1" 3 "\<mov[[:space:]]\+x4,[[:space:]]\+#0x10000\b"
65check "aarch64_relocs.stdout" "test_R_AARCH64_MOVW_UABS_G1" 4 "\<R_AARCH64_MOVW_UABS_G1[[:space:]]\+abs_0x11000\b"
66check "aarch64_relocs.stdout" "test_R_AARCH64_MOVW_UABS_G1" 5 "\<mov[[:space:]]\+x4,[[:space:]]\+#0x60000\b"
67check "aarch64_relocs.stdout" "test_R_AARCH64_MOVW_UABS_G1" 6 "\<R_AARCH64_MOVW_UABS_G1[[:space:]]\+abs_0x45000+0x20010\b"
68
69check "aarch64_relocs.stdout" "test_R_AARCH64_MOVW_UABS_G1_NC" 1 "\<movz[[:space:]]\+x4,[[:space:]]\+#0x0, lsl #16\b"
70check "aarch64_relocs.stdout" "test_R_AARCH64_MOVW_UABS_G1_NC" 2 "\<R_AARCH64_MOVW_UABS_G1_NC[[:space:]]\+abs_0x1234-0x4\b"
71check "aarch64_relocs.stdout" "test_R_AARCH64_MOVW_UABS_G1_NC" 3 "\<mov[[:space:]]\+x4,[[:space:]]\+#0x10000\b"
72check "aarch64_relocs.stdout" "test_R_AARCH64_MOVW_UABS_G1_NC" 4 "\<R_AARCH64_MOVW_UABS_G1_NC[[:space:]]\+abs_0x11000\b"
73check "aarch64_relocs.stdout" "test_R_AARCH64_MOVW_UABS_G1_NC" 5 "\<mov[[:space:]]\+x4,[[:space:]]\+#0x60000\b"
74check "aarch64_relocs.stdout" "test_R_AARCH64_MOVW_UABS_G1_NC" 6 "\<R_AARCH64_MOVW_UABS_G1_NC[[:space:]]\+abs_0x45000+0x100020010\b"
75
76check "aarch64_relocs.stdout" "test_R_AARCH64_MOVW_UABS_G2" 1 "\<movz[[:space:]]\+x4,[[:space:]]\+#0x0, lsl #32\b"
77check "aarch64_relocs.stdout" "test_R_AARCH64_MOVW_UABS_G2" 2 "\<R_AARCH64_MOVW_UABS_G2[[:space:]]\+abs_0x45000+0x20010\b"
78check "aarch64_relocs.stdout" "test_R_AARCH64_MOVW_UABS_G2" 3 "\<mov[[:space:]]\+x4,[[:space:]]\+#0x3700000000\b"
79check "aarch64_relocs.stdout" "test_R_AARCH64_MOVW_UABS_G2" 4 "\<R_AARCH64_MOVW_UABS_G2[[:space:]]\+abs_0x3600010000+0x100020010\b"
80
81check "aarch64_relocs.stdout" "test_R_AARCH64_MOVW_UABS_G2_NC" 1 "\<movz[[:space:]]\+x4,[[:space:]]\+#0x0, lsl #32\b"
82check "aarch64_relocs.stdout" "test_R_AARCH64_MOVW_UABS_G2_NC" 2 "\<R_AARCH64_MOVW_UABS_G2_NC[[:space:]]\+abs_0x45000+0x20010\b"
83check "aarch64_relocs.stdout" "test_R_AARCH64_MOVW_UABS_G2_NC" 3 "\<mov[[:space:]]\+x4,[[:space:]]\+#0x3700000000\b"
84check "aarch64_relocs.stdout" "test_R_AARCH64_MOVW_UABS_G2_NC" 4 "\<R_AARCH64_MOVW_UABS_G2_NC[[:space:]]\+abs_0x3600010000+0x3000100020010\b"
85
86check "aarch64_relocs.stdout" "test_R_AARCH64_MOVW_UABS_G3" 1 "\<movz[[:space:]]\+x4,[[:space:]]\+#0x0, lsl #48\b"
87check "aarch64_relocs.stdout" "test_R_AARCH64_MOVW_UABS_G3" 2 "\<R_AARCH64_MOVW_UABS_G3[[:space:]]\+abs_0x3600010000+0x100020010\b"
88check "aarch64_relocs.stdout" "test_R_AARCH64_MOVW_UABS_G3" 3 "\<mov[[:space:]]\+x4,[[:space:]]\+#0x3000000000000\b"
89check "aarch64_relocs.stdout" "test_R_AARCH64_MOVW_UABS_G3" 4 "\<R_AARCH64_MOVW_UABS_G3[[:space:]]\+abs_0x3600010000+0x3000100020010\b"
90
91check "aarch64_relocs.stdout" "test_R_AARCH64_MOVW_SABS_G0" 1 "\<mov[[:space:]]\+x4,[[:space:]]\+#0x1238\b"
92check "aarch64_relocs.stdout" "test_R_AARCH64_MOVW_SABS_G0" 2 "\<R_AARCH64_MOVW_SABS_G0[[:space:]]\+abs_0x1234+0x4\b"
93check "aarch64_relocs.stdout" "test_R_AARCH64_MOVW_SABS_G0" 3 "\<mov[[:space:]]\+x4,[[:space:]]\+#0xffffffffffffeeef\b"
94check "aarch64_relocs.stdout" "test_R_AARCH64_MOVW_SABS_G0" 4 "\<R_AARCH64_MOVW_SABS_G0[[:space:]]\+abs_0x1234-0x2345\b"
95
96check "aarch64_relocs.stdout" "test_R_AARCH64_MOVW_SABS_G1" 1 "\<movn[[:space:]]\+x4,[[:space:]]\+#0x0, lsl #16\b"
97check "aarch64_relocs.stdout" "test_R_AARCH64_MOVW_SABS_G1" 2 "\<R_AARCH64_MOVW_SABS_G1[[:space:]]\+abs_0x1234-0x2345\b"
98check "aarch64_relocs.stdout" "test_R_AARCH64_MOVW_SABS_G1" 3 "\<mov[[:space:]]\+x4,[[:space:]]\+#0x60000\b"
99check "aarch64_relocs.stdout" "test_R_AARCH64_MOVW_SABS_G1" 4 "\<R_AARCH64_MOVW_SABS_G1[[:space:]]\+abs_0x45000+0x20010\b"
100check "aarch64_relocs.stdout" "test_R_AARCH64_MOVW_SABS_G1" 5 "\<mov[[:space:]]\+x4,[[:space:]]\+#0xfffffffffffeffff\b"
101check "aarch64_relocs.stdout" "test_R_AARCH64_MOVW_SABS_G1" 6 "\<R_AARCH64_MOVW_SABS_G1[[:space:]]\+abs_0x45000-0x56000\b"
102
103check "aarch64_relocs.stdout" "test_R_AARCH64_MOVW_SABS_G2" 1 "\<movz[[:space:]]\+x4,[[:space:]]\+#0x0, lsl #32\b"
104check "aarch64_relocs.stdout" "test_R_AARCH64_MOVW_SABS_G2" 2 "\<R_AARCH64_MOVW_SABS_G2[[:space:]]\+abs_0x45000+0x20010\b"
105check "aarch64_relocs.stdout" "test_R_AARCH64_MOVW_SABS_G2" 3 "\<mov[[:space:]]\+x4,[[:space:]]\+#0x3700000000\b"
106check "aarch64_relocs.stdout" "test_R_AARCH64_MOVW_SABS_G2" 4 "\<R_AARCH64_MOVW_SABS_G2[[:space:]]\+abs_0x3600010000+0x100020010\b"
107check "aarch64_relocs.stdout" "test_R_AARCH64_MOVW_SABS_G2" 5 "\<mov[[:space:]]\+x4,[[:space:]]\+#0xfffffff2ffffffff\b"
108check "aarch64_relocs.stdout" "test_R_AARCH64_MOVW_SABS_G2" 6 "\<R_AARCH64_MOVW_SABS_G2[[:space:]]\+abs_0x3600010000-0x4400010000\b"
109
110exit 0