e1c2d85aa81753e270642e05a7d33bef9d1856c2
[packages/trusty/cirros-testvm.git] / cirros-testvm / src-cirros / buildroot-2015.05 / package / binutils / 2.24 / 901-xtensa-gas-first-frag-alignment.patch
1 From a35d5e823fdfe8a6e7e05ca8e3fb8bb5697335b1 Mon Sep 17 00:00:00 2001
2 From: Max Filippov <jcmvbkbc@gmail.com>
3 Date: Tue, 15 Apr 2014 19:12:46 +0400
4 Subject: [PATCH] Fix alignment for the first section frag on xtensa
5
6 Linking object files produced by partial linking with link-time
7 relaxation enabled sometimes fails with the following error message:
8
9 dangerous relocation: call8: misaligned call target: (.text.unlikely+0x63)
10
11 This happens because no basic block with an XTENSA_PROP_ALIGN flag in the
12 property table is generated for the first basic block, even if the
13 .align directive is present.
14 It was believed that the first frag alignment could be derived from the
15 section alignment, but this was not implemented for the partial linking
16 case: after partial linking first frag of a section may become not
17 first, but no additional alignment frag is inserted before it.
18 Basic block for such frag may be merged with previous basic block into
19 extended basic block during relaxation pass losing its alignment
20 restrictions.
21
22 Fix this by always recording alignment for the first section frag.
23
24 2014-04-22  Max Filippov  <jcmvbkbc@gmail.com>
25
26 gas/
27     * config/tc-xtensa.c (xtensa_handle_align): record alignment for the
28     first section frag.
29
30 ---
31 Backported from: a35d5e823fdfe8a6e7e05ca8e3fb8bb5697335b1
32 Changes to Changelog files and tests are dropped.
33
34  gas/config/tc-xtensa.c                      | 1 -
35  1 file changed, 1 deletion(-)
36
37 diff --git a/gas/config/tc-xtensa.c b/gas/config/tc-xtensa.c
38 index ea23c96..58ace38 100644
39 --- a/gas/config/tc-xtensa.c
40 +++ b/gas/config/tc-xtensa.c
41 @@ -5609,7 +5609,6 @@ xtensa_handle_align (fragS *fragP)
42        && ! fragP->tc_frag_data.is_literal
43        && (fragP->fr_type == rs_align
44           || fragP->fr_type == rs_align_code)
45 -      && fragP->fr_address + fragP->fr_fix > 0
46        && fragP->fr_offset > 0
47        && now_seg != bss_section)
48      {
49 -- 
50 1.8.1.4
51