Question on commit a48931cc2df9f87596d93b31

Alan Modra amodra@gmail.com
Sat Apr 18 00:53:16 GMT 2020


On Fri, Apr 17, 2020 at 12:13:03PM -0700, Sonja Schofield via Binutils wrote:
> which means the "sec >= bfd_abs_section_ptr && sec <= bfd_ind_section_ptr" would only cover abs_section_ptr and ind_section_ptr.  If the first >= was to the com_section_ptr it would do as you describe, unless there is something I am missing?

Thanks for noticing.  Yes, it looks to be a typo/thinko.

	* section.c (bfd_is_const_section): Correct test for special
	sections.
	* bfd-in2.h: Regenerate.

diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h
index 7aa64556b8..8693f86dd4 100644
--- a/bfd/bfd-in2.h
+++ b/bfd/bfd-in2.h
@@ -1329,7 +1329,9 @@ bfd_is_ind_section (const asection *sec)
 static inline bfd_boolean
 bfd_is_const_section (const asection *sec)
 {
-  return sec >= bfd_abs_section_ptr && sec <= bfd_ind_section_ptr;
+  return (sec >= _bfd_std_section
+          && sec < _bfd_std_section + (sizeof (_bfd_std_section)
+                                       / sizeof (_bfd_std_section[0])));
 }
 
 /* Return TRUE if input section SEC has been discarded.  */

-- 
Alan Modra
Australia Development Lab, IBM


More information about the Binutils mailing list