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