summaryrefslogtreecommitdiff
path: root/debian/patches/ada-link-lib.diff
blob: ebf318daab311a1d9b592a0e4a9f2aace6ad1af9 (plain)
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
183
184
185
186
187
Description: adapt libgnat build for Debian
 Don't include a runtime link path (-rpath), when linking binaries.
 .
 Build the shared libraries on hppa-linux (see #786692 below).
 TODO: ask the reporter (no porterbox) to attempt a rebuild without this
 chunk, now that we diverge less from upstream.
 .
 Instead of building libada as a target library only, build it as
 both a host and, if different, target library.
 .
 Compile with -gnatn for efficiency.
 Double-check the link since Debian moves some symbols.
 .
 Please read ada-changes-in-autogen-output.diff about src/Makefile.def.
Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=786692
Forwarded: not-needed
Author: Ludovic Brenta <lbrenta@debian.org>
Author: Nicolas Boulenguez <nicolas@debian.org>
Author: Matthias Klose <doko@debian.org>

--- a/src/gcc/ada/gcc-interface/config-lang.in
+++ b/src/gcc/ada/gcc-interface/config-lang.in
@@ -44,7 +44,7 @@ if test "x$cross_compiling/$build/$host"
 fi
 
 target_libs="target-libada"
-lang_dirs="gnattools"
+lang_dirs="libada gnattools"
 
 # Ada is not enabled by default for the time being.
 build_by_default=no
--- a/src/gcc/ada/link.c
+++ b/src/gcc/ada/link.c
@@ -107,9 +107,9 @@ const char *__gnat_default_libgcc_subdir
    || defined (__NetBSD__) || defined (__OpenBSD__) \
    || defined (__QNX__)
 const char *__gnat_object_file_option = "-Wl,@";
-const char *__gnat_run_path_option = "-Wl,-rpath,";
-char __gnat_shared_libgnat_default = STATIC;
-char __gnat_shared_libgcc_default = STATIC;
+const char *__gnat_run_path_option = "";
+char __gnat_shared_libgnat_default = SHARED;
+char __gnat_shared_libgcc_default = SHARED;
 int __gnat_link_max = 8192;
 unsigned char __gnat_objlist_file_supported = 1;
 const char *__gnat_object_library_extension = ".a";
@@ -129,9 +129,9 @@ const char *__gnat_default_libgcc_subdir
 
 #elif defined (__linux__) || defined (__GLIBC__)
 const char *__gnat_object_file_option = "-Wl,@";
-const char *__gnat_run_path_option = "-Wl,-rpath,";
-char __gnat_shared_libgnat_default = STATIC;
-char __gnat_shared_libgcc_default = STATIC;
+const char *__gnat_run_path_option = "";
+char __gnat_shared_libgnat_default = SHARED;
+char __gnat_shared_libgcc_default = SHARED;
 int __gnat_link_max = 8192;
 unsigned char __gnat_objlist_file_supported = 1;
 const char *__gnat_object_library_extension = ".a";
--- a/src/libada/Makefile.in
+++ b/src/libada/Makefile.in
@@ -77,10 +77,11 @@ ADA_RTS_DIR=$(GCC_DIR)/ada/rts$(subst /,
 # by recursive make invocations in gcc/ada/Makefile.in
 LIBADA_FLAGS_TO_PASS = \
         "MAKEOVERRIDES=" \
-        "LDFLAGS=$(LDFLAGS)" \
+        "LDFLAGS=$(LDFLAGS) -Wl,--no-allow-shlib-undefined \
+          -Wl,--no-copy-dt-needed-entries -Wl,--no-undefined" \
         "LN_S=$(LN_S)" \
         "SHELL=$(SHELL)" \
-        "GNATLIBFLAGS=$(GNATLIBFLAGS) $(MULTIFLAGS)" \
+        "GNATLIBFLAGS=$(GNATLIBFLAGS) $(MULTIFLAGS) -gnatn" \
         "GNATLIBCFLAGS=$(GNATLIBCFLAGS) $(MULTIFLAGS)" \
         "GNATLIBCFLAGS_FOR_C=$(GNATLIBCFLAGS_FOR_C) $(MULTIFLAGS)" \
         "PICFLAG_FOR_TARGET=$(PICFLAG)" \
--- a/src/Makefile.def
+++ b/src/Makefile.def
@@ -122,7 +122,16 @@ host_modules= { module= libtermcap; no_c
                 missing=distclean;
                 missing=maintainer-clean; };
 host_modules= { module= utils; no_check=true; };
-host_modules= { module= gnattools; };
+host_modules= { module= gnattools; no_check=true;
+		missing= info;
+		missing= dvi;
+		missing= html;
+		missing= pdf;
+		missing= install-pdf;
+		missing= install-html;
+		missing= TAGS;
+		missing= install-info;
+		missing= installcheck; };
 host_modules= { module= lto-plugin; bootstrap=true;
 		extra_configure_flags='--enable-shared @extra_linker_plugin_flags@ @extra_linker_plugin_configure_flags@';
 		extra_make_flags='@extra_linker_plugin_flags@'; };
@@ -165,7 +174,16 @@ target_modules = { module= libgloss; no_
 target_modules = { module= libffi; no_install=true; };
 target_modules = { module= zlib; };
 target_modules = { module= rda; };
-target_modules = { module= libada; };
+target_modules = { module= libada; no_install=true; no_check=true;
+		   missing= info;
+		   missing= dvi;
+		   missing= html;
+		   missing= pdf;
+		   missing= install-html;
+		   missing= install-pdf;
+		   missing= TAGS;
+		   missing= install-info;
+		   missing= installcheck; };
 target_modules = { module= libgm2; lib_path=.libs; };
 target_modules = { module= libgomp; bootstrap= true; lib_path=.libs; };
 target_modules = { module= libitm; lib_path=.libs; };
@@ -368,6 +386,7 @@ dependencies = { module=all-libcpp; on=a
 
 dependencies = { module=all-fixincludes; on=all-libiberty; };
 
+dependencies = { module=all-target-libada; on=all-gcc; };
 dependencies = { module=all-gnattools; on=all-target-libada; };
 dependencies = { module=all-gnattools; on=all-target-libstdc++-v3; };
 
--- a/src/configure.ac
+++ b/src/configure.ac
@@ -141,6 +141,11 @@ host_libs="intl libiberty opcodes bfd re
 # If --enable-gold is used, "gold" may replace "ld".
 host_tools="texinfo flex bison binutils gas ld fixincludes gcc cgen sid sim gdb gprof etc expect dejagnu m4 utils guile fastjar gnattools libcc1 gotools"
 
+case "${target}" in
+  hppa64-*linux*) ;;
+  *) target_libiberty="target-libiberty";;
+esac
+
 # these libraries are built for the target environment, and are built after
 # the host libraries and the host tools (which may be a cross compiler)
 # Note that libiberty is not a target library.
@@ -162,6 +167,7 @@ target_libraries="target-libgcc \
 		target-libffi \
 		target-libobjc \
 		target-libada \
+		${target_libiberty} \
 		target-libgm2 \
 		target-libgo \
 		target-libphobos \
--- a/src/gcc/ada/gcc-interface/Make-lang.in
+++ b/src/gcc/ada/gcc-interface/Make-lang.in
@@ -45,7 +45,7 @@ RMDIR = rm -rf
 
 
 # Extra flags to pass to recursive makes.
-COMMON_ADAFLAGS= -gnatpg
+COMMON_ADAFLAGS= -gnatpgn
 ifeq ($(TREECHECKING),)
 CHECKING_ADAFLAGS=
 else
@@ -233,7 +233,9 @@ else
 endif
 
 # Strip -Werror during linking for the LTO bootstrap
-GCC_LINKERFLAGS = $(filter-out -Werror, $(ALL_LINKERFLAGS))
+GCC_LINKERFLAGS = $(filter-out -Werror, $(ALL_LINKERFLAGS)) \
+  -Wl,--no-allow-shlib-undefined -Wl,--no-copy-dt-needed-entries \
+  -Wl,--no-undefined
 
 GCC_LINK=$(LINKER) $(GCC_LINKERFLAGS) $(LDFLAGS)
 GCC_LLINK=$(LLINKER) $(GCC_LINKERFLAGS) $(LDFLAGS)
--- a/src/gcc/testsuite/lib/gnat.exp
+++ b/src/gcc/testsuite/lib/gnat.exp
@@ -115,6 +115,7 @@ proc gnat_target_compile { source dest t
     global TOOL_OPTIONS
     global gnat_target_current
     global TEST_ALWAYS_FLAGS
+    global ld_library_path
 
     # dg-require-effective-target tests must be compiled as C.
     if [ string match "*.c" $source ] then {
@@ -144,6 +145,11 @@ proc gnat_target_compile { source dest t
 	# Always log so compilations can be repeated manually.
 	verbose -log "ADA_INCLUDE_PATH=$rtsdir/adainclude"
 	verbose -log "ADA_OBJECTS_PATH=$rtsdir/adainclude"
+
+	if { ! [ string match "*/libada/adalib*" $ld_library_path ] } {
+	    append ld_library_path ":$rtsdir/adalib"
+	    set_ld_library_path_env_vars
+	}
     }
 
     lappend options "compiler=$GNAT_UNDER_TEST -q -f"