forked from Imagelibrary/binutils-gdb
Arm64/ELF: accept relocations against STN_UNDEF
While only a secondary issue there, the testcase of PR gas/27212 exposes an oversight in relocation handling: Just like e.g. Arm32, which has a similar comment and a similar check, relocations against STN_UNDEF have to be permitted to satisfy the ELF spec.
This commit is contained in:
@@ -6946,8 +6946,12 @@ elfNN_aarch64_relocate_section (bfd *output_bfd,
|
|||||||
|
|
||||||
/* An object file might have a reference to a local
|
/* An object file might have a reference to a local
|
||||||
undefined symbol. This is a daft object file, but we
|
undefined symbol. This is a daft object file, but we
|
||||||
should at least do something about it. */
|
should at least do something about it. NONE and NULL
|
||||||
|
relocations do not use the symbol and are explicitly
|
||||||
|
allowed to use an undefined one, so allow those.
|
||||||
|
Likewise for relocations against STN_UNDEF. */
|
||||||
if (r_type != R_AARCH64_NONE && r_type != R_AARCH64_NULL
|
if (r_type != R_AARCH64_NONE && r_type != R_AARCH64_NULL
|
||||||
|
&& r_symndx != STN_UNDEF
|
||||||
&& bfd_is_und_section (sec)
|
&& bfd_is_und_section (sec)
|
||||||
&& ELF_ST_BIND (sym->st_info) != STB_WEAK)
|
&& ELF_ST_BIND (sym->st_info) != STB_WEAK)
|
||||||
(*info->callbacks->undefined_symbol)
|
(*info->callbacks->undefined_symbol)
|
||||||
|
|||||||
Reference in New Issue
Block a user