gas: xtensa: limit size of auto litpools
authorMax Filippov <jcmvbkbc@gmail.com>
Thu, 8 Feb 2018 18:28:52 +0000 (10:28 -0800)
committerMax Filippov <jcmvbkbc@gmail.com>
Tue, 20 Feb 2018 19:49:48 +0000 (11:49 -0800)
commitcd665a945eccba1406696c65ac7eebb12a355446
treea3982708d2d39792d56384e59144d9143d8d91c4
parent7104e59bece90e387d70f617eb7ed4c34087283d
gas: xtensa: limit size of auto litpools

Literal movement code may grow auto litpool so big that it won't be
possible to jump around it. Limit the size of auto litpools by 1/2 of
the jump range.

gas/
2018-02-20  Max Filippov  <jcmvbkbc@gmail.com>

* config/tc-xtensa.c (struct litpool_frag): Add new field
literal_count.
(MAX_AUTO_POOL_LITERALS, MAX_EXPLICIT_POOL_LITERALS)
(MAX_POOL_LITERALS): New macro definitions.
(auto_litpool_limit): Initialize to 0.
(md_parse_option): Set auto_litpool_limit in the presence of
--auto-litpools option.
(xtensa_maybe_create_literal_pool_frag): Zero-initialize
literal_count field.
(xg_find_litpool): New function. Make sure that found literal
pool size is within the limit.
(xtensa_move_literals): Extract literal pool search code into
the new function.
* testsuite/gas/xtensa/all.exp: Add auto-litpools-2 test.
* testsuite/gas/xtensa/auto-litpools-2.d: New file.
* testsuite/gas/xtensa/auto-litpools-2.s: New file.
* testsuite/gas/xtensa/auto-litpools.d: Fix up changed
addresses.
* testsuite/gas/xtensa/auto-litpools.s: Change literal value so
that objdump doesn't get out of sync.
gas/ChangeLog
gas/config/tc-xtensa.c
gas/testsuite/gas/xtensa/all.exp
gas/testsuite/gas/xtensa/auto-litpools-2.d [new file with mode: 0644]
gas/testsuite/gas/xtensa/auto-litpools-2.s [new file with mode: 0644]
gas/testsuite/gas/xtensa/auto-litpools.d
gas/testsuite/gas/xtensa/auto-litpools.s