[llvm] avoid FP elimination on iOS/armv7 (mono/mono#15617)
authorBernhard Urban <lewurm@gmail.com>
Sun, 14 Jul 2019 20:15:56 +0000 (22:15 +0200)
committermonojenkins <jo.shields+jenkins@xamarin.com>
Sun, 14 Jul 2019 20:15:55 +0000 (16:15 -0400)
[llvm] avoid FP elimination on iOS/armv7

Instead of
```
push    {r4, r5, r6, r7, r10, r11, lr}
```

LLVM will generate
```
push    {r4, r5, r6, r7, lr}
add     r7, sp, mono/mono#12
push    {r9, r10}
```

Seems like this https://github.com/mono/llvm/commit/mono/mono@a04e9e4a0af16f15ace258e81448b7eeca5ff599 assumes that `-disable-fp-elim` is passed for iOS targets. I wondered why this wouldn't break things for them, but when you run `clang` from Xcode with `-v`, you will discover that its driver passes `-mdisable-fp-elim`.

Together with https://github.com/mono/llvm/pull/48 this fixes crashes with FullAOT+LLVM on iOS 32bit.

Fixes https://github.com/mono/mono/issues/15058

Contributes to https://github.com/mono/mono/issues/9621

Commit migrated from https://github.com/mono/mono/commit/9a19bdb6e63590875e9ac80496720dd365611754

src/mono/mono/mini/aot-compiler.c

index d6d49c5..0d4b2e2 100644 (file)
@@ -1125,7 +1125,7 @@ arch_init (MonoAotCompile *acfg)
 
                if (acfg->aot_opts.mtriple && strstr (acfg->aot_opts.mtriple, "ios")) {
                        g_string_append (acfg->llc_args, " -mattr=+v7");
-                       g_string_append (acfg->llc_args, " -exception-model=dwarf");
+                       g_string_append (acfg->llc_args, " -exception-model=dwarf -disable-fp-elim");
                }
 
 #if defined(ARM_FPU_VFP_HARD)