[binutils-gdb] bfd_is_const_section thinko
Alan Modra
amodra@sourceware.org
Sat Apr 18 00:55:24 GMT 2020
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=18f97353547b1a00d5840d2ad6e7e67f44488070
commit 18f97353547b1a00d5840d2ad6e7e67f44488070
Author: Alan Modra <amodra@gmail.com>
Date: Sat Apr 18 10:15:35 2020 +0930
bfd_is_const_section thinko
* section.c (bfd_is_const_section): Correct test for special
sections.
* bfd-in2.h: Regenerate.
Diff:
---
bfd/ChangeLog | 6 ++++++
bfd/bfd-in2.h | 4 +++-
bfd/section.c | 4 +++-
3 files changed, 12 insertions(+), 2 deletions(-)
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 <amodra@gmail.com>
+
+ * section.c (bfd_is_const_section): Correct test for special
+ sections.
+ * bfd-in2.h: Regenerate.
+
2020-04-17 Alan Modra <amodra@gmail.com>
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. *}
More information about the Binutils-cvs
mailing list