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