[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#885428: gcc-6: Please add support for building internal libunwind



Source: gcc-6
Version: 6.4.0-11
Severity: normal
Tags: patch
User: debian-ia64@lists.debian.org
Usertags: ia64

Hi!

In order to be able to build a cross-compiler for ia64, we need
to be able to build and use the internal libunwind of gcc as the
external libunwind is not available for cross-builds.

I have added a new flag "with_unwind" which is set in debian/
rules.defs for the case when a cross-compiler is built for the
ia64 target architecture. This "with_unwind" is used in debian/
rules2 to pass either --with-system-libunwind or --with-newlib/
--without-headers to the configure script, the latter are necessary
to set inhibit_libc without which building the internal libunwind
is not possible.

I also added the internal libunwind to debian/rules.sonames and
debian/rules.d/binary-libgcc.mk to install the static and shared
libunwind libraries into libgcc if libgcc built as a shared library.

Unfortunately, I couldn't figure out a clean way to avoid the
double check for ia64-linux == $(DEB_TARGET_GNU_TYPE), but this
is the only way to make sure I'm not breaking anything outside
ia64.

With the patch applied, rebuilding src:gcc-6 provides a gcc-6-source
package which can be used successully to build the package
cross-toolchain-base-ports with the ia64 target enabled which in
turn will allow us to enable ia64 in gcc-7-cross-ports (after
this patch has been added to src:gcc-7 as well).

Thanks,
Adrian

--
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer - glaubitz@debian.org
`. `'   Freie Universitaet Berlin - glaubitz@physik.fu-berlin.de
  `-    GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913
diff -Nru old/gcc-6-6.4.0/debian/rules2 new/gcc-6-6.4.0/debian/rules2
--- old/gcc-6-6.4.0/debian/rules2	2017-12-27 01:32:47.000000000 +0100
+++ new/gcc-6-6.4.0/debian/rules2	2017-12-27 01:59:43.873507119 +0100
@@ -560,7 +560,12 @@
 endif
 
 ifneq (,$(findstring ia64-linux,$(DEB_TARGET_GNU_TYPE)))
-  CONFARGS += --with-system-libunwind
+  ifeq ($(with_unwind),yes)
+      CONFARGS += --with-newlib
+      CONFARGS += --without-headers
+  else
+      CONFARGS += --with-system-libunwind
+  endif
 endif
 
 ifneq (,$(findstring sh4-linux,$(DEB_TARGET_GNU_TYPE)))
diff -Nru old/gcc-6-6.4.0/debian/rules.d/binary-libgcc.mk new/gcc-6-6.4.0/debian/rules.d/binary-libgcc.mk
--- old/gcc-6-6.4.0/debian/rules.d/binary-libgcc.mk	2017-12-27 01:32:47.000000000 +0100
+++ new/gcc-6-6.4.0/debian/rules.d/binary-libgcc.mk	2017-12-27 01:10:46.587608383 +0100
@@ -265,6 +265,9 @@
 	$(if $(filter yes, $(with_qmath)),
 		$(call install_gcc_lib,libquadmath,$(QUADMATH_SONAME),$(1),$(2))
 	)
+	$(if $(filter yes, $(with_unwind)),
+		$(call install_gcc_lib,libunwind,$(UNWIND_SONAME),$(1),$(2))
+	)
 endef
 
 # do_gcc_devels(flavour)
diff -Nru old/gcc-6-6.4.0/debian/rules.defs new/gcc-6-6.4.0/debian/rules.defs
--- old/gcc-6-6.4.0/debian/rules.defs	2017-12-27 01:32:47.000000000 +0100
+++ new/gcc-6-6.4.0/debian/rules.defs	2017-12-27 00:51:30.727647629 +0100
@@ -1481,6 +1481,14 @@
     endif
   endif
 
+  # libunwind -----------------
+  ifneq (,$(findstring ia64-linux,$(DEB_TARGET_GNU_TYPE)))
+    with_unwind := no
+    ifeq ($(DEB_CROSS)-$(with_shared_libgcc),yes-yes)
+      with_unwind := yes
+    endif
+  endif
+
   # Shared libgcc --------------------
   ifneq ($(DEB_STAGE),stage1)
     with_shared_libgcc := yes
diff -Nru old/gcc-6-6.4.0/debian/rules.sonames new/gcc-6-6.4.0/debian/rules.sonames
--- old/gcc-6-6.4.0/debian/rules.sonames	2017-12-27 01:32:47.000000000 +0100
+++ new/gcc-6-6.4.0/debian/rules.sonames	2017-12-27 01:09:51.136178371 +0100
@@ -38,6 +38,8 @@
 	echo TSAN_SONAME=$$v >> $$cache; \
 	v=`tail -1 $(srcdir)/libsanitizer/ubsan/libtool-version | cut -d: -f1`; \
 	echo UBSAN_SONAME=$$v >> $$cache; \
+	v=`tail -1 $(srcdir)/libunwind/unwind/libtool-version | cut -d: -f1`; \
+	echo UNWIND_SONAME=$$v >> $$cache; \
 	v=`awk -F= '/^libtool_VERSION/ {split($$2,v,":"); print v[1]}' \
 		$(srcdir)/libatomic/configure.ac`; \
         v=1; \
@@ -84,6 +86,7 @@
 LSAN_SONAME	= $(call vafilt,$(SONAME_VARS),LSAN_SONAME)
 TSAN_SONAME	= $(call vafilt,$(SONAME_VARS),TSAN_SONAME)
 UBSAN_SONAME	= $(call vafilt,$(SONAME_VARS),UBSAN_SONAME)
+UNWIND_SONAME	= $(call vafilt,$(SONAME_VARS),UNWIND_SONAME)
 VTV_SONAME	= $(call vafilt,$(SONAME_VARS),VTV_SONAME)
 CILKRTS_SONAME	= $(call vafilt,$(SONAME_VARS),CILKRTS_SONAME)
 QUADMATH_SONAME	= $(call vafilt,$(SONAME_VARS),QUADMATH_SONAME)

Reply to: