[PATCH] D27296: Don't assume mingw is providing SSP functions
Martin Storsjö via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sun Mar 18 13:02:41 PDT 2018
mstorsjo added a comment.
In https://reviews.llvm.org/D27296#1041079, @vchuravy wrote:
> @mstorsjo Thanks for your feedback. Might I ask how you tested this? Did you simply compiled clang as well and run the testsuite?
I tested compiling a minimal trivial C file with clang:
$ cat ssp.c
void other(void* ptr);
void func(void) {
char c;
other(&c);
}
$ clang -target x86_64-w64-mingw32 -S -o - ssp.c -O2 -fstack-protector-strong
It can also easily be reproduced with plain IR and llc:
$ cat ssp.ll
define dso_local void @func() sspstrong {
entry:
%c = alloca i8, align 1
call void @llvm.lifetime.start.p0i8(i64 1, i8* nonnull %c)
call void @other(i8* nonnull %c)
call void @llvm.lifetime.end.p0i8(i64 1, i8* nonnull %c)
ret void
}
declare void @llvm.lifetime.start.p0i8(i64, i8* nocapture)
declare dso_local void @other(i8*)
declare void @llvm.lifetime.end.p0i8(i64, i8* nocapture)
$ llc -mtriple x86_64-w64-mingw32 ssp.ll
> Yes this should only be an issue when `StackProtectStrong` is set on functions, which Julia does in certain build configurations (we could also not do that on Windows, but I would rather fix the issue upstream)
Ok, well if you are setting this you will need to have GCC's `libssp` available for linking as well (I presume you have that and that's what you intend?), since the example above should produce references to `__stack_chk_guard` and `__stack_chk_fail` if it didn't error out during compilation.
Repository:
rL LLVM
https://reviews.llvm.org/D27296
More information about the llvm-commits
mailing list