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 | c6cb92c5ba6f9001097e4ae97f265ba28ff0d975 (patch) | |
tree | b6cc25af4f0f4f1c9246c7e359414a18198a793d /gas/subsegs.c | |
parent | e80937925fd99e09392fe3f76e4cce1b1b42105f (diff) | |
download | gdb-c6cb92c5ba6f9001097e4ae97f265ba28ff0d975.zip gdb-c6cb92c5ba6f9001097e4ae97f265ba28ff0d975.tar.gz gdb-c6cb92c5ba6f9001097e4ae97f265ba28ff0d975.tar.bz2 |
* 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 c63f301..287dd17 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) { |