diff options
author | Maciej W. Rozycki <macro@imgtec.com> | 2017-04-27 00:47:15 +0100 |
---|---|---|
committer | Maciej W. Rozycki <macro@imgtec.com> | 2017-04-27 00:50:57 +0100 |
commit | ce8ad8721313d288a05a95b62d95ca43db584ebb (patch) | |
tree | 4eb66ffed394520ed4396ce21f46a113ee62dbdd /gas/ChangeLog | |
parent | 97d343d40012b1030f1fd219f91efcab180fb3ef (diff) | |
download | gdb-ce8ad8721313d288a05a95b62d95ca43db584ebb.zip gdb-ce8ad8721313d288a05a95b62d95ca43db584ebb.tar.gz gdb-ce8ad8721313d288a05a95b62d95ca43db584ebb.tar.bz2 |
MIPS/GAS: Fix `.option picX' handling with relaxation
Correct the handling of `.option pic0' and `.option pic2' GAS pseudo-ops
in relaxation and use the setting of `mips_pic' (which these directives
control) as at the time a relaxed frag has been created rather than the
final `mips_pic' setting at the end of the source file processed.
To do so record whether `mips_pic' is NO_PIC or not in the frag itself
and use this information throughout relaxation instead of `mips_pic' to
decide which of NO_PIC or SVR4_PIC to produce machine code for, fixing
code generation and removing a possible fatal failure reproducible with:
$ as -32 --relax-branch -o option-pic-relax-3.o option-pic-relax-3.s
option-pic-relax-3.s: Assembler messages:
option-pic-relax-3.s:7: Warning: relaxed out-of-range branch into a jump
option-pic-relax-3.s: Internal error in cvt_frag_to_fill at .../gas/write.c:490.
Please report this bug.
$
using the test source included, due to a buffer overrun in filling the
variable part of a frag.
Likewise use the `fx_tcbit2' flag of a BFD_RELOC_16_PCREL_S2 fixup to
handle the simple case of substituting an out of range unconditional
branch with an equivalent absolute jump in NO_PIC code.
Retain the current way of VXWORKS_PIC use, which commit 41a1578ed17c
("MIPS/GAS: Sanitize `.option picX' pseudo-op") has forbidden the use of
`.option picX' with.
gas/
* config/tc-mips.c (RELAX_ENCODE): Add `PIC' flag.
(RELAX_PIC): New macro.
(RELAX_USE_SECOND, RELAX_SECOND_LONGER, RELAX_NOMACRO)
(RELAX_DELAY_SLOT, RELAX_DELAY_SLOT_16BIT)
(RELAX_DELAY_SLOT_SIZE_FIRST, RELAX_DELAY_SLOT_SIZE_SECOND):
Shift bits.
(RELAX_BRANCH_ENCODE): Add `pic' flag.
(RELAX_BRANCH_UNCOND, RELAX_BRANCH_LIKELY, RELAX_BRANCH_LINK)
(RELAX_BRANCH_TOOFAR): Shift bits.
(RELAX_BRANCH_PIC): New macro.
(RELAX_MICROMIPS_ENCODE): Add `pic' flag.
(RELAX_MICROMIPS_PIC): New macro.
(RELAX_MICROMIPS_UNCOND, RELAX_MICROMIPS_COMPACT)
(RELAX_MICROMIPS_LINK, RELAX_MICROMIPS_NODS)
(RELAX_MICROMIPS_RELAX32): Shift bits.
(relax_close_frag): Pass `mips_pic' setting to RELAX_ENCODE.
(append_insn): Pass `mips_pic' setting to RELAX_BRANCH_ENCODE
and RELAX_MICROMIPS_ENCODE, and record it in `fx_tcbit2' of the
first fixup created.
(md_apply_fix) <BFD_RELOC_16_PCREL_S2>: Use `fx_tcbit2' of the
fixup processed rather than `mips_pic' in choosing to relax an
out of range branch to a jump.
(relaxed_branch_length): Use the `pic' flag of the relaxed frag
rather than `mips_pic'.
(relaxed_micromips_32bit_branch_length): Likewise.
(md_estimate_size_before_relax): Likewise.
(md_convert_frag): Likewise.
* testsuite/gas/mips/option-pic-relax-0.d: New test.
* testsuite/gas/mips/option-pic-relax-1.d: New test.
* testsuite/gas/mips/option-pic-relax-2.d: New test.
* testsuite/gas/mips/option-pic-relax-3.d: New test.
* testsuite/gas/mips/option-pic-relax-3a.d: New test.
* testsuite/gas/mips/option-pic-relax-4.d: New test.
* testsuite/gas/mips/option-pic-relax-5.d: New test.
* testsuite/gas/mips/option-pic-relax-2.l: New stderr output.
* testsuite/gas/mips/option-pic-relax-3.l: New stderr output.
* testsuite/gas/mips/option-pic-relax-4.l: New stderr output.
* testsuite/gas/mips/option-pic-relax-5.l: New stderr output.
* testsuite/gas/mips/option-pic-relax-0.s: New test source.
* testsuite/gas/mips/option-pic-relax-1.s: New test source.
* testsuite/gas/mips/option-pic-relax-2.s: New test source.
* testsuite/gas/mips/option-pic-relax-3.s: New test source.
* testsuite/gas/mips/option-pic-relax-4.s: New test source.
* testsuite/gas/mips/option-pic-relax-5.s: New test source.
* testsuite/gas/mips/mips.exp: Run the new tests.
Diffstat (limited to 'gas/ChangeLog')
-rw-r--r-- | gas/ChangeLog | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog index ded300d..6156e1e 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,52 @@ +2017-04-26 Maciej W. Rozycki <macro@imgtec.com> + + * config/tc-mips.c (RELAX_ENCODE): Add `PIC' flag. + (RELAX_PIC): New macro. + (RELAX_USE_SECOND, RELAX_SECOND_LONGER, RELAX_NOMACRO) + (RELAX_DELAY_SLOT, RELAX_DELAY_SLOT_16BIT) + (RELAX_DELAY_SLOT_SIZE_FIRST, RELAX_DELAY_SLOT_SIZE_SECOND): + Shift bits. + (RELAX_BRANCH_ENCODE): Add `pic' flag. + (RELAX_BRANCH_UNCOND, RELAX_BRANCH_LIKELY, RELAX_BRANCH_LINK) + (RELAX_BRANCH_TOOFAR): Shift bits. + (RELAX_BRANCH_PIC): New macro. + (RELAX_MICROMIPS_ENCODE): Add `pic' flag. + (RELAX_MICROMIPS_PIC): New macro. + (RELAX_MICROMIPS_UNCOND, RELAX_MICROMIPS_COMPACT) + (RELAX_MICROMIPS_LINK, RELAX_MICROMIPS_NODS) + (RELAX_MICROMIPS_RELAX32): Shift bits. + (relax_close_frag): Pass `mips_pic' setting to RELAX_ENCODE. + (append_insn): Pass `mips_pic' setting to RELAX_BRANCH_ENCODE + and RELAX_MICROMIPS_ENCODE, and record it in `fx_tcbit2' of the + first fixup created. + (md_apply_fix) <BFD_RELOC_16_PCREL_S2>: Use `fx_tcbit2' of the + fixup processed rather than `mips_pic' in choosing to relax an + out of range branch to a jump. + (relaxed_branch_length): Use the `pic' flag of the relaxed frag + rather than `mips_pic'. + (relaxed_micromips_32bit_branch_length): Likewise. + (md_estimate_size_before_relax): Likewise. + (md_convert_frag): Likewise. + + * testsuite/gas/mips/option-pic-relax-0.d: New test. + * testsuite/gas/mips/option-pic-relax-1.d: New test. + * testsuite/gas/mips/option-pic-relax-2.d: New test. + * testsuite/gas/mips/option-pic-relax-3.d: New test. + * testsuite/gas/mips/option-pic-relax-3a.d: New test. + * testsuite/gas/mips/option-pic-relax-4.d: New test. + * testsuite/gas/mips/option-pic-relax-5.d: New test. + * testsuite/gas/mips/option-pic-relax-2.l: New stderr output. + * testsuite/gas/mips/option-pic-relax-3.l: New stderr output. + * testsuite/gas/mips/option-pic-relax-4.l: New stderr output. + * testsuite/gas/mips/option-pic-relax-5.l: New stderr output. + * testsuite/gas/mips/option-pic-relax-0.s: New test source. + * testsuite/gas/mips/option-pic-relax-1.s: New test source. + * testsuite/gas/mips/option-pic-relax-2.s: New test source. + * testsuite/gas/mips/option-pic-relax-3.s: New test source. + * testsuite/gas/mips/option-pic-relax-4.s: New test source. + * testsuite/gas/mips/option-pic-relax-5.s: New test source. + * testsuite/gas/mips/mips.exp: Run the new tests. + 2017-04-25 Claudiu Zissulescu <claziss@synopsys.com> * testsuite/gas/arc/leave_enter.d: Update test. |