[Cbe-oss-dev] [PATCH 0/7] libspe2: Hide internal symbols

Christoph Hellwig hch at lst.de
Fri Jul 20 00:15:44 EST 2007


On Thu, Jul 19, 2007 at 10:20:27PM +0900, Kazunori Asayama wrote:
> This series of patches adds 'static' modifiers or appropriate prefixes
> to internal symbols in libspe2, so that they are hidden from the
> outside of the library.
> 
> OK to apply ?

Nice that someone does this work.  Any chance you'd also be interested
in -fvisibility and elf symbol version to make sure none but the proper
ABIs leak outside?

Here's my really old patch for a dumb implementation of a default hidden
visibility in libspe1:

Index: libspe/libspe.h
===================================================================
--- libspe.orig/libspe.h	2006-07-01 12:26:57.000000000 +0200
+++ libspe/libspe.h	2006-07-01 12:32:14.000000000 +0200
@@ -142,6 +142,7 @@
 #define SPE_SIG_NOTIFY_REG_1		0x0001
 #define SPE_SIG_NOTIFY_REG_2		0x0002
 
+#pragma GCC visibility push(default)
 /* APIs for SPE threads.
  */
 extern spe_gid_t spe_create_group (int policy, int priority, int spe_events);
@@ -278,6 +279,7 @@
  * returns the file descriptor for the spe context.
  */
 extern int __spe_get_context_fd(speid_t speid);
+#pragma GCC visibility pop
 
 #endif
 
Index: libspe/spe.h
===================================================================
--- libspe.orig/spe.h	2006-07-01 12:26:57.000000000 +0200
+++ libspe/spe.h	2006-07-01 12:32:14.000000000 +0200
@@ -103,6 +103,7 @@
         int retfd;
 };
 
+#pragma GCC visibility push(default)
 /* Low-level SPE execution API.
  */
 
@@ -123,6 +124,7 @@
 
 extern void register_handler(void * handler, unsigned int callnum );
 extern int check_priority(int policy, int priority);
+#pragma GCC visibility pop
 
 /*
  * For testing purposes only 
Index: libspe/Makefile
===================================================================
--- libspe.orig/Makefile	2006-07-01 12:32:17.000000000 +0200
+++ libspe/Makefile	2006-07-01 12:32:37.000000000 +0200
@@ -66,6 +66,7 @@
 			-Wmissing-prototypes -Wmissing-declarations \
 			-Wmissing-noreturn -Wredundant-decls \
 			-Wnested-externs -Winline -Wformat \
+			-fvisibility=hidden \
 			${EXTRA_CFLAGS} ${OPTFLAGS}
 ifdef GLIBC23
 CFLAGS += -DHAVE_GLIBC23



More information about the cbe-oss-dev mailing list