From 87b9278607db44c02c3e6b17342089dae164be49 Mon Sep 17 00:00:00 2001 From: Rodrigo Kumpera Date: Mon, 8 Apr 2013 15:25:21 -0400 Subject: [PATCH] Fix llvm loading when calling through a symlink. mini-llvm.h: When trying to load mono from ./.libs or ../lib we did not resolve the current binary for symlinks. This failed on OSX since everyone calls /usr/bin/mono while libmono-llvm was on /Library/Frameworks/Mono.framework/Versions/Current/lib. This make mono --llvm work on release mono. --- mono/mini/mini-llvm.h | 6 ++++-- mono/mini/mini.c | 1 + 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/mono/mini/mini-llvm.h b/mono/mini/mini-llvm.h index aa99f26c8d396..53c524e7549c6 100644 --- a/mono/mini/mini-llvm.h +++ b/mono/mini/mini-llvm.h @@ -106,9 +106,10 @@ mono_llvm_load (const char* bpath) #endif if (binl != -1) { char *base; - char *name; + char *resolvedname, *name; buf [binl] = 0; - base = g_path_get_dirname (buf); + resolvedname = mono_path_resolve_symlinks (buf); + base = g_path_get_dirname (resolvedname); name = g_strdup_printf ("%s/.libs", base); err = NULL; llvm_lib = try_llvm_load (name, &err); @@ -121,6 +122,7 @@ mono_llvm_load (const char* bpath) g_free (name); } g_free (base); + g_free (resolvedname); } if (!llvm_lib) { llvm_lib = try_llvm_load (NULL, &err); diff --git a/mono/mini/mini.c b/mono/mini/mini.c index 8357ca931c956..2eb82a036fed9 100644 --- a/mono/mini/mini.c +++ b/mono/mini/mini.c @@ -54,6 +54,7 @@ #include #include #include +#include #include #include