===================================================================
@@ -167,6 +167,13 @@ tmake_file = @tmake_file@
# Directory where sources are, from where we are.
VPATH = $(srcdir)/ada
+# Full path to top source directory
+# In particular this is used to access libgcc headers, so that references to
+# these headers from GNAT runtime objects have path names in debugging info
+# that are consistent with libgcc objects. Also used for other references to
+# the top source directory for consistency.
+ftop_srcdir := $(shell cd $(srcdir)/..;${PWD_COMMAND})
+
fsrcdir := $(shell cd $(srcdir);${PWD_COMMAND})
fsrcpfx := $(shell cd $(srcdir);${PWD_COMMAND})/
fcurdir := $(shell ${PWD_COMMAND})
@@ -262,7 +269,7 @@ TOOLS_LIBS = ../link.o ../targext.o ../.
# Both . and srcdir are used, in that order,
# so that tm.h and config.h will be found in the compilation
# subdirectory rather than in the source directory.
-INCLUDES = -I- -I. -I.. -I$(srcdir)/ada -I$(srcdir) -I$(srcdir)/../include $(GMPINC)
+INCLUDES = -I- -I. -I.. -I$(srcdir)/ada -I$(srcdir) -I$(ftop_srcdir)/include $(GMPINC)
ADA_INCLUDES = -I- -I. -I$(srcdir)/ada
@@ -272,11 +279,11 @@ ADA_INCLUDES = -I- -I. -I$(srcdir)/ada
ifneq ($(findstring vxworks,$(target_os)),)
INCLUDES_FOR_SUBDIR = -iquote . -iquote .. -iquote ../.. \
-iquote $(fsrcdir)/ada \
- -I$(fsrcdir)/../include $(GMPINC)
+ -I$(ftop_srcdir)/include $(GMPINC)
else
INCLUDES_FOR_SUBDIR = -iquote . -iquote .. -iquote ../.. \
-iquote $(fsrcdir)/ada -iquote $(fsrcdir) \
- -I$(fsrcdir)/../include $(GMPINC)
+ -I$(ftop_srcdir)/include $(GMPINC)
endif
ADA_INCLUDES_FOR_SUBDIR = -I. -I$(fsrcdir)/ada
@@ -3015,7 +3024,7 @@ vx_stack_info.o : vx_stack_info.c
raise-gcc.o : raise-gcc.c raise.h
$(COMPILER) -c $(ALL_COMPILERFLAGS) $(ADA_CFLAGS) \
- -iquote $(srcdir) -iquote $(srcdir)/../libgcc \
+ -iquote $(srcdir) -iquote $(ftop_srcdir)/libgcc \
$(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
cio.o : cio.c