Created
August 16, 2018 14:30
-
-
Save izabera/c4ee292f47edbbb7a0aa57682608966f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash -e | |
rm -rf build | |
mkdir build | |
cd build | |
echo "int main() {" > f.c | |
limit=${1-500} | |
for (( i = 0; i < ${1-500}; i++ )) do | |
printf "%s\r" "$i" | |
echo "void f$i(void) { }" > "f$i.c" | |
echo "void f$i(void); f$i();" >> f.c | |
gcc -shared -fPIC "f$i.c" -o "libf$i.so" & | |
(( i > 8 )) && wait -n | |
libs+=(-l"f$i") | |
done | |
echo "}" >> f.c | |
wait | |
gcc f.c -L. "${libs[@]}" -o f |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment