Fix bug where --icf=safe triggers segfault when linking ARM.
authorCary Coutant <ccoutant@gmail.com>
Sat, 14 Apr 2018 22:58:07 +0000 (15:58 -0700)
committerCary Coutant <ccoutant@gmail.com>
Sat, 14 Apr 2018 22:58:07 +0000 (15:58 -0700)
When checking a R_ARM_TARGET[12] relocation, we need a valid target
pointer, but the garbage collection code was passing a NULL instead.

gold/
PR gold/23046
* gc.h (gc_process_relocs): Pass target to
scan.global_reloc_may_be_function_pointer.

gold/ChangeLog
gold/gc.h

index fa7317370aa9fd836e59796a257cf27b0bb20e21..b86812ceeaca2c69657bee344bf88d6a14b2077b 100644 (file)
@@ -1,3 +1,9 @@
+2018-04-14  Cary Coutant  <ccoutant@gmail.com>
+
+       PR gold/23046
+       * gc.h (gc_process_relocs): Pass target to
+       scan.global_reloc_may_be_function_pointer.
+
 2018-04-09  Alan Modra  <amodra@gmail.com>
 
        * configure: Regenerate.
index eda332c22dc3dfa07f0f2750f83d7ff4e2b0f211..00f383f443493ab302aa7e45e3189e4bbe12836e 100644 (file)
--- a/gold/gc.h
+++ b/gold/gc.h
@@ -300,7 +300,7 @@ gc_process_relocs(
               && dst_obj != NULL
               && (!is_ordinary
                   || scan.global_reloc_may_be_function_pointer(
-                       symtab, NULL, NULL, src_obj, src_indx, NULL, reloc,
+                       symtab, NULL, target, src_obj, src_indx, NULL, reloc,
                        r_type, gsym)))
             symtab->icf()->set_section_has_function_pointers(dst_obj, dst_indx);