Skip to content

Instantly share code, notes, and snippets.

@thomwiggers
Created June 7, 2021 10:33
Show Gist options
  • Save thomwiggers/626e74f6f5864e7100d158fc83769afd to your computer and use it in GitHub Desktop.
Save thomwiggers/626e74f6f5864e7100d158fc83769afd to your computer and use it in GitHub Desktop.
script to do namespacing
#!/bin/bash
PREFIX="PQCLEAN_NTRUHPS2048509_AVX2_"
for symbol in $(nm -g lib*.a | grep -E ' (T|R) ' | cut -f3 -d' '); do
if [[ $symbol = $PREFIX* ]]; then
echo Already done $symbol
elif [[ $symbol = Keccak* ]]; then
echo "Don't need to do $symbol"
else
echo $symbol
perl -p -i -e "s/\\b$symbol\\b(?!\.[ch])/$PREFIX$symbol/g" *.[cSh]
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment