aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2023-10-16 16:11:49 +0100
committerNick Clifton <nickc@redhat.com>2023-10-16 16:11:49 +0100
commitfd00374fc73e990b2a1b97a1bab431e0466f5efc (patch)
tree01901be7902d4ac1e60b6043f29f8dec7738d6d2 /bfd
parenta79e9a07a0d350031cd491031a756fbaa6a01df0 (diff)
downloadgdb-fd00374fc73e990b2a1b97a1bab431e0466f5efc.zip
gdb-fd00374fc73e990b2a1b97a1bab431e0466f5efc.tar.gz
gdb-fd00374fc73e990b2a1b97a1bab431e0466f5efc.tar.bz2
Fix: GNU-ld: ARM: Issues when trying to set target output architecture
PR 28910 * elf32-arm.c (elf32_arm_merge_private_bfd_data): Do not set output flags if the input flags have not been set.
Diffstat (limited to 'bfd')
-rw-r--r--bfd/ChangeLog6
-rw-r--r--bfd/elf32-arm.c19
2 files changed, 16 insertions, 9 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 2731d85..1b9d13a 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,9 @@
+2023-10-16 Nick Clifton <nickc@redhat.com>
+
+ PR 28910
+ * elf32-arm.c (elf32_arm_merge_private_bfd_data): Do not set
+ output flags if the input flags have not been set.
+
2023-10-09 Nick Clifton <nickc@redhat.com>
PR 30950
diff --git a/bfd/elf32-arm.c b/bfd/elf32-arm.c
index 18c30db..2e50849 100644
--- a/bfd/elf32-arm.c
+++ b/bfd/elf32-arm.c
@@ -20672,16 +20672,17 @@ elf32_arm_merge_private_bfd_data (bfd *ibfd, struct bfd_link_info *info)
if (!elf_flags_init (obfd))
{
- /* If the input is the default architecture and had the default
- flags then do not bother setting the flags for the output
- architecture, instead allow future merges to do this. If no
- future merges ever set these flags then they will retain their
- uninitialised values, which surprise surprise, correspond
- to the default values. */
- if (bfd_get_arch_info (ibfd)->the_default
- && elf_elfheader (ibfd)->e_flags == 0)
+ /* If the input has no flags set, then do not set the output flags.
+ This will allow future bfds to determine the desired output flags.
+ If no input bfds have any flags set, then neither will the output bfd.
+
+ Note - we used to restrict this test to when the input architecture
+ variant was the default variant, but this does not allow for
+ linker scripts which override the default. See PR 28910 for an
+ example. */
+ if (in_flags == 0)
return true;
-
+
elf_flags_init (obfd) = true;
elf_elfheader (obfd)->e_flags = in_flags;