bfd/dwarf2.c: fix assertion failure in comp_unit_hash_info

Message ID 20191010234951.6600-1-jcmvbkbc@gmail.com
State New
Headers show
Series
  • bfd/dwarf2.c: fix assertion failure in comp_unit_hash_info
Related show

Commit Message

Max Filippov Oct. 10, 2019, 11:49 p.m.
stash_maybe_enable_info_hash_tables sets
stash->info_hash_status = STASH_INFO_HASH_ON;
regardless of the result of stash_maybe_update_info_hash_tables call. In
case it fails this results in repeated invocation of comp_unit_hash_info
for the same comp unit and assertion failure in this function.

Only set stash->info_hash_status = STASH_INFO_HASH_ON; when
stash_maybe_update_info_hash_tables is successful.

bfd/
2019-10-10  Max Filippov  <jcmvbkbc@gmail.com>

	* dwarf2.c (stash_maybe_enable_info_hash_tables): Only set
	stash->info_hash_status = STASH_INFO_HASH_ON when
	stash_maybe_update_info_hash_tables succeeds.
---
 bfd/dwarf2.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

-- 
2.20.1

Comments

Max Filippov Oct. 11, 2019, 4:06 p.m. | #1
On Fri, Oct 11, 2019 at 2:40 AM Nick Clifton <nickc@redhat.com> wrote:
> > bfd/

> > 2019-10-10  Max Filippov  <jcmvbkbc@gmail.com>

> >

> >       * dwarf2.c (stash_maybe_enable_info_hash_tables): Only set

> >       stash->info_hash_status = STASH_INFO_HASH_ON when

> >       stash_maybe_update_info_hash_tables succeeds.

>

> Approved - please apply.


Applied to master. Thanks!

-- Max

Patch

diff --git a/bfd/dwarf2.c b/bfd/dwarf2.c
index 88aaa2d23c22..75d19aa83750 100644
--- a/bfd/dwarf2.c
+++ b/bfd/dwarf2.c
@@ -4231,8 +4231,8 @@  stash_maybe_enable_info_hash_tables (bfd *abfd, struct dwarf2_debug *stash)
   /* We need a forced update so that the info hash tables will
      be created even though there is no compilation unit.  That
      happens if STASH_INFO_HASH_TRIGGER is 0.  */
-  stash_maybe_update_info_hash_tables (stash);
-  stash->info_hash_status = STASH_INFO_HASH_ON;
+  if (stash_maybe_update_info_hash_tables (stash))
+    stash->info_hash_status = STASH_INFO_HASH_ON;
 }
 
 /* Find the file and line associated with a symbol and address using the