public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* GNAT mysterious "missing stub for subunit" error.
@ 2009-09-08  6:08 Dave Korn
  2009-09-08  8:51 ` Laurent GUERBY
  0 siblings, 1 reply; 10+ messages in thread
From: Dave Korn @ 2009-09-08  6:08 UTC (permalink / raw)
  To: gcc

[-- Attachment #1: Type: text/plain, Size: 6364 bytes --]


    Hello all,

  Currently, what you get when you build GNAT on Cygwin is a hybrid port that
is mostly based on the MinGW port.  This doesn't work well when it does things
(such as e.g. creating threads) "behind Cygwin's back" using the Win32 APIs
(e.g. CreateThread) rather than by using Cygwin's POSIX interfaces (e.g.
pthread_create).

  I'm trying to build a fully POSIXified Cygwin port by going through the list
of LIBGNAT_TARGET_PAIRS for the Windows port, examining all the *-mingw.ad[bs]
files listed, and replacing them by references to the existing -linux or
-posix versions, or new -cygwin versions in a couple of cases.  I had hoped
that this would be something I could do with a limited understanding of the
Ada build system, but I must have done something wrong.

  Bootstrap fails during building gnatlib-shared-win32 at the final link
stage, with a whole bunch of undefined references to the following functions:

> ___gnat_adjust_n_cleanups_for
> ___gnat_all_others_value
> ___gnat_begin_handler
> ___gnat_eid_for
> ___gnat_end_handler
> ___gnat_is_handled_by_others
> ___gnat_others_value

  As far as I can tell these should come from $objdir/gcc/ada/rts/a-exexpr.adb
(which is correctly softlinked to $srcdir/gcc/ada/a-exexpr-gcc.adb), but there
is no a-exexpr.o file when the build fails, so make has thought it's not a
dependency for some reason, and when I try to build it at the command line, I
get the error message mentioned in the subject:

> admin@ubik /gnu/gcc/releases/4.3.4-1/gcc4-4.3.4-1/build/gcc
> $ make ada/rts/a-exexpr.o
> /gnu/gcc/releases/4.3.4-1/gcc4-4.3.4-1/build/./prev-gcc/xgcc
> -B/gnu/gcc/releases /4.3.4-1/gcc4-4.3.4-1/build/./prev-gcc/
> -B/usr/i686-pc-cygwin/bin/ -c -g -O2 -gnatpg -gnata -nostdinc -I- -I. -Iada
> -I/gnu/gcc/releases/4.3.4-1/gcc4-4.3.4-1/src/gcc-4.3.4/gcc/ada
> ada/rts/a-exexpr.adb -o ada/rts/a-exexpr.o
> a-exexpr.adb:42:14: missing stub for subunit
> make: *** [ada/rts/a-exexpr.o] Error 1
> 
> admin@ubik /gnu/gcc/releases/4.3.4-1/gcc4-4.3.4-1/build/gcc
> $

  I couldn't find anything about this in the manual, and the comment in
sem_ch10.adb where the error is generated is a bit inscrutable to me:

>  --  If the unit is a subunit whose parent has not been analyzed (which
>  --  indicates that the main unit is a subunit, either the current one or
>  --  one of its descendents) then the subunit is compiled as part of the
>  --  analysis of the parent, which we proceed to do. Basically this gets
>  --  handled from the top down and we don't want to do anything at this
>  --  level (i.e. this subunit will be handled on the way down from the
>  --  parent), so at this level we immediately return. If the subunit
>  --  ends up not analyzed, it means that the parent did not contain a
>  --  stub for it, or that there errors were dectected in some ancestor.

  I don't understand this, but it suggests to me that the error would occur if
I had somehow inadvertently altered the position or relations of the a-exexpr
module in some kind of dependency graph between the units.  I'm not sure how
the minor changes I made to the list of target pairs could have done this
though, or why the build didn't even try and compile ada/rts/a-exexpr.o before
it got to the link stage.

  I'm working on 4.3 branch to develop this, just because I happened to have a
need for it there, but the details of changing LIBGNAT_TARGET_PAIRS should be
the same on mainline even after the gcc-interface/ refactoring.  (Will of
course bring it up to head and submit it once I've got it working... who knows
if it'll make stage 1 though.)  I've attached a copy of my full working diff,
but it's largely extraneous; the critical part is the section that sets the
variables for the Cygwin target, which after my changes looks like:

---------------------------<snip>---------------------------
ifeq ($(strip $(filter-out cygwin% mingw% pe,$(osys))),)

 [ ... snip irrelevant part ... ]

  ifneq ($(strip $(filter cygwin%,$(osys))),)
    W32_TARG=cygwin
    LIBGNAT_TARGET_PAIRS = \
    s-taspri.ads<s-taspri-posix.ads \
    s-tasinf.adb<s-tasinf-linux.adb \
    s-tasinf.ads<s-tasinf-linux.ads \
    s-intman.adb<s-intman-posix.adb \
    s-tpopsp.adb<s-tpopsp-posix-foreign.adb \
    s-osprim.adb<s-osprim-posix.adb \
    s-osinte.adb<s-osinte-posix.adb
  endif

  LIBGNAT_TARGET_PAIRS += \
  a-excpol.adb<a-excpol-abort.adb \
  a-numaux.adb<a-numaux-x86.adb \
  a-numaux.ads<a-numaux-x86.ads \
  s-gloloc.adb<s-gloloc-mingw.adb \
  s-inmaop.adb<s-inmaop-dummy.adb \
  g-bytswa.adb<g-bytswa-x86.adb \
  g-stsifd.adb<g-stsifd-sockets.adb \
  g-soccon.ads<g-soccon-$(W32_TARG).ads \

  ifeq ($(strip $(filter-out rtx_w32 rtx_rtss,$(THREAD_KIND))),)

 [ ... snip irrelevant part ... ]

  else
    LIBGNAT_TARGET_PAIRS += \
    a-exetim.adb<a-exetim-mingw.adb \
    a-exetim.ads<a-exetim-mingw.ads \
    a-intnam.ads<a-intnam-$(W32_TARG).ads \
    s-osinte.ads<s-osinte-$(W32_TARG).ads \
    s-taprop.adb<s-taprop-$(W32_TARG).adb \
    system.ads<system-$(W32_TARG).ads

    EXTRA_GNATRTL_NONTASKING_OBJS = g-regist.o
    EXTRA_GNATRTL_TASKING_OBJS=a-exetim.o

    # Which install goal to use.
    INSTALL_GNATLIB_MAIN  = unused-install-gnatlib
    INSTALL_GNATLIB_WIN32 = install-gnatlib

    # Mingw uses winsock-based sockets; cygwin uses POSIX sockets.
    ifneq ($(strip $(filter-out cygwin%,$(osys))),)
 [ ... snip irrelevant part ... ]
    endif

    # Set shared lib prefix (lib for mingw, cyg for cygwin)
    WIN32_SHARED_LIB_PREFIX=lib
    ifneq ($(strip $(filter cygwin%,$(osys))),)
      WIN32_SHARED_LIB_PREFIX=cyg
    endif

    # ??? 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
  endif

  TOOLS_TARGET_PAIRS= \
  mlib-tgt-specific.adb<mlib-tgt-$(W32_TARG).adb \
  indepsw.adb<indepsw-$(W32_TARG).adb

  EH_MECHANISM=-gcc
  GMEM_LIB = gmemlib
  PREFIX_OBJS = $(PREFIX_REAL_OBJS)
  EXTRA_GNATTOOLS = ../../gnatdll$(exeext)
  EXTRA_GNATMAKE_OBJS = mdll.o mdll-utl.o mdll-fil.o
  soext = .dll
  LIBRARY_VERSION := $(LIB_VERSION)
endif
---------------------------<snip>---------------------------

  Can anyone offer me any advice to help me better understand what must have
gone wrong for this error message to appear, which might give me a clue how to
fix it?

    cheers,
      DaveK


[-- Attachment #2: gcc-4_3-working.diff --]
[-- Type: text/x-c, Size: 9937 bytes --]

--- origsrc/gcc-4.3.4/gcc/ada/Makefile.in	2009-02-28 17:30:26.000000000 +0000
+++ src/gcc-4.3.4/gcc/ada/Makefile.in	2009-09-08 02:48:54.843750000 +0100
@@ -198,6 +198,10 @@ TARGET_ADA_SRCS =
 # Type of tools build we are doing; default is not compiling tools.
 TOOLSCASE =
 
+# Which install goal to use.
+INSTALL_GNATLIB_MAIN  = install-gnatlib
+INSTALL_GNATLIB_WIN32 = unused-install-gnatlib
+
 # End of variables for you to override.
 
 all: all.indirect
@@ -273,7 +277,7 @@ ADA_INCLUDES_FOR_SUBDIR = -I. -I$(fsrcdi
 	$(CC) -c -x assembler $< $(OUTPUT_OPTION)
 
 .c.o:
-	$(CC) -c $(ALL_CFLAGS) $(ADA_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< \
+	$(CC) -c $(ALL_CFLAGS) $(ALL_ADA_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< \
 	  $(OUTPUT_OPTION)
 
 .adb.o:
@@ -1298,24 +1302,42 @@ endif
   LIBRARY_VERSION := $(subst .,_,$(LIB_VERSION))
 endif
 
-ifeq ($(strip $(filter-out cygwin32% mingw32% pe,$(osys))),)
+ifeq ($(strip $(filter-out cygwin% mingw% pe,$(osys))),)
+
+  # Set target pair suffix for mingw or cygwin
+  W32_TARG=mingw
   LIBGNAT_TARGET_PAIRS = \
-  a-dirval.adb<a-dirval-mingw.adb \
+  a-dirval.adb<a-dirval-$(W32_TARG).adb \
+  s-memory.adb<s-memory-$(W32_TARG).adb \
+  s-taspri.ads<s-taspri-$(W32_TARG).ads \
+  s-tasinf.adb<s-tasinf-$(W32_TARG).adb \
+  s-tasinf.ads<s-tasinf-$(W32_TARG).ads \
+  g-soliop.ads<g-soliop-$(W32_TARG).ads \
+  s-intman.adb<s-intman-$(W32_TARG).adb \
+  s-osprim.adb<s-osprim-$(W32_TARG).adb \
+  s-interr.adb<s-interr-sigaction.adb
+
+  ifneq ($(strip $(filter cygwin%,$(osys))),)
+    W32_TARG=cygwin
+    LIBGNAT_TARGET_PAIRS = \
+    s-taspri.ads<s-taspri-posix.ads \
+    s-tasinf.adb<s-tasinf-linux.adb \
+    s-tasinf.ads<s-tasinf-linux.ads \
+    s-intman.adb<s-intman-posix.adb \
+    s-tpopsp.adb<s-tpopsp-posix-foreign.adb \
+    s-osprim.adb<s-osprim-posix.adb \
+    s-osinte.adb<s-osinte-posix.adb
+  endif
+
+  LIBGNAT_TARGET_PAIRS += \
   a-excpol.adb<a-excpol-abort.adb \
   a-numaux.adb<a-numaux-x86.adb \
   a-numaux.ads<a-numaux-x86.ads \
   s-gloloc.adb<s-gloloc-mingw.adb \
   s-inmaop.adb<s-inmaop-dummy.adb \
-  s-memory.adb<s-memory-mingw.adb \
-  s-taspri.ads<s-taspri-mingw.ads \
-  s-tasinf.adb<s-tasinf-mingw.adb \
-  s-tasinf.ads<s-tasinf-mingw.ads \
   g-bytswa.adb<g-bytswa-x86.adb \
-  g-socthi.ads<g-socthi-mingw.ads \
-  g-socthi.adb<g-socthi-mingw.adb \
   g-stsifd.adb<g-stsifd-sockets.adb \
-  g-soccon.ads<g-soccon-mingw.ads \
-  g-soliop.ads<g-soliop-mingw.ads
+  g-soccon.ads<g-soccon-$(W32_TARG).ads \
 
   ifeq ($(strip $(filter-out rtx_w32 rtx_rtss,$(THREAD_KIND))),)
     LIBGNAT_TARGET_PAIRS += \
@@ -1331,18 +1353,31 @@ ifeq ($(strip $(filter-out cygwin32% min
     LIBGNAT_TARGET_PAIRS += \
     a-exetim.adb<a-exetim-mingw.adb \
     a-exetim.ads<a-exetim-mingw.ads \
-    a-intnam.ads<a-intnam-mingw.ads \
-    s-interr.adb<s-interr-sigaction.adb \
-    s-intman.adb<s-intman-mingw.adb \
-    s-osinte.ads<s-osinte-mingw.ads \
-    s-osprim.adb<s-osprim-mingw.adb \
-    s-taprop.adb<s-taprop-mingw.adb \
-    system.ads<system-mingw.ads
+    a-intnam.ads<a-intnam-$(W32_TARG).ads \
+    s-osinte.ads<s-osinte-$(W32_TARG).ads \
+    s-taprop.adb<s-taprop-$(W32_TARG).adb \
+    system.ads<system-$(W32_TARG).ads
 
     EXTRA_GNATRTL_NONTASKING_OBJS = g-regist.o
     EXTRA_GNATRTL_TASKING_OBJS=a-exetim.o
 
-    MISCLIB = -lwsock32
+    # Which install goal to use.
+    INSTALL_GNATLIB_MAIN  = unused-install-gnatlib
+    INSTALL_GNATLIB_WIN32 = install-gnatlib
+
+    # Mingw uses winsock-based sockets; cygwin uses POSIX sockets.
+    ifneq ($(strip $(filter-out cygwin%,$(osys))),)
+      LIBGNAT_TARGET_PAIRS += \
+      g-socthi.ads<g-socthi-$(W32_TARG).ads \
+      g-socthi.adb<g-socthi-$(W32_TARG).adb
+      MISCLIB = -lwsock32
+    endif
+
+    # Set shared lib prefix (lib for mingw, cyg for cygwin)
+    WIN32_SHARED_LIB_PREFIX=lib
+    ifneq ($(strip $(filter cygwin%,$(osys))),)
+      WIN32_SHARED_LIB_PREFIX=cyg
+    endif
 
     # ??? This will be replaced by gnatlib-shared-dual-win32 when GNAT
     # auto-import support for array/record will be done.
@@ -1350,9 +1385,10 @@ ifeq ($(strip $(filter-out cygwin32% min
   endif
 
   TOOLS_TARGET_PAIRS= \
-  mlib-tgt-specific.adb<mlib-tgt-mingw.adb \
-  indepsw.adb<indepsw-mingw.adb
+  mlib-tgt-specific.adb<mlib-tgt-$(W32_TARG).adb \
+  indepsw.adb<indepsw-$(W32_TARG).adb
 
+  EH_MECHANISM=-gcc
   GMEM_LIB = gmemlib
   PREFIX_OBJS = $(PREFIX_REAL_OBJS)
   EXTRA_GNATTOOLS = ../../gnatdll$(exeext)
@@ -1797,7 +1833,7 @@ gnatbl.o: gnatbl.c adaint.h
 	  true; \
 	fi
 
-install-gnatlib: ../stamp-gnatlib
+$(INSTALL_GNATLIB_MAIN): ../stamp-gnatlib
 #	Create the directory before deleting it, in case the directory is
 #	a list of directories (as it may be on VMS). This ensures we are
 #	deleting the right one.
@@ -1839,6 +1875,48 @@ install-gnatlib: ../stamp-gnatlib
 	cd $(DESTDIR)$(ADA_INCLUDE_DIR); $(CHMOD) a-wx *.adb
 	cd $(DESTDIR)$(ADA_INCLUDE_DIR); $(CHMOD) a-wx *.ads
 
+$(INSTALL_GNATLIB_WIN32): ../stamp-gnatlib
+#	Create the directory before deleting it, in case the directory is
+#	a list of directories (as it may be on VMS). This ensures we are
+#	deleting the right one.  This is the win32 version.
+	-$(MKDIR) $(DESTDIR)$(ADA_RTL_OBJ_DIR)
+	-$(MKDIR) $(DESTDIR)$(ADA_INCLUDE_DIR)
+	$(RMDIR) $(DESTDIR)$(ADA_RTL_OBJ_DIR)
+	$(RMDIR) $(DESTDIR)$(ADA_INCLUDE_DIR)
+	-$(MKDIR) $(DESTDIR)$(ADA_RTL_OBJ_DIR)
+	-$(MKDIR) $(DESTDIR)$(ADA_INCLUDE_DIR)
+	for file in rts/*.ali; do \
+	    $(INSTALL_DATA_DATE) $$file $(DESTDIR)$(ADA_RTL_OBJ_DIR); \
+	done
+	-$(INSTALL_DATA) rts/g-trasym$(objext) $(DESTDIR)$(ADA_RTL_OBJ_DIR)
+	-cd rts; for file in *$(arext);do \
+	    $(INSTALL_DATA) $$file $(DESTDIR)$(ADA_RTL_OBJ_DIR); \
+	    $(RANLIB_FOR_TARGET) $(DESTDIR)$(ADA_RTL_OBJ_DIR)/$$file; \
+	done
+	-$(foreach file, $(EXTRA_ADALIB_FILES), \
+	    $(INSTALL_DATA_DATE) rts/$(file) $(DESTDIR)$(ADA_RTL_OBJ_DIR) && \
+	) true
+#     Install the shared libraries, if any, using $(INSTALL) instead
+#     of $(INSTALL_DATA). The latter may force a mode inappropriate
+#     for shared libraries on some targets, e.g. on HP-UX where the x
+#     permission is required.  We are win32 here.
+	for file in gnat gnarl; do \
+	   if [ -f rts/$(WIN32_SHARED_LIB_PREFIX)$${file}$(hyphen)$(LIBRARY_VERSION)$(soext) ]; then \
+	      $(INSTALL) rts/$(WIN32_SHARED_LIB_PREFIX)$${file}$(hyphen)$(LIBRARY_VERSION)$(soext) \
+			 $(DESTDIR)$(bindir); \
+	   fi; \
+	   if [ -f rts/$(WIN32_SHARED_LIB_PREFIX)$${file}$(soext) ]; then \
+	      $(LN_S) $(WIN32_SHARED_LIB_PREFIX)$${file}$(hyphen)$(LIBRARY_VERSION)$(soext) \
+	      $(DESTDIR)$(bindir)/lib$${file}$(soext); \
+	   fi; \
+	done
+# This copy must be done preserving the date on the original file.
+	for file in rts/*.ad?; do \
+	    $(INSTALL_DATA_DATE) $$file $(DESTDIR)$(ADA_INCLUDE_DIR); \
+	done
+	cd $(DESTDIR)$(ADA_INCLUDE_DIR); $(CHMOD) a-wx *.adb
+	cd $(DESTDIR)$(ADA_INCLUDE_DIR); $(CHMOD) a-wx *.ads
+
 ../stamp-gnatlib2:
 	$(RM) rts/s-*.ali
 	$(RM) rts/s-*$(objext)
@@ -1995,14 +2073,18 @@ gnatlib-shared-win32:
              gnatlib
 	$(RM) rts/libgna*$(soext)
 	cd rts; ../../xgcc -B../../ -shared $(TARGET_LIBGCC2_CFLAGS) \
-		-o libgnat$(hyphen)$(LIBRARY_VERSION)$(soext) \
+		-o $(WIN32_SHARED_LIB_PREFIX)gnat$(hyphen)$(LIBRARY_VERSION)$(soext) \
+		-Wl,--out-implib,libgnat$(soext)$(arext) \
 		$(GNATRTL_NONTASKING_OBJS) $(LIBGNAT_OBJS) \
-		$(SO_OPTS)libgnat$(hyphen)$(LIBRARY_VERSION)$(soext) $(MISCLIB)
+		$(SO_OPTS)$(WIN32_SHARED_LIB_PREFIX)gnat$(hyphen)$(LIBRARY_VERSION)$(soext) $(MISCLIB) \
+		-Wl,--enable-auto-import
 	cd rts; ../../xgcc -B../../ -shared $(TARGET_LIBGCC2_CFLAGS) \
-		-o libgnarl$(hyphen)$(LIBRARY_VERSION)$(soext) \
+		-o $(WIN32_SHARED_LIB_PREFIX)gnarl$(hyphen)$(LIBRARY_VERSION)$(soext) \
+		-Wl,--out-implib,libgnarl$(soext)$(arext) \
 		$(GNATRTL_TASKING_OBJS) \
-		$(SO_OPTS)libgnarl$(hyphen)$(LIBRARY_VERSION)$(soext) \
-		$(THREADSLIB) -Wl,libgnat$(hyphen)$(LIBRARY_VERSION)$(soext)
+		$(SO_OPTS)$(WIN32_SHARED_LIB_PREFIX)gnarl$(hyphen)$(LIBRARY_VERSION)$(soext) $(MISCLIB) \
+		-L. $(THREADSLIB) -Wl,libgnat$(soext)$(arext) \
+		-Wl,--enable-auto-import
 
 gnatlib-shared-darwin:
 	$(MAKE) $(FLAGS_TO_PASS) \
@@ -2186,37 +2268,37 @@ raise.o   : raise.c raise.h
 vx_stack_info.o : vx_stack_info.c
 
 gen-soccon: gen-soccon.c gsocket.h
-	$(CC) $(ALL_CFLAGS) $(ADA_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
+	$(CC) $(ALL_CFLAGS) $(ALL_ADA_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
 		-UIN_GCC -DTARGET=\"$(target_alias)\" \
 		$< $(OUTPUT_OPTION)
 
 cio.o     : cio.c
-	$(CC) -c $(ALL_CFLAGS) $(ADA_CFLAGS) \
+	$(CC) -c $(ALL_CFLAGS) $(ALL_ADA_CFLAGS) \
 	         $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
 
 init.o    : init.c adaint.h raise.h
-	$(CC) -c $(ALL_CFLAGS) $(ADA_CFLAGS) \
+	$(CC) -c $(ALL_CFLAGS) $(ALL_ADA_CFLAGS) \
 	         $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
 
 initialize.o : initialize.c raise.h
-	$(CC) -c $(ALL_CFLAGS) $(ADA_CFLAGS) \
+	$(CC) -c $(ALL_CFLAGS) $(ALL_ADA_CFLAGS) \
 	         $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
 
 targext.o : targext.c
-	$(CC) -c $(ALL_CFLAGS) $(ADA_CFLAGS) \
+	$(CC) -c $(ALL_CFLAGS) $(ALL_ADA_CFLAGS) \
 		$(ALL_CPPFLAGS) $(INCLUDES_FOR_SUBDIR) \
 		$< $(OUTPUT_OPTION)
 
 # No optimization to compile this file as optimizations (-O1 or above) breaks
 # the SEH handling on Windows. The reasons are not clear.
 seh_init.o : seh_init.c raise.h
-	$(CC) -c $(ALL_CFLAGS) $(ADA_CFLAGS) -O0 \
+	$(CC) -c $(ALL_CFLAGS) $(ALL_ADA_CFLAGS) -O0 \
 	         $(ALL_CPPFLAGS) $(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
-	$(CC) -c $(ALL_CFLAGS) $(ADA_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
+	$(CC) -c $(ALL_CFLAGS) $(ALL_ADA_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
 	      -fno-omit-frame-pointer $< $(OUTPUT_OPTION)
 
 # In GNU Make, ignore whether `stage*' exists.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: GNAT mysterious "missing stub for subunit" error.
  2009-09-08  6:08 GNAT mysterious "missing stub for subunit" error Dave Korn
@ 2009-09-08  8:51 ` Laurent GUERBY
  2009-09-08 11:08   ` Dave Korn
  0 siblings, 1 reply; 10+ messages in thread
From: Laurent GUERBY @ 2009-09-08  8:51 UTC (permalink / raw)
  To: Dave Korn; +Cc: gcc

On Tue, 2009-09-08 at 07:21 +0100, Dave Korn wrote:
>   EH_MECHANISM=-gcc

I don't think this is correct for windows targets:
EH_MECHANISM must be left to its original empty
definition to get sjlj exceptions which are the only
one working on windows IIRC.

Sincerely,

Laurent



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: GNAT mysterious "missing stub for subunit" error.
  2009-09-08  8:51 ` Laurent GUERBY
@ 2009-09-08 11:08   ` Dave Korn
  2009-09-08 11:23     ` Eric Botcazou
  0 siblings, 1 reply; 10+ messages in thread
From: Dave Korn @ 2009-09-08 11:08 UTC (permalink / raw)
  To: Laurent GUERBY; +Cc: Dave Korn, gcc

Laurent GUERBY wrote:
> On Tue, 2009-09-08 at 07:21 +0100, Dave Korn wrote:
>>   EH_MECHANISM=-gcc
> 
> I don't think this is correct for windows targets:
> EH_MECHANISM must be left to its original empty
> definition to get sjlj exceptions which are the only
> one working on windows IIRC.

  I was planning to do whatever's needed to make it work on windows.  I don't
think this line cause the build failure, because it certainly appeared to
work, when I tried it on 4.3.2 (without all the other changes to the target
pair list); but for some reason the same trick isn't working on 4.3.4.

    cheers,
      DaveK

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: GNAT mysterious "missing stub for subunit" error.
  2009-09-08 11:08   ` Dave Korn
@ 2009-09-08 11:23     ` Eric Botcazou
  2009-09-08 11:50       ` Dave Korn
  0 siblings, 1 reply; 10+ messages in thread
From: Eric Botcazou @ 2009-09-08 11:23 UTC (permalink / raw)
  To: Dave Korn; +Cc: gcc, Laurent GUERBY

>   I was planning to do whatever's needed to make it work on windows.  I
> don't think this line cause the build failure, because it certainly
> appeared to work, when I tried it on 4.3.2 (without all the other changes
> to the target pair list); but for some reason the same trick isn't working
> on 4.3.4.

I'd do things step by step, i.e. first try to have a full cygwin port without 
changing the EH mechanism, then change it.

-- 
Eric Botcazou

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: GNAT mysterious "missing stub for subunit" error.
  2009-09-08 11:23     ` Eric Botcazou
@ 2009-09-08 11:50       ` Dave Korn
  2009-09-08 13:28         ` Eric Botcazou
  0 siblings, 1 reply; 10+ messages in thread
From: Dave Korn @ 2009-09-08 11:50 UTC (permalink / raw)
  To: Eric Botcazou; +Cc: Dave Korn, gcc, Laurent GUERBY

Eric Botcazou wrote:
>>   I was planning to do whatever's needed to make it work on windows.  I
>> don't think this line cause the build failure, because it certainly
>> appeared to work, when I tried it on 4.3.2 (without all the other changes
>> to the target pair list); but for some reason the same trick isn't working
>> on 4.3.4.
> 
> I'd do things step by step, i.e. first try to have a full cygwin port without 
> changing the EH mechanism, then change it.
> 

  That's what I am doing, kind of, just the other way round.  In 4.3.2 I
compiled the existing port and switched it over to ZCX, and it worked well
enough to pass most of the testsuite, including EH.  Now I'm changing the
target pairs on top of that and suddenly it's complaining, which is why I'm
confused; I thought that bit was stable.

  Guess I could try backing out the EH changes and seeing what happens.  Still
don't understand what the compiler's trying to tell me is wrong though.

    cheers,
      DaveK

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: GNAT mysterious "missing stub for subunit" error.
  2009-09-08 11:50       ` Dave Korn
@ 2009-09-08 13:28         ` Eric Botcazou
  2009-09-08 15:09           ` Dave Korn
  0 siblings, 1 reply; 10+ messages in thread
From: Eric Botcazou @ 2009-09-08 13:28 UTC (permalink / raw)
  To: Dave Korn; +Cc: gcc, Laurent GUERBY

>   That's what I am doing, kind of, just the other way round.  In 4.3.2 I
> compiled the existing port and switched it over to ZCX, and it worked well
> enough to pass most of the testsuite, including EH.  Now I'm changing the
> target pairs on top of that and suddenly it's complaining, which is why I'm
> confused; I thought that bit was stable.

Your .diff contains this

+  EH_MECHANISM=-gcc

so it looks as though the base compiler was SJLJ.

-- 
Eric Botcazou

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: GNAT mysterious "missing stub for subunit" error.
  2009-09-08 13:28         ` Eric Botcazou
@ 2009-09-08 15:09           ` Dave Korn
  2009-09-23 19:38             ` Why Ada always seems to want to devolve from ZCX back to SJLJ: the mystery explained [was Re: GNAT mysterious "missing stub for subunit" error. ] Dave Korn
  0 siblings, 1 reply; 10+ messages in thread
From: Dave Korn @ 2009-09-08 15:09 UTC (permalink / raw)
  To: Eric Botcazou; +Cc: Dave Korn, gcc, Laurent GUERBY

Eric Botcazou wrote:
>>   That's what I am doing, kind of, just the other way round.  In 4.3.2 I
>> compiled the existing port and switched it over to ZCX, and it worked well
>> enough to pass most of the testsuite, including EH.  Now I'm changing the
>> target pairs on top of that and suddenly it's complaining, which is why I'm
>> confused; I thought that bit was stable.
> 
> Your .diff contains this
> 
> +  EH_MECHANISM=-gcc
> 
> so it looks as though the base compiler was SJLJ.
> 

  Ah, bingo!  Thanks Eric; yes, I have a recent build of an SJLJ Gnat from
HEAD lying around my PATH ahead of my old 4.3.2-with-ZCX.  Getting that out of
the way should help!

    cheers,
      DaveK

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Why Ada always seems to want to devolve from ZCX back to SJLJ: the  mystery explained [was  Re: GNAT mysterious "missing stub for subunit" error.  ]
  2009-09-08 15:09           ` Dave Korn
@ 2009-09-23 19:38             ` Dave Korn
  2009-09-23 21:06               ` Eric Botcazou
  0 siblings, 1 reply; 10+ messages in thread
From: Dave Korn @ 2009-09-23 19:38 UTC (permalink / raw)
  To: Dave Korn; +Cc: Eric Botcazou, gcc, Laurent GUERBY

Dave Korn wrote:
> Eric Botcazou wrote:
>> Your .diff contains this
>>
>> +  EH_MECHANISM=-gcc
>>
>> so it looks as though the base compiler was SJLJ.
>
>   Ah, bingo!  Thanks Eric; yes, I have a recent build of an SJLJ Gnat from
> HEAD lying around my PATH ahead of my old 4.3.2-with-ZCX.  Getting that out of
> the way should help!

  And although it turns out that was the case, it didn't actually solve the
problem.  It turns out to be a horribly subtle artifact of this factor:

> switched it over to ZCX, and it worked well
> enough to pass most of the testsuite, including EH.  Now I'm changing the
> target pairs on top of that and suddenly it's complaining, which is why I'm
> confused; I thought that bit was stable.

  This was driving me mad, I had a perfectly working ZCX compiler but every
time I tried to change anything, it mysteriously switched itself back to SJLJ
for seemingly no reason at all and then failed building target-libada as a
consequence.  The thing was down to the particular way in which I was setting
the LIBGNAT_TARGET_PAIRS variable; because of the way Cygwin and MinGW share
most of their port implementation, I was doing this:

  LIBGNAT_TARGET_PAIRS = \
    [ ... overrides only for mingw ... ]
  if (  ... target is cygwin ... )
    # blank it out, no cygwin-only overrides yet
    LIBGNAT_TARGET_PAIRS =
  endif
  LIBGNAT_TARGET_PAIRS += \
    [ ... common overrides ... ]

  And the result of doing it this way was that LIBGNAT_TARGET_PAIRS ended up
with an embedded leading space.  This wouldn't have mattered much, except for
one little thing: later, in gcc-interface/Makefile.in, we have ...

ifeq ($(filter-out a-except%,$(LIBGNAT_TARGET_PAIRS)),$(LIBGNAT_TARGET_PAIRS))
  LIBGNAT_TARGET_PAIRS += \
    a-except.ads<a-except-2005.ads \
    a-except.adb<a-except-2005.adb
endif

... and the $(filter-out) function has an implicit $(strip) operation, and as
a result even though the filter-out doesn't remove anything from
LIBGNAT_TARGET_PAIRS (because this is indeed supposed to be a ZCX compiler
we're building and it doesn't yet have any override for a-except.*), the
result doesn't match because the leading blank is missing.  And so the
compiler would revert to SJLJ!

  Is it just a bug for me to generate LIBGNAT_TARGET_PAIRS in a way that has
superfluous spaces (whether leading, trailing or embedded), or shall I send a
patch to add a $(strip) to the right-hand side of the ifeq comparison?  Or
perhaps we should do

LIBGNAT_TARGET_PAIRS:=$(strip $(LIBGNAT_TARGET_PAIRS))

right at the top-level, just after the per-target chunks, to ensure the string
is properly normalised before any further tests and comparisons we might want
to make?

    cheers,
      DaveK

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Why Ada always seems to want to devolve from ZCX back to SJLJ: the mystery explained [was  Re: GNAT mysterious "missing stub for subunit" error. ]
  2009-09-23 19:38             ` Why Ada always seems to want to devolve from ZCX back to SJLJ: the mystery explained [was Re: GNAT mysterious "missing stub for subunit" error. ] Dave Korn
@ 2009-09-23 21:06               ` Eric Botcazou
  2009-09-23 21:55                 ` Dave Korn
  0 siblings, 1 reply; 10+ messages in thread
From: Eric Botcazou @ 2009-09-23 21:06 UTC (permalink / raw)
  To: Dave Korn; +Cc: gcc, Laurent GUERBY

>   Is it just a bug for me to generate LIBGNAT_TARGET_PAIRS in a way that
> has superfluous spaces (whether leading, trailing or embedded), or shall I
> send a patch to add a $(strip) to the right-hand side of the ifeq
> comparison?  Or perhaps we should do
>
> LIBGNAT_TARGET_PAIRS:=$(strip $(LIBGNAT_TARGET_PAIRS))
>
> right at the top-level, just after the per-target chunks, to ensure the
> string is properly normalised before any further tests and comparisons we
> might want to make?

That indeed seems to be a good idea (with a little comment).

-- 
Eric Botcazou

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Why Ada always seems to want to devolve from ZCX back to SJLJ:  the mystery explained [was  Re: GNAT mysterious "missing stub for subunit"  error. ]
  2009-09-23 21:06               ` Eric Botcazou
@ 2009-09-23 21:55                 ` Dave Korn
  0 siblings, 0 replies; 10+ messages in thread
From: Dave Korn @ 2009-09-23 21:55 UTC (permalink / raw)
  To: Eric Botcazou; +Cc: Dave Korn, gcc, Laurent GUERBY

Eric Botcazou wrote:
>>   Is it just a bug for me to generate LIBGNAT_TARGET_PAIRS in a way that
>> has superfluous spaces (whether leading, trailing or embedded), or shall I
>> send a patch to add a $(strip) to the right-hand side of the ifeq
>> comparison?  Or perhaps we should do
>>
>> LIBGNAT_TARGET_PAIRS:=$(strip $(LIBGNAT_TARGET_PAIRS))
>>
>> right at the top-level, just after the per-target chunks, to ensure the
>> string is properly normalised before any further tests and comparisons we
>> might want to make?
> 
> That indeed seems to be a good idea (with a little comment).
> 

  Actually, the test logic is kinda backwards.  We want to know if
LIBGNAT_TARGET_PAIRS contains anything matching a certain pattern, so we
remove anything matching that pattern and then see if the string has changed
or not?  It would seem a bit more direct and to-the-point to just have used
$(filter) instead of $(filter-out) and compare against an empty string, and
that way would have been robust in the face of whitespace changes.  Maybe I'll
rewrite that test as well in the patch.

    cheers,
      DaveK

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2009-09-23 21:55 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-09-08  6:08 GNAT mysterious "missing stub for subunit" error Dave Korn
2009-09-08  8:51 ` Laurent GUERBY
2009-09-08 11:08   ` Dave Korn
2009-09-08 11:23     ` Eric Botcazou
2009-09-08 11:50       ` Dave Korn
2009-09-08 13:28         ` Eric Botcazou
2009-09-08 15:09           ` Dave Korn
2009-09-23 19:38             ` Why Ada always seems to want to devolve from ZCX back to SJLJ: the mystery explained [was Re: GNAT mysterious "missing stub for subunit" error. ] Dave Korn
2009-09-23 21:06               ` Eric Botcazou
2009-09-23 21:55                 ` Dave Korn

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).