llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
29.43k stars 12.16k forks source link

lld: error: section size decrease is too large on RISCV64 #63374

Closed kraj closed 1 year ago

kraj commented 1 year ago

In an attempt to make LLD as default linker in a Yocto distro, when using LLD/RISC-V64 from Clang 16.0.6 several packages are failing to link with below error

riscv64-yoe-linux-ld.lld: error: section size decrease is too large

I have collected all objects and libs into a single place to reproduce it. test case is here https://uclibc.org/~kraj/lld-riscv-fail.tar.xz

Inside the tarball there is a script called a.sh when run sh ./a.sh shows the problem. it links fine with bfd linker, it also linked fine with LLD if --no-relax option is added to it.

@MaskRay any ideas ?

topperc commented 1 year ago

This may have been fixed by https://github.com/llvm/llvm-project/commit/9d37ea95df1b84cca9b5e954d8964c976a5e303e

llvmbot commented 1 year ago

@llvm/issue-subscribers-backend-risc-v

llvmbot commented 1 year ago

@llvm/issue-subscribers-lld-elf

kraj commented 1 year ago

This may have been fixed by 9d37ea9

yes indeed, I backported the above fix to clang16 branch and it seems to work

asb commented 1 year ago

Marking this as "LLVM 16.0.x release" because if another 16.0.x is produced we'd like to backport this fix, but we probably wouldn't request a new point release just due to this fix if it wasn't happening anyway.

MaskRay commented 1 year ago

Yes, the large section use case was supported by https://github.com/llvm/llvm-project/commit/9d37ea95df1b84cca9b5e954d8964c976a5e303e . When I implemented the relaxation, I thought that 65535 was sufficient.

If we still do a 16.0.6 release after https://discourse.llvm.org/t/16-0-5-release/71097 , this commit is a good candidate.

MaskRay commented 1 year ago

Fixed for 17