Message ID | 1520894304-6249-1-git-send-email-martin@martin.st |
---|---|
State | Committed |
Commit | 847190ebd99ffd57dc89bd568a33bf2d5c424129 |
Headers | show |
Series |
|
Related | show |
On 12/03/2018 23:38, Martin Storsjö wrote: > If we'd enable a 16 byte aligned stack, clang/llvm would also assume > that alignment everywhere and produce code that strictly requires it. > That would require adding realignment (via attribute_align_arg) on every > single public library function or enable -mstackrealign (which does the > same on every single function). > > Also relatedly; the parameter currently tested (-mllvm > -stack-alignment=16) hasn't actually been supported for quite some > time; current clang versions use -mstack-alignment=16 for the same. > Actually testing for that parameter would be a different change > though, since it has a real risk of changing behaviour on any other > platform where clang is used. > --- > configure | 11 ++++++++++- > 1 file changed, 10 insertions(+), 1 deletion(-) > > diff --git a/configure b/configure > index b91be32..7042635 100755 > --- a/configure > +++ b/configure > @@ -4955,7 +4955,16 @@ elif enabled gcc; then > elif enabled llvm_gcc; then > check_cflags -mllvm -stack-alignment=16 > elif enabled clang; then > - check_cflags -mllvm -stack-alignment=16 > + if [ "$target_os" = "mingw32" -o "$target_os" = "win32" ] && enabled x86_32; then > + # Clang doesn't support maintaining alignment without assuming the > + # same alignment in every function. If 16 byte alignment would be > + # enabled, one would also have to either add attribute_align_arg on > + # every single entry point into the libraries or enable -mstackrealign > + # (doing stack realignment in every single function). > + disable aligned_stack > + else > + check_cflags -mllvm -stack-alignment=16 > + fi > check_cflags -Qunused-arguments > check_cflags -Werror=implicit-function-declaration > check_cflags -Werror=missing-prototypes > Ok.
diff --git a/configure b/configure index b91be32..7042635 100755 --- a/configure +++ b/configure @@ -4955,7 +4955,16 @@ elif enabled gcc; then elif enabled llvm_gcc; then check_cflags -mllvm -stack-alignment=16 elif enabled clang; then - check_cflags -mllvm -stack-alignment=16 + if [ "$target_os" = "mingw32" -o "$target_os" = "win32" ] && enabled x86_32; then + # Clang doesn't support maintaining alignment without assuming the + # same alignment in every function. If 16 byte alignment would be + # enabled, one would also have to either add attribute_align_arg on + # every single entry point into the libraries or enable -mstackrealign + # (doing stack realignment in every single function). + disable aligned_stack + else + check_cflags -mllvm -stack-alignment=16 + fi check_cflags -Qunused-arguments check_cflags -Werror=implicit-function-declaration check_cflags -Werror=missing-prototypes