aboutsummaryrefslogtreecommitdiff
path: root/bfd/elfnn-aarch64.c
diff options
context:
space:
mode:
authorJan Beulich <jbeulich@suse.com>2023-03-31 08:15:53 +0200
committerJan Beulich <jbeulich@suse.com>2023-03-31 08:15:53 +0200
commitaf9eb2ee1b10caa89e1c603cd484bc025e71f4fd (patch)
tree349ebfb424e5fed5e9b468107264ce419ec08213 /bfd/elfnn-aarch64.c
parent56ce0c730b5dcb1e365e9cb42394f42a9a4154a3 (diff)
downloadgdb-af9eb2ee1b10caa89e1c603cd484bc025e71f4fd.zip
gdb-af9eb2ee1b10caa89e1c603cd484bc025e71f4fd.tar.gz
gdb-af9eb2ee1b10caa89e1c603cd484bc025e71f4fd.tar.bz2
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.
Diffstat (limited to 'bfd/elfnn-aarch64.c')
-rw-r--r--bfd/elfnn-aarch64.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/bfd/elfnn-aarch64.c b/bfd/elfnn-aarch64.c
index c4db1e6..c23cbd3 100644
--- a/bfd/elfnn-aarch64.c
+++ b/bfd/elfnn-aarch64.c
@@ -6946,8 +6946,12 @@ elfNN_aarch64_relocate_section (bfd *output_bfd,
/* An object file might have a reference to a local
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
+ && r_symndx != STN_UNDEF
&& bfd_is_und_section (sec)
&& ELF_ST_BIND (sym->st_info) != STB_WEAK)
(*info->callbacks->undefined_symbol)