[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug binutils/32340] New: strip has difficulty handling the relocations
From: |
ptr1337 at cachyos dot org |
Subject: |
[Bug binutils/32340] New: strip has difficulty handling the relocations in .rel.llvm.call-graph-profile |
Date: |
Tue, 05 Nov 2024 16:09:08 +0000 |
https://sourceware.org/bugzilla/show_bug.cgi?id=32340
Bug ID: 32340
Summary: strip has difficulty handling the relocations in
.rel.llvm.call-graph-profile
Product: binutils
Version: 2.43
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: binutils
Assignee: unassigned at sourceware dot org
Reporter: ptr1337 at cachyos dot org
Target Milestone: ---
Hi together,
Recently there has been the Clang AutoFDO series posted to lkml. After testing
this series, I faced a bug in the packaging, as soon an AutoFDO profile was
passed.
Log:
```
make[2]: *** [scripts/Makefile.modinst:125:
/tmp/makepkg/linux-cachyos-rc-autofdo/pkg/linux-cachyos-rc-autofdo/usr/lib/modules/6.12.0-rc5-5-cachyos-rc-autofdo/kernel/arch/x86/kvm/kvm.ko]
Error 1
make[2]: *** Deleting file
'/tmp/makepkg/linux-cachyos-rc-autofdo/pkg/linux-cachyos-rc-autofdo/usr/lib/modules/6.12.0-rc5-5-cachyos-rc-autofdo/kernel/arch/x86/kvm/kvm.ko'
INSTALL
/tmp/makepkg/linux-cachyos-rc-autofdo/pkg/linux-cachyos-rc-autofdo/usr/lib/modules/6.12.0-rc5-5-cachyos-rc-autofdo/kernel/crypto/cryptd.ko
make[2]: *** Waiting for unfinished jobs....
```
Rong Xu found the issue in binutils after debugging:
Quote:
"
In this case,
$ readelf -r kvm.ko |grep llvm.call-graph-profile
Relocation section '.rel.llvm.call-graph-profile' at offset 0xf62a00
contains 4 entries:
strip (v2.43.0) has difficulty handling the relocations in
.rel.llvm.call-graph-profile -- it silently failed with --strip-debug.
But strip (v.2.42) has no issue with kvm.ko. The strip in llvm (i.e.
llvm-strip) also passes with kvm.ko
I compared binutil/strip source code for version v2.43.0 and v2.42.
The different is around here:
In v2.42 of bfd/elfcode.h
1618 if ((entsize == sizeof (Elf_External_Rela)
1619 && ebd->elf_info_to_howto != NULL)
1620 || ebd->elf_info_to_howto_rel == NULL)
1621 res = ebd->elf_info_to_howto (abfd, relent, &rela);
1622 else
1623 res = ebd->elf_info_to_howto_rel (abfd, relent, &rela);
In v2.43.0 of bfd/elfcode.h
1618 if (entsize == sizeof (Elf_External_Rela)
1619 && ebd->elf_info_to_howto != NULL)
1620 res = ebd->elf_info_to_howto (abfd, relent, &rela);
1621 else if (ebd->elf_info_to_howto_rel != NULL)
1622 res = ebd->elf_info_to_howto_rel (abfd, relent, &rela);
In the 2.43 strip, line 1618 is false and line 1621 is also false.
"res" is returned as false and the program exits with -1.
While in 2.42, line 1620 is true and we get "res" from line 1621 and
program functions correctly."
The commit, which introduced the issue is following:
https://github.com/bminor/binutils-gdb/commit/b20ab53f81db7eefa0db00d14f06c04527ac324c
Reverting this commit or using binutils 2.42 does not provide any issue and the
packaging is successful.
--
You are receiving this mail because:
You are on the CC list for the bug.
- [Bug binutils/32340] New: strip has difficulty handling the relocations in .rel.llvm.call-graph-profile,
ptr1337 at cachyos dot org <=