Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
Better support relocating NOTE sections/segments #218
SHT_NOTE sections can be mapped in memory by PT_NOTE segments. When
Note that an ELF can contain multiple SHT_NOTE sections, and a given
Also fix (or more like hack around) alignment issues with note sections.
Hmm, looks like this won't be enough. The situation with multiple SHT_NOTE covered by a single PT_NOTE is common enough that apparently we hit it even in the test suite :-/
And indeed there is a single
Not completely sure what the best way forward is -- maybe some kind of normalization step where we break up the
SHT_NOTE sections can be mapped in memory by PT_NOTE segments. When rewriting an SHT_NOTE, attempt to also rewrite a matching segment if it exists. Note that an ELF can contain multiple SHT_NOTE sections, and a given PT_NOTE segment can theoretically map multiple contiguous sections. There are multiple ways this could be handled, the one picked here is to pre-normalize PT_NOTE segments so that a multi-section segment gets broken up into multiple separate segments instead. Also fix (or more like hack around) alignment issues with note sections. Keeping the original alignment value when possible is important because it determines how the data within the section needs to be parsed.