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/read.c | |
parent | 99fabbc9739a87ba3433e66792e93b773896790e (diff) | |
download | fsf-binutils-gdb-058430b4a1ed7441dfc2e167bfdb9dc89ea9a209.zip fsf-binutils-gdb-058430b4a1ed7441dfc2e167bfdb9dc89ea9a209.tar.gz fsf-binutils-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/read.c')
-rw-r--r-- | gas/read.c | 46 |
1 files changed, 32 insertions, 14 deletions
@@ -3506,6 +3506,11 @@ s_space (int mult) void s_nop (int ignore ATTRIBUTE_UNUSED) { + expressionS exp; + fragS *start; + addressT start_off; + offsetT frag_off; + #ifdef md_flush_pending_output md_flush_pending_output (); #endif @@ -3515,29 +3520,42 @@ s_nop (int ignore ATTRIBUTE_UNUSED) #endif SKIP_WHITESPACE (); + expression (&exp); demand_empty_rest_of_line (); + start = frag_now; + start_off = frag_now_fix (); + do + { #ifdef md_emit_single_noop - md_emit_single_noop; + md_emit_single_noop; #else - char * nop; + char *nop; #ifndef md_single_noop_insn #define md_single_noop_insn "nop" #endif - /* md_assemble might modify its argument, so - we must pass it a string that is writeable. */ - if (asprintf (&nop, "%s", md_single_noop_insn) < 0) - as_fatal ("%s", xstrerror (errno)); - - /* Some targets assume that they can update input_line_pointer inside - md_assemble, and, worse, that they can leave it assigned to the string - pointer that was provided as an argument. So preserve ilp here. */ - char * saved_ilp = input_line_pointer; - md_assemble (nop); - input_line_pointer = saved_ilp; - free (nop); + /* md_assemble might modify its argument, so + we must pass it a string that is writable. */ + if (asprintf (&nop, "%s", md_single_noop_insn) < 0) + as_fatal ("%s", xstrerror (errno)); + + /* Some targets assume that they can update input_line_pointer + inside md_assemble, and, worse, that they can leave it + assigned to the string pointer that was provided as an + argument. So preserve ilp here. */ + char *saved_ilp = input_line_pointer; + md_assemble (nop); + input_line_pointer = saved_ilp; + free (nop); +#endif +#ifdef md_flush_pending_output + md_flush_pending_output (); #endif + } while (exp.X_op == O_constant + && exp.X_add_number > 0 + && frag_offset_ignore_align_p (start, frag_now, &frag_off) + && frag_off + frag_now_fix () < start_off + exp.X_add_number); } void |