[gold commit] PR 23046: Fix bug where --icf=safe triggers segfault when linking ARM

Cary Coutant ccoutant@gmail.com
Sat Apr 14 23:01:00 GMT 2018


When checking a R_ARM_TARGET[12] relocation, we need a valid target
pointer, but the garbage collection code was passing a NULL instead.

-cary


2018-04-14  Cary Coutant  <ccoutant@gmail.com>

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

diff --git a/gold/gc.h b/gold/gc.h
index eda332c22d..00f383f443 100644
--- 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);



More information about the Binutils mailing list