diff options
author | Alexandre Oliva <oliva@adacore.com> | 2020-03-04 17:28:46 +0000 |
---|---|---|
committer | Nick Clifton <nickc@redhat.com> | 2020-03-04 17:28:46 +0000 |
commit | 749479c8d3b63c9075d2fabf4b87b1f7109608b6 (patch) | |
tree | ea0bf41a6d7fb0dd11a33e930893a96adb2a9f38 /gas/config | |
parent | 440cf44eb0f70830b8d8ac35289f84129c7a35c1 (diff) | |
download | fsf-binutils-gdb-749479c8d3b63c9075d2fabf4b87b1f7109608b6.zip fsf-binutils-gdb-749479c8d3b63c9075d2fabf4b87b1f7109608b6.tar.gz fsf-binutils-gdb-749479c8d3b63c9075d2fabf4b87b1f7109608b6.tar.bz2 |
Generate a warning in the ARM assembler if a PC-relative thumb load instruction is detected in a section with insufficient alignment.
* config/tc-arm.c (md_apply_fix): Warn if a PC-relative load is
detected in a section which does not have at least 4 byte
alignment.
* testsuite/gas/arm/armv8-ar-it-bad.s: Add alignment directive.
* testsuite/gas/arm/ldr-t.s: Likewise.
* testsuite/gas/arm/sp-pc-usage-t.s: Likewise.
* testsuite/gas/arm/sp-pc-usage-t.d: Finish test at end of
disassembly, ignoring any NOPs that may have been inserted because
of section alignment.
* testsuite/gas/arm/ldr-t.d: Likewise.
Diffstat (limited to 'gas/config')
-rw-r--r-- | gas/config/tc-arm.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/gas/config/tc-arm.c b/gas/config/tc-arm.c index 59b1f6b..329a2de 100644 --- a/gas/config/tc-arm.c +++ b/gas/config/tc-arm.c @@ -29290,6 +29290,9 @@ md_apply_fix (fixS * fixP, (((unsigned long) fixP->fx_frag->fr_address + (unsigned long) fixP->fx_where) & ~3) + (unsigned long) value); + else if (get_recorded_alignment (seg) < 2) + as_warn_where (fixP->fx_file, fixP->fx_line, + _("section does not have enough alignment to ensure safe PC-relative loads")); if (value & ~0x3fc) as_bad_where (fixP->fx_file, fixP->fx_line, |