[arm] if mtriple is provided, do not set -march (mono/mono#17937)
authorBernhard Urban-Forster <lewurm@gmail.com>
Wed, 27 Nov 2019 16:36:03 +0000 (17:36 +0100)
committermonojenkins <jo.shields+jenkins@xamarin.com>
Wed, 27 Nov 2019 16:36:03 +0000 (17:36 +0100)
[arm] if mtriple is provided, do not set -march

E.g. when passing `-march=arm -mtriple=armv7s-ios`, `-march` will win and thus ignore `armv7s`.

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

* Caused by mono/mono@5e318afd2e1d5f9ef0fd692abbceadcf615389a5
* Related with mono/mono@4cd506823079bc15c9ee72da4f94a653f237a5e5
* Almost fixed by mono/mono@e431093f73360b5726e5256fd0de3108ec21b38a

Hopefully we are done with it.

Commit migrated from https://github.com/mono/mono/commit/4c595069e72e6dc39e13c1e322087a502ea000c9

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

index e051b84..eb665b4 100644 (file)
@@ -1136,12 +1136,15 @@ arch_init (MonoAotCompile *acfg)
        if (acfg->aot_opts.mtriple && strstr (acfg->aot_opts.mtriple, "darwin")) {
                g_string_append (acfg->llc_args, "-mattr=+v6");
        } else {
-               if (!(acfg->aot_opts.mtriple && strstr (acfg->aot_opts.mtriple, "thumb")))
+               if (!acfg->aot_opts.mtriple) {
                        g_string_append (acfg->llc_args, " -march=arm");
+               } else {
+                       /* arch will be defined via mtriple, e.g. armv7s-ios or thumb. */
 
-               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 -disable-fp-elim");
+                       if (strstr (acfg->aot_opts.mtriple, "ios")) {
+                               g_string_append (acfg->llc_args, " -mattr=+v7");
+                               g_string_append (acfg->llc_args, " -exception-model=dwarf -disable-fp-elim");
+                       }
                }
 
 #if defined(ARM_FPU_VFP_HARD)