From 18f97353547b1a00d5840d2ad6e7e67f44488070 Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Sat, 18 Apr 2020 10:15:35 +0930 Subject: bfd_is_const_section thinko * section.c (bfd_is_const_section): Correct test for special sections. * bfd-in2.h: Regenerate. --- bfd/ChangeLog | 6 ++++++ bfd/bfd-in2.h | 4 +++- bfd/section.c | 4 +++- 3 files changed, 12 insertions(+), 2 deletions(-) (limited to 'bfd') diff --git a/bfd/ChangeLog b/bfd/ChangeLog index b9ee795..9d5f1cb 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 7aa6455..8693f86 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 ecad4cd..17f5b4c 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. *} -- cgit v1.1