asan: linker.c:2294:8: runtime error: load of value 253
authorAlan Modra <amodra@gmail.com>
Tue, 30 Mar 2021 02:33:30 +0000 (13:03 +1030)
committerAlan Modra <amodra@gmail.com>
Tue, 30 Mar 2021 03:17:18 +0000 (13:47 +1030)
Seen after converting bfd_boolean to bool.
mmix  +FAIL: ld-mmix/zeroehmmo

./ld-new   -L/home/alan/src/binutils-gdb/ld/testsuite/ld-mmix  -m mmo -Ttext 0xa00 -T /home/alan/src/binutils-gdb/ld/testsuite/ld-mmix/zeroeh.ld -o tmpdir/dump tmpdir/x.o tmpdir/y.o
/home/alan/src/binutils-gdb/bfd/linker.c:2294:8: runtime error: load of value 253, which is not a valid value for type '_Bool'

* elflink.c (elf_link_add_object_symbols): Don't set h->indx
unless is_elf_hash_table.

bfd/ChangeLog
bfd/elflink.c

index 6d361d56b98dc8d23888a0e0a7bb73b30b8a0f89..a94223d1d99a9b32d2feb02495f9539b17ce47a4 100644 (file)
@@ -1,3 +1,8 @@
+2021-03-30  Alan Modra  <amodra@gmail.com>
+
+       * elflink.c (elf_link_add_object_symbols): Don't set h->indx
+       unless is_elf_hash_table.
+
 2021-03-29  Alan Modra  <amodra@gmail.com>
 
        * aoutx.h (aout_link_write_symbols): Don't cast boolean expression
index 6be14e7c333751d6ebb7b9e266163b8582bf891e..c7102e691f134e3fc50ee696ef5ff8cef08910b5 100644 (file)
@@ -4968,13 +4968,13 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info)
             || h->root.type == bfd_link_hash_warning)
        h = (struct elf_link_hash_entry *) h->root.u.i.link;
 
+      *sym_hash = h;
+
       /* Setting the index to -3 tells elf_link_output_extsym that
         this symbol is defined in a discarded section.  */
-      if (discarded)
+      if (discarded && is_elf_hash_table (htab))
        h->indx = -3;
 
-      *sym_hash = h;
-
       new_weak = (flags & BSF_WEAK) != 0;
       if (dynamic
          && definition