diff options
author | Nathan Sidwell <nathan@codesourcery.com> | 2005-01-27 16:33:47 +0000 |
---|---|---|
committer | Nathan Sidwell <nathan@codesourcery.com> | 2005-01-27 16:33:47 +0000 |
commit | 36c98617f877aa672bbfe2e100cdfc0cb776d26d (patch) | |
tree | bc4c1f53c90366cec82ae8575de85e5743a04d6c /gas/subsegs.c | |
parent | 7cc6a5c2ab7e86b578407cfebe6a5863c0d2db27 (diff) | |
download | binutils-redhat-36c98617f877aa672bbfe2e100cdfc0cb776d26d.tar.gz |
* dwarf2dbg.c (dwarf2_finish): Correct logic for determining when
to emit .debug_line and other debug sections.
* as.h (seg_not_empty_p): Declare.
* subsegs.c (seg_not_empty_p): New predicate.
Diffstat (limited to 'gas/subsegs.c')
-rw-r--r-- | gas/subsegs.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/gas/subsegs.c b/gas/subsegs.c index c63f3010ea..287dd1700c 100644 --- a/gas/subsegs.c +++ b/gas/subsegs.c @@ -595,6 +595,34 @@ subseg_text_p (segT sec) #endif /* ! BFD_ASSEMBLER */ } +/* Return non zero if SEC has at least one byte of data. It is + possible that we'll return zero even on a non-empty section because + we don't know all the fragment types, and it is possible that an + fr_fix == 0 one still contributes data. Think of this as + seg_definitely_not_empty_p. */ + +bfd_boolean +seg_not_empty_p (segT sec) +{ + segment_info_type *seginfo = seg_info (sec); + frchainS *chain; + fragS *frag; + + if (!seginfo) + return 0; + + for (chain = seginfo->frchainP; chain; chain = chain->frch_next) + { + for (frag = chain->frch_root; frag; frag = frag->fr_next) + if (frag->fr_fix) + return 1; + if (obstack_next_free (&chain->frch_obstack) + != chain->frch_last->fr_literal) + return 1; + } + return 0; +} + void subsegs_print_statistics (FILE *file) { |