[PATCH] Avoid symbol versions in rtld syscalls

Richard Henderson rth@twiddle.net
Sat May 26 17:40:00 GMT 2012


This is the root cause of the incorrect symbols being exported from
ld.so on alpha.  I had a look at ld about honoring the version-map
file above the symver symbols in the object file, and it isn't an
easy fix.  Whereas arranging for these symbols not to be defined in
the rtld-foo.os files is fairly trivial.

Sanity tested on x86_64.  Ok?


r~
-------------- next part --------------
	* include/libc-symbols.h (nonrtld_default_symbol_version): New.
	(nonrtld_symbol_version): New.
	* sysdeps/unix/make-syscalls.sh: Use them.


diff --git a/include/libc-symbols.h b/include/libc-symbols.h
index 12b3639..5a01e89 100644
--- a/include/libc-symbols.h
+++ b/include/libc-symbols.h
@@ -378,6 +378,17 @@ for linking")
   strong_alias(real, name)
 #endif
 
+#ifdef IS_IN_rtld
+# define nonrtld_default_symbol_version(real, name, version) \
+  strong_alias(real, name)
+# define nonrtld_symbol_version(real, name, version)
+#else
+# define nonrtld_default_symbol_version(real, name, version) \
+  default_symbol_version(real, name, version)
+# define nonrtld_symbol_version(real, name, version) \
+  symbol_version(real, name, version)
+#endif
+
 #if defined SHARED || defined LIBC_NONSHARED
 # define attribute_hidden __attribute__ ((visibility ("hidden")))
 #else
diff --git a/sysdeps/unix/make-syscalls.sh b/sysdeps/unix/make-syscalls.sh
index cedce31..98af9e7 100644
--- a/sysdeps/unix/make-syscalls.sh
+++ b/sysdeps/unix/make-syscalls.sh
@@ -84,7 +84,7 @@ emit_weak_aliases()
 	  vcount=`expr $vcount + 1`
 	  echo "	 echo 'strong_alias ($strong, $source)'; \\"
 	fi
-	echo "	 echo 'default_symbol_version($source, $base, $ver)'; \\"
+	echo "	 echo 'nonrtld_default_symbol_version($source, $base, $ver)'; \\"
 	;;
       *@*)
 	base=`echo $name | sed 's/@.*//'`
@@ -97,7 +97,7 @@ emit_weak_aliases()
 	  vcount=`expr $vcount + 1`
 	  echo "	 echo 'strong_alias ($strong, $source)'; \\"
 	fi
-	echo "	 echo 'symbol_version ($source, $base, $ver)'; \\"
+	echo "	 echo 'nonrtld_symbol_version ($source, $base, $ver)'; \\"
 	;;
       !*)
 	name=`echo $name | sed 's/.//'`


More information about the Libc-alpha mailing list