summaryrefslogtreecommitdiffstats
path: root/meta
diff options
context:
space:
mode:
authorArmin Kuster <akuster808@gmail.com>2018-09-13 11:42:37 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2018-09-27 12:17:45 +0100
commit8cdabe1f6fa908489e6daad912fadae69adf78c4 (patch)
tree2b6a103405d49e1dce2f7a31b13cf9bce3f98760 /meta
parent79083fcd0ddd9bf69b5068da9c503ae28a809aae (diff)
downloadpoky-8cdabe1f6fa908489e6daad912fadae69adf78c4.tar.gz
binutils: Change the ARM assembler's ADR and ADRl pseudo-ops so that they will only set the bottom bit of imported thumb function symbols if the -mthumb-interwork option is active.
[Yocto 12865] < 2.30 (From OE-Core rev: a1c0135e96bca684db0e3a7c6209c0cb2054f306) Signed-off-by: Armin Kuster <akuster808@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rw-r--r--meta/recipes-devtools/binutils/binutils-2.30.inc1
-rw-r--r--meta/recipes-devtools/binutils/binutils/0001-Change-the-ARM-assembler-s-ADR-and-ADRl-pseudo-ops-s.patch176
2 files changed, 177 insertions, 0 deletions
diff --git a/meta/recipes-devtools/binutils/binutils-2.30.inc b/meta/recipes-devtools/binutils/binutils-2.30.inc
index 37243db1bc..35d7d9b93f 100644
--- a/meta/recipes-devtools/binutils/binutils-2.30.inc
+++ b/meta/recipes-devtools/binutils/binutils-2.30.inc
@@ -47,6 +47,7 @@ SRC_URI = "\
47 file://CVE-2018-10372.patch \ 47 file://CVE-2018-10372.patch \
48 file://CVE-2018-10535.patch \ 48 file://CVE-2018-10535.patch \
49 file://CVE-2018-10534.patch \ 49 file://CVE-2018-10534.patch \
50 file://0001-Change-the-ARM-assembler-s-ADR-and-ADRl-pseudo-ops-s.patch \
50" 51"
51S = "${WORKDIR}/git" 52S = "${WORKDIR}/git"
52 53
diff --git a/meta/recipes-devtools/binutils/binutils/0001-Change-the-ARM-assembler-s-ADR-and-ADRl-pseudo-ops-s.patch b/meta/recipes-devtools/binutils/binutils/0001-Change-the-ARM-assembler-s-ADR-and-ADRl-pseudo-ops-s.patch
new file mode 100644
index 0000000000..8604e678da
--- /dev/null
+++ b/meta/recipes-devtools/binutils/binutils/0001-Change-the-ARM-assembler-s-ADR-and-ADRl-pseudo-ops-s.patch
@@ -0,0 +1,176 @@
1From fc6141f097056f830a412afebed8d81a9d72b696 Mon Sep 17 00:00:00 2001
2From: Nick Clifton <nickc@redhat.com>
3Date: Wed, 20 Jun 2018 12:38:10 +0100
4Subject: [PATCH] Change the ARM assembler's ADR and ADRl pseudo-ops so that
5 they will only set the bottom bit of imported thumb function symbols if the
6 -mthumb-interwork option is active.
7
8For more information see the email thread starting here:
9https://www.sourceware.org/ml/binutils/2018-05/msg00348.html
10
11 PR 21458
12 * tc-arm.c (do_adr): Only set the bottom bit of an imported thumb
13 function symbol address if -mthumb-interwork is active.
14 (do_adrl): Likewise.
15 * doc/c-arm.texi: Update descriptions of the -mthumb-interwork
16 option and the ADR and ADRL pseudo-ops.
17 * NEWS: Mention the new behaviour of the ADR and ADRL pseudo-ops.
18 * testsuite/gas/arm/pr21458.d: Add -mthumb-interwork option to
19 assembler command line.
20 * testsuite/gas/arm/adr.d: Likewise.
21 * testsuite/gas/arm/adrl.d: Likewise.
22---
23 gas/ChangeLog | 14 ++++++++++++++
24 gas/NEWS | 4 ++++
25 gas/config/tc-arm.c | 10 ++++++----
26 gas/doc/c-arm.texi | 17 ++++++++++++++++-
27 gas/testsuite/gas/arm/adr.d | 1 +
28 gas/testsuite/gas/arm/adrl.d | 1 +
29 gas/testsuite/gas/arm/pr21458.d | 3 ++-
30 7 files changed, 44 insertions(+), 6 deletions(-)
31
32Index: git/gas/config/tc-arm.c
33===================================================================
34--- git.orig/gas/config/tc-arm.c
35+++ git/gas/config/tc-arm.c
36@@ -8410,11 +8410,12 @@ do_adr (void)
37 inst.reloc.pc_rel = 1;
38 inst.reloc.exp.X_add_number -= 8;
39
40- if (inst.reloc.exp.X_op == O_symbol
41+ if (support_interwork
42+ && inst.reloc.exp.X_op == O_symbol
43 && inst.reloc.exp.X_add_symbol != NULL
44 && S_IS_DEFINED (inst.reloc.exp.X_add_symbol)
45 && THUMB_IS_FUNC (inst.reloc.exp.X_add_symbol))
46- inst.reloc.exp.X_add_number += 1;
47+ inst.reloc.exp.X_add_number |= 1;
48 }
49
50 /* This is a pseudo-op of the form "adrl rd, label" to be converted
51@@ -8434,11 +8435,12 @@ do_adrl (void)
52 inst.size = INSN_SIZE * 2;
53 inst.reloc.exp.X_add_number -= 8;
54
55- if (inst.reloc.exp.X_op == O_symbol
56+ if (support_interwork
57+ && inst.reloc.exp.X_op == O_symbol
58 && inst.reloc.exp.X_add_symbol != NULL
59 && S_IS_DEFINED (inst.reloc.exp.X_add_symbol)
60 && THUMB_IS_FUNC (inst.reloc.exp.X_add_symbol))
61- inst.reloc.exp.X_add_number += 1;
62+ inst.reloc.exp.X_add_number |= 1;
63 }
64
65 static void
66Index: git/gas/doc/c-arm.texi
67===================================================================
68--- git.orig/gas/doc/c-arm.texi
69+++ git/gas/doc/c-arm.texi
70@@ -317,7 +317,8 @@ instructions; that is, it should behave
71 @cindex @code{-mthumb-interwork} command line option, ARM
72 @item -mthumb-interwork
73 This option specifies that the output generated by the assembler should
74-be marked as supporting interworking.
75+be marked as supporting interworking. It also affects the behaviour
76+of the @code{ADR} and @code{ADRL} pseudo opcodes.
77
78 @cindex @code{-mimplicit-it} command line option, ARM
79 @item -mimplicit-it=never
80@@ -1060,6 +1061,16 @@ out of range, or if it is not defined in
81 the ADR instruction, then an error will be generated. This instruction
82 will not make use of the literal pool.
83
84+If @var{label} is a thumb function symbol, and thumb interworking has
85+been enabled via the @option{-mthumb-interwork} option then the bottom
86+bit of the value stored into @var{register} will be set. This allows
87+the following sequence to work as expected:
88+
89+@smallexample
90+ adr r0, thumb_function
91+ blx r0
92+@end smallexample
93+
94 @cindex @code{ADRL reg,<label>} pseudo op, ARM
95 @item ADRL
96 @smallexample
97@@ -1076,6 +1087,10 @@ If the label is out of range, or if it i
98 (and section) as the ADRL instruction, then an error will be generated.
99 This instruction will not make use of the literal pool.
100
101+If @var{label} is a thumb function symbol, and thumb interworking has
102+been enabled via the @option{-mthumb-interwork} option then the bottom
103+bit of the value stored into @var{register} will be set.
104+
105 @end table
106
107 For information on the ARM or Thumb instruction sets, see @cite{ARM
108Index: git/gas/testsuite/gas/arm/adr.d
109===================================================================
110--- git.orig/gas/testsuite/gas/arm/adr.d
111+++ git/gas/testsuite/gas/arm/adr.d
112@@ -1,3 +1,4 @@
113+#as: -mthumb-interwork
114 #objdump: -dr --prefix-addresses --show-raw-insn
115 #name: ADR
116
117Index: git/gas/testsuite/gas/arm/adrl.d
118===================================================================
119--- git.orig/gas/testsuite/gas/arm/adrl.d
120+++ git/gas/testsuite/gas/arm/adrl.d
121@@ -1,3 +1,4 @@
122+#as: -mthumb-interwork
123 #objdump: -dr --prefix-addresses --show-raw-insn
124 #name: ADRL
125
126Index: git/gas/ChangeLog
127===================================================================
128--- git.orig/gas/ChangeLog
129+++ git/gas/ChangeLog
130@@ -1,3 +1,17 @@
131+2018-06-20 Nick Clifton <nickc@redhat.com>
132+
133+ PR 21458
134+ * tc-arm.c (do_adr): Only set the bottom bit of an imported thumb
135+ function symbol address if -mthumb-interwork is active.
136+ (do_adrl): Likewise.
137+ * doc/c-arm.texi: Update descriptions of the -mthumb-interwork
138+ option and the ADR and ADRL pseudo-ops.
139+ * NEWS: Mention the new behaviour of the ADR and ADRL pseudo-ops.
140+ * testsuite/gas/arm/pr21458.d: Add -mthumb-interwork option to
141+ assembler command line.
142+ * testsuite/gas/arm/adr.d: Likewise.
143+ * testsuite/gas/arm/adrl.d: Likewise.
144+
145 2018-02-05 Nick Clifton <nickc@redhat.com>
146
147 * po/ru.po: Updated Russian translation.
148Index: git/gas/NEWS
149===================================================================
150--- git.orig/gas/NEWS
151+++ git/gas/NEWS
152@@ -1,5 +1,9 @@
153 -*- text -*-
154
155+* The ADR and ADRL pseudo-instructions supported by the ARM assembler
156+ now only set the bottom bit of the address of thumb function symbols
157+ if the -mthumb-interwork command line option is active.
158+
159 Changes in 2.30:
160
161 * Add support for loaction views in DWARF debug line information.
162Index: git/gas/testsuite/gas/arm/pr21458.d
163===================================================================
164--- git.orig/gas/testsuite/gas/arm/pr21458.d
165+++ git/gas/testsuite/gas/arm/pr21458.d
166@@ -1,8 +1,9 @@
167+#as: -mthumb-interwork
168 #objdump: -d --prefix-addresses --show-raw-insn
169 #name: ADR(L) for Thumb functions
170 #skip: *-*-pe *-wince-* *-*-coff *-*-vxworks
171
172-# Test that using ADR(L) on thumb function symbols sets the T bit.
173+# Test that using ADR(L) on thumb function symbols sets the T bit when -mthumb-interwork is active.
174
175 .*: +file format .*arm.*
176