test for stdlib opcodes

This commit is contained in:
Michael McLoughlin
2018-11-24 14:55:51 -08:00
parent 898d66c585
commit a70227cbe3
4 changed files with 262 additions and 0 deletions

22
script/stdlibopcodes Executable file
View File

@@ -0,0 +1,22 @@
#!/bin/bash -e
eval $(go env)
workdir=$(mktemp -d)
# Provide stub "go_asm.h".
include=${workdir}/include
mkdir -p ${include}
echo '#define get_tls ' > ${include}/go_asm.h
# Preprocess all assembly files.
asm=${workdir}/all.s
find ${GOROOT}/src -name '*_amd64.s' | while read s; do
gcc -E -I${GOROOT}/pkg/include -I${include} ${s} >>${asm}
done
# Extract instructions.
awk '/^[[:space:]]+[A-Z0-9]+[[:space:]]+/ { print $1 }' ${asm} | sort | uniq
# Clean.
rm -rf ${workdir}