bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug ld/25210] New: aarch64: -fix-cortex-a53-835769 --fix-cortex-a53-843


From: matz at suse dot de
Subject: [Bug ld/25210] New: aarch64: -fix-cortex-a53-835769 --fix-cortex-a53-843419 lead to invalid operation
Date: Wed, 20 Nov 2019 16:20:10 +0000

https://sourceware.org/bugzilla/show_bug.cgi?id=25210

            Bug ID: 25210
           Summary: aarch64: -fix-cortex-a53-835769
                    --fix-cortex-a53-843419 lead to invalid operation
           Product: binutils
           Version: 2.33
            Status: NEW
          Severity: normal
          Priority: P2
         Component: ld
          Assignee: unassigned at sourceware dot org
          Reporter: matz at suse dot de
  Target Milestone: ---

This came up in our distro build when updating to binutils 2.33 (2.32 was still
fine) which then fails building GCC.  But it can actually be reproduced by
the testcases included in binutils itself, when using both fix-arrata options
at the same time:

(on an aarch64 system, from a binutils checkout 2.33 branch):
% ../configure --disable-gold; make CFLAGS=-g -j8
% cd ld
% gcc -c -o bla.o ../../ld/testsuite/ld-aarch64/erratum835769.s
% ld bla.o
ld: warning: cannot find entry symbol _start; defaulting to 0000000000400078
(i.e. works)
% ./ld-new --fix-cortex-a53-835769 --fix-cortex-a53-843419=full bla.o
./ld-new: can not size stub section: invalid operation
./ld-new: warning: cannot find entry symbol _start; defaulting to
0000000000400078
./ld-new: linker stubs: file class ELFCLASSNONE incompatible with ELFCLASS64
./ld-new: final link failed: file in wrong format

This might be related to the fix for PR24373, as that seems the only relevant
change re linker stubs on aarch64 between 2.32 and 2.33.  I haven't checked if
master has the same problem.

I've debugged this a little bit, and the error happens because
elf64_aarch64_size_stubs iterates over all input_bfds, and over all sections
and tries to determine if it needs the fixes; while doing so it calls (of
course) bfd_malloc_and_get_section, which breaks because one of the input bfds
doesn't have an iovec.  This bfd is precisely the one created for the stubs.
So the iteration over all input BFDs is confused when it inspects the stub_bfd
for needing stubs.  I.e. this patch helps the immediate cause:

--- ../../bfd/elfnn-aarch64.c.mm        2019-09-09 13:19:43.000000000 +0000
+++ ../../bfd/elfnn-aarch64.c   2019-11-20 11:44:00.000000000 +0000
@@ -4312,7 +4312,8 @@ elfNN_aarch64_size_stubs (bfd *output_bf

       for (input_bfd = info->input_bfds;
           input_bfd != NULL; input_bfd = input_bfd->link.next)
-       if (!_bfd_aarch64_erratum_835769_scan (input_bfd, info,
+       if (input_bfd != stub_bfd
+           && !_bfd_aarch64_erratum_835769_scan (input_bfd, info,
                                               &num_erratum_835769_fixes))
          return FALSE;

@@ -4327,6 +4328,7 @@ elfNN_aarch64_size_stubs (bfd *output_bf
       for (input_bfd = info->input_bfds;
           input_bfd != NULL;
           input_bfd = input_bfd->link.next)
+       if (input_bfd != stub_bfd)
        {
          asection *section;

But I'm not sure if this is complete, or the correct place; or if perhaps the
check should be based on sections being linker created, though I think the
above is better.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]