diff options
author | Alan Modra <amodra@gmail.com> | 2020-11-17 12:41:36 +1030 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2020-11-18 23:46:39 +1030 |
commit | 058430b4a1ed7441dfc2e167bfdb9dc89ea9a209 (patch) | |
tree | 9b7ec856174062c736b1255b25f7f7e0edae6621 /gas/frags.c | |
parent | 99fabbc9739a87ba3433e66792e93b773896790e (diff) | |
download | gdb-058430b4a1ed7441dfc2e167bfdb9dc89ea9a209.zip gdb-058430b4a1ed7441dfc2e167bfdb9dc89ea9a209.tar.gz gdb-058430b4a1ed7441dfc2e167bfdb9dc89ea9a209.tar.bz2 |
Re: Stop Gas from generating line info or address ranges
* doc/as.texi (.nop): Document optional size arg.
* dwarf2dbg.c (dwarf2_gen_line_info_1): Only check SEC_ALLOC
when ELF. Warn whenever dwarf line number information is ignored.
* frags.c (frag_offset_ignore_align_p): New function.
* frags.h (frag_offset_ignore_align_p): Declare.
* read.c (s_nop): Extend to support optional size arg.
* testsuite/gas/elf/dwarf2-20.d: Expect warnings, and exact range.
* testsuite/gas/elf/dwarf2-20.s: Emit 16 bytes worth of nops.
* testsuite/gas/m68hc11/indexed12.d: Expect warnings.
Diffstat (limited to 'gas/frags.c')
-rw-r--r-- | gas/frags.c | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/gas/frags.c b/gas/frags.c index c926ec3..9ed4d7b 100644 --- a/gas/frags.c +++ b/gas/frags.c @@ -468,6 +468,48 @@ frag_offset_fixed_p (const fragS *frag1, const fragS *frag2, offsetT *offset) return FALSE; } +/* Return TRUE if FRAG2 follows FRAG1 with a fixed relationship + between the two assuming alignment frags do nothing. Set OFFSET to + the difference in address not already accounted for in the frag + FR_ADDRESS. */ + +bfd_boolean +frag_offset_ignore_align_p (const fragS *frag1, const fragS *frag2, + offsetT *offset) +{ + const fragS *frag; + offsetT off; + + /* Start with offset initialised to difference between the two frags. + Prior to assigning frag addresses this will be zero. */ + off = frag1->fr_address - frag2->fr_address; + if (frag1 == frag2) + { + *offset = off; + return TRUE; + } + + frag = frag1; + while (frag->fr_type == rs_fill + || frag->fr_type == rs_align + || frag->fr_type == rs_align_code + || frag->fr_type == rs_align_test) + { + if (frag->fr_type == rs_fill) + off += frag->fr_fix + frag->fr_offset * frag->fr_var; + frag = frag->fr_next; + if (frag == NULL) + break; + if (frag == frag2) + { + *offset = off; + return TRUE; + } + } + + return FALSE; +} + /* Return TRUE if we can determine whether FRAG2 OFF2 appears after (strict >, not >=) FRAG1 OFF1, assuming it is not before. Set *OFFSET so that resolve_expression will resolve an O_gt operation |