|
|
53dace |
2011-04-04 Jakub Jelinek <jakub@redhat.com>
|
|
|
53dace |
|
|
|
53dace |
* toplev.cc (toplev_main_argv): New variable.
|
|
|
53dace |
(toplev_main): Initialize it.
|
|
|
53dace |
* graphite.cc (init_isl_pointers): Load libisl.so.15 from gcc's private
|
|
|
53dace |
directory.
|
|
|
53dace |
|
|
|
53dace |
--- gcc/toplev.cc.jj 2008-12-09 23:59:10.000000000 +0100
|
|
|
53dace |
+++ gcc/toplev.cc 2009-01-27 14:33:52.000000000 +0100
|
|
|
53dace |
@@ -113,6 +113,8 @@ static void finalize (bool);
|
|
|
53dace |
static void crash_signal (int) ATTRIBUTE_NORETURN;
|
|
|
53dace |
static void compile_file (void);
|
|
|
53dace |
|
|
|
53dace |
+const char **toplev_main_argv;
|
|
|
53dace |
+
|
|
|
53dace |
/* Decoded options, and number of such options. */
|
|
|
53dace |
struct cl_decoded_option *save_decoded_options;
|
|
|
53dace |
unsigned int save_decoded_options_count;
|
|
|
53dace |
@@ -2239,6 +2241,8 @@ toplev::main (int argc, char **argv)
|
|
|
53dace |
|
|
|
53dace |
expandargv (&argc, &argv);
|
|
|
53dace |
|
|
|
53dace |
+ toplev_main_argv = CONST_CAST2 (const char **, char **, argv);
|
|
|
53dace |
+
|
|
|
53dace |
/* Initialization of GCC's environment, and diagnostics. */
|
|
|
53dace |
general_init (argv[0], m_init_signals);
|
|
|
53dace |
|
|
|
53dace |
--- gcc/graphite.cc.jj 2010-12-01 10:24:32.000000000 -0500
|
|
|
53dace |
+++ gcc/graphite.cc 2010-12-01 11:46:07.832118193 -0500
|
|
|
53dace |
@@ -64,11 +64,39 @@ __typeof (isl_pointers__) isl_pointers__
|
|
|
53dace |
static bool
|
|
|
53dace |
init_isl_pointers (void)
|
|
|
53dace |
{
|
|
|
53dace |
- void *h;
|
|
|
53dace |
+ void *h = NULL;
|
|
|
53dace |
+ extern const char **toplev_main_argv;
|
|
|
53dace |
+ char *buf, *p;
|
|
|
53dace |
+ size_t len;
|
|
|
53dace |
|
|
|
53dace |
if (isl_pointers__.inited)
|
|
|
53dace |
return isl_pointers__.h != NULL;
|
|
|
53dace |
- h = dlopen ("libisl.so.15", RTLD_LAZY);
|
|
|
53dace |
+ len = progname - toplev_main_argv[0];
|
|
|
53dace |
+ buf = XALLOCAVAR (char, len + sizeof "libisl.so.15");
|
|
|
53dace |
+ memcpy (buf, toplev_main_argv[0], len);
|
|
|
53dace |
+ strcpy (buf + len, "libisl.so.15");
|
|
|
53dace |
+ len += sizeof "libisl.so.15";
|
|
|
53dace |
+ p = strstr (buf, "/libexec/");
|
|
|
53dace |
+ if (p != NULL)
|
|
|
53dace |
+ {
|
|
|
53dace |
+ while (1)
|
|
|
53dace |
+ {
|
|
|
53dace |
+ char *q = strstr (p + 8, "/libexec/");
|
|
|
53dace |
+ if (q == NULL)
|
|
|
53dace |
+ break;
|
|
|
53dace |
+ p = q;
|
|
|
53dace |
+ }
|
|
|
53dace |
+ memmove (p + 4, p + 8, len - (p + 8 - buf));
|
|
|
53dace |
+ h = dlopen (buf, RTLD_LAZY);
|
|
|
53dace |
+ if (h == NULL)
|
|
|
53dace |
+ {
|
|
|
53dace |
+ len = progname - toplev_main_argv[0];
|
|
|
53dace |
+ memcpy (buf, toplev_main_argv[0], len);
|
|
|
53dace |
+ strcpy (buf + len, "libisl.so.15");
|
|
|
53dace |
+ }
|
|
|
53dace |
+ }
|
|
|
53dace |
+ if (h == NULL)
|
|
|
53dace |
+ h = dlopen (buf, RTLD_LAZY);
|
|
|
53dace |
isl_pointers__.h = h;
|
|
|
53dace |
if (h == NULL)
|
|
|
53dace |
return false;
|