]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Neaten up a clause in final_link_relocate
authorMatthew Malcomson <matthew.malcomson@arm.com>
Fri, 1 Jul 2022 10:48:57 +0000 (11:48 +0100)
committerMatthew Malcomson <matthew.malcomson@arm.com>
Fri, 1 Jul 2022 10:48:57 +0000 (11:48 +0100)
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.

bfd/elfnn-aarch64.c

index 244b837f4458051fc0bce7e878a63a0b5278c26b..1b6e80aa20982c294780cc20cd49c1702549a47c 100644 (file)
@@ -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