[Pkg-alsa-devel] Re: [Alsa-devel] 1.0.13rc3: relocation error: mocp: symbol snd_pcm_hw_params_get_channels_min ..

Takashi Iwai tiwai at suse.de
Thu Sep 28 10:18:46 UTC 2006


At Wed, 27 Sep 2006 21:48:40 +0200,
Elimar Riesebieter wrote:
> 
> On Wed, 27 Sep 2006 the mental interface of
> Takashi Iwai told:
> 
> > At Wed, 27 Sep 2006 20:07:56 +0200,
> > Elimar Riesebieter wrote:
> > > 
> > > On Wed, 27 Sep 2006 the mental interface of
> > > Jaroslav Kysela told:
> > > 
> > > > On Tue, 26 Sep 2006, Elimar Riesebieter wrote:
> > > > 
> > > > > Hi all,
> > > > > 
> > > > > I am testing 1.0.13rc3 (lib/driver/utils) on PPC/2.6.18
> > > > > 
> > > > > Starting a soundapp like moc gives:
> > > > > 
> > > > > "relocation error: mocp: symbol snd_pcm_hw_params_get_channels_min,
> > > > > version ALSA_0.9.0rc4 not defined in file libasound.so.2 with link
> > > > > time reference"
> > > > > 
> > > > > Any hints?
> > > > 
> > > > What is output from commands 'nm /usr/lib/libasound.so.2 | grep 
> > > > snd_pcm_hw_params_get_channels_min' 
> > > 
> > > nm: /usr/lib/libasound.so.2: no symbols
> > > 
> > > > and 'nm mocp | grep 
> > > > snd_pcm_hw_params_get_channels_min'?
> > > 
> > > nm: /usr/bin/mocp: no symbols
> > 
> > The symbols are stripped.
> > Use objdump, e.g. with -T option, instead.
> 
> root at samweis ~ # objdump -T  `which mocp` | grep
> snd_pcm_hw_params_get_channels_min
> 1005ca20      DF *UND*  0000002c  ALSA_0.9.0rc4 \
> snd_pcm_hw_params_get_channels_min
> root at samweis ~ # objdump -T /usr/lib/libasound.so.2 | grep
> snd_pcm_hw_params_get_channels_min
> 00057aa0 g    DF .text  0000002c  ALSA_0.9 \
> __snd_pcm_hw_params_get_channels_min
> 00057aa0  w   DF .text  0000002c  ALSA_0.9 \
> snd_pcm_hw_params_get_channels_min

Hm, the versions are not seen here.

> Hmmm, why there are different versions? 1.0.13rc2 works fine.

If 1.0.13rc2 works, a skeptical change is the prefix check below.
Could you revert this patch and try whether it works?

Also, what is defined as __SYMBOL_PREFIX in config.h?


Takashi


# HG changeset patch
# User tiwai
# Date 1158682071 -7200
# Node ID aea9a680d2825ad040aa8a427d6c55d643a75f56
# Parent  8bdd686087881ce878ab56be3768f2077308a00d
add support for hosts that have custom symbol prefixes

From: Mike Frysinger <vapier at gentoo.org>

some architectures, like Blackfin, have a prefix added to all symbols (in our
case it's historical baggage)

while normally packages shouldnt care, when code starts mixing assembler with
C (like symbol versioning), you need to dip down into the inner details.
find attached a patch which queries gcc for the prefix (all gcc toolchains
have a builtin define of __USER_LABEL_PREFIX__) and then automatically has
asm() constructs utilize this

since most targets define __USER_LABEL_PREFIX__ to nothing, hopefully this
shouldnt cause any problems :)

diff -r 8bdd68608788 -r aea9a680d282 configure.in
--- a/configure.in	Mon Sep 18 17:57:58 2006 +0200
+++ b/configure.in	Tue Sep 19 18:07:51 2006 +0200
@@ -34,6 +34,7 @@ fi
 	    
 
 AC_PROG_CC
+AC_PROG_CPP
 AC_PROG_INSTALL
 AC_PROG_LN_S 
 AC_DISABLE_STATIC
@@ -104,6 +105,16 @@ else
   AC_MSG_RESULT(no)
 fi
 AM_CONDITIONAL(VERSIONED_SYMBOLS, test x$versioned = xyes)
+
+dnl See if toolchain has a custom prefix for symbols ...
+AC_MSG_CHECKING(for custom symbol prefixes)
+SYMBOL_PREFIX=` \
+	echo "PREFIX=__USER_LABEL_PREFIX__" \
+		| ${CPP-${CC-gcc} -E} - 2>&1 \
+		| ${EGREP-grep} "^PREFIX=" \
+		| ${SED-sed} "s:^PREFIX=::"`
+AC_DEFINE_UNQUOTED([__SYMBOL_PREFIX], "$SYMBOL_PREFIX", [Toolchain Symbol Prefix])
+AC_MSG_RESULT($SYMBOL_PREFIX)
 
 dnl Check for debug...
 AC_MSG_CHECKING(for debug)
diff -r 8bdd68608788 -r aea9a680d282 include/alsa-symbols.h
--- a/include/alsa-symbols.h	Mon Sep 18 17:57:58 2006 +0200
+++ b/include/alsa-symbols.h	Tue Sep 19 18:07:51 2006 +0200
@@ -31,16 +31,16 @@
 
 #ifdef __powerpc64__
 # define symbol_version(real, name, version) 			\
-	__asm__ (".symver " #real "," #name "@" #version);	\
-	__asm__ (".symver ." #real ",." #name "@" #version)
+	__asm__ (".symver " ASM_NAME(#real) "," ASM_NAME(#name) "@" #version);	\
+	__asm__ (".symver ." ASM_NAME(#real) ",." ASM_NAME(#name) "@" #version)
 # define default_symbol_version(real, name, version) 		\
-	__asm__ (".symver " #real "," #name "@@" #version);	\
-	__asm__ (".symver ." #real ",." #name "@@" #version)
+	__asm__ (".symver " ASM_NAME(#real) "," ASM_NAME(#name) "@@" #version);	\
+	__asm__ (".symver ." ASM_NAME(#real) ",." ASM_NAME(#name) "@@" #version)
 #else
 # define symbol_version(real, name, version) \
-	__asm__ (".symver " #real "," #name "@" #version)
+	__asm__ (".symver " ASM_NAME(#real) "," ASM_NAME(#name) "@" #version)
 # define default_symbol_version(real, name, version) \
-	__asm__ (".symver " #real "," #name "@@" #version)
+	__asm__ (".symver " ASM_NAME(#real) "," ASM_NAME(#name) "@@" #version)
 #endif
 
 #ifdef USE_VERSIONED_SYMBOLS
@@ -52,19 +52,19 @@
 #define use_symbol_version(real, name, version) /* nothing */
 #ifdef __powerpc64__
 #define use_default_symbol_version(real, name, version) \
-	__asm__ (".weak " #name); 			\
-	__asm__ (".weak ." #name); 			\
-	__asm__ (".set " #name "," #real);		\
-	__asm__ (".set ." #name ",." #real)
+	__asm__ (".weak " ASM_NAME(#name)); 			\
+	__asm__ (".weak ." ASM_NAME(#name)); 			\
+	__asm__ (".set " ASM_NAME(#name) "," ASM_NAME(#real));		\
+	__asm__ (".set ." ASM_NAME(#name) ",." ASM_NAME(#real))
 #else
 #if defined(__alpha__) || defined(__mips__)
 #define use_default_symbol_version(real, name, version) \
-        __asm__ (".weak " #name); \
-        __asm__ (#name " = " #real)
+        __asm__ (".weak " ASM_NAME(#name)); \
+        __asm__ (ASM_NAME(#name) " = " ASM_NAME(#real))
 #else
 #define use_default_symbol_version(real, name, version) \
-	__asm__ (".weak " #name); \
-	__asm__ (".set " #name "," #real)
+	__asm__ (".weak " ASM_NAME(#name)); \
+	__asm__ (".set " ASM_NAME(#name) "," ASM_NAME(#real))
 #endif
 #endif
 #endif
diff -r 8bdd68608788 -r aea9a680d282 include/local.h
--- a/include/local.h	Mon Sep 18 17:57:58 2006 +0200
+++ b/include/local.h	Tue Sep 19 18:07:51 2006 +0200
@@ -192,6 +192,9 @@ extern snd_lib_error_handler_t snd_err_m
 
 /* When a reference to SYMBOL is encountered, the linker will emit a
    warning message MSG.  */
+
+#define ASM_NAME(name) __SYMBOL_PREFIX name
+
 #ifdef HAVE_GNU_LD
 # ifdef HAVE_ELF
 
@@ -210,19 +213,19 @@ extern snd_lib_error_handler_t snd_err_m
    section attributes on what looks like a comment to the assembler.  */
 #  ifdef HAVE_SECTION_QUOTES
 #   define link_warning(symbol, msg) \
-  __make_section_unallocated (".gnu.warning." #symbol) \
+  __make_section_unallocated (".gnu.warning." ASM_NAME(#symbol)) \
   static const char __evoke_link_warning_##symbol[]	\
-    __attribute__ ((section (".gnu.warning." #symbol "\"\n\t#\""))) = msg;
+    __attribute__ ((section (".gnu.warning." ASM_NAME(#symbol) "\"\n\t#\""))) = msg;
 #  else
 #   define link_warning(symbol, msg) \
-  __make_section_unallocated (".gnu.warning." #symbol) \
+  __make_section_unallocated (".gnu.warning." ASM_NAME(#symbol)) \
   static const char __evoke_link_warning_##symbol[]	\
-    __attribute__ ((section (".gnu.warning." #symbol "\n\t#"))) = msg;
+    __attribute__ ((section (".gnu.warning." ASM_NAME(#symbol) "\n\t#"))) = msg;
 #  endif
 # else
 #  define link_warning(symbol, msg)		\
   asm (".stabs \"" msg "\",30,0,0,0\n\t"	\
-       ".stabs \"" __SYMBOL_PREFIX #symbol "\",1,0,0,0\n");
+       ".stabs \"" ASM_NAME(#symbol) "\",1,0,0,0\n");
 # endif
 #else
 /* We will never be heard; they will all die horribly.  */



More information about the Pkg-alsa-devel mailing list