-
Notifications
You must be signed in to change notification settings - Fork 109
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
gimli::write: support relocation in expression #474
Comments
gimli definitely needs to implement better support for writing expressions. The current The simplest thing that supports relocations would be to use a I'm not sure how I'm also not sure if the memory usage of this approach is too high. There can be many expressions and using an enum like this has some overhead. Maybe an expression should be @bjorn3 and @yurydelendik might have thoughts about this. |
It is hard to guess what's behind of Yes, |
Yeah that's what I meant, sorry for being so brief. Although I was thinking we could have a Also to expand a bit more, the API for adding operations could still use an enum for the operation, we'd just immediately convert it to bytes and automatically handle creating the 0-islands and the |
Using |
I am generating DWARF on fly with the object file. I want to specify
DW_AT_location
for a global variable, which would be a constant address in the .data section and would require relocation (since I am also generating the .data section before linking and don't know the final address yet). Unlike other places that needs relocation and that supportsgimli::write::Address::Symbol
,DW_AT_location
expects an expression and I can't find a sane way to add the relocation. Here is what I have tried:DW_OP_addr
followed by the address. The address needs relocation, but I would need to know where the "from" point to when writing the relocation entry, which gimli doesn't give.DW_OP_addrx
followed by an index into.debug_addr
section, and do relocation there. However,gimli::write
doesn't support.debug_addr
. Not a big deal as I can manually craft one, butDW_AT_addr_base
to the unit, which expects a section offset into.debug_addr
(addrptr
class) butgimli::write::AttributeValue
doesn't support it.Any idea how I can do the relocation and/or can you implement the feature to support it?
The text was updated successfully, but these errors were encountered: