Bug 2326190

Summary: [abrt] binutils-aarch64-linux-gnu: elf64_aarch64_init_small_plt0_entry(): aarch64-linux-gnu-ld killed by SIGSEGV
Product: [Fedora] Fedora Reporter: Enric Balletbo i Serra <eballetbo>
Component: binutilsAssignee: Nick Clifton <nickc>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 41CC: dan, dhowells, dvlasenk, eballetbo, ekovsky, epel-packagers-sig, fweimer, jakub, josmyers, lkundrak, mbrown, nickc, sbonazzo, sipoyare, suraj.ghimire7, yahmad
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Unspecified   
URL: https://retrace.fedoraproject.org/faf/reports/bthash/14e97a45a0e77c0b07769492040724b74957894
Whiteboard: abrt_hash:a4e1e1df938a912b005a33e7b4c903bb58378058;VARIANT_ID=workstation;
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2025-08-11 12:02:13 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
File: proc_pid_status
none
File: maps
none
File: limits
none
File: open_fds
none
File: mountinfo
none
File: os_info
none
File: cpuinfo
none
File: core_backtrace
none
File: exploitable
none
File: dso_list
none
File: environ
none
File: backtrace none

Description Enric Balletbo i Serra 2024-11-14 09:11:25 UTC
Description of problem:
You can reproduce the crash in both x86_64 and aarch64 architectures.

On x86_64 architecture:
1. Clone the u-boot project
    git clone https://source.denx.de/u-boot/u-boot.git
2. Go to the project
    cd u-boot
3. Configure for the rcar spider board
    make r8a779f0_spider_defconfig
4. Cross-build with
      make CROSS_COMPILE=aarch64-linux-gnu-

On aarch64 architecture:
1. Clone the u-boot project
    git clone https://source.denx.de/u-boot/u-boot.git
2. Go to the project
    cd u-boot
3. Configure for the rcar spider board
    make r8a779f0_spider_defconfig
4. Build with
      make 

The same segmentation fault happens.

    collect2: fatal error: ld terminated with signal 11 [Segmentation fault], core dumped

Version-Release number of selected component:
binutils-aarch64-linux-gnu-2.41-2.fc41

Additional info:
reporter:       libreport-2.17.15
type:           CCpp
reason:         aarch64-linux-gnu-ld killed by SIGSEGV
journald_cursor: s=bb27a374636d4211bcbdf6b680828a68;i=122fd75;b=2a04dc238a5c4957967fdb1e5b43987a;m=29564579d1;t=6263c1181d192;x=71d6fbe047bcb459
executable:     /usr/bin/aarch64-linux-gnu-ld
cmdline:        /usr/bin/aarch64-linux-gnu-ld -plugin /usr/libexec/gcc/aarch64-linux-gnu/14/liblto_plugin.so -plugin-opt=/usr/libexec/gcc/aarch64-linux-gnu/14/lto-wrapper -plugin-opt=-fresolution=/tmp/ccudJr06.res --sysroot=/usr/aarch64-linux-gnu/sys-root --build-id --no-add-needed --eh-frame-hdr --hash-style=gnu -dynamic-linker /lib/ld-linux-aarch64.so.1 -X -EL -maarch64linux -o u-boot -L/usr/lib/gcc/aarch64-linux-gnu/14 -L/usr/lib/gcc/aarch64-linux-gnu/14 -z noexecstack --no-warn-rwx-segments -pie --gc-sections -Bstatic --no-dynamic-linker -z notext --build-id=none -Ttext 0x0 arch/arm/cpu/armv8/start.o --whole-archive arch/arm/cpu/built-in.o arch/arm/cpu/armv8/built-in.o arch/arm/lib/built-in.o arch/arm/mach-renesas/built-in.o board/renesas/spider/built-in.o boot/built-in.o cmd/built-in.o common/built-in.o disk/built-in.o drivers/built-in.o drivers/usb/cdns3/built-in.o drivers/usb/common/built-in.o drivers/usb/dwc3/built-in.o drivers/usb/emul/built-in.o drivers/usb/eth/built-in.o drivers/usb/host/built-in.o drivers/usb/isp1760/built-in.o drivers/usb/mtu3/built-in.o drivers/usb/musb-new/built-in.o drivers/usb/musb/built-in.o drivers/usb/phy/built-in.o drivers/usb/ulpi/built-in.o env/built-in.o fs/built-in.o lib/built-in.o net/built-in.o keep-syms-lto.o -lgcc --no-whole-archive -Map u-boot.map -T u-boot.lds
cgroup:         0::/user.slice/user-1000.slice/user/app.slice/app-org.gnome.Terminal.slice/vte-spawn-20120831-efc6-44f5-8234-8863123f5475.scope
rootdir:        /
uid:            1000
kernel:         6.11.5-300.fc41.x86_64
package:        binutils-aarch64-linux-gnu-2.41-2.fc41
runlevel:       N 5
backtrace_rating: 4
crash_function: elf64_aarch64_init_small_plt0_entry

Truncated backtrace:
Thread no. 1 (4 frames)
 #0 elf64_aarch64_init_small_plt0_entry at ../bfd/elfnn-aarch64.c:9847
 #1 elf64_aarch64_finish_dynamic_sections at ../bfd/elfnn-aarch64.c:9947
 #2 bfd_elf_final_link at ../bfd/../../binutils-2.41/bfd/elflink.c:13412
 #3 ldwrite at ../../binutils-2.41/ld/ldwrite.c:545

Comment 1 Enric Balletbo i Serra 2024-11-14 09:11:30 UTC
Created attachment 2057675 [details]
File: proc_pid_status

Comment 2 Enric Balletbo i Serra 2024-11-14 09:11:32 UTC
Created attachment 2057676 [details]
File: maps

Comment 3 Enric Balletbo i Serra 2024-11-14 09:11:33 UTC
Created attachment 2057677 [details]
File: limits

Comment 4 Enric Balletbo i Serra 2024-11-14 09:11:36 UTC
Created attachment 2057678 [details]
File: open_fds

Comment 5 Enric Balletbo i Serra 2024-11-14 09:11:37 UTC
Created attachment 2057679 [details]
File: mountinfo

Comment 6 Enric Balletbo i Serra 2024-11-14 09:11:39 UTC
Created attachment 2057680 [details]
File: os_info

Comment 7 Enric Balletbo i Serra 2024-11-14 09:11:41 UTC
Created attachment 2057681 [details]
File: cpuinfo

Comment 8 Enric Balletbo i Serra 2024-11-14 09:11:43 UTC
Created attachment 2057682 [details]
File: core_backtrace

Comment 9 Enric Balletbo i Serra 2024-11-14 09:11:45 UTC
Created attachment 2057683 [details]
File: exploitable

Comment 10 Enric Balletbo i Serra 2024-11-14 09:11:47 UTC
Created attachment 2057684 [details]
File: dso_list

Comment 11 Enric Balletbo i Serra 2024-11-14 09:11:48 UTC
Created attachment 2057685 [details]
File: environ

Comment 12 Enric Balletbo i Serra 2024-11-14 09:11:51 UTC
Created attachment 2057686 [details]
File: backtrace

Comment 13 Dan Horák 2024-11-14 16:05:57 UTC
If I understand right, then the native aarch64 ld crashes the same way as the cross-ld. Let's switch the component to binutils as we are only consumers here.

Comment 14 Nick Clifton 2025-02-07 11:40:51 UTC
Yes, this is a linker problem.

I have a small patch which allows the link to complete, but I have also pinged the AArch64 binutils maintainers upstream to see if they would prefer a different solution.  In the meantime I will apply the patch to rawhide, f42 and f41 so that u-boot builds can complete.

Comment 15 Nick Clifton 2025-02-07 15:56:25 UTC
Fixed in binutils-2.44-3.fc42.

For unknown reasons rawhide builds are not working at the moment, so a fix for rawhide is delayed.

Comment 16 Nick Clifton 2025-02-07 22:52:00 UTC
Fixed in binutils-2.44-3.fc43.

The rawhide build issue has resolved itself, so now that build is complete as well.

Both builds are now in the Bodhi system awaiting enough karma to reach their buildroots.

Comment 17 Eddie Kovsky 2025-02-25 16:58:11 UTC
Hi Nick

I am still seeing the same segmentation fault with binutils-2.44-3.fc43. This occurred with a recent Fedora nightly snapshot while cross compiling u-boot. 

[root@kvm-01-guest08 ~]# cat /etc/fedora-release
Fedora release 43 (Rawhide)

[root@kvm-01-guest08 ~]# rpm -qa binutils
binutils-2.44-3.fc43.x86_64

[root@kvm-01-guest08 ~]# dnf install -y gcc-aarch64-linux-gnu bison flex openssl-devel gnutls-devel openssl-devel-engine srecord

[root@kvm-01-guest08 ~]# git clone https://source.denx.de/u-boot/u-boot.git

[root@kvm-01-guest08 ~]# cd u-boot/

[root@kvm-01-guest08 u-boot]# make r8a779f0_spider_defconfig
  YACC    scripts/kconfig/zconf.tab.c
  LEX     scripts/kconfig/zconf.lex.c
  HOSTCC  scripts/kconfig/zconf.tab.o
  HOSTLD  scripts/kconfig/conf
#
# configuration written to .config
#

[root@kvm-01-guest08 u-boot]# make CROSS_COMPILE=aarch64-linux-gnu-
--->8
  UPD     include/generated/timestamp_autogenerated.h
  CC      common/version.o
  AR      common/built-in.o
  KSL     keep-syms-lto.c
  KSLCC   keep-syms-lto.o
  LTO     u-boot
lto-wrapper: warning: using serial compilation of 12 LTRANS jobs
lto-wrapper: note: see the ‘-flto’ option documentation for more information
/usr/bin/aarch64-linux-gnu-ld: /usr/lib/gcc/aarch64-linux-gnu/14/libgcc.a(lse-init.o): in function `init_have_lse_atomics':
/builddir/build/BUILD/cross-gcc-14.2.1-build/gcc-14.2.1-20240912/aarch64-linux-gnu/aarch64-linux-gnu/libgcc/../../../gcc-14.2.1-20240912/libgcc/config/aarch64/lse-init.c:46:(.text.startup+0xc): undefined reference to `__getauxval'
/usr/bin/aarch64-linux-gnu-ld: /usr/lib/gcc/aarch64-linux-gnu/14/libgcc.a(__aarch64_have_sme.o): in function `sme_accessible':
/builddir/build/BUILD/cross-gcc-14.2.1-build/gcc-14.2.1-20240912/aarch64-linux-gnu/aarch64-linux-gnu/libgcc/../../../gcc-14.2.1-20240912/libgcc/config/aarch64/__aarch64_have_sme.c:49:(.text.startup+0xc): undefined reference to `__getauxval'
/usr/bin/aarch64-linux-gnu-ld: /usr/lib/gcc/aarch64-linux-gnu/14/libgcc.a(__arm_tpidr2_restore.o): in function `__arm_tpidr2_restore':
/builddir/build/BUILD/cross-gcc-14.2.1-build/gcc-14.2.1-20240912/aarch64-linux-gnu/aarch64-linux-gnu/libgcc/../../../gcc-14.2.1-20240912/libgcc/config/aarch64/__arm_tpidr2_restore.S:88:(.text+0x90): undefined reference to `abort'
/usr/bin/aarch64-linux-gnu-ld: /usr/lib/gcc/aarch64-linux-gnu/14/libgcc.a(__arm_tpidr2_save.o): in function `__libgcc_arm_tpidr2_save':
/builddir/build/BUILD/cross-gcc-14.2.1-build/gcc-14.2.1-20240912/aarch64-linux-gnu/aarch64-linux-gnu/libgcc/../../../gcc-14.2.1-20240912/libgcc/config/aarch64/__arm_tpidr2_save.S:95:(.text+0x9c): undefined reference to `abort'
collect2: fatal error: ld terminated with signal 11 [Segmentation fault], core dumped
compilation terminated.
make: *** [Makefile:1824: u-boot] Error 1
make: *** Deleting file 'u-boot'

Comment 18 Nick Clifton 2025-02-26 11:04:28 UTC
(In reply to Eddie Kovsky from comment #17)
Hi Eddie,

> I am still seeing the same segmentation fault with binutils-2.44-3.fc43.
> This occurred with a recent Fedora nightly snapshot while cross compiling
> u-boot. 

Darn...

> [root@kvm-01-guest08 ~]# rpm -qa binutils
> binutils-2.44-3.fc43.x86_64

Ah, but you have also installed: binutils-aarch64-linux-gnu-2.44.3.fc43.x86_64 ?

Probably not, because according to koji the build failed. :-(

I am looking into this.  But in the meantime are you able to test building u-boot in a native AArch64 environment ?

Comment 19 Nick Clifton 2025-02-26 15:36:35 UTC
FYI - there are two problems with the cross-binutils package:

This first is that the current rawhide sources do not build because they make use of a gcc extension to the C standard, but the cross compiler does not default to supporting this extension.  I have created a pull request to fix this build problem:

https://src.fedoraproject.org/rpms/cross-binutils/pull-request/8

The second issue is that the cross binutils sources do not include the patch that fixes the u-boot build.  The cross-binutils sources are at version 2.43.1-3 but the patch to fix the u-boot build only went into the ordinary binutils sources (as version 2.44-3).  So this patch needs to be copied into the cross-binutils.  I am working on this.

Comment 20 Dan Horák 2025-02-26 16:20:48 UTC
Ideally we would like to keep cross-binutils close to the rawhide (or branched) binutils, but help is always welcome ...

Comment 21 Nick Clifton 2025-02-26 16:49:17 UTC
(In reply to Dan Horák from comment #20)
> Ideally we would like to keep cross-binutils close to the rawhide (or
> branched) binutils, but help is always welcome ...

In which case I have now updated the pull request with the addition of the patch from binutils/rawhide that allows u-boot to build... :-)

Comment 22 Nick Clifton 2025-02-27 11:07:42 UTC
... and the pull request is in and the builds are complete.  I am not sure how long it will take the buildroot to update, but in the meantime you can download binutils-aarch64-linux-gnu-2.43.1-5.fc43.x86_64.rpm from:

https://koji.fedoraproject.org/koji/rpminfo?rpmID=41992751

Comment 23 Dan Horák 2025-02-27 13:44:48 UTC
(In reply to Nick Clifton from comment #22)
> ... and the pull request is in and the builds are complete.  I am not sure
> how long it will take the buildroot to update, but in the meantime you can
> download binutils-aarch64-linux-gnu-2.43.1-5.fc43.x86_64.rpm from:
> 
> https://koji.fedoraproject.org/koji/rpminfo?rpmID=41992751

should be in the buildroot now and tomorrow in the public rawhide repo, F-42 build has been submitted as an update in https://bodhi.fedoraproject.org/updates/FEDORA-2025-8e99c6193f

Comment 24 Sandro Bonazzola 2025-03-10 10:40:12 UTC
Looks like the update in  https://bodhi.fedoraproject.org/updates/FEDORA-2025-8e99c6193f is failing one test on rpminspect: https://artifacts.dev.testing-farm.io/8e612a81-b9e5-45bf-9572-4edf1b12f526/

Comment 25 Sandro Bonazzola 2025-08-05 07:52:50 UTC
Is this now fixed in current release? Can this be closed?

Comment 26 Nick Clifton 2025-08-11 12:02:13 UTC
Yes, closing