All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/4] Clang: fix versioned symbol build errors
@ 2024-01-07 13:48 Nicholas Vinson
  2024-01-07 13:48 ` [PATCH 1/4] configure.ac: Update AC_OUTPUT() function Nicholas Vinson
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Nicholas Vinson @ 2024-01-07 13:48 UTC (permalink / raw)
  To: alsa-devel; +Cc: Nicholas Vinson

When building alsa-lib with the following settings

    CFLAGS='-O3 -pipe'
    CXXFLAGS='-O3 -pipe'
    LDFLAGS=-Wl,-O1		\
	-Wl,--as-needed		\
	-fuse-ld=lld		\
	-rtlib=compiler-rt	\
	-unwindlib=libunwind

the build fails with errors similar to

    ld.lld: error: version script assignment of 'ALSA_0.9.5' to symbol
	'alsa_lisp' failed: symbol not defined

This patch corrects that issue and additional issues found while making
corrections so alsa-lib will successfully build using clang and ld.lld.

This patch set was also submitted as a github PR
(https://github.com/alsa-project/alsa-lib/pull/376).

Signed-off-by: Nicholas Vinson <nvinson234@gmail.com>

Nicholas Vinson (4):
  configure.ac: Update AC_OUTPUT() function
  src/Versions.in: Add guards for opt. alisp symbols
  src/Versions.in: Add guards for pcm and timer syms
  libatopology: Remove version-script flags

 configure.ac                        | 34 +++++++++++++++--------------
 src/Makefile.am                     | 14 +++++++++++-
 src/{Versions.in => Versions.in.in} | 17 +++++++++++++++
 src/topology/Makefile.am            |  8 +------
 4 files changed, 49 insertions(+), 24 deletions(-)
 rename src/{Versions.in => Versions.in.in} (95%)

-- 
2.43.0


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/4] configure.ac: Update AC_OUTPUT() function
  2024-01-07 13:48 [PATCH 0/4] Clang: fix versioned symbol build errors Nicholas Vinson
@ 2024-01-07 13:48 ` Nicholas Vinson
  2024-01-07 13:48 ` [PATCH 2/4] src/Versions.in: Add guards for opt. alisp symbols Nicholas Vinson
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Nicholas Vinson @ 2024-01-07 13:48 UTC (permalink / raw)
  To: alsa-devel; +Cc: Nicholas Vinson

Modern autoconf practice says AC_OUTPUT() should be called with no
arguments and generated configuration files should be specified by
calling AC_CONFIG_FILES() before AC_OUTPUT().

Update configure.ac to follow this practice.

Signed-off-by: Nicholas Vinson <nvinson234@gmail.com>
---
 configure.ac | 34 ++++++++++++++++++----------------
 1 file changed, 18 insertions(+), 16 deletions(-)

diff --git a/configure.ac b/configure.ac
index f86011f1..9db527c3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -747,22 +747,24 @@ if test ! -L "$srcdir"/include/alsa ; then
   ln -sf . "$srcdir"/include/alsa
 fi
 
-AC_OUTPUT(Makefile doc/Makefile doc/pictures/Makefile doc/doxygen.cfg \
-	  include/Makefile include/sound/Makefile include/sound/uapi/Makefile \
-	  src/Versions src/Makefile \
-          src/control/Makefile src/mixer/Makefile \
-	  src/pcm/Makefile src/pcm/scopes/Makefile \
-	  src/rawmidi/Makefile src/timer/Makefile \
-          src/hwdep/Makefile src/seq/Makefile src/ucm/Makefile \
-          src/alisp/Makefile src/topology/Makefile \
-	  src/conf/Makefile \
-	  src/conf/cards/Makefile \
-	  src/conf/ctl/Makefile \
-	  src/conf/pcm/Makefile \
-	  modules/Makefile modules/mixer/Makefile modules/mixer/simple/Makefile \
-	  alsalisp/Makefile aserver/Makefile \
-	  test/Makefile test/lsb/Makefile \
-	  utils/Makefile utils/alsa-lib.spec utils/alsa.pc utils/alsa-topology.pc)
+AC_CONFIG_FILES(Makefile doc/Makefile doc/pictures/Makefile doc/doxygen.cfg \
+		include/Makefile include/sound/Makefile include/sound/uapi/Makefile \
+		src/Versions src/Makefile \
+		src/control/Makefile src/mixer/Makefile \
+		src/pcm/Makefile src/pcm/scopes/Makefile \
+		src/rawmidi/Makefile src/timer/Makefile \
+		src/hwdep/Makefile src/seq/Makefile src/ucm/Makefile \
+		src/alisp/Makefile src/topology/Makefile \
+		src/conf/Makefile \
+		src/conf/cards/Makefile \
+		src/conf/ctl/Makefile \
+		src/conf/pcm/Makefile \
+		modules/Makefile modules/mixer/Makefile modules/mixer/simple/Makefile \
+		alsalisp/Makefile aserver/Makefile \
+		test/Makefile test/lsb/Makefile \
+		utils/Makefile utils/alsa-lib.spec utils/alsa.pc utils/alsa-topology.pc)
+
+AC_OUTPUT()
 
 dnl Create asoundlib.h dynamically according to configure options
 echo "Creating asoundlib.h..."
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/4] src/Versions.in: Add guards for opt. alisp symbols
  2024-01-07 13:48 [PATCH 0/4] Clang: fix versioned symbol build errors Nicholas Vinson
  2024-01-07 13:48 ` [PATCH 1/4] configure.ac: Update AC_OUTPUT() function Nicholas Vinson
@ 2024-01-07 13:48 ` Nicholas Vinson
  2024-01-07 13:48 ` [PATCH 3/4] src/Versions.in: Add guards for pcm and timer syms Nicholas Vinson
  2024-01-07 13:48 ` [PATCH 4/4] libatopology: Remove version-script flags Nicholas Vinson
  3 siblings, 0 replies; 5+ messages in thread
From: Nicholas Vinson @ 2024-01-07 13:48 UTC (permalink / raw)
  To: alsa-devel; +Cc: Nicholas Vinson

Add guards for optional alisp symbols. This ensures that the Versions
file does not contain undefined symbols when building alisp support is
disabled.

Fixes Gentoo bugs 914511 (https://bugs.gentoo.org/914511),
    914643 (https://bugs.gentoo.org/914643),
    and 919417 (https://bugs.gentoo.org/919417).

Fixes bug #305
Fixes alsa_lisp symbol error reported in bug #356

Signed-off-by: Nicholas Vinson <nvinson234@gmail.com>
---
 configure.ac                        |  2 +-
 src/Makefile.am                     | 11 ++++++++++-
 src/{Versions.in => Versions.in.in} |  4 ++++
 3 files changed, 15 insertions(+), 2 deletions(-)
 rename src/{Versions.in => Versions.in.in} (99%)

diff --git a/configure.ac b/configure.ac
index 9db527c3..024e70b0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -749,7 +749,7 @@ fi
 
 AC_CONFIG_FILES(Makefile doc/Makefile doc/pictures/Makefile doc/doxygen.cfg \
 		include/Makefile include/sound/Makefile include/sound/uapi/Makefile \
-		src/Versions src/Makefile \
+		src/Versions.in src/Makefile \
 		src/control/Makefile src/mixer/Makefile \
 		src/pcm/Makefile src/pcm/scopes/Makefile \
 		src/rawmidi/Makefile src/timer/Makefile \
diff --git a/src/Makefile.am b/src/Makefile.am
index df46dbc4..b4a0d5d9 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1,10 +1,11 @@
-EXTRA_DIST=Versions
 COMPATNUM=@LIBTOOL_VERSION_INFO@
 
 if VERSIONED_SYMBOLS
 VSYMS = -Wl,--version-script=Versions
+BUILT_SOURCES = $(top_builddir)/src/Versions
 else
 VSYMS =
+BUILT_SOURCES =
 endif
 
 if SYMBOLIC_FUNCTIONS
@@ -13,6 +14,8 @@ else
 SYMFUNCS =
 endif
 
+VERSION_CPPFLAGS =
+
 lib_LTLIBRARIES = libasound.la
 libasound_la_SOURCES = conf.c confeval.c confmisc.c input.c output.c async.c error.c dlmisc.c socket.c shmarea.c userfile.c names.c
 
@@ -43,6 +46,9 @@ SUBDIRS += ucm
 libasound_la_LIBADD += ucm/libucm.la
 endif
 if BUILD_ALISP
+if VERSIONED_SYMBOLS
+VERSION_CPPFLAGS += -DHAVE_ALISP_SYMS
+endif
 SUBDIRS += alisp
 libasound_la_LIBADD += alisp/libalisp.la
 endif
@@ -51,6 +57,9 @@ libasound_la_LIBADD += @ALSA_DEPLIBS@
 
 libasound_la_LDFLAGS = -version-info $(COMPATNUM) $(VSYMS) $(SYMFUNCS) $(LDFLAGS_NOUNDEFINED)
 
+$(top_builddir)/src/Versions: $(top_builddir)/src/Versions.in
+	$(COMPILE) -E $(VERSION_CPPFLAGS) -x assembler-with-cpp -o $@ $<
+
 control/libcontrol.la:
 	$(MAKE) -C control libcontrol.la
 
diff --git a/src/Versions.in b/src/Versions.in.in
similarity index 99%
rename from src/Versions.in
rename to src/Versions.in.in
index c53a99fa..041eff08 100644
--- a/src/Versions.in
+++ b/src/Versions.in.in
@@ -118,15 +118,19 @@ ALSA_0.9.3 {
 } ALSA_0.9.0;
 
 ALSA_0.9.5 {
+#ifdef HAVE_ALISP_SYMS
   global:
 
     @SYMBOL_PREFIX@alsa_lisp;
+#endif
 } ALSA_0.9.3;
 
 ALSA_0.9.7 {
+#ifdef HAVE_ALISP_SYMS
   global:
 
     @SYMBOL_PREFIX@alsa_lisp_*;
+#endif
 } ALSA_0.9.5;
 
 ALSA_1.1.6 {
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 3/4] src/Versions.in: Add guards for pcm and timer syms
  2024-01-07 13:48 [PATCH 0/4] Clang: fix versioned symbol build errors Nicholas Vinson
  2024-01-07 13:48 ` [PATCH 1/4] configure.ac: Update AC_OUTPUT() function Nicholas Vinson
  2024-01-07 13:48 ` [PATCH 2/4] src/Versions.in: Add guards for opt. alisp symbols Nicholas Vinson
@ 2024-01-07 13:48 ` Nicholas Vinson
  2024-01-07 13:48 ` [PATCH 4/4] libatopology: Remove version-script flags Nicholas Vinson
  3 siblings, 0 replies; 5+ messages in thread
From: Nicholas Vinson @ 2024-01-07 13:48 UTC (permalink / raw)
  To: alsa-devel; +Cc: Nicholas Vinson

Configure script allows for the disabling of the pcm module. When
disabled, the pcm symbols will not be available. Add guards to remove
symbols from version map when not present.

Signed-off-by: Nicholas Vinson <nvinson234@gmail.com>
---
 src/Makefile.am    |  3 +++
 src/Versions.in.in | 13 +++++++++++++
 2 files changed, 16 insertions(+)

diff --git a/src/Makefile.am b/src/Makefile.am
index b4a0d5d9..ad5bf8ef 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -26,6 +26,9 @@ SUBDIRS += mixer
 libasound_la_LIBADD += mixer/libmixer.la
 endif
 if BUILD_PCM
+if VERSIONED_SYMBOLS
+VERSION_CPPFLAGS += -DHAVE_PCM_SYMS -DHAVE_TIMER_SYMS
+endif
 SUBDIRS += pcm timer
 libasound_la_LIBADD += pcm/libpcm.la timer/libtimer.la
 endif
diff --git a/src/Versions.in.in b/src/Versions.in.in
index 041eff08..98f36ded 100644
--- a/src/Versions.in.in
+++ b/src/Versions.in.in
@@ -16,6 +16,7 @@ ALSA_0.9 {
 };
 
 ALSA_0.9.0rc4 {
+#ifdef HAVE_PCM_SYMS
   global:
 
     @SYMBOL_PREFIX@snd_pcm_hw_params_get_access;
@@ -42,6 +43,7 @@ ALSA_0.9.0rc4 {
     @SYMBOL_PREFIX@snd_pcm_hw_params_get_rate_max;
     @SYMBOL_PREFIX@snd_pcm_hw_params_set_rate_near;
     @SYMBOL_PREFIX@snd_pcm_hw_params_set_rate_first;
+
     @SYMBOL_PREFIX@snd_pcm_hw_params_set_rate_last;
 
     @SYMBOL_PREFIX@snd_pcm_hw_params_get_period_time;
@@ -85,22 +87,29 @@ ALSA_0.9.0rc4 {
     @SYMBOL_PREFIX@snd_pcm_hw_params_set_tick_time_near;
     @SYMBOL_PREFIX@snd_pcm_hw_params_set_tick_time_first;
     @SYMBOL_PREFIX@snd_pcm_hw_params_set_tick_time_last;
+#endif
 
 } ALSA_0.9;
 
 ALSA_0.9.0rc8 {
+#ifdef HAVE_PCM_SYMS
   global:
 
     @SYMBOL_PREFIX@snd_pcm_forward;
     @SYMBOL_PREFIX@snd_pcm_status_get_trigger_htstamp;
     @SYMBOL_PREFIX@snd_pcm_status_get_htstamp;
+#endif
 
 } ALSA_0.9.0rc4;
 
 ALSA_0.9.0 {
+#if defined HAVE_PCM_SYMS || defined HAVE_TIMER_SYMS
   global:
 
+#if defined HAVE_PCM_SYMS
     @SYMBOL_PREFIX@snd_pcm_type_name;
+#endif
+#ifdef HAVE_TIMER_SYMS
     @SYMBOL_PREFIX@snd_timer_query_info;
     @SYMBOL_PREFIX@snd_timer_query_params;
     @SYMBOL_PREFIX@snd_timer_query_status;
@@ -108,6 +117,8 @@ ALSA_0.9.0 {
     @SYMBOL_PREFIX@snd_timer_params_get_exclusive;
     @SYMBOL_PREFIX@snd_timer_params_set_filter;
     @SYMBOL_PREFIX@snd_timer_params_get_filter;
+#endif
+#endif
 } ALSA_0.9.0rc8;
 
 ALSA_0.9.3 {
@@ -146,11 +157,13 @@ ALSA_1.2.6 {
 } ALSA_1.1.6;
 
 ALSA_1.2.9 {
+#ifdef HAVE_PCM_SYMS
   global:
 
     @SYMBOL_PREFIX@snd_pcm_hw_params_is_perfect_drain;
     @SYMBOL_PREFIX@snd_pcm_hw_params_set_drain_silence;
     @SYMBOL_PREFIX@snd_pcm_hw_params_get_drain_silence;
+#endif
 } ALSA_1.2.6;
 
 ALSA_1.2.10 {
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 4/4] libatopology: Remove version-script flags
  2024-01-07 13:48 [PATCH 0/4] Clang: fix versioned symbol build errors Nicholas Vinson
                   ` (2 preceding siblings ...)
  2024-01-07 13:48 ` [PATCH 3/4] src/Versions.in: Add guards for pcm and timer syms Nicholas Vinson
@ 2024-01-07 13:48 ` Nicholas Vinson
  3 siblings, 0 replies; 5+ messages in thread
From: Nicholas Vinson @ 2024-01-07 13:48 UTC (permalink / raw)
  To: alsa-devel; +Cc: Nicholas Vinson

Review of Versions.in does not list any symbols defined in the
libatopology library. Naming undefined symbols in a version script
causes build failures with ld.lld when using default flags.

Signed-off-by: Nicholas Vinson <nvinson234@gmail.com>
---
 src/topology/Makefile.am | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/src/topology/Makefile.am b/src/topology/Makefile.am
index 9f48891f..b1bc10f1 100644
--- a/src/topology/Makefile.am
+++ b/src/topology/Makefile.am
@@ -1,11 +1,5 @@
 COMPATNUM=@LIBTOOL_VERSION_INFO@
 
-if VERSIONED_SYMBOLS
-VSYMS = -Wl,--version-script=../Versions
-else
-VSYMS =
-endif
-
 if SYMBOLIC_FUNCTIONS
 SYMFUNCS = -Wl,-Bsymbolic-functions
 else
@@ -15,7 +9,7 @@ endif
 lib_LTLIBRARIES = libatopology.la
 
 libatopology_la_LIBADD = ../libasound.la
-libatopology_la_LDFLAGS = -version-info $(COMPATNUM) $(VSYMS) $(SYMFUNCS) $(LDFLAGS_NOUNDEFINED)
+libatopology_la_LDFLAGS = -version-info $(COMPATNUM) $(SYMFUNCS) $(LDFLAGS_NOUNDEFINED)
 
 libatopology_la_SOURCES =\
 	parser.c \
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-01-08 16:23 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-01-07 13:48 [PATCH 0/4] Clang: fix versioned symbol build errors Nicholas Vinson
2024-01-07 13:48 ` [PATCH 1/4] configure.ac: Update AC_OUTPUT() function Nicholas Vinson
2024-01-07 13:48 ` [PATCH 2/4] src/Versions.in: Add guards for opt. alisp symbols Nicholas Vinson
2024-01-07 13:48 ` [PATCH 3/4] src/Versions.in: Add guards for pcm and timer syms Nicholas Vinson
2024-01-07 13:48 ` [PATCH 4/4] libatopology: Remove version-script flags Nicholas Vinson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.