[Pkg-electronics-devel] Bug#1039701: libsigrok4: Built-in driver list is empty when compiled with LTO
Victor Westerhuis
victor at westerhu.is
Wed Jun 28 12:40:32 BST 2023
Package: libsigrok4
Version: 0.5.2-4
Severity: normal
Tags: patch upstream
This bug only shows up when libsigrok is compiled with LTO and was reported (https://sigrok.org/bugzilla/show_bug.cgi?id=1433) and fixed (http://sigrok.org/gitweb/?p=libsigrok.git;a=commit;h=da5286bfa5d2dad1e24b9c9442c9875332d84e64) upstream.
I have opened a MR on https://salsa.debian.org/electronics-team/sigrok/libsigrok/-/merge_requests/3.
Groet, Regards,
Victor Westerhuis
-- System Information:
Debian Release: bookworm/sid
APT prefers lunar-updates
APT policy: (500, 'lunar-updates'), (500, 'lunar-security'), (500, 'lunar'), (100, 'lunar-backports')
Architecture: amd64 (x86_64)
Kernel: Linux 6.2.0-23-generic (SMP w/4 CPU threads; PREEMPT)
Locale: LANG=nl_NL.UTF-8, LC_CTYPE=nl_NL.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
Versions of packages libsigrok4 depends on:
ii libbluetooth3 5.66-0ubuntu1
ii libc6 2.37-0ubuntu2
ii libftdi1-2 1.5-6build2
ii libglib2.0-0 2.76.1-1
ii libhidapi-hidraw0 0.13.1-1
ii libieee1284-3 0.2.11-14build2
ii libserialport0 0.1.1-4
ii libusb-1.0-0 2:1.0.26-1
ii libzip4 1.7.3-1ubuntu2
libsigrok4 recommends no packages.
libsigrok4 suggests no packages.
-- no debconf information
-------------- next part --------------
>From a4aefa75a767e90fd4013ee9c307934edff28c56 Mon Sep 17 00:00:00 2001
From: Victor Westerhuis <victor at westerhu.is>
Date: Wed, 28 Jun 2023 12:46:14 +0200
Subject: [PATCH] Unbreak list of builtin drivers for LTO configurations
LP: 2025248
---
...k-list-of-builtin-drivers-for-LTO-co.patch | 74 +++++++++++++++++++
debian/patches/series | 1 +
2 files changed, 75 insertions(+)
create mode 100644 debian/patches/03-driver_list-unbreak-list-of-builtin-drivers-for-LTO-co.patch
diff --git a/debian/patches/03-driver_list-unbreak-list-of-builtin-drivers-for-LTO-co.patch b/debian/patches/03-driver_list-unbreak-list-of-builtin-drivers-for-LTO-co.patch
new file mode 100644
index 00000000..82ab8469
--- /dev/null
+++ b/debian/patches/03-driver_list-unbreak-list-of-builtin-drivers-for-LTO-co.patch
@@ -0,0 +1,74 @@
+From: Gerhard Sittig <gerhard.sittig at gmx.net>
+Date: Tue, 3 Nov 2020 18:25:18 +0100
+Subject: driver_list: unbreak list of builtin drivers for LTO configurations
+
+Check for the availability of the "no_reorder" linker attribute, which
+keeps the list of builtin drivers in shape on LTO enabled build setups.
+Keep backwards compatibility for platforms which lack support for the
+"no_reorder" attribute. Phrase the implementation such that other
+keywords as well as user provided external specs are possible.
+
+This resolves bug #1433.
+
+Submitted-By: Ivan Mironov <mironov.ivan at gmail.com>
+
+Origin: http://sigrok.org/gitweb/?p=libsigrok.git;a=commit;h=3decd3b1f0cbb3a035f72e9eade42279d0507b89
+Bug: https://sigrok.org/bugzilla/show_bug.cgi?id=1433
+---
+ src/driver_list_start.c | 1 +
+ src/driver_list_stop.c | 1 +
+ src/libsigrok-internal.h | 10 ++++++++++
+ 3 files changed, 12 insertions(+)
+
+diff --git a/src/driver_list_start.c b/src/driver_list_start.c
+index 7b6c775..535e331 100644
+--- a/src/driver_list_start.c
++++ b/src/driver_list_start.c
+@@ -28,6 +28,7 @@
+ */
+
+ SR_PRIV const struct sr_dev_driver *sr_driver_list__start[]
++ SR_DRIVER_LIST_NOREORDER
+ __attribute__((section (SR_DRIVER_LIST_SECTION),
+ used, aligned(sizeof(struct sr_dev_driver *))))
+ = { NULL /* Dummy item, as zero length arrays are not allowed by C99 */ };
+diff --git a/src/driver_list_stop.c b/src/driver_list_stop.c
+index ff2c51d..eefda05 100644
+--- a/src/driver_list_stop.c
++++ b/src/driver_list_stop.c
+@@ -28,6 +28,7 @@
+ */
+
+ SR_PRIV const struct sr_dev_driver *sr_driver_list__stop[]
++ SR_DRIVER_LIST_NOREORDER
+ __attribute__((section (SR_DRIVER_LIST_SECTION),
+ used, aligned(sizeof(struct sr_dev_driver *))))
+ = { NULL /* Dummy item, as zero length arrays are not allowed by C99 */ };
+diff --git a/src/libsigrok-internal.h b/src/libsigrok-internal.h
+index c57f205..0e1ebdb 100644
+--- a/src/libsigrok-internal.h
++++ b/src/libsigrok-internal.h
+@@ -282,6 +282,15 @@ struct zip_stat;
+ #define SR_DRIVER_LIST_SECTION "__sr_driver_list"
+ #endif
+
++#if !defined SR_DRIVER_LIST_NOREORDER && defined __has_attribute
++#if __has_attribute(no_reorder)
++#define SR_DRIVER_LIST_NOREORDER __attribute__((no_reorder))
++#endif
++#endif
++#if !defined SR_DRIVER_LIST_NOREORDER
++#define SR_DRIVER_LIST_NOREORDER /* EMPTY */
++#endif
++
+ /**
+ * Register a list of hardware drivers.
+ *
+@@ -311,6 +320,7 @@ struct zip_stat;
+ */
+ #define SR_REGISTER_DEV_DRIVER_LIST(name, ...) \
+ static const struct sr_dev_driver *name[] \
++ SR_DRIVER_LIST_NOREORDER \
+ __attribute__((section (SR_DRIVER_LIST_SECTION), used, \
+ aligned(sizeof(struct sr_dev_driver *)))) \
+ = { \
diff --git a/debian/patches/series b/debian/patches/series
index acf415cb..fb56225c 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,2 +1,3 @@
01-i386-test-fix.diff
02-fix-strutil-tests.diff
+03-driver_list-unbreak-list-of-builtin-drivers-for-LTO-co.patch
--
2.39.2
More information about the Pkg-electronics-devel
mailing list