Bug 30685 - bfd fails with lto on armhf and clang-16 (symbol from plugin): Number of symbols in input file has increased from 0 to 1
Summary: bfd fails with lto on armhf and clang-16 (symbol from plugin): Number of symb...
Status: RESOLVED FIXED
Alias: None
Product: binutils
Classification: Unclassified
Component: ld (show other bugs)
Version: 2.41
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-07-26 09:25 UTC by Gianfranco
Modified: 2024-03-26 08:42 UTC (History)
1 user (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Gianfranco 2023-07-26 09:25:32 UTC
As said in 27659

gold works:
# /usr/bin/arm-linux-gnueabihf-ld.gold -pie -EL -X --hash-style=gnu --build-id --eh-frame-hdr -m armelf_linux_eabi -dynamic-linker /lib/ld-linux-armhf.so.3 -o foo /lib/arm-linux-gnueabihf/Scrt1.o /lib/arm-linux-gnueabihf/crti.o /usr/bin/../lib/gcc/arm-linux-gnueabihf/13/crtbeginS.o -L/usr/bin/../lib/gcc/arm-linux-gnueabihf/13 -L/usr/bin/../lib/gcc/arm-linux-gnueabihf/13/../../../../lib -L/lib/arm-linux-gnueabihf -L/lib/../lib -L/usr/lib/arm-linux-gnueabihf -L/usr/lib/../lib -L/lib -L/usr/lib -plugin /usr/lib/llvm-16/bin/../lib/LLVMgold.so -plugin-opt=mcpu=cortex-a7 foo.o -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /usr/bin/../lib/gcc/arm-linux-gnueabihf/13/crtendS.o /lib/arm-linux-gnueabihf/crtn.o

bfd fails:
# /usr/bin/arm-linux-gnueabihf-ld.bfd -pie -EL -X --hash-style=gnu --build-id --eh-frame-hdr -m armelf_linux_eabi -dynamic-linker /lib/ld-linux-armhf.so.3 -o foo-bfd /lib/arm-linux-gnueabihf/Scrt1.o /lib/arm-linux-gnueabihf/crti.o /usr/bin/../lib/gcc/arm-linux-gnueabihf/13/crtbeginS.o -L/usr/bin/../lib/gcc/arm-linux-gnueabihf/13 -L/usr/bin/../lib/gcc/arm-linux-gnueabihf/13/../../../../lib -L/lib/arm-linux-gnueabihf -L/lib/../lib -L/usr/lib/arm-linux-gnueabihf -L/usr/lib/../lib -L/lib -L/usr/lib -plugin /usr/lib/llvm-16/bin/../lib/LLVMgold.so -plugin-opt=mcpu=cortex-a7 foo.o -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /usr/bin/../lib/gcc/arm-linux-gnueabihf/13/crtendS.o /lib/arm-linux-gnueabihf/crtn.o
/usr/bin/arm-linux-gnueabihf-ld.bfd: foo.o (symbol from plugin): Number of symbols in input file has increased from 0 to 1

$ echo '#include <stdio.h>
int main() {
if (1==1) {
  printf("true");
}else{
  printf("false");
  return 42;
}
return 0;}' > foo.c

$ apt install clang-16
$ clang-16 -flto foo.c -o foo

clang-16 -flto foo.c -v
Debian clang version 16.0.6 (6)
Target: arm-unknown-linux-gnueabihf
Thread model: posix
InstalledDir: /usr/bin
Found candidate GCC installation: /usr/bin/../lib/gcc/arm-linux-gnueabihf/12
Found candidate GCC installation: /usr/bin/../lib/gcc/arm-linux-gnueabihf/13
Selected GCC installation: /usr/bin/../lib/gcc/arm-linux-gnueabihf/13
Candidate multilib: .;@m32
Selected multilib: .;@m32
 "/usr/lib/llvm-16/bin/clang" -cc1 -triple armv7-unknown-linux-gnueabihf -emit-llvm-bc -flto=full -flto-unit -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name foo.c -mrelocation-model pic -pic-level 2 -pic-is-pie -mframe-pointer=all -fmath-errno -ffp-contract=on -fno-rounding-math -mconstructor-aliases -target-cpu generic -target-feature +vfp2 -target-feature +vfp2sp -target-feature -vfp3 -target-feature +vfp3d16 -target-feature +vfp3d16sp -target-feature -vfp3sp -target-feature -fp16 -target-feature -vfp4 -target-feature -vfp4d16 -target-feature -vfp4d16sp -target-feature -vfp4sp -target-feature -fp-armv8 -target-feature -fp-armv8d16 -target-feature -fp-armv8d16sp -target-feature -fp-armv8sp -target-feature -fullfp16 -target-feature +fp64 -target-feature -d32 -target-feature -neon -target-feature -sha2 -target-feature -aes -target-feature -fp16fml -target-abi aapcs-linux -mfloat-abi hard -mllvm -treat-scalable-fixed-error-as-warning -debugger-tuning=gdb -v -fcoverage-compilation-dir=/ -resource-dir /usr/lib/llvm-16/lib/clang/16 -internal-isystem /usr/lib/llvm-16/lib/clang/16/include -internal-isystem /usr/local/include -internal-isystem /usr/bin/../lib/gcc/arm-linux-gnueabihf/13/../../../../arm-linux-gnueabihf/include -internal-externc-isystem /usr/include/arm-linux-gnueabihf -internal-externc-isystem /include -internal-externc-isystem /usr/include -fdebug-compilation-dir=/ -ferror-limit 19 -fno-signed-char -fgnuc-version=4.2.1 -fcolor-diagnostics -faddrsig -o /tmp/foo-40d5e5.o -x c foo.c
clang -cc1 version 16.0.6 based upon LLVM 16.0.6 default target arm-linux-gnueabihf
ignoring nonexistent directory "/usr/bin/../lib/gcc/arm-linux-gnueabihf/13/../../../../arm-linux-gnueabihf/include"
ignoring nonexistent directory "/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/lib/llvm-16/lib/clang/16/include
 /usr/local/include
 /usr/include/arm-linux-gnueabihf
 /usr/include
End of search list.
 "/usr/bin/arm-linux-gnueabihf-ld" -pie -EL -X --hash-style=gnu --build-id --eh-frame-hdr -m armelf_linux_eabi -dynamic-linker /lib/ld-linux-armhf.so.3 -o a.out /lib/arm-linux-gnueabihf/Scrt1.o /lib/arm-linux-gnueabihf/crti.o /usr/bin/../lib/gcc/arm-linux-gnueabihf/13/crtbeginS.o -L/usr/bin/../lib/gcc/arm-linux-gnueabihf/13 -L/usr/bin/../lib/gcc/arm-linux-gnueabihf/13/../../../../lib -L/lib/arm-linux-gnueabihf -L/lib/../lib -L/usr/lib/arm-linux-gnueabihf -L/usr/lib/../lib -L/lib -L/usr/lib -plugin /usr/lib/llvm-16/bin/../lib/LLVMgold.so -plugin-opt=mcpu=cortex-a7 /tmp/foo-40d5e5.o -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /usr/bin/../lib/gcc/arm-linux-gnueabihf/13/crtendS.o /lib/arm-linux-gnueabihf/crtn.o
/usr/bin/arm-linux-gnueabihf-ld: /tmp/foo-40d5e5.o (symbol from plugin): Number of symbols in input file has increased from 0 to 1

clang: error: linker command failed with exit code 1 (use -v to see invocation)
Comment 1 Gianfranco 2023-07-26 09:39:00 UTC
The tarball of the whole armhf chroot can be found here:
https://drive.abinsula.com/index.php/s/uCTPVGovwIjXSor
(note the link might expire in a few days)
Comment 2 Gianfranco 2023-08-30 06:03:05 UTC
Hello @Nick, ping?
Comment 3 Gianfranco 2024-03-26 08:41:59 UTC
binutils 2.42-4ubuntu1 looks working now. Closing
Comment 4 Gianfranco 2024-03-26 08:42:07 UTC
binutils 2.42-4ubuntu1 looks working now. Closing