liballocs
liballocs copied to clipboard
Subsection allocator might be useful
Sometimes, especially for instrumentation, it's useful to be able to carve out little bits of space within a binary's segments. This could be used to hold trampolines, or static data they refer to.
Some such space is available in inter-section padding, so is already visible to liballocs. However, in larger objects there is a lot more space in linker-inserted gaps between sections. These are not currently visible, but would be visible if we could process the link map. Much as the liballocs toolchain forwards relocations (-Wl,-q), it could also forward the link map (-Wl,-Map,filename) for postprocessing into the -meta.so, after which the linker artifact can be deleted.
Probably the foundations for this would be best going in librunt, but it would be tied together here.
It could also be useful in libsystrap for lazy instrumentation: make uninstrumented code "virtually executable" but turn off the X bit. On taking a trap, instrument a whole number of sections spanning one or more pages including the trap site.