package/libunwind: link to libgcc_s, not libgcc
authorYann E. MORIN <yann.morin.1998@free.fr>
Sun, 16 Nov 2014 13:29:55 +0000 (14:29 +0100)
committerPeter Korsgaard <peter@korsgaard.com>
Sun, 16 Nov 2014 23:11:51 +0000 (00:11 +0100)
Backport a fix from upstream to link against libgcc_s instead of libgcc.

Fixes ltrace build failures:
    http://autobuild.buildroot.net/results/a0c/a0c132f8cdea2c34ceff27606764a60c2853f644/
    http://autobuild.buildroot.net/results/67f/67fbd04d6ae187861fa1bf84d3df1877c7be6fb2/
    http://autobuild.buildroot.net/results/0ca/0ca564101b870e5953acb66ac832ce9e23198392/
    ...

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
package/libunwind/0001-disable-tests.patch [new file with mode: 0644]
package/libunwind/0002-Add-AO_REQUIRE_CAS-to-fix-build-on-ARM-v6.patch [new file with mode: 0644]
package/libunwind/0003-Link-libunwind-to-libgcc_s-rather-than-libgcc.patch [new file with mode: 0644]
package/libunwind/libunwind-01-disable-tests.patch [deleted file]
package/libunwind/libunwind-02-Add-AO_REQUIRE_CAS-to-fix-build-on-ARM-v6.patch [deleted file]

diff --git a/package/libunwind/0001-disable-tests.patch b/package/libunwind/0001-disable-tests.patch
new file mode 100644 (file)
index 0000000..05475a5
--- /dev/null
@@ -0,0 +1,32 @@
+Disable building of tests
+
+libunwind tests do not build with uClibc, so we disable them.
+
+Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+
+Index: b/Makefile.am
+===================================================================
+--- a/Makefile.am
++++ b/Makefile.am
+@@ -36,7 +36,7 @@
+ nodist_include_HEADERS = include/libunwind-common.h
+-SUBDIRS = src tests doc
++SUBDIRS = src doc
+ noinst_HEADERS = include/dwarf.h include/dwarf_i.h include/dwarf-eh.h \
+       include/compiler.h include/libunwind_i.h include/mempool.h      \
+Index: b/Makefile.in
+===================================================================
+--- a/Makefile.in
++++ b/Makefile.in
+@@ -313,7 +313,7 @@
+       $(am__append_7) $(am__append_8) $(am__append_9) \
+       $(am__append_10)
+ nodist_include_HEADERS = include/libunwind-common.h
+-SUBDIRS = src tests doc
++SUBDIRS = src doc
+ noinst_HEADERS = include/dwarf.h include/dwarf_i.h include/dwarf-eh.h \
+       include/compiler.h include/libunwind_i.h include/mempool.h      \
+       include/remote.h                                                \
diff --git a/package/libunwind/0002-Add-AO_REQUIRE_CAS-to-fix-build-on-ARM-v6.patch b/package/libunwind/0002-Add-AO_REQUIRE_CAS-to-fix-build-on-ARM-v6.patch
new file mode 100644 (file)
index 0000000..2a37ed7
--- /dev/null
@@ -0,0 +1,56 @@
+From 24484e80b3e329c9edee1995e102f8612eedb79c Mon Sep 17 00:00:00 2001
+From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+Date: Tue, 13 May 2014 23:32:27 +0200
+Subject: [PATCH] Add AO_REQUIRE_CAS to fix build on ARM < v6
+
+ARM earlier than ARMv6, such as ARMv4 and ARMv5 do not provide
+optimize atomic operations in libatomic_ops. Since libunwind is using
+such operations, it should define AO_REQUIRE_CAS before including
+<atomic_ops.h> so that libatomic_ops knows it should use emulated
+atomic operations instead (even though they are obviously a lot more
+expensive).
+
+Also, while real atomic operations are all inline functions and
+therefore linking against libatomic_ops was not required, the emulated
+atomic operations actually require linking against libatomic_ops, so
+the commented AC_CHECK_LIB test in acinclude.m4 is uncommented to make
+sure we link against libatomic_ops.
+
+Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+---
+ acinclude.m4          | 8 +-------
+ include/libunwind_i.h | 1 +
+ 2 files changed, 2 insertions(+), 7 deletions(-)
+
+diff --git a/acinclude.m4 b/acinclude.m4
+index 497f7c2..9c15af1 100644
+--- a/acinclude.m4
++++ b/acinclude.m4
+@@ -22,11 +22,5 @@ fi])
+ AC_DEFUN([CHECK_ATOMIC_OPS],
+ [dnl Check whether the system has the atomic_ops package installed.
+   AC_CHECK_HEADERS(atomic_ops.h)
+-#
+-# Don't link against libatomic_ops for now.  We don't want libunwind
+-# to depend on libatomic_ops.so.  Fortunately, none of the platforms
+-# we care about so far need libatomic_ops.a (everything is done via
+-# inline macros).
+-#
+-#  AC_CHECK_LIB(atomic_ops, main)
++  AC_CHECK_LIB(atomic_ops, main)
+ ])
+diff --git a/include/libunwind_i.h b/include/libunwind_i.h
+index 23f615e..deabdfd 100644
+--- a/include/libunwind_i.h
++++ b/include/libunwind_i.h
+@@ -95,6 +95,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.  */
+       (pthread_mutex_unlock != NULL ? pthread_mutex_unlock (l) : 0)
+ #ifdef HAVE_ATOMIC_OPS_H
++# define AO_REQUIRE_CAS
+ # include <atomic_ops.h>
+ static inline int
+ cmpxchg_ptr (void *addr, void *old, void *new)
+-- 
+1.9.2
+
diff --git a/package/libunwind/0003-Link-libunwind-to-libgcc_s-rather-than-libgcc.patch b/package/libunwind/0003-Link-libunwind-to-libgcc_s-rather-than-libgcc.patch
new file mode 100644 (file)
index 0000000..7ea2512
--- /dev/null
@@ -0,0 +1,41 @@
+From f1684379dfaf8018d5d4c1945e292a56d0fab245 Mon Sep 17 00:00:00 2001
+From: Thierry Reding <treding@nvidia.com>
+Date: Fri, 27 Jun 2014 08:40:33 +0200
+Subject: [PATCH] Link libunwind to libgcc_s rather than libgcc
+
+For some architectures, -lgcc and -lgcc_s are not equivalent. On ARM for
+example, libgcc_s.so.1 contains some symbols needed by libunwind which
+are not present in libgcc.
+
+This causes the following link error when building the X.Org X server
+with libunwind support:
+
+         CCLD     Xorg
+       /usr/lib/libunwind.so: undefined reference to `__aeabi_unwind_cpp_pr0'
+       /usr/lib/libunwind.so: undefined reference to `__aeabi_unwind_cpp_pr1'
+
+Linking against libgcc_s explicitly solves this problem.
+
+Signed-off-by: Thierry Reding <treding@nvidia.com>
+[yann.morin.1998@free.fr: backport to libunwind 1.1]
+Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
+---
+ configure.ac | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/configure.ac b/configure.ac
+index 4e2fd23..a77cf01 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -258,7 +258,7 @@ else
+ if test x$GCC = xyes -a x$intel_compiler != xyes; then
+   CFLAGS="${CFLAGS} -fexceptions -Wall -Wsign-compare"
+-  LIBCRTS="-lgcc"
++  LIBCRTS="-lgcc_s"
+ fi
+ AC_MSG_RESULT([$intel_compiler])
+-- 
+1.9.1
+
diff --git a/package/libunwind/libunwind-01-disable-tests.patch b/package/libunwind/libunwind-01-disable-tests.patch
deleted file mode 100644 (file)
index 05475a5..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-Disable building of tests
-
-libunwind tests do not build with uClibc, so we disable them.
-
-Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
-
-Index: b/Makefile.am
-===================================================================
---- a/Makefile.am
-+++ b/Makefile.am
-@@ -36,7 +36,7 @@
- nodist_include_HEADERS = include/libunwind-common.h
--SUBDIRS = src tests doc
-+SUBDIRS = src doc
- noinst_HEADERS = include/dwarf.h include/dwarf_i.h include/dwarf-eh.h \
-       include/compiler.h include/libunwind_i.h include/mempool.h      \
-Index: b/Makefile.in
-===================================================================
---- a/Makefile.in
-+++ b/Makefile.in
-@@ -313,7 +313,7 @@
-       $(am__append_7) $(am__append_8) $(am__append_9) \
-       $(am__append_10)
- nodist_include_HEADERS = include/libunwind-common.h
--SUBDIRS = src tests doc
-+SUBDIRS = src doc
- noinst_HEADERS = include/dwarf.h include/dwarf_i.h include/dwarf-eh.h \
-       include/compiler.h include/libunwind_i.h include/mempool.h      \
-       include/remote.h                                                \
diff --git a/package/libunwind/libunwind-02-Add-AO_REQUIRE_CAS-to-fix-build-on-ARM-v6.patch b/package/libunwind/libunwind-02-Add-AO_REQUIRE_CAS-to-fix-build-on-ARM-v6.patch
deleted file mode 100644 (file)
index 2a37ed7..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-From 24484e80b3e329c9edee1995e102f8612eedb79c Mon Sep 17 00:00:00 2001
-From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
-Date: Tue, 13 May 2014 23:32:27 +0200
-Subject: [PATCH] Add AO_REQUIRE_CAS to fix build on ARM < v6
-
-ARM earlier than ARMv6, such as ARMv4 and ARMv5 do not provide
-optimize atomic operations in libatomic_ops. Since libunwind is using
-such operations, it should define AO_REQUIRE_CAS before including
-<atomic_ops.h> so that libatomic_ops knows it should use emulated
-atomic operations instead (even though they are obviously a lot more
-expensive).
-
-Also, while real atomic operations are all inline functions and
-therefore linking against libatomic_ops was not required, the emulated
-atomic operations actually require linking against libatomic_ops, so
-the commented AC_CHECK_LIB test in acinclude.m4 is uncommented to make
-sure we link against libatomic_ops.
-
-Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
----
- acinclude.m4          | 8 +-------
- include/libunwind_i.h | 1 +
- 2 files changed, 2 insertions(+), 7 deletions(-)
-
-diff --git a/acinclude.m4 b/acinclude.m4
-index 497f7c2..9c15af1 100644
---- a/acinclude.m4
-+++ b/acinclude.m4
-@@ -22,11 +22,5 @@ fi])
- AC_DEFUN([CHECK_ATOMIC_OPS],
- [dnl Check whether the system has the atomic_ops package installed.
-   AC_CHECK_HEADERS(atomic_ops.h)
--#
--# Don't link against libatomic_ops for now.  We don't want libunwind
--# to depend on libatomic_ops.so.  Fortunately, none of the platforms
--# we care about so far need libatomic_ops.a (everything is done via
--# inline macros).
--#
--#  AC_CHECK_LIB(atomic_ops, main)
-+  AC_CHECK_LIB(atomic_ops, main)
- ])
-diff --git a/include/libunwind_i.h b/include/libunwind_i.h
-index 23f615e..deabdfd 100644
---- a/include/libunwind_i.h
-+++ b/include/libunwind_i.h
-@@ -95,6 +95,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.  */
-       (pthread_mutex_unlock != NULL ? pthread_mutex_unlock (l) : 0)
- #ifdef HAVE_ATOMIC_OPS_H
-+# define AO_REQUIRE_CAS
- # include <atomic_ops.h>
- static inline int
- cmpxchg_ptr (void *addr, void *old, void *new)
--- 
-1.9.2
-