This file is indexed.

/usr/src/gcc-4.4/debian/patches/gcc-cloog-dl.diff is in gcc-4.4-source 4.4.7-8ubuntu1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
# DP: Link against -ldl instead of -lcloog -lppl. Exit with an error when using
# DP: the Graphite loop transformation infrastructure without having the
# DP: libcloog-ppl0 package installed. Packages using these optimizations
# DP: should build-depend on libcloog-ppl0.

2009-01-27  Jakub Jelinek  <jakub@redhat.com>

	* Makefile.in (BACKENDLIBS): Link against -ldl instead of -lcloog -lppl.
	(graphite.o): Force -O, remove -fkeep-inline-functions.
	* graphite.c: Include <dlfcn.h>.  Reference libcloog and libppl symbols
	through pointers in cloog_pointers variable.
	(init_cloog_pointers): New function.
	(gcc_type_for_iv_of_clast_loop): Rename stmt_for argument to stmt_fora.
	(graphite_transform_loops): Call init_cloog_pointers.

Index: b/src/gcc/Makefile.in
===================================================================
--- a/src/gcc/Makefile.in
+++ b/src/gcc/Makefile.in
@@ -919,7 +919,7 @@
 # How to link with both our special library facilities
 # and the system's installed libraries.
 LIBS = @LIBS@ $(CPPLIB) $(LIBINTL) $(LIBICONV) $(LIBIBERTY) $(LIBDECNUMBER)
-BACKENDLIBS = $(CLOOGLIBS) $(PPLLIBS) $(GMPLIBS)
+BACKENDLIBS = $(GMPLIBS) $(if $(CLOOGLIBS),-ldl)
 # Any system libraries needed just for GNAT.
 SYSLIBS = @GNAT_LIBEXC@
 
@@ -3079,6 +3079,9 @@
 	$(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) \
 		$(out_file) $(OUTPUT_OPTION)
 
+graphite.o : \
+  ALL_CFLAGS := -O $(filter-out -fkeep-inline-functions, $(ALL_CFLAGS))
+
 # Build auxiliary files that support ecoff format.
 mips-tfile: mips-tfile.o version.o $(LIBDEPS)
 	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ mips-tfile.o version.o $(LIBS)
Index: b/src/gcc/graphite.c
===================================================================
--- a/src/gcc/graphite.c
+++ b/src/gcc/graphite.c
@@ -59,6 +59,112 @@
 #include "cloog/cloog.h"
 #include "graphite.h"
 
+#include <dlfcn.h>
+#define DYNSYMS \
+  DYNSYM (cloog_block_alloc); \
+  DYNSYM (cloog_block_list_free); \
+  DYNSYM (cloog_block_list_malloc); \
+  DYNSYM (cloog_clast_create); \
+  DYNSYM (cloog_clast_free); \
+  DYNSYM (cloog_domain_free); \
+  DYNSYM (cloog_domain_matrix2domain); \
+  DYNSYM (cloog_initialize); \
+  DYNSYM (cloog_loop_malloc); \
+  DYNSYM (cloog_matrix_alloc); \
+  DYNSYM (cloog_matrix_copy); \
+  DYNSYM (cloog_matrix_free); \
+  DYNSYM (cloog_matrix_print); \
+  DYNSYM (cloog_names_malloc); \
+  DYNSYM (cloog_names_scalarize); \
+  DYNSYM (cloog_options_free); \
+  DYNSYM (cloog_options_malloc); \
+  DYNSYM (cloog_program_dump_cloog); \
+  DYNSYM (cloog_program_extract_scalars); \
+  DYNSYM (cloog_program_free); \
+  DYNSYM (cloog_program_generate); \
+  DYNSYM (cloog_program_malloc); \
+  DYNSYM (cloog_program_print); \
+  DYNSYM (cloog_program_scatter); \
+  DYNSYM (cloog_statement_alloc); \
+  DYNSYM (ppl_finalize); \
+  DYNSYM (pprint); \
+  DYNSYM (stmt_block); \
+  DYNSYM (stmt_for); \
+  DYNSYM (stmt_guard); \
+  DYNSYM (stmt_root); \
+  DYNSYM (stmt_user);
+static struct
+{
+  bool inited;
+  void *h;
+#define DYNSYM(x) __typeof (x) *p_##x
+  DYNSYMS
+#undef DYNSYM
+} cloog_pointers;
+
+#define cloog_block_alloc (*cloog_pointers.p_cloog_block_alloc)
+#define cloog_block_list_free (*cloog_pointers.p_cloog_block_list_free)
+#define cloog_block_list_malloc (*cloog_pointers.p_cloog_block_list_malloc)
+#define cloog_clast_create (*cloog_pointers.p_cloog_clast_create)
+#define cloog_clast_free (*cloog_pointers.p_cloog_clast_free)
+#define cloog_domain_free (*cloog_pointers.p_cloog_domain_free)
+#define cloog_domain_matrix2domain (*cloog_pointers.p_cloog_domain_matrix2domain)
+#define cloog_initialize (*cloog_pointers.p_cloog_initialize)
+#define cloog_loop_malloc (*cloog_pointers.p_cloog_loop_malloc)
+#define cloog_matrix_alloc (*cloog_pointers.p_cloog_matrix_alloc)
+#define cloog_matrix_copy (*cloog_pointers.p_cloog_matrix_copy)
+#define cloog_matrix_free (*cloog_pointers.p_cloog_matrix_free)
+#define cloog_matrix_print (*cloog_pointers.p_cloog_matrix_print)
+#define cloog_names_malloc (*cloog_pointers.p_cloog_names_malloc)
+#define cloog_names_scalarize (*cloog_pointers.p_cloog_names_scalarize)
+#define cloog_options_free (*cloog_pointers.p_cloog_options_free)
+#define cloog_options_malloc (*cloog_pointers.p_cloog_options_malloc)
+#define cloog_program_dump_cloog (*cloog_pointers.p_cloog_program_dump_cloog)
+#define cloog_program_extract_scalars (*cloog_pointers.p_cloog_program_extract_scalars)
+#define cloog_program_free (*cloog_pointers.p_cloog_program_free)
+#define cloog_program_generate (*cloog_pointers.p_cloog_program_generate)
+#define cloog_program_malloc (*cloog_pointers.p_cloog_program_malloc)
+#define cloog_program_print (*cloog_pointers.p_cloog_program_print)
+#define cloog_program_scatter (*cloog_pointers.p_cloog_program_scatter)
+#define cloog_statement_alloc (*cloog_pointers.p_cloog_statement_alloc)
+#define ppl_finalize (*cloog_pointers.p_ppl_finalize)
+#define pprint (*cloog_pointers.p_pprint)
+#define stmt_block (*cloog_pointers.p_stmt_block)
+#define stmt_for (*cloog_pointers.p_stmt_for)
+#define stmt_guard (*cloog_pointers.p_stmt_guard)
+#define stmt_root (*cloog_pointers.p_stmt_root)
+#define stmt_user (*cloog_pointers.p_stmt_user)
+
+#define cloog_finalize (*cloog_pointers.p_ppl_finalize)
+
+static bool
+init_cloog_pointers (void)
+{
+  void *h;
+
+  if (cloog_pointers.inited)
+    return cloog_pointers.h != NULL;
+  h = dlopen ("libcloog-ppl.so.1", RTLD_LAZY);
+  if (!h)
+    h = dlopen ("libcloog-debian.so.0", RTLD_LAZY);
+  cloog_pointers.h = h;
+  if (h == NULL)
+    return false;
+#define DYNSYM(x) \
+  do \
+    { \
+      union { __typeof (cloog_pointers.p_##x) p; void *q; } u; \
+      u.q = dlsym (h, #x); \
+      if (u.q == NULL) \
+	return false; \
+      cloog_pointers.p_##x = u.p; \
+    } \
+  while (0)
+  DYNSYMS
+#undef DYNSYM
+  return true;
+}
+
 static VEC (scop_p, heap) *current_scops;
 
 /* Converts a GMP constant V to a tree and returns it.  */
@@ -4075,10 +4181,10 @@
    STMT.  */
 
 static tree
-gcc_type_for_iv_of_clast_loop (struct clast_for *stmt_for)
+gcc_type_for_iv_of_clast_loop (struct clast_for *stmt_fora)
 {
-  struct clast_user_stmt *stmt = clast_get_body_of_loop ((struct clast_stmt *) stmt_for);
-  const char *cloog_iv = stmt_for->iterator;
+  struct clast_user_stmt *stmt = clast_get_body_of_loop ((struct clast_stmt *) stmt_fora);
+  const char *cloog_iv = stmt_fora->iterator;
   CloogStatement *cs = stmt->statement;
   graphite_bb_p gbb = (graphite_bb_p) cloog_statement_usr (cs);
 
@@ -6109,6 +6215,12 @@
   if (number_of_loops () <= 1)
     return;
 
+  if (!init_cloog_pointers ())
+    {
+      sorry ("Graphite loop optimizations can only be used if the libcloog-ppl1 or libcloog-ppl0 package is installed");
+      return;
+    }
+
   current_scops = VEC_alloc (scop_p, heap, 3);
   recompute_all_dominators ();