Previously when ICF merged 2 code sections it did not take
SHF_LINK_ORDER dependencies in account at all.
So if one of order sections was absent or different from another one,
ICF still performed code folding for code sections, what was not correct.
Patch improves the support, teaching ICF to compare static contents of
SHF_LINK_ORDER sections.
Details
Diff Detail
Event Timeline
ELF/InputSection.cpp | ||
---|---|---|
244 | You are assuming that there's up to one dependent section, but are you sure that the assumption is correct? I don't think that's guaranteed by the standard. |
ELF/InputSection.cpp | ||
---|---|---|
244 | It should not be too hard to change I believe. |
ELF/InputSection.cpp | ||
---|---|---|
244 | At least you need to be consistent with your own choice. Support multiple sections or report an error. |
- Added error for case when multiple SHF_LINK_ORDER sections with the same target.
- Added testcase for checking above.
ELF/ICF.cpp | ||
---|---|---|
279 | You shouldn't make this change -- you can check it on the caller side. | |
434–435 | This is pretty odd piece of code. You do not call replace on LinkOrder section, but you are reporting that you have removed it. It looks buggy even if it is not buggy. | |
ELF/InputSection.cpp | ||
244 | Why don't you just add a LinkOrderSection * member to InputSection? |
ELF/ICF.cpp | ||
---|---|---|
279 | OK. | |
434–435 | Fixed. | |
ELF/InputSection.cpp | ||
244 | If D38170 be landed, we will have InputSection *LinkOrderSection; in InputSectionBase, but that is different pointer. Doesn't seem we should add one more member for that, because we already have X in DependentSections member for L. |
If you have time to work on improving this, do you mind if I ask you to work on emitting per-function .eh_frame sections from clang?
Yes, I think at least I can try. Unfortunately I am not familar with clang code at all, so it probably will take some time before any first results,
I'll try to investigate how to implement this.
You shouldn't make this change -- you can check it on the caller side.