On Sun, 14 Apr 2019 at 18:40, Johannes Pfau <johannesp...@gmail.com> wrote:
>
> Even if we disable libphobos (as unsupported in libphobos/configure.tgt
> or using --disable-libphobos), config-lang.in still adds target-libbacktrace
> to the target_libs. This means target-zlib and target-libbacktrace still end 
> up
> being configured. On some embedded toolchains, libbacktrace however fails to 
> configure
> properly. This breaks the GCC build if d is added to --enabled-languages, 
> even if
> phobos is properly marked as unsupported.
>
> As we ideally want --enable-languages=d to work everywhere where
> --enable-languages=c works, this patch makes sure not to modify the 
> target_libs
> in any way if phobos is disabled. Due to the way this is implemented in
> configure.ac (default: configure all target libs, disable those only needed by
> disabled targets) we can not simply conditionally set target_libs. If we do 
> not
> set target_libs, we have to adjust disabled_target_libs instead for this to
> work properly.
>
> noconfigdirs without this patch if phobos is disabled:
> --enable-languages=c: gotools target-libgo target-libphobos target-zlib 
> target-libbacktrace
> --enable-languages=d: gotools target-libgo target-libphobos
> --enable-languages=d,go:
>
> noconfigdirs with this patch if phobos is disabled:
> --enable-languages=c: gotools target-libgo target-libphobos target-zlib 
> target-libbacktrace
> --enable-languages=d: gotools target-libgo target-libphobos target-zlib 
> target-libbacktrace
> --enable-languages=d,go: target-libphobos target-zlib
>
> Originally reviewed and tested here: 
> https://github.com/D-Programming-GDC/gcc/pull/11
>

OK, but for want of a better way to do this.  However I think its
right to have better support for targets without libphobos.

I've attached a couple knit changes.

-- 
Iain
---
diff --git a/gcc/d/config-lang.in b/gcc/d/config-lang.in
index 3fe1ac42f92..a3f78c7e6f9 100644
--- a/gcc/d/config-lang.in
+++ b/gcc/d/config-lang.in
@@ -25,7 +25,25 @@ language="d"
 
 compilers="d21\$(exeext)"
 
-target_libs="target-libphobos target-zlib target-libbacktrace"
+phobos_target_deps="target-zlib target-libbacktrace"
+phobos_target_libs="target-libphobos $phobos_target_deps"
+
+case "${noconfigdirs}" in
+  # Check if phobos was disabled as unsupported
+  *target-libphobos*)
+    disabled_target_libs="$disabled_target_libs $phobos_target_deps"
+    ;;
+  *)
+    # The --disable-<component> handler in configure.ac is called after
+    # config-lang.in. So when using --disable-libphobos, it has not been
+    # added to noconfigdirs here yet
+    if test x${enable_libphobos} != xno; then
+      target_libs="$phobos_target_libs"
+    else
+      disabled_target_libs="$disabled_target_libs $phobos_target_libs"
+    fi
+    ;;
+esac
 
 gtfiles="\$(srcdir)/d/d-tree.h \$(srcdir)/d/d-builtins.cc \$(srcdir)/d/d-lang.cc \$(srcdir)/d/modules.cc \$(srcdir)/d/typeinfo.cc"
 

Reply via email to