Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Backports:SLE-15-SP6:Update
libsigrok
LTO-linking-fix.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File LTO-linking-fix.patch of Package libsigrok
From: Jiri Slaby <jslaby@suse.cz> Subject: LTO: fix linking References: https://sigrok.org/bugzilla/show_bug.cgi?id=1433 With LTO, the trick to collect drivers does not work. Use linker script instead. --- Makefile.am | 15 +++--------- Makefile.in | 56 +++++++++--------------------------------------- src/driver_list_start.c | 33 ---------------------------- src/driver_list_stop.c | 33 ---------------------------- src/drivers.c | 2 - src/libdrivers.ld | 9 +++++++ 6 files changed, 25 insertions(+), 123 deletions(-) --- a/Makefile.am +++ b/Makefile.am @@ -173,22 +173,15 @@ libsigrok_la_SOURCES += \ src/scale/kern.c # Hardware drivers -noinst_LTLIBRARIES = src/libdrivers.la \ - src/libdrivers_head.la src/libdrivers_tail.la +noinst_LTLIBRARIES = src/libdrivers.la -src/libdrivers.o: src/libdrivers.la \ - src/libdrivers_head.la src/libdrivers_tail.la - $(AM_V_CCLD)$(LINK) src/libdrivers_head.la src/libdrivers.la \ - src/libdrivers_tail.la +src/libdrivers.o: src/libdrivers.la + $(AM_V_CCLD)$(LINK) src/libdrivers.la src/libdrivers.lo: src/libdrivers.o $(AM_V_GEN)echo "# Generated by libtool" > $@ $(AM_V_at)echo "pic_object='libdrivers.o'" >> $@ $(AM_V_at)echo "non_pic_object='libdrivers.o'" >> $@ -src_libdrivers_head_la_SOURCES = src/driver_list_start.c - -src_libdrivers_tail_la_SOURCES = src/driver_list_stop.c - src_libdrivers_la_SOURCES = src/drivers.c if HW_AGILENT_DMM @@ -604,7 +597,7 @@ src_libdrivers_la_SOURCES += \ endif libsigrok_la_LIBADD = src/libdrivers.lo $(SR_EXTRA_LIBS) $(LIBSIGROK_LIBS) -libsigrok_la_LDFLAGS = -version-info $(SR_LIB_VERSION) -no-undefined +libsigrok_la_LDFLAGS = -version-info $(SR_LIB_VERSION) -no-undefined -Wc,-T -Wc,src/libdrivers.ld library_includedir = $(includedir)/libsigrok library_include_HEADERS = \ --- a/Makefile.in +++ b/Makefile.in @@ -1018,12 +1018,6 @@ am_src_libdrivers_la_OBJECTS = src/drive $(am__objects_72) $(am__objects_73) $(am__objects_74) \ $(am__objects_75) $(am__objects_76) src_libdrivers_la_OBJECTS = $(am_src_libdrivers_la_OBJECTS) -src_libdrivers_head_la_LIBADD = -am_src_libdrivers_head_la_OBJECTS = src/driver_list_start.lo -src_libdrivers_head_la_OBJECTS = $(am_src_libdrivers_head_la_OBJECTS) -src_libdrivers_tail_la_LIBADD = -am_src_libdrivers_tail_la_OBJECTS = src/driver_list_stop.lo -src_libdrivers_tail_la_OBJECTS = $(am_src_libdrivers_tail_la_OBJECTS) am_tests_main_OBJECTS = tests/lib.$(OBJEXT) tests/main.$(OBJEXT) \ tests/core.$(OBJEXT) tests/input_all.$(OBJEXT) \ tests/input_binary.$(OBJEXT) tests/output_all.$(OBJEXT) \ @@ -1052,8 +1046,7 @@ am__maybe_remake_depfiles = depfiles am__depfiles_remade = bindings/cxx/$(DEPDIR)/classes.Plo \ src/$(DEPDIR)/analog.Plo src/$(DEPDIR)/backend.Plo \ src/$(DEPDIR)/conversion.Plo src/$(DEPDIR)/device.Plo \ - src/$(DEPDIR)/driver_list_start.Plo \ - src/$(DEPDIR)/driver_list_stop.Plo src/$(DEPDIR)/drivers.Plo \ + src/$(DEPDIR)/drivers.Plo \ src/$(DEPDIR)/error.Plo src/$(DEPDIR)/ezusb.Plo \ src/$(DEPDIR)/fallback.Plo src/$(DEPDIR)/hwdriver.Plo \ src/$(DEPDIR)/log.Plo src/$(DEPDIR)/resource.Plo \ @@ -1287,13 +1279,10 @@ am__v_CXXLD_0 = @echo " CXXLD " $@; am__v_CXXLD_1 = SOURCES = $(bindings_cxx_libsigrokcxx_la_SOURCES) \ $(libsigrok_la_SOURCES) $(src_libdrivers_la_SOURCES) \ - $(src_libdrivers_head_la_SOURCES) \ - $(src_libdrivers_tail_la_SOURCES) $(tests_main_SOURCES) + $(tests_main_SOURCES) DIST_SOURCES = $(am__bindings_cxx_libsigrokcxx_la_SOURCES_DIST) \ $(am__libsigrok_la_SOURCES_DIST) \ - $(am__src_libdrivers_la_SOURCES_DIST) \ - $(src_libdrivers_head_la_SOURCES) \ - $(src_libdrivers_tail_la_SOURCES) $(tests_main_SOURCES) + $(am__src_libdrivers_la_SOURCES_DIST) $(tests_main_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ @@ -1691,7 +1680,6 @@ program_transform_name = @program_transf psdir = @psdir@ pyexecdir = @pyexecdir@ pythondir = @pythondir@ -runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ @@ -1762,11 +1750,7 @@ libsigrok_la_SOURCES = src/backend.c src src/scale/kern.c # Hardware drivers -noinst_LTLIBRARIES = src/libdrivers.la \ - src/libdrivers_head.la src/libdrivers_tail.la - -src_libdrivers_head_la_SOURCES = src/driver_list_start.c -src_libdrivers_tail_la_SOURCES = src/driver_list_stop.c +noinst_LTLIBRARIES = src/libdrivers.la src_libdrivers_la_SOURCES = src/drivers.c $(am__append_9) \ $(am__append_10) $(am__append_11) $(am__append_12) \ $(am__append_13) $(am__append_14) $(am__append_15) \ @@ -1791,7 +1775,7 @@ src_libdrivers_la_SOURCES = src/drivers. $(am__append_73) $(am__append_74) $(am__append_75) \ $(am__append_76) $(am__append_77) libsigrok_la_LIBADD = src/libdrivers.lo $(SR_EXTRA_LIBS) $(LIBSIGROK_LIBS) -libsigrok_la_LDFLAGS = -version-info $(SR_LIB_VERSION) -no-undefined +libsigrok_la_LDFLAGS = -version-info $(SR_LIB_VERSION) -no-undefined -Wc,-T -Wc,src/libdrivers.ld library_includedir = $(includedir)/libsigrok library_include_HEADERS = \ include/libsigrok/libsigrok.h \ @@ -3028,16 +3012,6 @@ src/hardware/zketech-ebd-usb/api.lo: \ src/libdrivers.la: $(src_libdrivers_la_OBJECTS) $(src_libdrivers_la_DEPENDENCIES) $(EXTRA_src_libdrivers_la_DEPENDENCIES) src/$(am__dirstamp) $(AM_V_CCLD)$(LINK) $(src_libdrivers_la_OBJECTS) $(src_libdrivers_la_LIBADD) $(LIBS) -src/driver_list_start.lo: src/$(am__dirstamp) \ - src/$(DEPDIR)/$(am__dirstamp) - -src/libdrivers_head.la: $(src_libdrivers_head_la_OBJECTS) $(src_libdrivers_head_la_DEPENDENCIES) $(EXTRA_src_libdrivers_head_la_DEPENDENCIES) src/$(am__dirstamp) - $(AM_V_CCLD)$(LINK) $(src_libdrivers_head_la_OBJECTS) $(src_libdrivers_head_la_LIBADD) $(LIBS) -src/driver_list_stop.lo: src/$(am__dirstamp) \ - src/$(DEPDIR)/$(am__dirstamp) - -src/libdrivers_tail.la: $(src_libdrivers_tail_la_OBJECTS) $(src_libdrivers_tail_la_DEPENDENCIES) $(EXTRA_src_libdrivers_tail_la_DEPENDENCIES) src/$(am__dirstamp) - $(AM_V_CCLD)$(LINK) $(src_libdrivers_tail_la_OBJECTS) $(src_libdrivers_tail_la_LIBADD) $(LIBS) tests/$(am__dirstamp): @$(MKDIR_P) tests @: > tests/$(am__dirstamp) @@ -3241,8 +3215,6 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/backend.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/conversion.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/device.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/driver_list_start.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/driver_list_stop.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/drivers.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/error.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/ezusb.Plo@am__quote@ # am--include-marker @@ -4387,8 +4359,6 @@ distclean: distclean-am -rm -f src/$(DEPDIR)/backend.Plo -rm -f src/$(DEPDIR)/conversion.Plo -rm -f src/$(DEPDIR)/device.Plo - -rm -f src/$(DEPDIR)/driver_list_start.Plo - -rm -f src/$(DEPDIR)/driver_list_stop.Plo -rm -f src/$(DEPDIR)/drivers.Plo -rm -f src/$(DEPDIR)/error.Plo -rm -f src/$(DEPDIR)/ezusb.Plo @@ -4674,8 +4644,6 @@ maintainer-clean: maintainer-clean-am -rm -f src/$(DEPDIR)/backend.Plo -rm -f src/$(DEPDIR)/conversion.Plo -rm -f src/$(DEPDIR)/device.Plo - -rm -f src/$(DEPDIR)/driver_list_start.Plo - -rm -f src/$(DEPDIR)/driver_list_stop.Plo -rm -f src/$(DEPDIR)/drivers.Plo -rm -f src/$(DEPDIR)/error.Plo -rm -f src/$(DEPDIR)/ezusb.Plo @@ -4968,10 +4936,8 @@ uninstall-am: uninstall-bindings_cxx_lib .PRECIOUS: Makefile -src/libdrivers.o: src/libdrivers.la \ - src/libdrivers_head.la src/libdrivers_tail.la - $(AM_V_CCLD)$(LINK) src/libdrivers_head.la src/libdrivers.la \ - src/libdrivers_tail.la +src/libdrivers.o: src/libdrivers.la + $(AM_V_CCLD)$(LINK) src/libdrivers.la src/libdrivers.lo: src/libdrivers.o $(AM_V_GEN)echo "# Generated by libtool" > $@ $(AM_V_at)echo "pic_object='libdrivers.o'" >> $@ --- a/src/driver_list_start.c +++ /dev/null @@ -1,33 +0,0 @@ -/* - * This file is part of the libsigrok project. - * - * Copyright (C) 2017 Marcus Comstedt <marcus@mc.pp.se> - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -#include <config.h> -#include <glib.h> -#include <libsigrok/libsigrok.h> -#include "libsigrok-internal.h" - -/* - * This marks the start of the driver list. This file must be linked - * before any actual drivers. - */ - -SR_PRIV const struct sr_dev_driver *sr_driver_list__start[] - __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 */ }; --- a/src/driver_list_stop.c +++ /dev/null @@ -1,33 +0,0 @@ -/* - * This file is part of the libsigrok project. - * - * Copyright (C) 2017 Marcus Comstedt <marcus@mc.pp.se> - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -#include <config.h> -#include <glib.h> -#include <libsigrok/libsigrok.h> -#include "libsigrok-internal.h" - -/* - * This marks the end of the driver list. This file must be linked - * after any actual drivers. - */ - -SR_PRIV const struct sr_dev_driver *sr_driver_list__stop[] - __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 */ }; --- a/src/drivers.c +++ b/src/drivers.c @@ -45,7 +45,7 @@ SR_API void sr_drivers_init(struct sr_co array = g_array_new(TRUE, FALSE, sizeof(struct sr_dev_driver *)); #ifdef HAVE_DRIVERS - for (const struct sr_dev_driver **drivers = sr_driver_list__start + 1; + for (const struct sr_dev_driver **drivers = sr_driver_list__start; drivers < sr_driver_list__stop; drivers++) g_array_append_val(array, *drivers); #endif --- /dev/null +++ b/src/libdrivers.ld @@ -0,0 +1,9 @@ +SECTIONS +{ + __sr_driver_list : { + sr_driver_list__start = .; + *(__sr_driver_list) + sr_driver_list__stop = .; + } +} +INSERT AFTER .data;
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor