Originally this clause included lines checking `!bfd_link_pic && bfd_link_executable`. I left these in to ensure that the new Morello part to the clause did not interfere with the original stock AArch64 part of the clause.
Now we have split the condition into multiple if statements for clarity, we can remove the confusing parts of the clause. This clause is to catch any symbols that go in the GOT but would not be otherwise given a relocation by finish_dynamic_symbol. We can express that check better with a modified condition.
What we want to do in this clause is to account for all GOT entries which would not get a dynamic relocation otherwise, but need a RELATIVE dynamic relocation for Morello. This is any symbol for which c64_should_not_relocate is false and WILL_CALL_FINISH_DYNAMIC_SYMBOL is false. Changing the clause to only mention these two predicates (plus ensuring that we do not mess around with such relocations when creating a relocatable object file rather than a final binary) explains the purpose of this condition much better.
N.b. see the commit message of 8f5baae3d15 for the reasoning for the original decision to not change the conditional.
############### Attachment also inlined for ease of reply ###############
diff --git a/bfd/elfnn-aarch64.c b/bfd/elfnn-aarch64.c index bb17f18e498ae3118c70636b8e6318511b9a0ccd..6d45d5d68a3213bf7f22710271a39e1478b745c5 100644 --- a/bfd/elfnn-aarch64.c +++ b/bfd/elfnn-aarch64.c @@ -7276,10 +7276,9 @@ elfNN_aarch64_final_link_relocate (reloc_howto_type *howto, This clause catches the case when we're not relocating for GOT, or when we're relocating an undefined weak symbol. */ } - else if (!bfd_link_pic (info) + else if (!bfd_link_relocatable (info) && !WILL_CALL_FINISH_DYNAMIC_SYMBOL (is_dynamic, bfd_link_pic (info), h) - && bfd_link_executable (info) && !symbol_got_offset_mark_p (input_bfd, h, r_symndx)) { /* This clause is here to catch any c64 entries in the GOT which
gnu-morello@op-lists.linaro.org