When providing negative immediate offset (step) values to the JUMPR and
JUMPS opcodes, the resulting instruction contained an incorrect offset.
This commit fixes that behaviour.
This is the same issue that affected the ESP32 code. See previous commit for
more technical detail on the issue.
When providing negative immediate offset (step) values to the JUMPR and
JUMPS opcodes, the resulting instruction contained an incorrect offset.
This commit fixes that behaviour.
According to the technical reference manual (TRM)
[https://www.espressif.com/sites/default/files/documentation/esp32_technical_reference_manual_en.pdf]
the magnitude of the relative shift from the current position is determined
by bit 0-6 of the step field, and the direction is determined by bit 7,
with 0 meaning PC+step, and 1 meaning PC-step.
(For comparion, the ULP C macros in the ESP-IDF implement this as described
in the TRM. All step values passed to the relevant JUMP macros will result in the
instruction step field having bit 7 indicating the sign and bit 0-6 holding the
absolute value of the offset.)
This fix modifies the I_JUMP_REL{R,S} macros to set the step field correctly
for negative immediate values. Since symbols, which are resolved later during
the BFD relocation phase always evaluate to 0 at this stage (from EXPR_VALUE),
this change to the macro only affects the case of immediate values (as can be
seen from all previous test cases resulting in the same listing output as
before). The relocation code (in function esp32ulp_jumprelr_reloc) already did
this correctly for symbols, and thus remains unchanged.
Example of the issue:
For an offset of -2, the step field should have looked as follows:
bit 0-6 = 2 # positive 2
bit 7 = 1 # 1 means negative
However, the result was actually:
bit 0-6 = 126 # negative 2 (two's compliment)
bit 7 = 1 # 1 means negative
This patch fixes a mistake when enabling MVE instructions that disabled support
for single precision vmla and vmul for arm mode.
gas/ChangeLog:
2020-11-19 Andre Vieira <andre.simoesdiasvieira@arm.com>
Backport from mainline.
2020-11-12 Andre Vieira <andre.simoesdiasvieira@arm.com>
PR 26858
* config/tc-arm.c (asm_opcode insns): Fix vmul and vmla's ARM_VARIANT.
* testsuite/gas/arm/pr26858.s: New test.
* testsuite/gas/arm/pr26858.d: New test.
Some instructions can be emitted (dwarf2_emit_insn is called) before the
first .file <NUMBER> directive has been seen, which allocates the input
file as the first file entry. Reuse the input file entry in the file
table.
PR gas/25878
PR gas/26740
* dwarf2dbg.c (file_entry): Remove auto_assigned.
(assign_file_to_slot): Remove the auto_assign argument.
(allocate_filenum): Updated.
(allocate_filename_to_slot): Reuse the input file entry in the
file table.
(dwarf2_where): Replace as_where with as_where_physical.
* testsuite/gas/i386/dwarf5-line-1.d: New file.
* testsuite/gas/i386/dwarf5-line-1.s: Likewise.
* testsuite/gas/i386/i386.exp: Run dwarf5-line-1.
(cherry picked from commit 6915020bb134ae29fd772295c66fd67b5944962d)
gas: Always use as_where for preprocessed assembly codes
Always clear the slot 1 if it was assigned to the input file before the
first .file <NUMBER> directive has been seen. Always use as_where to
generate the correct debug infor for preprocessed assembly codes.
PR gas/25878
PR gas/26740
* dwarf2dbg.c (allocate_filename_to_slot): Don't reuse the slot 1
here.
(dwarf2_where): Restore as_where.
(dwarf2_directive_filename): Clear the slot 1 if it was assigned
to the input file.
* testsuite/gas/i386/dwarf5-line-2.d: New file.
* testsuite/gas/i386/dwarf5-line-2.s: Likewise.
* testsuite/gas/i386/dwarf5-line-3.d: Likewise.
* testsuite/gas/i386/dwarf5-line-3.s: Likewise.
* testsuite/gas/i386/i386.exp: Run dwarf5-line-2 and
dwarf5-line-3.
(cherry picked from commit bd0c565edbf4ba8121fded38e389530d7fa6f963)
gas: Clear all auto-assigned file slots
Since a file slot is auto-assigned for the #APP marker appeared before
the first .file <NUMBER> directive has been seen, clear all auto-assigned
file slots when seeing the first .file <NUMBER> directive.
PR gas/26778
* * dwarf2dbg.c (num_of_auto_assigned): New.
(allocate_filenum): Increment num_of_auto_assigned.
(dwarf2_directive_filename): Clear the slots auto-assigned
before the first .file <NUMBER> directive was seen.
* testsuite/gas/i386/dwarf4-line-1.d: New file.
* testsuite/gas/i386/dwarf4-line-1.s: Likewise.
* testsuite/gas/i386/i386.exp: Run dwarf4-line-1.
(cherry picked from commit ae9d2233e61a98ff8dba56be10219aa5306ffc9a)