This patch defines InitFiniSection synthetic section to convert
.[cd]tors to .{init,fini}_array.
Details
- Reviewers
- None
Diff Detail
- Build Status
Buildable 11551 Build 11551: arc lint + arc unit
Event Timeline
@ruiu I'd appreciate if you continue with this review.
WRT toInitFiniName — section renaming was just a hack, and it is absent from my final patch. Is it really needed here?
lld/ELF/Writer.cpp | ||
---|---|---|
137 |
lld/ELF/Writer.cpp | ||
---|---|---|
137 | Should we show warning when have .ctors/.dtors ? |
I added support for .init_array and .fini_array to OpenBSD's ld.so almost a year ago. It hasn't been extensively tested on architectures other than arm64, but there is no reason why it shouldn't work on other architectures. We don't really have any ABI concerns.
However, .init_array and .fini_array don't work (yet) for static binaries. I don't think that's a major issue.
Warning for .ctor/.dtor use would IMO be completely bogus. They can easily be translated and they are kind of the LCD for "portable" assembler, i.e. much less problematic to deal with than plain .init/.fini segments.
Do we need a new type?
You can have a standalone function that does the conversion and creates a InputSection directly. Not that different from how .comment is created.