Fix alignment for the first section frag on xtensa
authorMax Filippov <jcmvbkbc@gmail.com>
Tue, 15 Apr 2014 15:12:46 +0000 (19:12 +0400)
committerMax Filippov <jcmvbkbc@gmail.com>
Tue, 22 Apr 2014 18:53:49 +0000 (22:53 +0400)
commita35d5e823fdfe8a6e7e05ca8e3fb8bb5697335b1
treef6c54cb44c457093f199a20d9bcf1a37a33f32ab
parent483805cf9ea5a6dace41415d8830e93fccc49c43
Fix alignment for the first section frag on xtensa

Linking object files produced by partial linking with link-time
relaxation enabled sometimes fails with the following error message:

dangerous relocation: call8: misaligned call target: (.text.unlikely+0x63)

This happens because no basic block with an XTENSA_PROP_ALIGN flag in the
property table is generated for the first basic block, even if the
.align directive is present.
It was believed that the first frag alignment could be derived from the
section alignment, but this was not implemented for the partial linking
case: after partial linking first frag of a section may become not
first, but no additional alignment frag is inserted before it.
Basic block for such frag may be merged with previous basic block into
extended basic block during relaxation pass losing its alignment
restrictions.

Fix this by always recording alignment for the first section frag.

2014-04-22  Max Filippov  <jcmvbkbc@gmail.com>

gas/
    * config/tc-xtensa.c (xtensa_handle_align): record alignment for the
    first section frag.

gas/testsuite/
    * gas/xtensa/all.exp: Add test for the first section frag alignment.
    * gas/xtensa/first_frag_align.d: First section frag alignment expected
    dump.
    * gas/xtensa/first_frag_align.s: First section frag alignment test
    source.
gas/ChangeLog
gas/config/tc-xtensa.c
gas/testsuite/ChangeLog
gas/testsuite/gas/xtensa/all.exp
gas/testsuite/gas/xtensa/first_frag_align.d [new file with mode: 0644]
gas/testsuite/gas/xtensa/first_frag_align.s [new file with mode: 0644]
This page took 0.029402 seconds and 4 git commands to generate.