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

Make symbols script work cross-platform #5

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

Conversation

christianbundy
Copy link

@christianbundy christianbundy commented Sep 11, 2020

The symbols script had darwin-x64 hardcoded as the platform and arch,
which means that running the script doesn't work on Linux.

This commit adds directory read and selects a file that starts with
'libsodium', which is a .dylib file on MacOS and .so on Linux. This
commit also makes a slight changes to the nm execution, which was
previously depending on flags that aren't used across other versions of
nm.

This commit uses only --dynamic, and uses the symbol type column to
select the symbols that we want without depending on command-line flags
that aren't always available. I've output the results into the readme,
and the only surprising change is that numbers and underscores are now
being sorted differently in the 'missing altogether' section. This is
because the previous code sorted the unparsed lines from nm, which meant
that we were sorting by memory address rather than symbol name.

@emilbayes
Copy link
Member

I think it should be looking for .so on linux, as it's trying to read symbols from libsodium not the bindings :)

@emilbayes
Copy link
Member

If we use the long argument names we'll probably be good with cross compat. Otherwise good to merge

@christianbundy
Copy link
Author

Thanks! I've updated my PR with a new commit, which also comes with readme output for cross-checking. I've updated the original post in this PR with the new commit message explaining the changes.

The symbols script had darwin-x64 hardcoded as the platform and arch,
which means that running the script doesn't work on Linux.

This commit adds directory read and selects a file that starts with
'libsodium', which is a `.dylib` file on MacOS and `.so` on Linux. This
commit also makes a slight changes to the nm execution, which was
previously depending on flags that aren't used across other versions of
nm.

This commit uses only `--dynamic`, and uses the symbol type column to
select the symbols that we want without depending on command-line flags
that aren't always available. I've output the results into the readme,
and the only surprising change is that numbers and underscores are now
being sorted differently in the 'missing altogether' section. This is
because the previous code sorted the unparsed lines from nm, which meant
that we were sorting by memory address rather than symbol name.
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.

None yet

2 participants