Skip to content

Rel vaddrs #114

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Rel vaddrs #114

wants to merge 2 commits into from

Conversation

henrymkw
Copy link

This PR adds virtual addresses support for RELs splits.txt and symbols.txt files. This would resolve #98.

Implementation

The main implementation goal was make changes in the 'front-end' without touching the 'back-end'. Virtual addresses get converted to REL addresses upon parsing, which the REL address is used for the remainder of runtime. A virtual address field was also added to ObjSymbol to support virtual addresses in objdiff.

Usage

To use, the user needs to add the virtual_address:{offset_virtual_address} attribute to each section definition in splits.txt. For example

Sections:
	.text       type:code align:4
	.ctors      type:rodata align:4
	.dtors      type:rodata align:4
	.rodata     type:rodata align:32
	.data       type:data align:8
	.bss        type:bss align:32

Will become

Sections:
	.text       type:code align:4 virtual_address:0x805103B4
	.ctors      type:rodata align:4 virtual_address:0x8088F400
	.dtors      type:rodata align:4 virtual_address:0x8088F704
	.rodata     type:rodata align:32 virtual_address:0x8088F720
	.data       type:data align:8 virtual_address:0x808B2BD0
	.bss        type:bss align:32 virtual_address:0x809BD6E0

From here, the user needs to adjust the addresses in splits.txt, and the addresses and auto generated names in symbols.txt to be virtual.

Feedback

This is my first time writing Rust, so I'm sure there are some 'code smells' as a result; feedback related to that is greatly appreciated.

Other than that, I want to bring up requiring users to adjust addresses and names in symbols.txt and splits.txt themselves. I believe automating this through dtk is out of scope for this PR. It would require relatively significant refactoring and risks introducing breaking changes. I think requiring the user to make a script to make adjustments would be the best option for now.

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.

Support virtual addresses for RELs
1 participant