1 2011-04-04 Jakub Jelinek <jakub@redhat.com>
3 * toplev.c (toplev_main_argv): New variable.
4 (toplev_main): Initialize it.
5 * graphite.c (init_cloog_pointers): Load libcloog-isl.so.4 from gcc's private
8 --- gcc/toplev.c.jj 2008-12-09 23:59:10.000000000 +0100
9 +++ gcc/toplev.c 2009-01-27 14:33:52.000000000 +0100
10 @@ -107,6 +107,8 @@ static bool no_backend;
11 /* Length of line when printing switch values. */
14 +const char **toplev_main_argv;
16 /* Decoded options, and number of such options. */
17 struct cl_decoded_option *save_decoded_options;
18 unsigned int save_decoded_options_count;
19 @@ -1909,6 +1911,8 @@ toplev_main (int argc, char **argv)
21 expandargv (&argc, &argv);
23 + toplev_main_argv = CONST_CAST2 (const char **, char **, argv);
25 /* Initialization of GCC's environment, and diagnostics. */
26 general_init (argv[0]);
28 --- gcc/graphite.c.jj 2010-12-01 10:24:32.000000000 -0500
29 +++ gcc/graphite.c 2010-12-01 11:46:07.832118193 -0500
30 @@ -72,11 +72,39 @@ __typeof (cloog_pointers__) cloog_pointe
32 init_cloog_pointers (void)
36 - if (cloog_pointers__.inited)
37 - return cloog_pointers__.h != NULL;
38 - h = dlopen ("libcloog-isl.so.4", RTLD_LAZY);
40 + extern const char **toplev_main_argv;
44 + if (cloog_pointers__.inited)
45 + return cloog_pointers__.h != NULL;
46 + len = progname - toplev_main_argv[0];
47 + buf = XALLOCAVAR (char, len + sizeof "libcloog-isl.so.4");
48 + memcpy (buf, toplev_main_argv[0], len);
49 + strcpy (buf + len, "libcloog-isl.so.4");
50 + len += sizeof "libcloog-isl.so.4";
51 + p = strstr (buf, "/libexec/");
56 + char *q = strstr (p + 8, "/libexec/");
61 + memmove (p + 4, p + 8, len - (p + 8 - buf));
62 + h = dlopen (buf, RTLD_LAZY);
65 + len = progname - toplev_main_argv[0];
66 + memcpy (buf, toplev_main_argv[0], len);
67 + strcpy (buf + len, "libcloog-isl.so.4");
71 + h = dlopen (buf, RTLD_LAZY);
72 cloog_pointers__.h = h;