6 Commits

Author SHA256 Message Date
87dc18d451 Accepting request 1281863 from devel:libraries:c_c++
OBS-URL: https://build.opensuse.org/request/show/1281863
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/libunwind?expand=0&rev=57
2025-06-04 18:27:29 +00:00
e02475422a - 0001-Fix-unw_is_signal_frame-for-RISC-V.patch: Fix unw_is_signal_frame
for RISC-V

OBS-URL: https://build.opensuse.org/package/show/devel:libraries:c_c++/libunwind?expand=0&rev=78
2025-06-02 10:14:58 +00:00
5a4fa40427 Accepting request 1280458 from devel:libraries:c_c++
OBS-URL: https://build.opensuse.org/request/show/1280458
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/libunwind?expand=0&rev=56
2025-05-30 12:27:19 +00:00
57d3a8385c - Update to 1.8.2:
* Rework inline aarch64 as for setcontext
  * Fixed miscompilation of unw_getcontext() on ARM
  * Support -mbranch-protection=pac-ret on aarch64
  * Add unw_is_plt_entry() to public API (fixes FTBFS on QNX)
  * Fix signal handling for QNX aarch64

OBS-URL: https://build.opensuse.org/package/show/devel:libraries:c_c++/libunwind?expand=0&rev=76
2025-05-27 06:54:09 +00:00
4b51dbef9b Accepting request 1267506 from devel:libraries:c_c++
OBS-URL: https://build.opensuse.org/request/show/1267506
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/libunwind?expand=0&rev=55
2025-04-08 15:50:31 +00:00
f01f9328a8 add malloc-prototype.patch from upstream to fix gcc15 compile time error
OBS-URL: https://build.opensuse.org/package/show/devel:libraries:c_c++/libunwind?expand=0&rev=74
2025-04-07 08:15:09 +00:00
8 changed files with 331 additions and 21 deletions

View File

@@ -0,0 +1,27 @@
From 3705baed4ddb5a98138d16dd2effcaeaa7e72db5 Mon Sep 17 00:00:00 2001
From: Andreas Schwab <schwab@suse.de>
Date: Wed, 3 Apr 2024 15:13:16 +0200
Subject: [PATCH] Fix unw_is_signal_frame for RISC-V
Don't require the IP to be 8-byte aligned. Instructions can start at any
even address.
---
src/riscv/Gis_signal_frame.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/riscv/Gis_signal_frame.c b/src/riscv/Gis_signal_frame.c
index 92356343..aba71f5b 100644
--- a/src/riscv/Gis_signal_frame.c
+++ b/src/riscv/Gis_signal_frame.c
@@ -57,7 +57,7 @@ unw_is_signal_frame (unw_cursor_t *cursor)
ip = c->dwarf.ip;
- if (!ip || !a->access_mem || (ip & (sizeof(unw_word_t) - 1)))
+ if (!ip || !a->access_mem)
return 0;
if ((ret = (*a->access_mem) (as, ip, &i0, 0, arg)) < 0)
--
2.49.0

BIN
libunwind-1.8.1.tar.gz (Stored with Git LFS)

Binary file not shown.

View File

@@ -1,16 +0,0 @@
-----BEGIN PGP SIGNATURE-----
iQIzBAABCgAdFiEE+G6wn3JxdCbyDTZHCg/4RbfbNCcFAmXXV+cACgkQCg/4Rbfb
NCfxtQ//fWFWIOcGe6SYeah8cfDLLNJkylQ5OgghJKtC3dQACCjowYOtm/+fttBv
PvwYnrM7FI8m5755/etVeSnlTAgUH7M4IRcLcggS6wJNN7id7ffiyk1B2YU/yqUS
rCSh7ZUTSFuMLexIZIby0NRPit1kAEvWMDXXysHb+TNDZj/DbQGVDhYAfTaOl3/+
NQA9ONcOF0PzPHbNVQ6bfhFz2IIS4GCBbbnUnQe587l0J30AN7fB8cHOpv5nPTJj
6ATfN0q3HBmB7iAyZgWgR5CjdK0J2uLQQ1s4YOYCGM/rhC2ooPXtuaRABKwk7zeK
EjBmS8IP8I4qrwSFGSqt0DX141Hx3lE7YG9b9K5yWd/SFRYCjaoW9O9xgkVmjU+I
PAEIQsM9XyKdnel3ornlO+9CyfIlMtASdj+yKZoAljqu/8VKzt2aWS+zaD0U6TgF
Yf2fkm1gjXy1cWa/JuI1qdjIgV93ycwcT6eeBvCG/OYYHtjq80Raa/MhAQaMhKp/
kn2DffZatjslri5gkk9oS2QwZlkh1r2IYaz1G2GYxVzRzvkoLaypzsaR/7YhaO2H
gu3bnKKcLg7fDPmFpB8qzfkc8OmoGGCUPGlw//4gYvsvEj+oAL0Arq0KqLRWY5fb
D8t0SgCRttvs2xkXwF70KGATZcaBU8TEktpE17o07l7dj94esWI=
=xD26
-----END PGP SIGNATURE-----

3
libunwind-1.8.2.tar.gz Normal file
View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:7f262f1a1224f437ede0f96a6932b582c8f5421ff207c04e3d9504dfa04c8b82
size 979922

View File

@@ -0,0 +1,16 @@
-----BEGIN PGP SIGNATURE-----
iQIzBAABCgAdFiEE+G6wn3JxdCbyDTZHCg/4RbfbNCcFAmgwfD8ACgkQCg/4Rbfb
NCdc5RAAqWStwvMeFnLIbob34rI/j9dXeQybkUFXG+t4Fzcc6Kh4luiSHk0M8t7S
Fg5lLqbwm7+Y8a3cTH2B8fI+HjhbhY03Fu9yXHbnDToaSErU6APksIAPkosLtV6M
+hsXHpn7fR0mJczD2qmYahFXkv/kAWrAmXa+sxbhMlOeSHZLtnSC4NRkswEX0+2J
XmQAuCMYdnuQJ6LRLZOsUrnFggPakDMayCmXoP+ewZvfTIQurM+i4fBDFNx4ojSL
378W+ZGTjwGDLXEX3KL4HjkiFcYZA0lykBwARxUyIslB3SJyZ/pbW+2tIslpq8/4
ZD7ceyS2K98ctGPx733s8lM10pCD0yN2yBkfTzQK8swbturxAD1YdrnmmNbKCj/l
G4chp3r3FV5Ox8jVeJ/c4EacQodJZEBuyHEdvbHKzpV9uolWlwz3Cyge2P+MV8rk
ozEVsJxJT9Tet9H/VGroqTvYnOSdYyXvit+pIn7u4TJ4zmZj1GscODikxsOMd85X
EnAKSXjzBjXGEdAbie0gYuILEDj5SSDDPt2zW2dj3A+mtizhQIYXLVssqgT72KCg
vKY6PgZWr0URd5fV4YnpCTaqis2Dg/5DKw4dNGPqbw3FHld69G815uMByMc578Dx
CEd9a4kDfE3vzUdvPWcpXnNXM1u6kXq3z5ccoco1s/sXu5KY7Hw=
=iP3H
-----END PGP SIGNATURE-----

View File

@@ -1,3 +1,24 @@
-------------------------------------------------------------------
Fri May 30 17:44:37 UTC 2025 - Andreas Schwab <schwab@suse.de>
- 0001-Fix-unw_is_signal_frame-for-RISC-V.patch: Fix unw_is_signal_frame
for RISC-V
-------------------------------------------------------------------
Mon May 26 07:27:57 UTC 2025 - Pedro Monreal <pmonreal@suse.com>
- Update to 1.8.2:
* Rework inline aarch64 as for setcontext
* Fixed miscompilation of unw_getcontext() on ARM
* Support -mbranch-protection=pac-ret on aarch64
* Add unw_is_plt_entry() to public API (fixes FTBFS on QNX)
* Fix signal handling for QNX aarch64
-------------------------------------------------------------------
Sat Apr 5 14:20:12 UTC 2025 - Friedrich Haubensak <hsk17@mail.de>
- Add malloc-prototype.patch to fix gcc15 compile time error
-------------------------------------------------------------------
Fri Mar 22 09:28:07 UTC 2024 - Fabian Vogt <fvogt@suse.com>

View File

@@ -1,7 +1,7 @@
#
# spec file for package libunwind
#
# Copyright (c) 2024 SUSE LLC
# Copyright (c) 2025 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -24,7 +24,7 @@
# Note the wrong version number from upstream
Name: libunwind
Version: 1.8.1
Version: 1.8.2
Release: 0
Summary: Call chain detection library
License: MIT
@@ -36,6 +36,10 @@ Source2: %{name}.keyring
Source3: baselibs.conf
# PATCH-FIX-UPSTREAM https://github.com/libunwind/libunwind/pull/712
Patch1: dont-disable-documentation-without-latex2man.patch
# PATCH-FIX-UPSTREAM https://github.com/libunwind/libunwind/pull/831
Patch2: malloc-prototype.patch
# PATCH-FIX-UPSTREAM https://github.com/libunwind/libunwind/commit/3705baed
Patch3: 0001-Fix-unw_is_signal_frame-for-RISC-V.patch
BuildRequires: automake >= 1.14
BuildRequires: gcc-c++
BuildRequires: libtool

258
malloc-prototype.patch Normal file
View File

@@ -0,0 +1,258 @@
github.com/libunwind/libunwind/pull/831
github.com/libunwind/libunwind/commit/b67d508
From b67d508a93bf1ba231c18dce3894cfee25c16e0d Mon Sep 17 00:00:00 2001
From: Stephen Webb <swebb@blackberry.com>
Date: Wed, 12 Feb 2025 12:08:07 -0500
Subject: [PATCH] Fix bad prototype for malloc() in test
The unit test Gtest-nomalloc.c had an incorrect prototype for malloc()
which caused newer compilers to fail compiling for newer C editions.
Corrected the prototype and corrected a few other errors. The unit now
compiles using GCC with `CFLAGS=-Wall -Wextra -pedantic -C11` with no
warnings, which is the minimum requirement.
Added the tests/unw_test.h header as a first step to cleaning up some
unit tests further.
---
tests/Gtest-nomalloc.c | 124 +++++++++++++++++++++++------------------
tests/Makefile.am | 2 +-
tests/unw_test.h | 47 ++++++++++++++++
3 files changed, 117 insertions(+), 56 deletions(-)
create mode 100644 tests/unw_test.h
diff --git a/tests/Gtest-nomalloc.c b/tests/Gtest-nomalloc.c
index 5b97fc709..e770ff614 100644
--- a/tests/Gtest-nomalloc.c
+++ b/tests/Gtest-nomalloc.c
@@ -1,78 +1,92 @@
-/* libunwind - a platform-independent unwind library
- Copyright (C) 2009 Google, Inc
- Contributed by Arun Sharma <arun.sharma@google.com>
+/**
+ * @file tests/Gtest-nomalloc.c
+ *
+ * Verify that @c malloc() is not called during an unwinding operation.
+ */
+/*
+ * This file is part of libunwind.
+ * Copyright 2025 Stephen M. Webb <stephen.webb@bregmasoft.ca>
+ * Copyright (C) 2009 Google, Inc
+ * Contributed by Arun Sharma <arun.sharma@google.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ */
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
-
-#include <unistd.h>
-#include <stdio.h>
-#include <stdlib.h>
#include <dlfcn.h>
#include <libunwind.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
-#define panic(args...) \
- { fprintf (stderr, args); exit (-1); }
+#include "unw_test.h"
-int verbose;
-int num_errors;
+int malloc_call_count;
int in_unwind;
+/**
+ * Intercepted malloc() call.
+ *
+ * If invoked during unwinding this call will increment the test error count
+ * and indicate a failure by returning NULL. Otherwise it just calls the real
+ * malloc().
+ */
void *
-malloc(size_t s)
+malloc (size_t sz)
{
- static void * (*func)();
+ typedef void *(*malloc_t) (size_t);
- if(!func)
- func = (void *(*)()) dlsym(RTLD_NEXT, "malloc");
+ static malloc_t real_malloc = NULL;
+ if (real_malloc == NULL)
+ {
+ real_malloc = (malloc_t)(intptr_t)dlsym (RTLD_NEXT, "malloc");
+ if (real_malloc == NULL)
+ {
+ fprintf (stderr, "no malloc() found\n");
+ exit (UNW_TEST_EXIT_HARD_ERROR); \
+ }
+ }
- if (in_unwind) {
- num_errors++;
- return NULL;
- } else {
- return func(s);
- }
+ if (in_unwind)
+ {
+ malloc_call_count++;
+ }
+ return real_malloc (sz);
}
static void
do_backtrace (void)
{
- unw_word_t ip, sp;
- unw_cursor_t cursor;
+ unw_cursor_t cursor;
unw_context_t uc;
- int ret;
+ int ret;
in_unwind = 1;
unw_getcontext (&uc);
if (unw_init_local (&cursor, &uc) < 0)
- panic ("unw_init_local failed!\n");
+ {
+ fprintf (stderr, "unw_init_local failed!\n");
+ exit (UNW_TEST_EXIT_HARD_ERROR); \
+ }
do
{
- unw_get_reg (&cursor, UNW_REG_IP, &ip);
- unw_get_reg (&cursor, UNW_REG_SP, &sp);
-
ret = unw_step (&cursor);
- if (ret < 0)
- {
- ++num_errors;
- }
}
while (ret > 0);
in_unwind = 0;
@@ -99,12 +113,12 @@ foo1 (void)
int
main (void)
{
- foo1();
+ foo1 ();
- if (num_errors > 0)
+ if (malloc_call_count > 0)
{
- fprintf (stderr, "FAILURE: detected %d errors\n", num_errors);
- exit (-1);
+ fprintf (stderr, "FAILURE: malloc called %d times, expected 0\n", malloc_call_count);
+ exit (UNW_TEST_EXIT_FAIL);
}
- return 0;
+ exit (UNW_TEST_EXIT_PASS);
}
diff --git a/tests/Makefile.am b/tests/Makefile.am
index adc34ac63..60f3f3adc 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -214,7 +214,7 @@ endif
noinst_PROGRAMS = $(noinst_PROGRAMS_common) $(noinst_PROGRAMS_cdep) \
$(noinst_PROGRAMS_arch)
-noinst_HEADERS = ident.h
+noinst_HEADERS = ident.h unw_test.h
do_test_subst = sed -e 's,[@]TESTS[@],$(TESTS),g' \
-e 's,[@]XFAIL_TESTS[@],$(XFAIL_TESTS),g' \
diff --git a/tests/unw_test.h b/tests/unw_test.h
new file mode 100644
index 000000000..9ae86dce1
--- /dev/null
+++ b/tests/unw_test.h
@@ -0,0 +1,47 @@
+/**
+ * @file tests/unw_test.h
+ *
+ * Common unit test API for libunwind.
+ */
+/*
+ * This file is part of libunwind.
+ * Copyright 2025 Stephen M. Webb <stephen.webb@bregmasoft.ca>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ */
+#ifndef LIBUNWIND_UNW_TEST_H
+#define LIBUNWIND_UNW_TEST_H 1
+
+/**
+ * Exit values for test programs.
+ * Based on https://www.gnu.org/software/automake/manual/html_node/Scripts_002dbased-Testsuites.html
+ *
+ * These are used to interact with the test harness (eg. a TAP-based harness,
+ * CTest, or automake).
+ */
+enum {
+ UNW_TEST_EXIT_PASS = 0, /* Item under test is a PASS */
+ UNW_TEST_EXIT_FAIL = 1, /* Item under test is a FAIL */
+ UNW_TEST_EXIT_BAD_COMMAND = 2, /* Test program is invoked with invalid arguments */
+ UNW_TEST_EXIT_SKIP = 77, /* Test should be skipped */
+ UNW_TEST_EXIT_HARD_ERROR = 99 /* Test program itself has failed */
+};
+
+#endif /* LIBUNWIND_UNW_TEST_H */
+