Created
October 25, 2023 02:39
-
-
Save MaskRay/927d715e190617f8d8a2a066893705e3 to your computer and use it in GitHub Desktop.
Test Clang's -fstack-protector code generation for AArch32
This file contains hidden or 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/zsh | |
CC=/tmp/Rel/bin/clang | |
if [[ -n $1 ]]; then | |
update=1 | |
echo updated | |
else | |
update= | |
fi | |
[[ ! -e a.cc ]] && echo 'void bar(char *); void foo() { char a[200]; bar(a); }' > a.cc | |
run() { | |
if [[ -n $update ]]; then | |
$CC "${@:2}" -S -fstack-protector a.cc -o $1.s | |
else | |
$CC "${@:2}" -S -fstack-protector a.cc -o - | diff -u $1.s - | |
fi | |
} | |
run arm.linux.nopic --target=arm-linux-gnueabi -fno-pic | |
run arm.linux.pie --target=arm-linux-gnueabi -fpie | |
run arm.linux.pic --target=arm-linux-gnueabi -fpic | |
run armv6.darwin.nopic --target=armv6-apple-darwin -fno-pic | |
run armv6.darwin.dynamicnopic --target=armv6-apple-darwin -mdynamic-no-pic | |
run armv6.darwin.pic --target=armv6-apple-darwin -fpic | |
run armv7.darwin.nopic --target=armv7-apple-darwin -mcpu=cortex-a8 -fno-pic | |
run armv7.darwin.dynamicnopic --target=armv7-apple-darwin -mcpu=cortex-a8 -mdynamic-no-pic | |
run armv7.darwin.pic --target=armv7-apple-darwin -mcpu=cortex-a8 -fpic | |
run arm64.darwin.pic --target=arm64-apple-darwin |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment