[binutils-gdb] aarch64: remove early exit when setting up GNU properties with partial linking

Matthieu Longo mlongo@sourceware.org
Mon Dec 2 15:22:23 GMT 2024


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=2ad1fffee5f0eb055d7919dd1098107fa131501d

commit 2ad1fffee5f0eb055d7919dd1098107fa131501d
Author: Matthieu Longo <matthieu.longo@arm.com>
Date:   Thu Nov 14 17:35:24 2024 +0000

    aarch64: remove early exit when setting up GNU properties with partial linking
    
    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.

Diff:
---
 bfd/elfxx-aarch64.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/bfd/elfxx-aarch64.c b/bfd/elfxx-aarch64.c
index 406b2fac0d3..896497a7812 100644
--- a/bfd/elfxx-aarch64.c
+++ b/bfd/elfxx-aarch64.c
@@ -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)


More information about the Binutils-cvs mailing list