Add a testcase for libssp

This commit is contained in:
Martin Storsjö committed 2018-08-13 23:50:01 +03:00
1 parent 0448bd616a
commit 4a1c91c208
3 files changed
+41 -1

No files matched your search

+8
View File
@@ -80,6 +80,14 @@ RUN cd test && \
COPY build-libssp.sh libssp-Makefile ./
RUN ./build-libssp.sh $TOOLCHAIN_PREFIX
RUN cd test && \
for arch in $TOOLCHAIN_ARCHS; do \
mkdir -p $arch && \
for test in ssp; do \
$arch-w64-mingw32-clang $test.c -o $arch/$test.exe -fstack-protector-strong || exit 1; \
done; \
done
# Cheating: Pull strip and objcopy from the normal binutils package.
RUN apt-get update -qq && \
apt-get install -qqy binutils-mingw-w64-x86-64 && \
+5 -1
View File
@@ -16,6 +16,7 @@ TESTS_C="hello hello-tls crt-test setjmp"
TESTS_C_NO_BUILTIN="crt-test"
TESTS_CPP="hello-cpp hello-exception tlstest-main"
TESTS_CPP_DLL="tlstest-lib"
TESTS_SSP="ssp"
for arch in $ARCHS; do
mkdir -p $arch
for test in $TESTS_C; do
@@ -32,6 +33,9 @@ for arch in $ARCHS; do
for test in $TESTS_CPP_DLL; do
$arch-w64-mingw32-clang++ $test.cpp -shared -o $arch/$test.dll
done
for test in $TESTS_SSP; do
$arch-w64-mingw32-clang $test.c -o $arch/$test.exe -fstack-protector-strong
done
DLL="$TESTS_CPP_DLL"
case $arch in
i686|x86_64)
@@ -53,7 +57,7 @@ for arch in $ARCHS; do
$COPY $i.dll
done
fi
for test in $TESTS_C $TESTS_CPP $TESTS_EXTRA; do
for test in $TESTS_C $TESTS_CPP $TESTS_EXTRA $TESTS_SSP; do
file=$test.exe
if [ -n "$COPY" ]; then
$COPY $file
+28
View File
@@ -0,0 +1,28 @@
/*
* Copyright (c) 2018 Martin Storsjo
*
* This file is part of llvm-mingw.
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
__attribute__((noinline))
void func(char *ptr) {
ptr[10] = 0;
}
int main(int argc, char *argv[]) {
char buf[10];
if (argc > 1)
func(buf);
return 0;
}