Bug 28859 - Assertion failed while building glibc on raspbian bookworm.
Summary: Assertion failed while building glibc on raspbian bookworm.
Status: RESOLVED DUPLICATE of bug 28848
Alias: None
Product: binutils
Classification: Unclassified
Component: ld (show other bugs)
Version: 2.38
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-02-03 17:18 UTC by peter green
Modified: 2022-03-01 09:53 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments
files needed to trigger assert. (1.74 KB, application/zip)
2022-02-03 17:18 UTC, peter green
Details

Note You need to log in before you can comment on or make changes to this bug.
Description peter green 2022-02-03 17:18:46 UTC
Created attachment 13955 [details]
files needed to trigger assert.

I maintain raspbian, unfortunately my attemts to update glibc in raspbian bookworm are failing with an assertion failre.

The bintutils package in Raspbian bookworm is based on that from Debian bookworm and is currently at 2.37.90.20220123-2+rpi1

arm-linux-gnueabihf-gcc-10   -shared -static-libgcc  -Wl,-dynamic-linker=/lib/ld-linux-armhf.so.3 -Wl,-z,defs -B/glibc/build-tree/armhf-libc/csu/  -Wl,-z,combreloc -Wl,-z,relro -Wl,--hash-style=both  -L/glibc/build-tree/armhf-libc -L/glibc/build-tree/armhf-libc/math -L/glibc/build-tree/armhf-libc/elf -L/glibc/build-tree/armhf-libc/dlfcn -L/glibc/build-tree/armhf-libc/nss -L/glibc/build-tree/armhf-libc/nis -L/glibc/build-tree/armhf-libc/rt -L/glibc/build-tree/armhf-libc/resolv -L/glibc/build-tree/armhf-libc/mathvec -L/glibc/build-tree/armhf-libc/support -L/glibc/build-tree/armhf-libc/nptl -Wl,-rpath-link=/glibc/build-tree/armhf-libc:/glibc/build-tree/armhf-libc/math:/glibc/build-tree/armhf-libc/elf:/glibc/build-tree/armhf-libc/dlfcn:/glibc/build-tree/armhf-libc/nss:/glibc/build-tree/armhf-libc/nis:/glibc/build-tree/armhf-libc/rt:/glibc/build-tree/armhf-libc/resolv:/glibc/build-tree/armhf-libc/mathvec:/glibc/build-tree/armhf-libc/support:/glibc/build-tree/armhf-libc/nptl -o /glibc/build-tree/armhf-libc/elf/sotruss-lib.so  /glibc/build-tree/armhf-libc/csu/abi-note.o -Wl,--as-needed /glibc/build-tree/armhf-libc/elf/sotruss-lib.os  -Wl,--no-as-needed -Wl,--start-group /glibc/build-tree/armhf-libc/libc.so /glibc/build-tree/armhf-libc/libc_nonshared.a -Wl,--as-needed /glibc/build-tree/armhf-libc/elf/ld.so -Wl,--no-as-needed -Wl,--end-group

collect2: error: ld returned 1 exit status

I checked that the line where the assert triggered was the same in our binutils tree as it is in current git head.

14800               /* If the output has no requirement about FP hardware,
14801                  follow the requirement of the input.  */
14802               if (out_attr[i].i == 0)
14803                 {
14804                   /* This assert is still reasonable, we shouldn't
14805                      produce the suspicious build attribute
14806                      combination (See below for in_attr).  */
14807                   BFD_ASSERT (out_attr[Tag_ABI_HardFP_use].i == 0);
14808                   out_attr[i].i = in_attr[i].i;
14809                   out_attr[Tag_ABI_HardFP_use].i
14810                     = in_attr[Tag_ABI_HardFP_use].i;
14811                   break;
14812                 }

I was able to reduce the command needed to trigger the assert to /usr/bin/ld -shared /glibc/build-tree/armhf-libc/csu/crti.o /usr/lib/gcc/arm-linux-gnueabihf/10/crtendS.o
Comment 1 Nick Clifton 2022-02-10 11:48:02 UTC
Hi Peter,

  I believe that this is the same issue as had been reported in PR 28848.

  The good news is that a proposed patch has submitted.  If you would like
  to give it a try yourself please do.

Cheers
  Nick

*** This bug has been marked as a duplicate of bug 28848 ***
Comment 2 Sourceware Commits 2022-03-01 09:53:15 UTC
The master branch has been updated by Nick Clifton <nickc@sourceware.org>:

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

commit 81c9e0f6c48748f4b66fc3b13e12eb68735cf1f9
Author: Nick Clifton <nickc@redhat.com>
Date:   Tue Mar 1 09:51:59 2022 +0000

    Prevent an assertion from being triggered when linking an ARM object file with incorrectly set build attributes.
    
            PR 28848
            PR 28859
            * elf32-arm.c (elf32_arm_merge_eabi_attributes): If the first
            input bfd has a Tag_ABI_HardFP_use set to 3 but does not also have
            TAG_FP_arch set then reset the TAG_ABI_HardFP_use.