diff mbox series

[FFmpeg-devel] configure: fix clang on macOS 10.15

Message ID 20200414174452.25659-1-josh@itanimul.li
State Superseded
Headers show
Series [FFmpeg-devel] configure: fix clang on macOS 10.15 | expand

Checks

Context Check Description
andriy/default pending
andriy/make success Make finished
andriy/make_fate success Make fate finished

Commit Message

Josh Dekker April 14, 2020, 5:44 p.m. UTC
Works around a bug in the newer Xcode 11's clang with -fstack-check
emitting bad code with misaligned call instructions.
---
 configure | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Jan Ekström April 14, 2020, 6:49 p.m. UTC | #1
On Tue, Apr 14, 2020 at 8:45 PM Josh de Kock <josh@itanimul.li> wrote:
>
> Works around a bug in the newer Xcode 11's clang with -fstack-check
> emitting bad code with misaligned call instructions.
> ---
>  configure | 5 +++++
>  1 file changed, 5 insertions(+)
>
> diff --git a/configure b/configure
> index 4d4c429be9..c872a2932d 100755
> --- a/configure
> +++ b/configure
> @@ -5358,6 +5358,11 @@ case $target_os in
>          fi
>          version_script='-exported_symbols_list'
>          VERSION_SCRIPT_POSTPROCESS_CMD='tr " " "\n" | sed -n /global:/,/local:/p | grep ";" | tr ";" "\n" | sed -E "s/(.+)/_\1/g" | sed -E "s/(.+[^*])$$$$/\1*/"'
> +        # Workaround for Xcode 11 -fstack-check bug
> +        if enabled clang; then
> +            clang_version=$($cc -dumpversion)
> +            test ${clang_version%%.*} -ge 11 && add_cflags -fno-stack-check

I would match what dav1d does so far, and check for equality against
11. Not greater-or-equal, if I'm reading this correctly.

> +        fi
>          ;;
>      msys*)
>          die "Native MSYS builds are discouraged, please use the MINGW environment."
> --
> 2.24.1 (Apple Git-126)

Can verify this fixes running newly built binaries on macOS 10.15.
Without this, the binary crashes immediately.

Please mention that this also fixes ticket #8073 .

For context for others, it seems like Apple has been distributing a
broken clang binary with their development tool kit for quite a while.
People have reported it, but things go as usual (
https://forums.developer.apple.com/thread/121887 ).

Other projects, such as dav1d, have taken the same approach. Check for
clang major version under darwin, and if 11 -> disable stack checking.

Best regards,
Jan
Carl Eugen Hoyos April 14, 2020, 8:16 p.m. UTC | #2
Am Di., 14. Apr. 2020 um 20:49 Uhr schrieb Jan Ekström <jeebjp@gmail.com>:
>
> On Tue, Apr 14, 2020 at 8:45 PM Josh de Kock <josh@itanimul.li> wrote:
> >
> > Works around a bug in the newer Xcode 11's clang with -fstack-check
> > emitting bad code with misaligned call instructions.
> > ---
> >  configure | 5 +++++
> >  1 file changed, 5 insertions(+)
> >
> > diff --git a/configure b/configure
> > index 4d4c429be9..c872a2932d 100755
> > --- a/configure
> > +++ b/configure
> > @@ -5358,6 +5358,11 @@ case $target_os in
> >          fi
> >          version_script='-exported_symbols_list'
> >          VERSION_SCRIPT_POSTPROCESS_CMD='tr " " "\n" | sed -n /global:/,/local:/p | grep ";" | tr ";" "\n" | sed -E "s/(.+)/_\1/g" | sed -E "s/(.+[^*])$$$$/\1*/"'
> > +        # Workaround for Xcode 11 -fstack-check bug
> > +        if enabled clang; then
> > +            clang_version=$($cc -dumpversion)
> > +            test ${clang_version%%.*} -ge 11 && add_cflags -fno-stack-check
>
> I would match what dav1d does so far, and check for equality against
> 11.

> Not greater-or-equal, if I'm reading this correctly.

+1

Carl Eugen
diff mbox series

Patch

diff --git a/configure b/configure
index 4d4c429be9..c872a2932d 100755
--- a/configure
+++ b/configure
@@ -5358,6 +5358,11 @@  case $target_os in
         fi
         version_script='-exported_symbols_list'
         VERSION_SCRIPT_POSTPROCESS_CMD='tr " " "\n" | sed -n /global:/,/local:/p | grep ";" | tr ";" "\n" | sed -E "s/(.+)/_\1/g" | sed -E "s/(.+[^*])$$$$/\1*/"'
+        # Workaround for Xcode 11 -fstack-check bug
+        if enabled clang; then
+            clang_version=$($cc -dumpversion)
+            test ${clang_version%%.*} -ge 11 && add_cflags -fno-stack-check
+        fi
         ;;
     msys*)
         die "Native MSYS builds are discouraged, please use the MINGW environment."