Skip to content

Conversation

@lyakh
Copy link
Contributor

@lyakh lyakh commented May 24, 2024

RFC: handle sections automatically, the last commit is intrusive. Marked as draft because it actually includes #72479 and #72940

@pillo79
Copy link
Contributor

pillo79 commented May 30, 2024

I very much like the idea in the last commit, given that the limitation of "have a memory map where similar RWX features are grouped toghether" is pretty common. Multiple separate areas would need quite a different handling anyways, since each enum definition maps to 1 entry now.

I propose to get rid of the following series of ifs, by mapping .text (EXECUTABLE && !WRITE) and .bss (!ALLOC && size) in the same way. At this point, you can assign the proper enum value for each section based on flags, and do the logic checks once on indexed shdr arrays.

You could then add a final check for these sections to not overlap, and it would be pretty robust IMHO! 💪

The only remaining by-name entry would be .exported_sym as that would otherwise be merged in "RODATA". I would move this check as first thing in the for, store the info and otherwise skip the section. Now that I think of it, with this it is important that exported_sym is either first or last in the "RODATA" group so that it can be properly skipped.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants