From 41c4f26229bd3ba169726c7e8e2d7c9c32c5d566 Mon Sep 17 00:00:00 2001 From: Aleksey Kliger Date: Tue, 23 Aug 2022 15:50:56 -0400 Subject: [PATCH 1/2] [mini] double quote linker path in defined(LD_NAME) case In https://github.com/dotnet/runtime/commit/e71a9583b4d6c9bd97edd87cda7f98f232f63530 we started setting a default `LD_NAME` for x86 non-mach targets Fixes Android x86 builds that specify a `tool_prefix` with spaces in it --- src/mono/mono/mini/aot-compiler.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mono/mono/mini/aot-compiler.c b/src/mono/mono/mini/aot-compiler.c index db6f3435edd886..e479f210e6ed11 100644 --- a/src/mono/mono/mini/aot-compiler.c +++ b/src/mono/mono/mini/aot-compiler.c @@ -12737,7 +12737,7 @@ compile_asm (MonoAotCompile *acfg) if (ld_binary_name == NULL) { ld_binary_name = LD_NAME; } - g_string_append_printf (str, "%s%s %s", tool_prefix, ld_binary_name, LD_OPTIONS); + g_string_append_printf (str, "\"%s%s\" %s", tool_prefix, ld_binary_name, LD_OPTIONS); #else if (ld_binary_name == NULL) { ld_binary_name = "ld"; From 39f4bc7424be85a42aad7940fdb5d10833797097 Mon Sep 17 00:00:00 2001 From: Aleksey Kliger Date: Tue, 23 Aug 2022 15:59:20 -0400 Subject: [PATCH 2/2] also add an "llvm_only" branch to the defined(LD_NAME) case --- src/mono/mono/mini/aot-compiler.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/mono/mono/mini/aot-compiler.c b/src/mono/mono/mini/aot-compiler.c index e479f210e6ed11..107507498be330 100644 --- a/src/mono/mono/mini/aot-compiler.c +++ b/src/mono/mono/mini/aot-compiler.c @@ -12737,7 +12737,12 @@ compile_asm (MonoAotCompile *acfg) if (ld_binary_name == NULL) { ld_binary_name = LD_NAME; } - g_string_append_printf (str, "\"%s%s\" %s", tool_prefix, ld_binary_name, LD_OPTIONS); + if (acfg->aot_opts.tool_prefix) + g_string_append_printf (str, "\"%s%s\" %s", tool_prefix, ld_binary_name, LD_OPTIONS); + else if (acfg->aot_opts.llvm_only) + g_string_append_printf (str, "%s", acfg->aot_opts.clangxx); + else + g_string_append_printf (str, "\"%s%s\" %s", tool_prefix, ld_binary_name, LD_OPTIONS); #else if (ld_binary_name == NULL) { ld_binary_name = "ld";