gas: xtensa: fix literal movement
authorMax Filippov <jcmvbkbc@gmail.com>
Tue, 8 May 2018 20:49:00 +0000 (13:49 -0700)
committerMax Filippov <jcmvbkbc@gmail.com>
Wed, 9 May 2018 19:44:08 +0000 (12:44 -0700)
commitd0ad159d6848fbd42f5c213f8b051735793101e4
tree9a242b794be15a22c8853954b7215babadfa4fe2
parent06cfb1c89510d08217da8b3ccea05ecd4cdb5bc6
gas: xtensa: fix literal movement

Not all literals need to be moved in the presence of
--text-section-literals or --auto-litpools, but only those created by
.literal pseudo op or generated as a result of relaxation. Attempts to
move other literals may result in abnormal termination of the assembler
due to the following assertion failure:

  Internal error in xg_find_litpool at gas/config/tc-xtensa.c:11209.

The same assertion may also be triggered by attempting to assign literal
pools to literals in .init and .fini sections; don't try to do that.

gas/
2018-05-09  Max Filippov  <jcmvbkbc@gmail.com>

* config/tc-xtensa.c (xtensa_is_init_fini): New function.
(xtensa_move_literals): Only attempt to assign literal pool to
literals with tc_frag_data.is_literal mark and not in .init or
.fini sections.
Join nested 'if' conditions to simplify function structure.
(xtensa_switch_to_non_abs_literal_fragment): Use
xtensa_is_init_fini to test for .init/.fini sections.
* testsuite/gas/xtensa/all.exp (auto-litpools-3)
(auto-litpools-4, text-section-literals-1): New tests.
* testsuite/gas/xtensa/auto-litpools-3.d: New test results.
* testsuite/gas/xtensa/auto-litpools-3.s: New test source.
* testsuite/gas/xtensa/auto-litpools-4.d: New test results.
* testsuite/gas/xtensa/auto-litpools-4.s: New test source.
* testsuite/gas/xtensa/text-section-literals-1.d: New test results.
* testsuite/gas/xtensa/text-section-literals-1.s: New test source.
gas/ChangeLog
gas/config/tc-xtensa.c
gas/testsuite/gas/xtensa/all.exp
gas/testsuite/gas/xtensa/auto-litpools-3.d [new file with mode: 0644]
gas/testsuite/gas/xtensa/auto-litpools-3.s [new file with mode: 0644]
gas/testsuite/gas/xtensa/auto-litpools-4.d [new file with mode: 0644]
gas/testsuite/gas/xtensa/auto-litpools-4.s [new file with mode: 0644]
gas/testsuite/gas/xtensa/text-section-literals-1.d [new file with mode: 0644]
gas/testsuite/gas/xtensa/text-section-literals-1.s [new file with mode: 0644]