]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
aarch64: remove early exit when setting up GNU properties with partial linking
authorMatthieu Longo <matthieu.longo@arm.com>
Thu, 14 Nov 2024 17:35:24 +0000 (17:35 +0000)
committerMatthieu Longo <matthieu.longo@arm.com>
Mon, 2 Dec 2024 15:18:40 +0000 (15:18 +0000)
There is an early exit in _bfd_aarch64_elf_link_setup_gnu_properties
that is enabled when the output link unit is relocatable, i.e. ld
generates an output file that can in turn serve as input to ld. (see
ld manual, -r,--relocatable for more details).

At this stage, the GNU properties have already been merged and errors
or warnings (if any) have already been issued. However, OUTPROP has
not been updated yet.
Not updating OUTPROP means that implicits enablement of BTI PLTs via
the GNU properties will be ignored for final links. Indeed, the
enablement of BTI PLTs is checked inside _bfd_aarch64_add_call_stub_entries
by looking up at gnu_property_aarch64_feature_1_and (OUTPROP).
Since the final link does not happen in the case of partial linking,
the behaviour with or without the early exit should be the same.

Given that there is currently no comment for explain why the exit is
there, and that there might in the future be cases were these properties
affect relocatable links, it is preferrable to drop the early exit.

bfd/elfxx-aarch64.c

index 406b2fac0d3d2eaff62b5737ea9af306d11965bc..896497a7812166ec0a0f1fc7f6ace9c74002c5b3 100644 (file)
@@ -797,9 +797,6 @@ _bfd_aarch64_elf_link_setup_gnu_properties (struct bfd_link_info *info)
      GNU properties (if found).  */
   bfd *pbfd = _bfd_elf_link_setup_gnu_properties (info);
 
-  if (bfd_link_relocatable (info))
-    return pbfd;
-
   /* If pbfd has any GNU_PROPERTY_AARCH64_FEATURE_1_AND properties, update
      outprop accordingly.  */
   if (pbfd != NULL)