Skip to content

Commit

Permalink
Cleanup symbol collection
Browse files Browse the repository at this point in the history
  • Loading branch information
justsmth committed Jul 31, 2024
1 parent 6fb34c9 commit 5d78b54
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/sys-bindings-generator.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ jobs:
if: github.repository == 'aws/aws-lc-rs'
runs-on: windows-latest
strategy:
fail-fast: true
fail-fast: false
matrix:
target:
- 'aarch64-pc-windows-msvc'
Expand Down
13 changes: 9 additions & 4 deletions scripts/build/collect_symbols.sh
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ if [[ ! -d "${AWS_LC_DIR}" ]]; then
fi

function filter_symbols() {
grep -v -E "^bignum_" | grep -v "curve25519_x25519" | grep -v "edwards25519_"
grep -E '^\w*$' | grep -v -E "^bignum_" | grep -v "curve25519_x25519" | grep -v "edwards25519_"
}

function filter_nm_symbols() {
Expand Down Expand Up @@ -93,12 +93,17 @@ if [[ "${PLATFORM}" = *-msvc ]]; then
VS_INSTALL_PATH="$("$(echo "${PFx86//\\/\/}//Microsoft Visual Studio/Installer/vswhere.exe")" | grep 'resolvedInstallationPath:' | sed -e 's/[^:]*: \(.*\)$/\1/')"

DUMPBIN="$(ls -1 "${VS_INSTALL_PATH//\\/\/}"/VC/Tools/MSVC/*/bin/Hostx64/${MSVC_ARCH}/dumpbin.exe | tail -n 1)"
PATH="$(dirname "${DUMPBIN}")":"${PATH}"
dumpbin //EXPORTS //SYMBOLS ${LIBCRYPTO_PATH} | grep External | grep SECT1 | sed -e 's/.*External\s*|\s*\(.*\)$/\1/'| egrep '^\w' | sort | uniq | filter_symbols >"${SYMBOLS_FILE}"
PATH="$(dirname "${DUMPBIN/C:/\/c}")":"${PATH}"
if [[ "${MSVC_ARCH}" = x* ]]; then
dumpbin //EXPORTS //SYMBOLS "${LIBCRYPTO_PATH}" | grep External | grep -v UNDEF | sed -e 's/.*External\s*|\s*\(.*\)$/\1/' | grep -E '^\w*$' | sort | uniq >"${SYMBOLS_FILE}"
else
dumpbin //EXPORTS //SYMBOLS "${LIBCRYPTO_PATH}" | grep External | grep -v UNDEF | sed -e 's/.*External\s*|\s*\(.*\)$/\1/' | sort | uniq | filter_symbols>"${SYMBOLS_FILE}"
fi
echo "dumpbin pipes: ${PIPESTATUS[@]}"
elif [[ "${LIBCRYPTO_PATH}" = *.dylib ]]; then
nm --extern-only --defined-only -j "${LIBCRYPTO_PATH}" | grep -v "${REPO_ROOT}" | sort | uniq | filter_macho_symbols | filter_nm_symbols | filter_symbols >"${SYMBOLS_FILE}"
elif [[ "${LIBCRYPTO_PATH}" = *.so || "${LIBCRYPTO_PATH}" = *.lib ]]; then
nm --extern-only --defined-only --format=just-symbols "${LIBCRYPTO_PATH}" | grep -v "${REPO_ROOT}" | sort | uniq | filter_nm_symbols | filter_symbols >"${SYMBOLS_FILE}"
nm --extern-only --defined-only --format=just-symbols "${LIBCRYPTO_PATH}" | sort | uniq | filter_nm_symbols | filter_symbols >"${SYMBOLS_FILE}"
else
pushd "${AWS_LC_DIR}"
go run -mod readonly "${AWS_LC_DIR}"/util/read_symbols.go "${LIBCRYPTO_PATH}" | filter_symbols >"${SYMBOLS_FILE}"
Expand Down

0 comments on commit 5d78b54

Please sign in to comment.