.stack_sizes should interact better with ELF
| Bugzilla Link | 36717 |
| Resolution | FIXED |
| Resolved on | Feb 19, 2020 11:14 |
| Version | trunk |
| OS | Linux |
| Reporter | LLVM Bugzilla Contributor |
| CC | @bd1976bris,@MaskRay,@jh7370,@wjristow,@wolfy1961 |
Extended Description
I have noticed a few issues with the current .stack_sizes implementation
1: It can created unaligned relocations:
000000000009 000400000001 R_X86_64_64 0000000000000000 bar + 0
2: The relocations point to global symbols. If bar is weak and resolves to another file this entry will refer to the wrong function.
3: It doesn't produce multiple sections if -function-sections is used.
4: It doesn't take comdats into consideration.
5: It doesn't use SHF_LINK_ORDER for enabling garbage collection by the linker.
The last part requires some work in lld too.
Point 1 is not a problem. Misalignment is fine. Everything has been fixed now, closing.
Problem 1: https://reviews.llvm.org/D74815
(.stack_sizes uses SHF_LINK_ORDER unconditionally, not guarded by -use-integrated-as.
I reported several GNU as and ld feature requests. hjl implemented all of them. binutils>=2.35 will be good.
Link: https://gcc.gnu.org/ml/gcc/2020-01/msg00067.html https://sourceware.org/ml/binutils/2020-02/ )
Item 2 from comment 0 was implemented with r328581.
Items 3, 4, and 5 from comment 0 were implemented with rL335332 and rL335336 respectively.
1: It can created unaligned relocations:
I'm not sure this is a problem. Unaligned relocations are perfectly acceptable. If I'm not mistaken, this is already the case for e.g. debug data.
local symbols: https://reviews.llvm.org/D44669.
Comdats: https://reviews.llvm.org/D46874.
See http://lists.llvm.org/pipermail/llvm-dev/2018-March/122180.html for performance concerns and also comments in the above two reviews.