1
# DP: There are two exception mechanisms to choose from: zero-cost and
2
# DP: setjump/longjump. The Ada run-time library uses either of them
3
# DP: but not both. Build both versions of the run-time library.
5
# This patch changes the way the upstream Makefiles build the run-time
6
# library. Before the patch: libada/Makefile calls gcc/ada/Makefile,
7
# which builds the "rts" subdirectory containing symbolic links to
8
# most source files, and modified copies of a few source files (to
9
# take target dependencies into account, and also to select the
10
# exception handling mechanism in system.ads). Then, gcc/ada/Makefile
11
# calls itself recursively but in the "rts" subdirectory and builds
12
# libgnat.a and libgnarl.a (and a couple other libraries:
13
# libgccprefix.a, libgmem.a). Upon return from this recursive call,
14
# it deletes the source and object files from "rts", reconstructs the
15
# source files, and builds libgnat.so and libgnarl.so by calling
16
# itself recursively a second time in the "rts" directory.
18
# Furthermore, gcc/ada/Makefile disables parallel makes, so building
19
# the static and then shared versions of the RTS is entirely
20
# sequential even on SMP systems.
22
# As a consequence of the above, building the SJLJ version of the
23
# library would overwrite the ZCX version. Thus it is necessary to
24
# manually save the previous version of the library before building the
27
# After the patch: libada/Makefile calls gcc/ada/Makefile, which
28
# builds the source directory (named gnatlib-sources instead of rts),
29
# containing the symbolic links and target-dependent files.
31
# In a second step, libada/Makefile calls gcc/ada/Makefile again to
32
# build the targets gnatlib-shared-zcx, gnatlib-static-zcx and
33
# gnatlib-static-sjlj (we could also build gnatlib-shared-sjlj, but
34
# that triggers compiler errors on PowerPC).
36
# Each of these three targets copies the source directory "rts" into a
37
# new directory named rts-shared-zcx, rts-static-zcx or
38
# rts-static-sjlj. In the new directory, they change the value of
39
# System.ZCX_By_Default, and then they call gcc/ada/Makefile
40
# recursively in the new directory to build the library.
42
# gcc/ada/Makefile.in has a .NOTPARALLEL directive preventing it from
43
# launching commands in parallel. However, libada/Makefile has no
44
# such directive and can invoke up to three instances of
45
# gcc/ada/Makefile.in in parallel. This is okay because each of them
46
# runs in a different directory.
48
# This patch also updates libgnat{vsn,prj}/Makefile and
49
# gnattools/Makefile to look for the shared ZCX version of the library
50
# in the appropriate directory, rather than just "rts", and updates
51
# the "make install" and binary targets as well.
53
Index: b/src/libada/Makefile.in
54
===================================================================
55
--- a/src/libada/Makefile.in
56
+++ b/src/libada/Makefile.in
58
# <http://www.gnu.org/licenses/>.
60
# Default target; must be first.
62
+GNATLIB = gnatlib-static-zcx gnatlib-static-sjlj gnatlib-shared-zcx
64
$(MULTIDO) $(AM_MAKEFLAGS) DO=all multi-do # $(MAKE)
68
"CFLAGS=$(CFLAGS) $(WARN_CFLAGS)"
70
# Rules to build gnatlib.
71
-.PHONY: gnatlib gnatlib-plain gnatlib-sjlj gnatlib-zcx gnatlib-shared osconstool
72
-gnatlib: @default_gnatlib_target@
73
+.PHONY: $(GNATLIB) osconstool
75
-gnatlib-plain: osconstool $(GCC_DIR)/ada/Makefile
76
- test -f stamp-libada || \
77
- $(MAKE) -C $(GCC_DIR)/ada $(LIBADA_FLAGS_TO_PASS) gnatlib \
78
- && touch stamp-libada
81
- $(LN_S) $(ADA_RTS_DIR) adainclude
82
- $(LN_S) $(ADA_RTS_DIR) adalib
84
-gnatlib-sjlj gnatlib-zcx gnatlib-shared: osconstool $(GCC_DIR)/ada/Makefile
85
- test -f stamp-libada || \
86
- $(MAKE) -C $(GCC_DIR)/ada $(LIBADA_FLAGS_TO_PASS) $@ \
87
- && touch stamp-libada
90
- $(LN_S) $(ADA_RTS_DIR) adainclude
91
- $(LN_S) $(ADA_RTS_DIR) adalib
92
+$(GCC_DIR)/ada/gnatlib-sources-sjlj/a-except.ads:
93
+ $(MAKE) -C $(GCC_DIR)/ada $(LIBADA_FLAGS_TO_PASS) \
95
+ gnatlib-sources-sjlj/a-except.ads
97
+$(GCC_DIR)/ada/gnatlib-sources-zcx/a-except.ads:
98
+ $(MAKE) -C $(GCC_DIR)/ada $(LIBADA_FLAGS_TO_PASS) \
99
+ EH_MECHANISM="-gcc" \
100
+ gnatlib-sources-zcx/a-except.ads
102
+$(GNATLIB): osconstool $(GCC_DIR)/ada/Makefile \
103
+$(GCC_DIR)/ada/gnatlib-sources-zcx/a-except.ads \
104
+$(GCC_DIR)/ada/gnatlib-sources-sjlj/a-except.ads
105
+ $(MAKE) -C $(GCC_DIR)/ada $(FLAGS_TO_PASS) \
106
+ GNATLIBFLAGS="$(GNATLIBFLAGS)" \
107
+ GNATLIBCFLAGS="$(GNATLIBCFLAGS)" \
108
+ TARGET_LIBGCC2_CFLAGS="$(TARGET_LIBGCC2_CFLAGS)" \
109
+ THREAD_KIND="$(THREAD_KIND)" \
114
$(MAKE) -C $(GCC_DIR)/ada $(LIBADA_FLAGS_TO_PASS) ./bldtools/oscons/xoscons
115
Index: b/src/gcc/ada/gcc-interface/Makefile.in
116
===================================================================
117
--- a/src/gcc/ada/gcc-interface/Makefile.in
118
+++ b/src/gcc/ada/gcc-interface/Makefile.in
119
@@ -2234,57 +2234,75 @@
120
a-[a-o]*.adb a-[p-z]*.adb a-[a-o]*.ads a-[p-z]*.ads g-*.ad? i-*.ad? \
121
s-[a-o]*.adb s-[p-z]*.adb s-[a-o]*.ads s-[p-z]*.ads
123
-../stamp-gnatlib-$(RTSDIR):
124
- @if [ ! -f stamp-gnatlib-$(RTSDIR) ] ; \
126
- $(ECHO) You must first build the GNAT library: make gnatlib; \
131
+libgnat = libgnat$(hyphen)$(LIBRARY_VERSION)$(soext)
132
+libgnat-sjlj = libgnat$(hyphen)sjlj$(hyphen)$(LIBRARY_VERSION)$(soext)
134
-install-gnatlib: ../stamp-gnatlib-$(RTSDIR)
135
+install-gnatlib: rts-static-zcx/libgnat$(arext) rts-static-sjlj/libgnat$(arext)
136
+install-gnatlib: rts-shared-zcx/$(libgnat)
137
# Create the directory before deleting it, in case the directory is
138
# a list of directories (as it may be on VMS). This ensures we are
139
# deleting the right one.
140
- -$(MKDIR) $(DESTDIR)$(ADA_RTL_OBJ_DIR)
141
- -$(MKDIR) $(DESTDIR)$(ADA_INCLUDE_DIR)
142
- $(RMDIR) $(DESTDIR)$(ADA_RTL_OBJ_DIR)
143
- $(RMDIR) $(DESTDIR)$(ADA_INCLUDE_DIR)
144
- -$(MKDIR) $(DESTDIR)$(ADA_RTL_OBJ_DIR)
145
- -$(MKDIR) $(DESTDIR)$(ADA_INCLUDE_DIR)
146
- for file in $(RTSDIR)/*.ali; do \
147
- $(INSTALL_DATA_DATE) $$file $(DESTDIR)$(ADA_RTL_OBJ_DIR); \
148
+ -$(MKDIR) $(DESTDIR)$(ADA_NATIVE_RTL_OBJ_DIR)
149
+ -$(MKDIR) $(DESTDIR)$(ADA_NATIVE_INCLUDE_DIR)
150
+ $(RMDIR) $(DESTDIR)$(ADA_NATIVE_RTL_OBJ_DIR)
151
+ $(RMDIR) $(DESTDIR)$(ADA_NATIVE_INCLUDE_DIR)
152
+ -$(MKDIR) $(DESTDIR)$(ADA_NATIVE_RTL_OBJ_DIR)
153
+ -$(MKDIR) $(DESTDIR)$(ADA_NATIVE_INCLUDE_DIR)
155
+ -$(MKDIR) $(DESTDIR)$(ADA_SJLJ_RTL_OBJ_DIR)
156
+ -$(MKDIR) $(DESTDIR)$(ADA_SJLJ_INCLUDE_DIR)
157
+ $(RMDIR) $(DESTDIR)$(ADA_SJLJ_RTL_OBJ_DIR)
158
+ $(RMDIR) $(DESTDIR)$(ADA_SJLJ_INCLUDE_DIR)
159
+ -$(MKDIR) $(DESTDIR)$(ADA_SJLJ_RTL_OBJ_DIR)
160
+ -$(MKDIR) $(DESTDIR)$(ADA_SJLJ_INCLUDE_DIR)
162
+ for file in rts-shared-zcx/*.ali; do \
163
+ $(INSTALL_DATA_DATE) $$file $(DESTDIR)$(ADA_NATIVE_RTL_OBJ_DIR); \
165
+ for file in rts-static-sjlj/*.ali; do \
166
+ $(INSTALL_DATA_DATE) $$file $(DESTDIR)$(ADA_SJLJ_RTL_OBJ_DIR); \
169
+ -cd rts-static-zcx; for file in *$(arext);do \
170
+ $(INSTALL_DATA) $$file $(DESTDIR)$(ADA_NATIVE_RTL_OBJ_DIR); \
171
+ $(RANLIB_FOR_TARGET) $(DESTDIR)$(ADA_NATIVE_RTL_OBJ_DIR)/$$file; \
173
- -cd $(RTSDIR); for file in *$(arext);do \
174
- $(INSTALL_DATA) $$file $(DESTDIR)$(ADA_RTL_OBJ_DIR); \
175
- $(RANLIB_FOR_TARGET) $(DESTDIR)$(ADA_RTL_OBJ_DIR)/$$file; \
176
+ -cd rts-static-sjlj; for file in *$(arext);do \
177
+ $(INSTALL_DATA) $$file $(DESTDIR)$(ADA_SJLJ_RTL_OBJ_DIR); \
178
+ $(RANLIB_FOR_TARGET) $(DESTDIR)$(ADA_SJLJ_RTL_OBJ_DIR)/$$file; \
181
+ -$(foreach file, $(EXTRA_ADALIB_FILES), \
182
+ $(INSTALL_DATA_DATE) rts-static-zcx/$(file) $(DESTDIR)$(ADA_NATIVE_RTL_OBJ_DIR) && \
184
-$(foreach file, $(EXTRA_ADALIB_FILES), \
185
- $(INSTALL_DATA_DATE) $(RTSDIR)/$(file) $(DESTDIR)$(ADA_RTL_OBJ_DIR) && \
186
+ $(INSTALL_DATA_DATE) rts-static-sjlj/$(file) $(DESTDIR)$(ADA_SJLJ_RTL_OBJ_DIR) && \
188
# Install the shared libraries, if any, using $(INSTALL) instead
189
# of $(INSTALL_DATA). The latter may force a mode inappropriate
190
# for shared libraries on some targets, e.g. on HP-UX where the x
191
# permission is required.
192
-# Also install the .dSYM directories if they exist (these directories
193
-# contain the debug information for the shared libraries on darwin)
194
for file in gnat gnarl; do \
195
- if [ -f $(RTSDIR)/lib$${file}$(hyphen)$(LIBRARY_VERSION)$(soext) ]; then \
196
- $(INSTALL) $(RTSDIR)/lib$${file}$(hyphen)$(LIBRARY_VERSION)$(soext).1 \
197
- $(DESTDIR)$(ADA_RTL_OBJ_DIR); \
199
- if [ -d $(RTSDIR)/lib$${file}$(hyphen)$(LIBRARY_VERSION)$(soext).dSYM ]; then \
200
- $(CP) -r $(RTSDIR)/lib$${file}$(hyphen)$(LIBRARY_VERSION)$(soext).dSYM \
201
- $(DESTDIR)$(ADA_RTL_OBJ_DIR); \
202
+ if [ -f rts-shared-zcx/lib$${file}$(hyphen)$(LIBRARY_VERSION)$(soext).1 ]; then \
203
+ $(INSTALL) rts-shared-zcx/lib$${file}$(hyphen)$(LIBRARY_VERSION)$(soext).1 \
204
+ $(DESTDIR)$(ADA_NATIVE_RTL_OBJ_DIR); \
207
# This copy must be done preserving the date on the original file.
208
- for file in $(RTSDIR)/*.ad?; do \
209
- $(INSTALL_DATA_DATE) $$file $(DESTDIR)$(ADA_INCLUDE_DIR); \
210
+ for file in rts-shared-zcx/*.adb rts-shared-zcx/*.ads; do \
211
+ $(INSTALL_DATA_DATE) $$file $(DESTDIR)$(ADA_NATIVE_INCLUDE_DIR); \
213
- cd $(DESTDIR)$(ADA_INCLUDE_DIR); $(CHMOD) a-wx *.adb
214
- cd $(DESTDIR)$(ADA_INCLUDE_DIR); $(CHMOD) a-wx *.ads
215
+ $(CHMOD) u=rw,go=r $(DESTDIR)$(ADA_NATIVE_INCLUDE_DIR)/*.adb
216
+ $(CHMOD) u=rw,go=r $(DESTDIR)$(ADA_NATIVE_INCLUDE_DIR)/*.ads
217
+ for file in rts-static-sjlj/*.adb rts-static-sjlj/*.ads; do \
218
+ $(INSTALL_DATA_DATE) $$file $(DESTDIR)$(ADA_SJLJ_INCLUDE_DIR); \
220
+ $(CHMOD) u=rw,go=r $(DESTDIR)$(ADA_SJLJ_INCLUDE_DIR)/*.adb
221
+ $(CHMOD) u=rw,go=r $(DESTDIR)$(ADA_SJLJ_INCLUDE_DIR)/*.ads
223
+ (cd $(DESTDIR)$(libsubdir); \
224
+ ln -s rts-native/adainclude adainclude; \
225
+ ln -s rts-native/adalib adalib;)
227
# NOTE: The $(foreach ...) commands assume ";" is the valid separator between
228
# successive target commands. Although the Gnu make documentation
229
@@ -2295,30 +2313,37 @@
231
# GNULLI Begin ###########################################################
233
-../stamp-gnatlib1-$(RTSDIR): Makefile
236
- $(CHMOD) u+w $(RTSDIR)
237
+replace_zcx_by_default=\
238
+'s/ZCX_By_Default.*/ZCX_By_Default : constant Boolean := $(zcx_by_default);/'
240
+gnatlib-sources-zcx/a-except.ads: dir=$(dir $@)
241
+gnatlib-sources-zcx/a-except.ads: zcx_by_default=True
243
+gnatlib-sources-sjlj/a-except.ads: dir=$(dir $@)
244
+gnatlib-sources-sjlj/a-except.ads: zcx_by_default=False
246
+gnatlib-sources-zcx/a-except.ads gnatlib-sources-sjlj/a-except.ads:
248
+ $(CHMOD) u+w $(dir)
249
# Copy target independent sources
250
$(foreach f,$(ADA_INCLUDE_SRCS) $(LIBGNAT_SRCS), \
251
- $(LN_S) $(fsrcpfx)ada/$(f) $(RTSDIR) ;) true
252
+ $(LN_S) $(fsrcpfx)ada/$(f) $(dir) ;) true
253
# Remove files to be replaced by target dependent sources
254
$(RM) $(foreach PAIR,$(LIBGNAT_TARGET_PAIRS), \
255
- $(RTSDIR)/$(word 1,$(subst <, ,$(PAIR))))
256
- for f in $(RTSDIR)/*-*-*.ads $(RTSDIR)/*-*-*.adb; do \
257
+ $(dir)/$(word 1,$(subst <, ,$(PAIR))))
258
+ for f in $(dir)/*-*-*.ads $(dir)/*-*-*.adb; do \
260
- $(RTSDIR)/s-stratt-*) ;; \
261
+ $(dir)/s-stratt-*) ;; \
265
# Copy new target dependent sources
266
$(foreach PAIR,$(LIBGNAT_TARGET_PAIRS), \
267
$(LN_S) $(fsrcpfx)ada/$(word 2,$(subst <, ,$(PAIR))) \
268
- $(RTSDIR)/$(word 1,$(subst <, ,$(PAIR)));)
269
+ $(dir)/$(word 1,$(subst <, ,$(PAIR)));)
270
+ sed -e $(replace_zcx_by_default) $(dir)/system.ads > $(dir)/s.ads
272
- $(CP) $(srcdir)/tsystem.h $(RTSDIR)
273
- $(RM) ../stamp-gnatlib-$(RTSDIR)
274
- touch ../stamp-gnatlib1-$(RTSDIR)
275
+ $(CP) $(srcdir)/tsystem.h $(dir)
277
# GNULLI End #############################################################
279
@@ -2347,9 +2372,10 @@
280
$(CP) $^ ./bldtools/oscons
281
(cd ./bldtools/oscons ; gnatmake -q xoscons)
283
-$(RTSDIR)/s-oscons.ads: ../stamp-gnatlib1-$(RTSDIR) s-oscons-tmplt.c gsocket.h ./bldtools/oscons/xoscons
284
- $(RM) $(RTSDIR)/s-oscons-tmplt.i $(RTSDIR)/s-oscons-tmplt.s
286
+%/s-oscons.ads: dir = $(dir $@)
287
+%/s-oscons.ads: s-oscons-tmplt.c gsocket.h ./bldtools/oscons/xoscons
288
+ $(RM) $(dir)/s-oscons-tmplt.i $(dir)/s-oscons-tmplt.s
291
$(OSCONS_EXTRACT) ; \
292
../bldtools/oscons/xoscons)
293
@@ -2360,8 +2386,11 @@
294
# Example: cd $(RTSDIR); ar rc libfoo.a $(LONG_LIST_OF_OBJS)
295
# is guaranteed to overflow the buffer.
297
-gnatlib: ../stamp-gnatlib1-$(RTSDIR) $(RTSDIR)/s-oscons.ads
298
- $(MAKE) -C $(RTSDIR) \
299
+%/libgnat$(arext): build_dir = $(dir $@)
300
+%/libgnat$(arext): libgnarl = $(subst libgnat,libgnarl,$@)
301
+%/libgnat$(arext): libgnala = $(subst libgnat,libgnala,$@)
302
+%/libgnat$(arext): % %/s-oscons.ads
303
+ $(MAKE) -C $(build_dir) \
304
CC="`echo \"$(GCC_FOR_TARGET)\" \
305
| sed -e 's,\./xgcc,../../xgcc,' -e 's,-B\./,-B../../,'`" \
306
INCLUDES="$(INCLUDES_FOR_SUBDIR) -I./../.." \
307
@@ -2369,7 +2398,7 @@
308
FORCE_DEBUG_ADAFLAGS="$(FORCE_DEBUG_ADAFLAGS)" \
310
-f ../Makefile $(LIBGNAT_OBJS)
311
- $(MAKE) -C $(RTSDIR) \
312
+ $(MAKE) -C $(build_dir) \
313
CC="`echo \"$(GCC_FOR_TARGET)\" \
314
| sed -e 's,\./xgcc,../../xgcc,' -e 's,-B\./,-B../../,'`" \
316
@@ -2377,35 +2406,37 @@
317
ADAFLAGS="$(GNATLIBFLAGS)" \
318
FORCE_DEBUG_ADAFLAGS="$(FORCE_DEBUG_ADAFLAGS)" \
322
- $(RM) $(RTSDIR)/libgnat$(arext) $(RTSDIR)/libgnarl$(arext)
323
- $(AR_FOR_TARGET) $(AR_FLAGS) $(RTSDIR)/libgnat$(arext) \
324
- $(addprefix $(RTSDIR)/,$(GNATRTL_NONTASKING_OBJS) $(LIBGNAT_OBJS) g-trasym.o convert_addresses.o)
325
- $(RANLIB_FOR_TARGET) $(RTSDIR)/libgnat$(arext)
326
- $(AR_FOR_TARGET) $(AR_FLAGS) $(RTSDIR)/libgnarl$(arext) \
327
- $(addprefix $(RTSDIR)/,$(GNATRTL_TASKING_OBJS))
328
- $(RANLIB_FOR_TARGET) $(RTSDIR)/libgnarl$(arext)
329
- $(AR_FOR_TARGET) $(AR_FLAGS) $(RTSDIR)/libgnala$(arext) \
330
- $(addprefix $(RTSDIR)/,$(GNATRTL_LINEARALGEBRA_OBJS))
331
- $(RANLIB_FOR_TARGET) $(RTSDIR)/libgnala$(arext)
334
+ $(RM) $@ $(libgnarl)
335
+ $(AR_FOR_TARGET) $(AR_FLAGS) $@ \
336
+ $(addprefix $(build_dir),$(GNATRTL_NONTASKING_OBJS) $(LIBGNAT_OBJS) g-trasym.o convert_addresses.o)
337
+ $(RANLIB_FOR_TARGET) $@
338
+ $(AR_FOR_TARGET) $(AR_FLAGS) $(libgnarl) \
339
+ $(addprefix $(build_dir),$(GNATRTL_TASKING_OBJS))
340
+ $(RANLIB_FOR_TARGET) $(libgnarl)
341
+ $(AR_FOR_TARGET) $(AR_FLAGS) $(libgnala) \
342
+ $(addprefix $(build_dir),$(GNATRTL_LINEARALGEBRA_OBJS))
343
+ $(RANLIB_FOR_TARGET) $(libgnala)
344
ifeq ($(GMEM_LIB),gmemlib)
345
- $(AR_FOR_TARGET) $(AR_FLAGS) $(RTSDIR)/libgmem$(arext) \
346
- $(RTSDIR)/memtrack.o
347
- $(RANLIB_FOR_TARGET) $(RTSDIR)/libgmem$(arext)
348
+ $(AR_FOR_TARGET) $(AR_FLAGS) $(build_dir)libgmem$(arext) \
349
+ $(build_dir)memtrack.o
350
+ $(RANLIB_FOR_TARGET) $(build_dir)libgmem$(arext)
352
- touch ../stamp-gnatlib-$(RTSDIR)
354
# Warning: this target assumes that LIBRARY_VERSION has been set correctly.
355
-gnatlib-shared-default: ../stamp-gnatlib1-$(RTSDIR)
356
- $(MAKE) -C $(RTSDIR) \
357
+%/$(libgnat) %/$(libgnat-sjlj): build_dir = $(dir $@)
358
+%/$(libgnat) %/$(libgnat-sjlj): libgnarl = $(notdir $(subst libgnat,libgnarl,$@))
359
+%/$(libgnat) %/$(libgnat-sjlj): libgnala = $(notdir $(subst libgnat,libgnala,$@))
360
+%/$(libgnat) %/$(libgnat-sjlj): % %/s-oscons.ads
361
+ $(MAKE) -C $(build_dir) \
362
CC="`echo \"$(GCC_FOR_TARGET)\" \
363
| sed -e 's,^\./xgcc,../../xgcc,' -e 's,-B\./,-B../../,'`" \
364
INCLUDES="$(INCLUDES_FOR_SUBDIR) -I./../.." \
365
CFLAGS="$(GNATLIBCFLAGS_FOR_C)" \
367
-f ../Makefile $(LIBGNAT_OBJS)
368
- $(MAKE) -C $(RTSDIR) \
369
+ $(MAKE) -C $(build_dir) \
370
CC="`echo \"$(GCC_FOR_TARGET)\" \
371
| sed -e 's,^\./xgcc,../../xgcc,' -e 's,-B\./,-B../../,'`" \
373
@@ -2415,160 +2446,56 @@
377
- $(RM) $(RTSDIR)/libgna*$(soext) $(RTSDIR)/libgna*$(soext).1
378
- cd $(RTSDIR); ../../xgcc -B../../ -shared $(GNATLIBCFLAGS) \
379
+ $(RM) $(build_dir)/libgna*$(soext) $(build_dir)/libgna*$(soext).1
380
+ cd $(build_dir); ../../xgcc -B../../ -shared $(GNATLIBCFLAGS) \
381
$(TARGET_LIBGCC2_CFLAGS) \
382
- -o libgnat$(hyphen)$(LIBRARY_VERSION)$(soext).1 \
383
+ -o $(notdir $@).1 \
384
$(GNATRTL_NONTASKING_OBJS) $(LIBGNAT_OBJS) \
385
g-trasym.o convert_addresses.o \
386
- $(SO_OPTS)libgnat$(hyphen)$(LIBRARY_VERSION)$(soext).1 \
387
+ $(SO_OPTS)$(notdir $@).1 \
389
- cd $(RTSDIR); ../../xgcc -B../../ -shared $(GNATLIBCFLAGS) \
390
+ cd $(build_dir); $(LN_S) $(notdir $@).1 $(notdir $@)
391
+ cd $(build_dir); ../../xgcc -B../../ -shared $(GNATLIBCFLAGS) \
392
$(TARGET_LIBGCC2_CFLAGS) \
393
- -o libgnarl$(hyphen)$(LIBRARY_VERSION)$(soext).1 \
395
$(GNATRTL_TASKING_OBJS) \
396
- $(SO_OPTS)libgnarl$(hyphen)$(LIBRARY_VERSION)$(soext).1 \
397
+ $(SO_OPTS)$(libgnarl).1 \
399
- cd $(RTSDIR); for lib in gnat gnarl; do \
400
- l=lib$${lib}$(hyphen)$(LIBRARY_VERSION)$(soext); \
401
- $(LN_S) $$l.1 $$l; \
403
-# Delete the object files, lest they be linked statically into the tools
404
-# executables. Only the .ali, .a and .so files must remain.
405
- rm -f $(RTSDIR)/*.o
406
- $(CHMOD) a-wx $(RTSDIR)/*.ali
408
-gnatlib-shared-dual:
409
- $(MAKE) $(FLAGS_TO_PASS) \
410
- GNATLIBFLAGS="$(GNATLIBFLAGS)" \
411
- GNATLIBCFLAGS="$(GNATLIBCFLAGS)" \
412
- GNATLIBCFLAGS_FOR_C="$(GNATLIBCFLAGS_FOR_C)" \
413
- MULTISUBDIR="$(MULTISUBDIR)" \
414
- THREAD_KIND="$(THREAD_KIND)" \
416
- $(RM) $(RTSDIR)/*.o $(RTSDIR)/*.ali
417
- $(MAKE) $(FLAGS_TO_PASS) \
418
- GNATLIBFLAGS="$(GNATLIBFLAGS)" \
419
- GNATLIBCFLAGS="$(GNATLIBCFLAGS)" \
420
- GNATLIBCFLAGS_FOR_C="$(GNATLIBCFLAGS_FOR_C)" \
421
- MULTISUBDIR="$(MULTISUBDIR)" \
422
- THREAD_KIND="$(THREAD_KIND)" \
423
- gnatlib-shared-default
425
-gnatlib-shared-dual-win32:
426
- $(MAKE) $(FLAGS_TO_PASS) \
427
- GNATLIBFLAGS="$(GNATLIBFLAGS)" \
428
- GNATLIBCFLAGS="$(GNATLIBCFLAGS)" \
429
- GNATLIBCFLAGS_FOR_C="$(GNATLIBCFLAGS_FOR_C)" \
430
- MULTISUBDIR="$(MULTISUBDIR)" \
431
- THREAD_KIND="$(THREAD_KIND)" \
433
- $(RM) $(RTSDIR)/*.o $(RTSDIR)/*.ali
434
- $(MAKE) $(FLAGS_TO_PASS) \
435
- GNATLIBFLAGS="$(GNATLIBFLAGS)" \
436
- GNATLIBCFLAGS="$(GNATLIBCFLAGS) $(TARGET_LIBGCC2_CFLAGS)" \
437
- GNATLIBCFLAGS_FOR_C="$(GNATLIBCFLAGS_FOR_C)" \
438
- MULTISUBDIR="$(MULTISUBDIR)" \
439
- THREAD_KIND="$(THREAD_KIND)" \
440
- gnatlib-shared-win32
442
-# ??? we need to add the option to support auto-import of arrays/records to
443
-# the GNATLIBFLAGS when this will be supported by GNAT. At this point we will
444
-# use the gnatlib-shared-dual-win32 target to build the GNAT runtimes on
446
-gnatlib-shared-win32:
447
- $(MAKE) $(FLAGS_TO_PASS) \
448
- GNATLIBFLAGS="$(GNATLIBFLAGS)" \
449
- GNATLIBCFLAGS="$(GNATLIBCFLAGS) $(TARGET_LIBGCC2_CFLAGS)" \
450
- GNATLIBCFLAGS_FOR_C="$(GNATLIBCFLAGS_FOR_C)" \
451
- MULTISUBDIR="$(MULTISUBDIR)" \
452
- THREAD_KIND="$(THREAD_KIND)" \
454
- $(RM) $(RTSDIR)/libgna*$(soext)
455
- cd $(RTSDIR); ../../xgcc -B../../ -shared -shared-libgcc \
456
- $(TARGET_LIBGCC2_CFLAGS) \
457
- -o libgnat$(hyphen)$(LIBRARY_VERSION)$(soext) \
458
- $(GNATRTL_NONTASKING_OBJS) $(LIBGNAT_OBJS) \
459
- $(SO_OPTS)libgnat$(hyphen)$(LIBRARY_VERSION)$(soext) $(MISCLIB)
460
- cd $(RTSDIR); ../../xgcc -B../../ -shared -shared-libgcc \
461
+ cd $(build_dir); $(LN_S) $(libgnarl).1 $(libgnarl)
462
+# TODO: enable building the shared libgnala
463
+ifeq (libgnala-shared-enabled,yes)
464
+ cd $(build_dir); ../../xgcc -B../../ -shared $(GNATLIBCFLAGS) \
465
$(TARGET_LIBGCC2_CFLAGS) \
466
- -o libgnarl$(hyphen)$(LIBRARY_VERSION)$(soext) \
467
- $(GNATRTL_TASKING_OBJS) \
468
- $(SO_OPTS)libgnarl$(hyphen)$(LIBRARY_VERSION)$(soext) \
469
- $(THREADSLIB) -Wl,libgnat$(hyphen)$(LIBRARY_VERSION)$(soext)
471
-gnatlib-shared-darwin:
472
- $(MAKE) $(FLAGS_TO_PASS) \
473
- GNATLIBFLAGS="$(GNATLIBFLAGS)" \
474
- GNATLIBCFLAGS="$(GNATLIBCFLAGS) $(TARGET_LIBGCC2_CFLAGS)" \
475
- GNATLIBCFLAGS_FOR_C="$(GNATLIBCFLAGS_FOR_C) -fno-common" \
476
- MULTISUBDIR="$(MULTISUBDIR)" \
477
- THREAD_KIND="$(THREAD_KIND)" \
479
- $(RM) $(RTSDIR)/libgnat$(soext) $(RTSDIR)/libgnarl$(soext)
480
- cd $(RTSDIR); ../../xgcc -B../../ -dynamiclib $(TARGET_LIBGCC2_CFLAGS) \
481
- -o libgnat$(hyphen)$(LIBRARY_VERSION)$(soext) \
482
- $(GNATRTL_NONTASKING_OBJS) $(LIBGNAT_OBJS) \
484
- -Wl,-install_name,@rpath/libgnat$(hyphen)$(LIBRARY_VERSION)$(soext) \
486
- cd $(RTSDIR); ../../xgcc -B../../ -dynamiclib $(TARGET_LIBGCC2_CFLAGS) \
487
- -o libgnarl$(hyphen)$(LIBRARY_VERSION)$(soext) \
488
- $(GNATRTL_TASKING_OBJS) \
490
- -Wl,-install_name,@rpath/libgnarl$(hyphen)$(LIBRARY_VERSION)$(soext) \
491
- $(THREADSLIB) -Wl,libgnat$(hyphen)$(LIBRARY_VERSION)$(soext)
492
- cd $(RTSDIR); $(LN_S) libgnat$(hyphen)$(LIBRARY_VERSION)$(soext) \
494
- cd $(RTSDIR); $(LN_S) libgnarl$(hyphen)$(LIBRARY_VERSION)$(soext) \
496
- cd $(RTSDIR); dsymutil libgnat$(hyphen)$(LIBRARY_VERSION)$(soext)
497
- cd $(RTSDIR); dsymutil libgnarl$(hyphen)$(LIBRARY_VERSION)$(soext)
499
+ $(GNATRTL_LINEARALGEBRA_OBJS) \
500
+ $(SO_OPTS)$(libgnala).1
501
+ cd $(build_dir); $(LN_S) $(libgnala).1 $(libgnala)
505
- $(MAKE) $(FLAGS_TO_PASS) \
506
- GNATLIBFLAGS="$(GNATLIBFLAGS)" \
507
- GNATLIBCFLAGS="$(GNATLIBCFLAGS)" \
508
- GNATLIBCFLAGS_FOR_C="$(GNATLIBCFLAGS_FOR_C)" \
509
- MULTISUBDIR="$(MULTISUBDIR)" \
510
- THREAD_KIND="$(THREAD_KIND)" \
512
- $(RM) $(RTSDIR)/libgna*$(soext)
514
- ../../gnatsym -s SYMVEC_$$$$.opt \
515
- $(LIBGNAT_OBJS) $(GNATRTL_NONTASKING_OBJS) && \
516
- ../../xgcc -g -B../../ -shared -shared-libgcc \
517
- -o libgnat$(hyphen)$(LIBRARY_VERSION)$(soext) libgnat.a \
518
- sys\$$library:trace.exe \
519
- --for-linker=/noinform \
520
- --for-linker=SYMVEC_$$$$.opt \
521
- --for-linker=gsmatch=equal,$(GSMATCH_VERSION)
523
- ../../gnatsym -s SYMVEC_$$$$.opt \
524
- $(GNATRTL_TASKING_OBJS) && \
525
- ../../xgcc -g -B../../ -shared -shared-libgcc \
526
- -o libgnarl$(hyphen)$(LIBRARY_VERSION)$(soext) \
527
- libgnarl.a libgnat$(hyphen)$(LIBRARY_VERSION)$(soext) \
528
- sys\$$library:trace.exe \
529
- --for-linker=/noinform \
530
- --for-linker=SYMVEC_$$$$.opt \
531
- --for-linker=gsmatch=equal,$(GSMATCH_VERSION)
532
+gnatlib-shared-dual: gnatlib-static-zcx gnatlib-static-sjlj gnatlib-shared-zcx
535
+gnatlib-shared-zcx: rts = $(subst gnatlib,rts,$@)
536
+gnatlib-shared-zcx: gnatlib-sources-zcx/a-except.ads
537
+ if [ ! -d $(rts) ] ; then \
538
+ cp -a gnatlib-sources-zcx $(rts); \
539
+ $(MV) $(rts)/s.ads $(rts)/system.ads; \
541
$(MAKE) $(FLAGS_TO_PASS) \
542
+ EH_MECHANISM="-gcc" \
543
GNATLIBFLAGS="$(GNATLIBFLAGS)" \
544
GNATLIBCFLAGS="$(GNATLIBCFLAGS)" \
545
GNATLIBCFLAGS_FOR_C="$(GNATLIBCFLAGS_FOR_C)" \
546
MULTISUBDIR="$(MULTISUBDIR)" \
547
THREAD_KIND="$(THREAD_KIND)" \
548
TARGET_LIBGCC2_CFLAGS="$(TARGET_LIBGCC2_CFLAGS)" \
553
- $(MAKE) $(FLAGS_TO_PASS) EH_MECHANISM="" \
554
- THREAD_KIND="$(THREAD_KIND)" ../stamp-gnatlib1-$(RTSDIR)
555
- sed -e 's/ZCX_By_Default.*/ZCX_By_Default : constant Boolean := False;/' $(RTSDIR)/system.ads > $(RTSDIR)/s.ads
556
- $(MV) $(RTSDIR)/s.ads $(RTSDIR)/system.ads
557
+gnatlib-static-sjlj: rts = $(subst gnatlib,rts,$@)
558
+gnatlib-static-sjlj: gnatlib-sources-sjlj/a-except.ads
559
+ if [ ! -d $(rts) ] ; then \
560
+ cp -a gnatlib-sources-sjlj $(rts); \
561
+ $(MV) $(rts)/s.ads $(rts)/system.ads; \
563
$(MAKE) $(FLAGS_TO_PASS) \
565
GNATLIBFLAGS="$(GNATLIBFLAGS)" \
566
@@ -2576,13 +2503,15 @@
567
GNATLIBCFLAGS_FOR_C="$(GNATLIBCFLAGS_FOR_C)" \
568
MULTISUBDIR="$(MULTISUBDIR)" \
569
THREAD_KIND="$(THREAD_KIND)" \
570
- TARGET_LIBGCC2_CFLAGS="$(TARGET_LIBGCC2_CFLAGS)" gnatlib
571
+ TARGET_LIBGCC2_CFLAGS="$(TARGET_LIBGCC2_CFLAGS)" \
572
+ $(rts)/libgnat$(arext)
575
- $(MAKE) $(FLAGS_TO_PASS) EH_MECHANISM="-gcc" \
576
- THREAD_KIND="$(THREAD_KIND)" ../stamp-gnatlib1-$(RTSDIR)
577
- sed -e 's/ZCX_By_Default.*/ZCX_By_Default : constant Boolean := True;/' $(RTSDIR)/system.ads > $(RTSDIR)/s.ads
578
- $(MV) $(RTSDIR)/s.ads $(RTSDIR)/system.ads
579
+gnatlib-static-zcx: rts = $(subst gnatlib,rts,$@)
580
+gnatlib-static-zcx: gnatlib-sources-zcx/a-except.ads
581
+ if [ ! -d $(rts) ] ; then \
582
+ cp -a gnatlib-sources-zcx $(rts); \
583
+ $(MV) $(rts)/s.ads $(rts)/system.ads; \
585
$(MAKE) $(FLAGS_TO_PASS) \
586
EH_MECHANISM="-gcc" \
587
GNATLIBFLAGS="$(GNATLIBFLAGS)" \
588
@@ -2590,7 +2519,8 @@
589
GNATLIBCFLAGS_FOR_C="$(GNATLIBCFLAGS_FOR_C)" \
590
MULTISUBDIR="$(MULTISUBDIR)" \
591
THREAD_KIND="$(THREAD_KIND)" \
592
- TARGET_LIBGCC2_CFLAGS="$(TARGET_LIBGCC2_CFLAGS)" gnatlib
593
+ TARGET_LIBGCC2_CFLAGS="$(TARGET_LIBGCC2_CFLAGS)" \
594
+ $(rts)/libgnat$(arext)
596
# .s files for cross-building
598
@@ -2598,6 +2528,10 @@
600
ADA_INCLUDE_DIR = $(libsubdir)/adainclude
601
ADA_RTL_OBJ_DIR = $(libsubdir)/adalib
602
+ADA_NATIVE_INCLUDE_DIR = $(libsubdir)/rts-native/adainclude
603
+ADA_NATIVE_RTL_OBJ_DIR = $(libsubdir)/rts-native/adalib
604
+ADA_SJLJ_INCLUDE_DIR = $(libsubdir)/rts-sjlj/adainclude
605
+ADA_SJLJ_RTL_OBJ_DIR = $(libsubdir)/rts-sjlj/adalib
607
# force no sibling call optimization on s-traceb.o so the number of stack
608
# frames to be skipped when computing a call chain is not modified by
609
Index: b/src/gnattools/Makefile.in
610
===================================================================
611
--- a/src/gnattools/Makefile.in
612
+++ b/src/gnattools/Makefile.in
615
target_noncanonical=@target_noncanonical@
617
+RTS=../gcc/ada/rts-shared-zcx
619
ADA_CFLAGS=-O2 -gnatn
620
-ADA_INCLUDES=-nostdinc -I- -I. -I../gcc/ada/rts -I../libgnatvsn -I../libgnatprj
621
+ADA_INCLUDES=-nostdinc -I- -I. -I$(RTS) -I../libgnatvsn -I../libgnatprj
622
LIB_VERSION=$(strip $(shell grep ' Library_Version :' \
623
../libgnatvsn/gnatvsn.ads | sed -e 's/.*"\(.*\)".*/\1/'))
624
-ADA_LIBS := -L../gcc/ada/rts -lgnat-$(LIB_VERSION)
625
+ADA_LIBS := -L$(RTS) -lgnat-$(LIB_VERSION)
626
ADA_LIBS += -L../libgnatvsn -lgnatvsn
627
ADA_LIBS += -L../libgnatprj -lgnatprj
631
.PHONY: gnattools gnattools-native gnattools-cross regnattools
632
gnattools: @default_gnattools_target@
633
+ (cd $(RTS); if [ -d obj ]; then mv obj/* .; rmdir obj; fi)
635
BODIES := $(foreach f,$(OBJECTS),$(wildcard $(patsubst %.o,@srcdir@/../gcc/ada/%.adb,$(f))))
636
SPECS := $(foreach f,$(OBJECTS),$(wildcard $(patsubst %.o,@srcdir@/../gcc/ada/%.ads,$(f))))
638
for file in $(BODIES) $(SPECS); do \
639
$(LN_S) -f $$file .; \
641
+# Move the RTS object files away lest they be linked statically into the
642
+# tools. Only the .ali, .a and .so files must remain.
643
+ (cd $(RTS); mkdir obj; mv *.o obj; chmod a-wx *.ali)
646
-gnattools-native: ../gcc/ada/rts/libgnat-$(LIB_VERSION).so
647
+gnattools-native: $(RTS)/libgnat-$(LIB_VERSION).so
648
gnattools-native: ../libgnatvsn/libgnatvsn.so
649
gnattools-native: stamp-gnattools-sources
650
gnattools-native: $(TOOLS)
653
../libgnatprj/libgnatprj.a \
654
../libgnatvsn/libgnatvsn.a \
655
- ../gcc/ada/rts/libgnat.a \
656
+ ../gcc/ada/rts-static-zcx/libgnat.a \
657
../libiberty/libiberty.a
659
gnatlink: $(GNATLINK_OBJS) b_gnatl.o
661
$(GCC) -o $@ $(ADA_CFLAGS) $^ \
662
../libgnatprj/libgnatprj.a \
663
../libgnatvsn/libgnatvsn.a \
664
- ../gcc/ada/rts/libgnat.a \
665
+ ../gcc/ada/rts-static-zcx/libgnat.a \
666
../libiberty/libiberty.a
668
gnatmake: $(GNATMAKE_OBJS) b_gnatm.o
669
Index: b/src/libgnatprj/Makefile.in
670
===================================================================
671
--- a/src/libgnatprj/Makefile.in
672
+++ b/src/libgnatprj/Makefile.in
674
@srcdir@/../gcc/ada/gnatvsn.ads | \
675
sed -e 's/.*"\(.*\)".*/\1/'))
676
GCC:=../gcc/xgcc -B../gcc/
677
-LIBGNAT_JUST_BUILT := -nostdinc -I../gcc/ada/rts
678
+RTS:=../gcc/ada/rts-shared-zcx
679
+LIBGNAT_JUST_BUILT := -nostdinc -I$(RTS)
680
LIBGNATVSN := -I../libgnatvsn
682
ADAFLAGS := -g -O2 -gnatn
684
libgnatprj.so.$(LIB_VERSION): $(addprefix obj-shared/,$(OBJECTS))
685
: # Make libgnatprj.so
686
$(GCC) -o $@ -shared -fPIC -Wl,--soname,$@ $^ \
687
- -L../gcc/ada/rts -lgnat-$(LIB_VERSION) \
688
+ -L$(RTS) -lgnat-$(LIB_VERSION) \
689
-L../libgnatvsn -lgnatvsn
690
$(LN_S) -f libgnatprj.so.$(LIB_VERSION) libgnatprj.so
691
chmod a=r obj-shared/*.ali
692
Index: b/src/libgnatvsn/Makefile.in
693
===================================================================
694
--- a/src/libgnatvsn/Makefile.in
695
+++ b/src/libgnatvsn/Makefile.in
697
@srcdir@/../gcc/ada/gnatvsn.ads | \
698
sed -e 's/.*"\(.*\)".*/\1/'))
699
GCC:=../gcc/xgcc -B../gcc/
700
-LIBGNAT_JUST_BUILT := -nostdinc -I../gcc/ada/rts
701
+RTS:=../gcc/ada/rts-shared-zcx
702
+LIBGNAT_JUST_BUILT := -nostdinc -I$(RTS)
703
CFLAGS := -g -O2 -gnatn
704
BASEVER := $(shell cat @srcdir@/../gcc/BASE-VER)
705
DEVPHASE := $(shell cat @srcdir@/../gcc/DEV-PHASE)
707
libgnatvsn.so.$(LIB_VERSION): $(addprefix obj-shared/,$(OBJECTS))
708
: # Make libgnatvsn.so
709
$(GCC) -o $@ -shared -fPIC -Wl,--soname,$@ $^ \
710
- -L../gcc/ada/rts -lgnat-$(LIB_VERSION)
711
+ -L$(RTS) -lgnat-$(LIB_VERSION)
712
ln -s libgnatvsn.so.$(LIB_VERSION) libgnatvsn.so
713
chmod a=r obj-shared/*.ali
714
# Make the .ali files, but not the .o files, visible to the gnat tools.
715
Index: b/src/gcc/ada/gcc-interface/Make-lang.in
716
===================================================================
717
--- a/src/gcc/ada/gcc-interface/Make-lang.in
718
+++ b/src/gcc/ada/gcc-interface/Make-lang.in
720
"ADA_FOR_TARGET=$(ADA_FOR_TARGET)" \
721
"INSTALL=$(INSTALL)" \
722
"INSTALL_DATA=$(INSTALL_DATA)" \
723
- "INSTALL_PROGRAM=$(INSTALL_PROGRAM)"
724
+ "INSTALL_PROGRAM=$(INSTALL_PROGRAM)" \
725
+ "GCC_FOR_TARGET=$(GCC_FOR_TARGET)"
727
# Say how to compile Ada programs.
728
.SUFFIXES: .ada .adb .ads