-
-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for more than SHN_LORESERVE sections #31
Conversation
I will try to add a unit test for this, at least some basic round-trip. (Switched to draft since the reading code is incomplete.) |
Another broken case that I found is that large section numbers in symbol table as truncated. There's an escape mechanism which uses |
661049a
to
0fc236f
Compare
I have an unpushed fix (+ unit test) for the first two errors but I am not really convinced whether it's going in the good direction... Do you think it's better to expose this format quirk in |
I haven't looked in the detail, but it might be error prone to expose it so I would think that hiding it would be better, but I would think that would be more in There is also the concept of |
There already needs to be a special case in the reader/writer. In the reader I need to read the NULL section header and only then I get the number of sections, and possibly the correct section index of string table. Since both of these are local variables in the reader it's relatively easy to handle it there with no changes to the model itself. That also makes the verification methods easier to reason about. I originally wrote some checks in Similarly, for the writer, I originally started with a design that modified I feel like this is similar to hiding the fact that sections with 32-bit and 64-bit headers are different in the file format. In this case the quirk is that the large numbers are just written into different place. The place just happens to be part of I'll try to get something ready to review this week and explain the design decisions. If necessary I can always rewrite it later. I still need to figure out how to reasonably expose the symbol table with large section numbers. |
0fc236f
to
0bf3604
Compare
I came up with something that works. Here's the gist:
|
… the new ManySections test).
Thanks a lot for this! |
ELF files with more than SHN_LORESERVE (0xff00) sections need special handling for the number of sections and link to section header string table. Both of these fields are unrepresentable using the
ushort
fields in the ELF header and they are instead written in fields of the NULL section.