diff mbox

[Ada] Adjust rules for selected files in Makefiles

Message ID 201104211833.21020.ebotcazou@adacore.com
State New
Headers show

Commit Message

Eric Botcazou April 21, 2011, 4:33 p.m. UTC
A few selected files must be compiled with special options in Ada, both for the 
compiler and the runtime.  The attached patch cleans things up a bit in this  
area and also fixes various minor related issues.

Bootstrapped/regtested on i586-suse-linux, applied on the mainline.


2011-04-21  Eric Botcazou  <ebotcazou@adacore.com>

	* gcc-interface/Makefile.in (NO_SIBLING_ADAFLAGS): Always define.
	(NO_REORDER_ADAFLAGS): New variable.
	(EXTRA_GNATTOOLS): Always define.
	(../stamp-gnatlib1-$(RTSDIR): Copy tsystem.h.
	Clean up and adjust list of files compiled with special options.
	* gcc-interface/Make-lang.in: Likewise.
	(ada/decl.o): Cosmetical change.
	(ada/misc.o): Remove dependency on $(PLUGIN_H).
diff mbox

Patch

Index: gcc-interface/Makefile.in
===================================================================
--- gcc-interface/Makefile.in	(revision 172811)
+++ gcc-interface/Makefile.in	(working copy)
@@ -107,6 +107,8 @@  ADA_CFLAGS =
 ADAFLAGS = -W -Wall -gnatpg -gnata
 SOME_ADAFLAGS =-gnata
 FORCE_DEBUG_ADAFLAGS = -g
+NO_SIBLING_ADAFLAGS=-fno-optimize-sibling-calls
+NO_REORDER_ADAFLAGS=-fno-toplevel-reorder
 GNATLIBFLAGS = -gnatpg -nostdinc
 GNATLIBCFLAGS = -g -O2
 # Pretend that _Unwind_GetIPInfo is available for the target by default.  This
@@ -180,6 +182,9 @@  SYSLIBS = @GNAT_LIBEXC@
 # List of extra object files linked in with various programs.
 EXTRA_GNATTOOLS_OBJS = ../../prefix.o ../../version.o
 
+# List extra gnattools
+EXTRA_GNATTOOLS =
+
 # List of target dependent sources, overridden below as necessary
 TARGET_ADA_SRCS =
 
@@ -243,6 +248,21 @@  LIBDEPS = $(LIBINTL_DEP) $(LIBIBERTY)
 TGT_LIB =
 TOOLS_LIBS = $(EXTRA_GNATTOOLS_OBJS) targext.o link.o $(LIBGNAT) ../../../libiberty/libiberty.a $(SYSLIBS) $(TGT_LIB)
 
+# Convert the target variable into a space separated list of architecture,
+# manufacturer, and operating system and assign each of those to its own
+# variable.
+
+host:=$(subst -, ,$(host_canonical))
+targ:=$(subst -, ,$(target))
+arch:=$(word 1,$(targ))
+ifeq ($(words $(targ)),2)
+  manu:=
+  osys:=$(word 2,$(targ))
+else
+  manu:=$(word 2,$(targ))
+  osys:=$(word 3,$(targ))
+endif
+
 # Specify the directories to be searched for header files.
 # Both . and srcdir are used, in that order,
 # so that tm.h and config.h will be found in the compilation
@@ -312,21 +332,6 @@  GNATMAKE_OBJS = a-except.o ali.o ali-uti
  uintp.o uname.o urealp.o usage.o widechar.o scil_ll.o \
  $(EXTRA_GNATMAKE_OBJS)
 
-# Convert the target variable into a space separated list of architecture,
-# manufacturer, and operating system and assign each of those to its own
-# variable.
-
-host:=$(subst -, ,$(host_canonical))
-targ:=$(subst -, ,$(target))
-arch:=$(word 1,$(targ))
-ifeq ($(words $(targ)),2)
-  manu:=
-  osys:=$(word 2,$(targ))
-else
-  manu:=$(word 2,$(targ))
-  osys:=$(word 3,$(targ))
-endif
-
 # Make arch match the current multilib so that the RTS selection code
 # picks up the right files. For a given target this must be coherent
 # with MULTILIB_DIRNAMES defined in gcc/config/target/t-*.
@@ -1634,7 +1639,6 @@  ifeq ($(strip $(filter-out cygwin32% min
     s-osprim.adb<s-osprim-mingw.adb \
     s-taprop.adb<s-taprop-mingw.adb
 
-    EH_MECHANISM=-gcc
     ifeq ($(strip $(filter-out x86_64%,$(arch))),)
       ifeq ($(strip $(MULTISUBDIR)),/32)
 	LIBGNAT_TARGET_PAIRS += \
@@ -1666,6 +1670,8 @@  ifeq ($(strip $(filter-out cygwin32% min
     # ??? This will be replaced by gnatlib-shared-dual-win32 when GNAT
     # auto-import support for array/record will be done.
     GNATLIB_SHARED = gnatlib-shared-win32
+
+    EH_MECHANISM=-gcc
   endif
 
   TOOLS_TARGET_PAIRS= \
@@ -2444,6 +2450,8 @@  install-gnatlib: ../stamp-gnatlib-$(RTSD
 	$(foreach PAIR,$(LIBGNAT_TARGET_PAIRS), \
 	          $(LN_S) $(fsrcpfx)ada/$(word 2,$(subst <, ,$(PAIR))) \
 	                $(RTSDIR)/$(word 1,$(subst <, ,$(PAIR)));)
+# Copy tsystem.h
+	$(CP) $(srcdir)/tsystem.h rts
 # Copy generated target dependent sources
 	$(RM) $(RTSDIR)/s-oscons.ads
 	(cd $(RTSDIR); $(LN_S) ../s-oscons.ads s-oscons.ads)
@@ -2668,7 +2676,7 @@  gnatlib-sjlj:
 
 gnatlib-zcx:
 	$(MAKE) $(FLAGS_TO_PASS) EH_MECHANISM="-gcc" \
-	THREAD_KIND="$(THREAD_KIND)" ../stamp-gnatlib1-$(RTSDIR)
+	  THREAD_KIND="$(THREAD_KIND)" ../stamp-gnatlib1-$(RTSDIR)
 	sed -e 's/ZCX_By_Default.*/ZCX_By_Default            : constant Boolean := True;/' $(RTSDIR)/system.ads > $(RTSDIR)/s.ads
 	$(MV) $(RTSDIR)/s.ads $(RTSDIR)/system.ads
 	$(MAKE) $(FLAGS_TO_PASS) \
@@ -2709,22 +2717,15 @@  b_gnatm.o : b_gnatm.adb
 ADA_INCLUDE_DIR = $(libsubdir)/adainclude
 ADA_RTL_OBJ_DIR = $(libsubdir)/adalib
 
+# Special flags
+
 # force no sibling call optimization on s-traceb.o so the number of stack
 # frames to be skipped when computing a call chain is not modified by
-# optimization. However we can do that only when building the runtime
-# (not the compiler) because the -fno-optimize-sibling-calls option exists
-# only in GCC 3 and above.
+# optimization.
 
-ifneq (,$(findstring xgcc,$(CC)))
-NO_SIBLING_ADAFLAGS=-fno-optimize-sibling-calls
-else
-NO_SIBLING_ADAFLAGS=
-endif
-
-s-traceb.o  : s-traceb.adb
+s-traceb.o  : s-traceb.adb s-traceb.ads
 	$(CC) -c $(ALL_ADAFLAGS) $(FORCE_DEBUG_ADAFLAGS) \
-	      $(NO_SIBLING_ADAFLAGS) $(ADA_INCLUDES) \
-      $< $(OUTPUT_OPTION)
+	      $(NO_SIBLING_ADAFLAGS) $(ADA_INCLUDES) $< $(OUTPUT_OPTION)
 
 # force debugging information on s-tasdeb.o so that it is always
 # possible to set conditional breakpoints on tasks.
@@ -2733,11 +2734,16 @@  s-tasdeb.o  : s-tasdeb.adb s-tasdeb.ads
 	$(CC) -c $(ALL_ADAFLAGS) $(FORCE_DEBUG_ADAFLAGS) -O0 $(ADA_INCLUDES) \
 	      $< $(OUTPUT_OPTION)
 
-# force no function reordering on a-except.o because of the exclusion bounds
-# mechanism (see the source file for more detailed information).
+# force debugging information on s-vaflop.o so that it is always
+# possible to call the VAX float debug print routines.
+# force at least -O so that the inline assembly works.
 
-NO_REORDER_ADAFLAGS=-fno-toplevel-reorder
+s-vaflop.o  : s-vaflop.adb s-vaflop.ads
+	$(CC) -c -O $(ALL_ADAFLAGS) $(FORCE_DEBUG_ADAFLAGS) $(ADA_INCLUDES) \
+	      $< $(OUTPUT_OPTION)
 
+# force no function reordering on a-except.o because of the exclusion bounds
+# mechanism (see the source file for more detailed information).
 # force debugging information on a-except.o so that it is always
 # possible to set conditional breakpoints on exceptions.
 # use -O1 otherwise gdb isn't able to get a full backtrace on mips targets.
@@ -2757,10 +2763,23 @@  s-except.o  : s-except.adb s-except.ads
 # force debugging information on s-assert.o so that it is always
 # possible to set breakpoint on assert failures.
 
-s-assert.o  : s-assert.adb s-assert.ads a-except.ads
-	$(CC) -c $(ALL_ADAFLAGS) $(FORCE_DEBUG_ADAFLAGS) -O2 $(ADA_INCLUDES) \
+s-assert.o  : s-assert.adb s-assert.ads
+	$(CC) -c $(ALL_ADAFLAGS) $(FORCE_DEBUG_ADAFLAGS) $(ADA_INCLUDES) \
 	      $< $(OUTPUT_OPTION)
 
+# force debugging information on a-tags.o so that the debugger can find
+# the description of Ada.Tags.Type_Specific_Data.
+
+a-tags.o  : a-tags.adb a-tags.ads
+	$(CC) -c $(ALL_ADAFLAGS) $(FORCE_DEBUG_ADAFLAGS) $(ADA_INCLUDES) \
+	      $< $(OUTPUT_OPTION)
+
+# need to keep the frame pointer in this file to pop the stack properly on
+# some targets.
+tracebak.o  : tracebak.c tb-alvms.c tb-alvxw.c tb-gcc.c
+	$(COMPILER) -c $(ALL_COMPILERFLAGS) $(ADA_CFLAGS) $(ALL_CPPFLAGS) \
+	      $(INCLUDES) -fno-omit-frame-pointer $< $(OUTPUT_OPTION)
+
 adadecode.o : adadecode.c adadecode.h
 aux-io.o  : aux-io.c
 argv.o    : argv.c
@@ -2770,15 +2789,18 @@  errno.o   : errno.c
 exit.o    : adaint.h exit.c
 expect.o  : expect.c
 final.o   : final.c
-link.o    : link.c
 locales.o : locales.c
 mkdir.o   : mkdir.c
 socket.o  : socket.c gsocket.h
 sysdep.o  : sysdep.c
-raise-gcc.o : raise-gcc.c raise.h
 raise.o   : raise.c raise.h
 vx_stack_info.o : vx_stack_info.c
 
+raise-gcc.o : raise-gcc.c raise.h
+	$(COMPILER) -c $(ALL_COMPILERFLAGS) $(ADA_CFLAGS) \
+		-iquote $(srcdir) \
+		$(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
+
 cio.o     : cio.c
 	$(COMPILER) -c $(ALL_COMPILERFLAGS) $(ADA_CFLAGS) \
 	         $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
@@ -2791,16 +2813,16 @@  initialize.o : initialize.c raise.h
 	$(COMPILER) -c $(ALL_COMPILERFLAGS) $(ADA_CFLAGS) \
 	         $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
 
-targext.o : targext.c
+link.o : link.c
 	$(COMPILER) -c $(ALL_COMPILERFLAGS) $(ADA_CFLAGS) \
 		$(ALL_CPPFLAGS) $(INCLUDES_FOR_SUBDIR) \
 		$< $(OUTPUT_OPTION)
 
-# Need to keep the frame pointer in this file to pop the stack properly on
-# some targets.
-tracebak.o  : tracebak.c tb-alvms.c tb-alvxw.c tb-gcc.c
-	$(COMPILER) -c $(ALL_COMPILERFLAGS) $(ADA_CFLAGS) $(ALL_CPPFLAGS) \
-	      $(INCLUDES) -fno-omit-frame-pointer $< $(OUTPUT_OPTION)
+targext.o : targext.c
+	$(COMPILER) -c $(ALL_COMPILERFLAGS) $(ADA_CFLAGS) \
+		-iquote $(srcdir) \
+		$(ALL_CPPFLAGS) $(INCLUDES_FOR_SUBDIR) \
+		$< $(OUTPUT_OPTION)
 
 # In GNU Make, ignore whether `stage*' exists.
 .PHONY: stage1 stage2 stage3 stage4 clean realclean TAGS bootstrap
Index: gcc-interface/Make-lang.in
===================================================================
--- gcc-interface/Make-lang.in	(revision 172811)
+++ gcc-interface/Make-lang.in	(working copy)
@@ -1,6 +1,6 @@ 
 # Top level -*- makefile -*- fragment for GNU Ada (GNAT).
 #   Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-#   2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
+#   2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
 #   Free Software Foundation, Inc.
 
 #This file is part of GCC.
@@ -1127,43 +1127,39 @@  ada/sdefault.o : ada/ada.ads ada/a-excep
 
 ADA_TREE_H = ada/gcc-interface/ada-tree.h
 
-# force debugging information on s-tasdeb.o so that it is always
-# possible to set conditional breakpoints on tasks.
+# Special flags - see gcc-interface/Makefile.in for the template
+
+ada/s-traceb.o : ada/s-traceb.adb ada/s-traceb.ads
+	$(CC) -c $(ALL_ADAFLAGS) $(FORCE_DEBUG_ADAFLAGS) $(ADA_INCLUDES) \
+	  $< $(OUTPUT_OPTION)
 
 ada/s-tasdeb.o  : ada/s-tasdeb.adb ada/s-tasdeb.ads
 	$(CC) -c $(ALL_ADAFLAGS) $(FORCE_DEBUG_ADAFLAGS) -O0 $(ADA_INCLUDES) \
 	  $< $(OUTPUT_OPTION)
 
-# force debugging information on s-vaflop.o so that it is always
-# possible to call the VAX float debug print routines.
-# force at least -O so that the inline assembly works.
-
 ada/s-vaflop.o  : ada/s-vaflop.adb ada/s-vaflop.ads
 	$(CC) -c -O $(ALL_ADAFLAGS) $(FORCE_DEBUG_ADAFLAGS) $(ADA_INCLUDES) \
-	  $(OUTPUT_OPTION) $<
-
-# force debugging information on a-except.o so that it is always
-# possible to set conditional breakpoints on exceptions.
-# use -O1 otherwise gdb isn't able to get a full backtrace on mips targets.
+	  $< $(OUTPUT_OPTION)
 
 ada/a-except.o  : ada/a-except.adb ada/a-except.ads
 	$(CC) -c $(ALL_ADAFLAGS) $(FORCE_DEBUG_ADAFLAGS) -O1 -fno-inline \
 	 $(ADA_INCLUDES) $< $(OUTPUT_OPTION)
 
-# compile s-except.o without optimization and with debug info to let the
-# debugger set breakpoints and inspect subprogram parameters on exception
-# related events.
-
 ada/s-except.o  : ada/s-except.adb ada/s-except.ads
 	$(CC) -c $(ALL_ADAFLAGS) $(FORCE_DEBUG_ADAFLAGS) -O0 \
 	 $(ADA_INCLUDES) $< $(OUTPUT_OPTION)
 
-# force debugging information on s-assert.o so that it is always
-# possible to set breakpoint on assert failures.
+ada/s-assert.o  : ada/s-assert.adb ada/s-assert.ads
+	$(CC) -c $(ALL_ADAFLAGS) $(FORCE_DEBUG_ADAFLAGS) $(ADA_INCLUDES) \
+	  $< $(OUTPUT_OPTION)
 
-ada/s-assert.o  : ada/s-assert.adb ada/s-assert.ads ada/a-except.ads
-	$(CC) -c $(ALL_ADAFLAGS) $(FORCE_DEBUG_ADAFLAGS) -O2 \
-	 $(ADA_INCLUDES) $< $(OUTPUT_OPTION)
+ada/a-tags.o  : ada/a-tags.adb ada/a-tags.ads
+	$(CC) -c $(ALL_ADAFLAGS) $(FORCE_DEBUG_ADAFLAGS) $(ADA_INCLUDES) \
+	  $< $(OUTPUT_OPTION)
+
+ada/tracebak.o : ada/tracebak.c $(CONFIG_H) $(SYSTEM_H)
+	$(COMPILER) -c $(ALL_COMPILERFLAGS) $(ADA_CFLAGS) $(ALL_CPPFLAGS) \
+	      $(INCLUDES) -fno-omit-frame-pointer $< $(OUTPUT_OPTION)
 
 # dependencies for windows specific tool (mdll)
 
@@ -1176,19 +1172,6 @@  ada/mdll-fil.o : ada/mdll-fil.adb ada/md
 ada/mdll-utl.o : ada/mdll-utl.adb ada/mdll.ads ada/mdll-utl.ads ada/sdefault.ads ada/types.ads
 	$(CC) -c $(ALL_ADAFLAGS) $(ADA_INCLUDES) $< $(OUTPUT_OPTION)
 
-# force debugging information and no optimization on s-memory.o so that it
-# is always possible to set breakpoint on __gnat_malloc and __gnat_free
-# this is important for gnatmem using GDB. memtrack.o is built from
-# memtrack.adb, and used by the post-mortem analysis with gnatmem.
-
-ada/s-memory.o  : ada/s-memory.adb ada/s-memory.ads
-	$(CC) -c $(ALL_ADAFLAGS) $(FORCE_DEBUG_ADAFLAGS) -O0 \
-	 $(ADA_INCLUDES) $< $(OUTPUT_OPTION)
-
-ada/memtrack.o  : ada/memtrack.adb ada/s-memory.ads
-	$(CC) -c $(ALL_ADAFLAGS) $(FORCE_DEBUG_ADAFLAGS) -O0 \
-	 $(ADA_INCLUDES) $< $(OUTPUT_OPTION)
-
 ada/adadecode.o : ada/adadecode.c $(CONFIG_H) $(SYSTEM_H) ada/adadecode.h
 ada/adaint.o   : ada/adaint.c $(CONFIG_H) $(SYSTEM_H) ada/adaint.h
 ada/argv.o     : ada/argv.c $(CONFIG_H) $(SYSTEM_H) ada/adaint.h
@@ -1197,7 +1180,6 @@  ada/exit.o     : ada/exit.c $(CONFIG_H)
 ada/final.o    : ada/final.c $(CONFIG_H) $(SYSTEM_H) ada/raise.h
 ada/link.o     : ada/link.c
 
-
 ada/targext.o : ada/targext.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H)
 	$(COMPILER) -c $(ALL_COMPILERFLAGS) $(ADA_CFLAGS) \
 		 $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
@@ -1218,11 +1200,6 @@  ada/raise.o : ada/raise.c $(CONFIG_H) $(
 	$(COMPILER) -c $(ALL_COMPILERFLAGS) $(ADA_CFLAGS) \
 		 $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
 
-# Need to keep the frame pointer to unwind the stack properly for some targets.
-ada/tracebak.o : ada/tracebak.c $(CONFIG_H) $(SYSTEM_H)
-	$(COMPILER) -c $(ALL_COMPILERFLAGS) $(ADA_CFLAGS) $(ALL_CPPFLAGS) \
-	      $(INCLUDES) -fno-omit-frame-pointer $< $(OUTPUT_OPTION)
-
 ada/cuintp.o : ada/gcc-interface/cuintp.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
    $(TM_H) $(TREE_H) ada/gcc-interface/ada.h ada/types.h ada/uintp.h \
    ada/atree.h ada/elists.h ada/nlists.h ada/stringt.h ada/fe.h $(ADA_TREE_H) \
@@ -1230,8 +1207,8 @@  ada/cuintp.o : ada/gcc-interface/cuintp.
 	$(COMPILER) -c $(ALL_COMPILERFLAGS) -I.. $(ALL_CPPFLAGS) $< -o $@
 
 ada/decl.o : ada/gcc-interface/decl.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
-   $(TM_H) $(TREE_H) $(FLAGS_H) toplev.h $(TARGET_H) $(TREE_INLINE_H) \
-   ada/gcc-interface/ada.h ada/types.h ada/atree.h \
+   $(TM_H) $(TREE_H) $(FLAGS_H) toplev.h $(TARGET_H) \
+   $(TREE_INLINE_H) ada/gcc-interface/ada.h ada/types.h ada/atree.h \
    ada/elists.h ada/namet.h ada/nlists.h ada/repinfo.h ada/snames.h \
    ada/stringt.h ada/uintp.h ada/fe.h ada/sinfo.h ada/einfo.h $(ADA_TREE_H) \
    ada/gcc-interface/gigi.h gt-ada-decl.h
@@ -1240,7 +1217,7 @@  ada/decl.o : ada/gcc-interface/decl.c $(
 ada/misc.o : ada/gcc-interface/misc.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
    $(TM_H) $(TREE_H) $(DIAGNOSTIC_H) $(TARGET_H) $(FUNCTION_H) \
    $(FLAGS_H) debug.h toplev.h langhooks.h \
-   $(LANGHOOKS_DEF_H) $(OPTS_H) $(OPTIONS_H) $(TREE_INLINE_H) $(PLUGIN_H) \
+   $(LANGHOOKS_DEF_H) $(OPTS_H) $(OPTIONS_H) $(TREE_INLINE_H) \
    ada/gcc-interface/ada.h ada/adadecode.h ada/types.h ada/atree.h \
    ada/elists.h ada/namet.h ada/nlists.h ada/stringt.h ada/uintp.h ada/fe.h \
    ada/sinfo.h ada/einfo.h $(ADA_TREE_H) ada/gcc-interface/gigi.h \