From: Alan Modra Date: Sat, 18 Apr 2020 00:45:35 +0000 (+0930) Subject: bfd_is_const_section thinko X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=18f97353547b1a00d5840d2ad6e7e67f44488070;p=binutils-gdb.git bfd_is_const_section thinko * section.c (bfd_is_const_section): Correct test for special sections. * bfd-in2.h: Regenerate. --- diff --git a/bfd/ChangeLog b/bfd/ChangeLog index b9ee79572aa..9d5f1cb89ec 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,9 @@ +2020-04-18 Alan Modra + + * section.c (bfd_is_const_section): Correct test for special + sections. + * bfd-in2.h: Regenerate. + 2020-04-17 Alan Modra PR 25842 diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h index 7aa64556b84..8693f86dd43 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. */ diff --git a/bfd/section.c b/bfd/section.c index ecad4cd0b9a..17f5b4c3d83 100644 --- a/bfd/section.c +++ b/bfd/section.c @@ -688,7 +688,9 @@ CODE_FRAGMENT .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. *}