-
Notifications
You must be signed in to change notification settings - Fork 531
Support MIPS64 .o files #493
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
Closed
Closed
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
321ac6c
Update relocation.py to support MIPS64 .o files. Add a test file. DWA…
f83ca66
Remove field _RELOCATION_RECIPE_TYPE.has_addend, since sometimes R_MI…
ec3d215
Adjust llvm-dwarfdump output for MIPS64 to match pyelftools and gcc-o…
bde61d8
update dwarf_mips64el.o.elf
d81a765
Change dwarf_mips64el.c to not use globals
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| /result |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| int f() { | ||
| int var1 = 3; | ||
| int var2 = 5; | ||
| return var1 + var2; | ||
| } |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| { | ||
| description = "A flake for building a mips64el .o file for testing pyelftools"; | ||
|
|
||
| inputs.nixpkgs.url = github:NixOS/nixpkgs/nixos-23.05; | ||
|
|
||
| outputs = { self, nixpkgs }: { | ||
|
|
||
| defaultPackage.x86_64-linux = | ||
| with (import nixpkgs { system = "x86_64-linux"; }).pkgsCross.mips64el-linux-gnuabi64; | ||
| stdenv.mkDerivation { | ||
| name = "dwarf_mips64el"; | ||
| src = self; | ||
| buildPhase = "$CC -g -c ./dwarf_mips64el.c"; | ||
| installPhase = "mkdir -p $out; cp dwarf_mips64el.o $out/"; | ||
| }; | ||
|
|
||
| }; | ||
| } |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure I understand why you removed
has_addend, can you elaborate more (beyond what the PR description says)? Is this a change that can be discussed separately from your implementation to support MIPS64?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure. I removed
has_addendbecause it was the easiest way I found to make what I needed work.See commit ec3d215 which is before removing
has_addend. It has this test failing:This is because I changed
ENUM_RELOC_TYPE_MIPS['R_MIPS_32']to havehas_addend=True. If I change it back toFalse, this fails:I have figured it was OK to remove this field from the recipe, since you can know if there is an
r_addendfield from the relocation object.Anyway, I now created another branch without removing the
r_addendfield, which instead uses two recipe dicts instead of one:_RELOCATION_RECIPES_MIPS_RELAand_RELOCATION_RECIPES_MIPS_REL. It's here: https://github.com/noamraph/pyelftools/tree/mips64-o-with-has-addendWhat do you think? Do you prefer the latter approach?
Thanks!
Noam
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please send your other branch as a separate PR? It should be easy to create a new PR from a different branch. A PR lets me see the delta/patch of the change much more conveniently than looking at a whole branch
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure. Here it is: #495