New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ld.bfd --gc-sections not working properly in LoongArch #40
Comments
I have added some _bfd_error_handler calls to binutils and here is the output:
It somehow marked |
Possible bug:
When marking spl_board_init, it locates eh_frame FDE entry for board_late_init. |
The extra relocations of R_LARCH_ADD6 and R_LARCH_SUB6 are weird:
|
I found the bug: the relocations are not in-ordered:
It only checks if
|
Possible solutions:
|
If you know how to fix it please send a patch to binutils@sourceware.org (with a DCO |
On the contrary, the order is correct in RISC-V:
|
https://sourceware.org/pipermail/binutils/2024-February/132266.html Pity: it seems the thought to test the Binutils pre-release with GCC trunk has never occurred to anyone (including myself) or we'll catch this much earlier! |
What version of your binutils? This bug has been fixed by Jinyang He on master branch(commit id: 7c93730fe50c22129e751d8479e64bc970b75aac). I will backport it to binutils 2.41 branch (binutils-2_41-branch). |
I was using binutils 2.41. And I confirm that binutils 2.42 fixes the issue. |
Hmm, but in Binutils 2.42 several tests in the test suite for -Wl,--gc-sections still fail with GCC 14. Then they might be different problems... |
I will take a look today. |
These errors are caused by R_LARCH_ALIGN or mismatched error message. But, it may be fixed after Spring Festival. |
Consider the following code (taken from u-boot-loongson):
Compile and link with
-ffunctions-sections -fdata-sections -fno-plt
:Output on loongarch:
Output on amd64:
You can see that
.text.board_late_init
is not properly GC-ed. If-fno-plt
is removed, it works.The text was updated successfully, but these errors were encountered: