bug-binutils
[Top][All Lists]
Advanced

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

[Bug ld/22706] New: bfd/elf32-sh.c fails asserts without additional info


From: slyfox at inbox dot ru
Subject: [Bug ld/22706] New: bfd/elf32-sh.c fails asserts without additional information: sh4-unknown-linux-gnu-ld: BFD assertion fail bfd/elf32-sh.c:5171
Date: Sun, 14 Jan 2018 00:10:02 +0000

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

            Bug ID: 22706
           Summary: bfd/elf32-sh.c fails asserts without additional
                    information: sh4-unknown-linux-gnu-ld: BFD assertion
                    fail bfd/elf32-sh.c:5171
           Product: binutils
           Version: 2.30 (HEAD)
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: ld
          Assignee: unassigned at sourceware dot org
          Reporter: slyfox at inbox dot ru
  Target Milestone: ---

Attempted to build glibc for sh4-unknown-linux-gnu target and got the following
errors:

LANG=C bash -x ./trigger-linker-system.sh 
+ sh4-unknown-linux-gnu-ld -plugin
/usr/libexec/gcc/sh4-unknown-linux-gnu/6.4.0/liblto_plugin.so
-plugin-opt=/usr/libexec/gcc/sh4-unknown-linux-gnu/6.4.0/lto-wrapper
-plugin-opt=-fresolution=/tmp/ccvxcoL0.res --sysroot=/usr/sh4-unknown-linux-gnu
-m shlelf_linux -static -o
/tmp/portage/cross-sh4-unknown-linux-gnu/glibc-9999/work/build-default-sh4-unknown-linux-gnu-nptl/elf/sln
-L/usr/lib/gcc/sh4-unknown-linux-gnu/6.4.0
-L/usr/lib/gcc/sh4-unknown-linux-gnu/6.4.0/../../../../sh4-unknown-linux-gnu/lib
-L/usr/sh4-unknown-linux-gnu/lib -L/usr/sh4-unknown-linux-gnu/usr/lib -O1
--as-needed --hash-style=gnu
/tmp/portage/cross-sh4-unknown-linux-gnu/glibc-9999/work/build-default-sh4-unknown-linux-gnu-nptl/csu/crt1.o
/tmp/portage/cross-sh4-unknown-linux-gnu/glibc-9999/work/build-default-sh4-unknown-linux-gnu-nptl/csu/crti.o
/usr/lib/gcc/sh4-unknown-linux-gnu/6.4.0/crtbeginT.o
/tmp/portage/cross-sh4-unknown-linux-gnu/glibc-9999/work/build-default-sh4-unknown-linux-gnu-nptl/elf/sln.o
/tmp/portage/cross-sh4-unknown-linux-gnu/glibc-9999/work/build-default-sh4-unknown-linux-gnu-nptl/elf/static-stubs.o
--start-group
/tmp/portage/cross-sh4-unknown-linux-gnu/glibc-9999/work/build-default-sh4-unknown-linux-gnu-nptl/libc.a
-lgcc --end-group /usr/lib/gcc/sh4-unknown-linux-gnu/6.4.0/crtend.o
/tmp/portage/cross-sh4-unknown-linux-gnu/glibc-9999/work/build-default-sh4-unknown-linux-gnu-nptl/csu/crtn.o
sh4-unknown-linux-gnu-ld: BFD (Gentoo 2.29.1 p3) 2.29.1 assertion fail
/tmp/portage-tmpdir/portage/cross-sh4-unknown-linux-gnu/binutils-2.29.1-r1/work/binutils-2.29.1/bfd/elf32-sh.c:5171
sh4-unknown-linux-gnu-ld: BFD (Gentoo 2.29.1 p3) 2.29.1 assertion fail
/tmp/portage-tmpdir/portage/cross-sh4-unknown-linux-gnu/binutils-2.29.1-r1/work/binutils-2.29.1/bfd/elf32-sh.c:5174
sh4-unknown-linux-gnu-ld: BFD (Gentoo 2.29.1 p3) 2.29.1 assertion fail
/tmp/portage-tmpdir/portage/cross-sh4-unknown-linux-gnu/binutils-2.29.1-r1/work/binutils-2.29.1/bfd/elf32-sh.c:5176
...

The trigger issue here is likely glibc's lack of support gcc built as
--enable-default-pie but binutils ld error messages are not informative enough
to understand what is wrong with the code.

It's caused by BFD_ASSERT calls at:
   
https://sourceware.org/git/?p=binutils-gdb.git;a=blob;f=bfd/elf32-sh.c;h=9fa363615ddbb7629628b7fe500df93d0a27a8b0;hb=HEAD#l5141

I suggest changing calls like
    BFD_ASSERT ((insn & 0xff00) == 0xd000);
to something like
    if ((insn & 0xff00) != 0xd000)
      _bfd_error_handler
        /* xgettext:c-format */
        (_("%B(%A+%#Lx): unexpected instruction %04X (expected 0xd0??, ?)"),
         input_bfd, input_section, offset, insn);
That way error message would be:
ld/ld-new: libc.a(sched_yield.o)(.text+0x3a): unexpected instruction A005
(expected 0xd0??, mov.l)
ld/ld-new: libc.a(sched_yield.o)(.text+0x3c): unexpected instruction E0FF
(expected 0x0?12, stc)
ld/ld-new: libc.a(sched_yield.o)(.text+0x3e): unexpected instruction 0009
(expected 0x0?ce, mov.l)

It will help tweaking glibc.

-- 
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]