score howto special_function final linking output bfd access
Checks
Commit Message
Like commit 804439b4d7a8, avoid segfaults when the hack to access
the output bfd won't work, eg. when the sym is absolute.
* elf32-score.c (score_elf_gprel15_reloc): Return bfd_reloc_undefined
when output_bfd cannot be determined from the symbol.
(score_elf_gprel32_reloc): Likewise.
* elf32-score7.c (score_elf_gprel32_reloc): Likewise.
@@ -545,6 +545,8 @@ score_elf_gprel15_reloc (bfd *abfd,
{
relocateable = false;
output_bfd = symbol->section->output_section->owner;
+ if (output_bfd == NULL)
+ return bfd_reloc_undefined;
}
ret = score_elf_final_gp (output_bfd, symbol, relocateable, error_message, &gp);
@@ -583,6 +585,8 @@ score_elf_gprel32_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol,
{
relocatable = false;
output_bfd = symbol->section->output_section->owner;
+ if (output_bfd == NULL)
+ return bfd_reloc_undefined;
}
ret = score_elf_final_gp (output_bfd, symbol, relocatable, error_message, &gp);
@@ -485,6 +485,8 @@ score_elf_gprel32_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol,
{
relocatable = false;
output_bfd = symbol->section->output_section->owner;
+ if (output_bfd == NULL)
+ return bfd_reloc_undefined;
}
ret = score_elf_final_gp (output_bfd, symbol, relocatable, error_message, &gp);