Skip to content
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

gnu linker script? #62

Closed
Cofflag opened this issue May 5, 2023 · 4 comments
Closed

gnu linker script? #62

Cofflag opened this issue May 5, 2023 · 4 comments

Comments

@Cofflag
Copy link

Cofflag commented May 5, 2023

can ddisasm generate a gnu linker script to ensure the reassembled binary is the same as the old one?

@adamjseitz
Copy link
Contributor

gtirb-pprinter (which is the component responsible for generating assembly and other artifacts for re-assembly, e.g., symbol version scripts - emitting an IR from ddisasm and using gtirb-pprinter directly gives some more options than ddisasm's --asm option) does not currently support generating linker scripts.

Is the idea of generating a linker script intended to ensure each section retains the original address? Or are there additional problems that it would solve?

#59 is a related issue, which has a bit more discussion of additional challenges with regenerating binaries identical to the original (in particular, this comment from aeflores).

@aeflores
Copy link
Collaborator

aeflores commented May 5, 2023

Generating linker scripts could help with some of the discrepancies, and we have considered implementing this functionality (in gtirb-pprinter), but as @adamjseitz said, this is not yet supported.
If want to implement it yourself, please take a look at our contributors guide https://github.com/GrammaTech/gtirb-pprinter/blob/master/CONTRIBUTING.md

@Cofflag
Copy link
Author

Cofflag commented May 5, 2023

does not currently support generating linker scripts.

I see. Thanks.

Is the idea of generating a linker script intended to ensure each section retains the original address?

Mostly yes. And it enables users to inject code to where they want without using pure address in assembly(which is not easy to modify)

If want to implement it yourself, please take a look at our contributors guide

Thanks.

@Cofflag
Copy link
Author

Cofflag commented May 5, 2023

Is the idea of generating a linker script intended to ensure each section retains the original address?

Oh, this also prevent gcc from using its default linker script which removes vanilla sections of the elf.

@Cofflag Cofflag closed this as completed May 12, 2023
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

No branches or pull requests

3 participants