error gprel relocs vs dynamic symbols
Richard Henderson
rth@twiddle.net
Sun Sep 9 00:05:00 GMT 2001
Such relocations cannot be resolved by the dynamic linker,
since it doesn't know what the GP base value is. Also, there
is the implicit intent that the symbol was _supposed_ to be
resolved locally.
r~
* elf64-alpha.c (elf64_alpha_relocate_section): Soft fail
relocation errors. Fail gp-relative relocations against
dynamic symbols.
Index: elf64-alpha.c
===================================================================
RCS file: /cvs/src/src/bfd/elf64-alpha.c,v
retrieving revision 1.34
diff -c -p -d -r1.34 elf64-alpha.c
*** elf64-alpha.c 2001/09/05 03:00:13 1.34
--- elf64-alpha.c 2001/09/09 06:55:56
*************** elf64_alpha_relocate_section (output_bfd
*** 3241,3246 ****
--- 3241,3247 ----
asection *sec, *sgot, *srel, *srelgot;
bfd *dynobj, *gotobj;
bfd_vma gp;
+ boolean ret_val = true;
srelgot = srel = NULL;
symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr;
*************** elf64_alpha_relocate_section (output_bfd
*** 3389,3395 ****
input_section, rel->r_offset,
(!info->shared || info->no_undefined
|| ELF_ST_VISIBILITY (h->root.other)))))
! return false;
relocation = 0;
}
}
--- 3390,3396 ----
input_section, rel->r_offset,
(!info->shared || info->no_undefined
|| ELF_ST_VISIBILITY (h->root.other)))))
! ret_val = false;
relocation = 0;
}
}
*************** elf64_alpha_relocate_section (output_bfd
*** 3488,3498 ****
--- 3489,3513 ----
case R_ALPHA_GPREL16:
case R_ALPHA_GPREL32:
case R_ALPHA_GPRELLOW:
+ if (h && alpha_elf_dynamic_symbol_p (&h->root, info))
+ {
+ (*_bfd_error_handler)
+ (_("%s: gp-relative relocation against dynamic symbol %s"),
+ bfd_get_filename (input_bfd), h->root.root.root.string);
+ ret_val = false;
+ }
BFD_ASSERT(gp != 0);
relocation -= gp;
goto default_reloc;
case R_ALPHA_GPRELHIGH:
+ if (h && alpha_elf_dynamic_symbol_p (&h->root, info))
+ {
+ (*_bfd_error_handler)
+ (_("%s: gp-relative relocation against dynamic symbol %s"),
+ bfd_get_filename (input_bfd), h->root.root.root.string);
+ ret_val = false;
+ }
BFD_ASSERT(gp != 0);
relocation -= gp;
relocation += addend;
*************** elf64_alpha_relocate_section (output_bfd
*** 3609,3615 ****
if (! ((*info->callbacks->reloc_overflow)
(info, name, howto->name, (bfd_vma) 0,
input_bfd, input_section, rel->r_offset)))
! return false;
}
break;
--- 3624,3630 ----
if (! ((*info->callbacks->reloc_overflow)
(info, name, howto->name, (bfd_vma) 0,
input_bfd, input_section, rel->r_offset)))
! ret_val = false;
}
break;
*************** elf64_alpha_relocate_section (output_bfd
*** 3619,3625 ****
}
}
! return true;
}
/* Finish up dynamic symbol handling. We set the contents of various
--- 3634,3640 ----
}
}
! return ret_val;
}
/* Finish up dynamic symbol handling. We set the contents of various
More information about the Binutils
mailing list