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

elf: use relocations to find number of dynamic symbols if hash is empty #112

Merged
merged 2 commits into from
Oct 23, 2018

Conversation

philipc
Copy link
Collaborator

@philipc philipc commented Oct 22, 2018

Fixes #111

Copy link
Owner

@m4b m4b left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don’t we need to append the number of reloc syms found? E.g. can’t dynsyms be non-zero and we have relocs pointing at syms (in which case we leave out some imported symbols)

@philipc
Copy link
Collaborator Author

philipc commented Oct 22, 2018

gnu_hash_len and hash_len already include imported symbols too, because imported symbols are always at the start of the table before the exported symbols. The problem is only when there are no exported symbols. If you want, we could do a max(relocs, gnu_hash_len), but it should not be necessary.

Copy link
Owner

@m4b m4b left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you think max isn't necessary, then don't add it; but i just hope it's true :) i guess we don't really know about the probably of a binary like that in the wild, or if it even makes sense to parse it?

@philipc
Copy link
Collaborator Author

philipc commented Oct 23, 2018

I may have been wrong about the imported symbols always being at the start... I couldn't find anything that says that. I've added another commit to always use the reloc symbols.

@m4b
Copy link
Owner

m4b commented Oct 23, 2018

Better safe than sorry :)

@philipc philipc merged commit fdaf135 into m4b:master Oct 23, 2018
@philipc philipc deleted the dyn-reloc branch October 23, 2018 07:09
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.

2 participants