There's no reason to export those symbols, since they are only meant to be used internally, so mark them as such. An alternative might be to use a linker script.
Signed-off-by: Cyril Brulebois kibi@debian.org --- radeon/bof.c | 36 ++++++++++++++++++------------------ radeon/bof.h | 10 ++++++++++ 2 files changed, 28 insertions(+), 18 deletions(-)
diff --git a/radeon/bof.c b/radeon/bof.c index 0598cc6..7d178cb 100644 --- a/radeon/bof.c +++ b/radeon/bof.c @@ -48,7 +48,7 @@ static int bof_entry_grow(bof_t *bof) /* * object */ -bof_t *bof_object(void) +_X_HIDDEN bof_t *bof_object(void) { bof_t *object;
@@ -61,7 +61,7 @@ bof_t *bof_object(void) return object; }
-bof_t *bof_object_get(bof_t *object, const char *keyname) +_X_HIDDEN bof_t *bof_object_get(bof_t *object, const char *keyname) { unsigned i;
@@ -73,7 +73,7 @@ bof_t *bof_object_get(bof_t *object, const char *keyname) return NULL; }
-int bof_object_set(bof_t *object, const char *keyname, bof_t *value) +_X_HIDDEN int bof_object_set(bof_t *object, const char *keyname, bof_t *value) { bof_t *key; int r; @@ -97,7 +97,7 @@ int bof_object_set(bof_t *object, const char *keyname, bof_t *value) /* * array */ -bof_t *bof_array(void) +_X_HIDDEN bof_t *bof_array(void) { bof_t *array = bof_object();
@@ -108,7 +108,7 @@ bof_t *bof_array(void) return array; }
-int bof_array_append(bof_t *array, bof_t *value) +_X_HIDDEN int bof_array_append(bof_t *array, bof_t *value) { int r; if (array->type != BOF_TYPE_ARRAY) @@ -122,14 +122,14 @@ int bof_array_append(bof_t *array, bof_t *value) return 0; }
-bof_t *bof_array_get(bof_t *bof, unsigned i) +_X_HIDDEN bof_t *bof_array_get(bof_t *bof, unsigned i) { if (!bof_is_array(bof) || i >= bof->array_size) return NULL; return bof->array[i]; }
-unsigned bof_array_size(bof_t *bof) +_X_HIDDEN unsigned bof_array_size(bof_t *bof) { if (!bof_is_array(bof)) return 0; @@ -139,7 +139,7 @@ unsigned bof_array_size(bof_t *bof) /* * blob */ -bof_t *bof_blob(unsigned size, void *value) +_X_HIDDEN bof_t *bof_blob(unsigned size, void *value) { bof_t *blob = bof_object();
@@ -157,14 +157,14 @@ bof_t *bof_blob(unsigned size, void *value) return blob; }
-unsigned bof_blob_size(bof_t *bof) +_X_HIDDEN unsigned bof_blob_size(bof_t *bof) { if (!bof_is_blob(bof)) return 0; return bof->size - 12; }
-void *bof_blob_value(bof_t *bof) +_X_HIDDEN void *bof_blob_value(bof_t *bof) { if (!bof_is_blob(bof)) return NULL; @@ -174,7 +174,7 @@ void *bof_blob_value(bof_t *bof) /* * string */ -bof_t *bof_string(const char *value) +_X_HIDDEN bof_t *bof_string(const char *value) { bof_t *string = bof_object();
@@ -195,7 +195,7 @@ bof_t *bof_string(const char *value) /* * int32 */ -bof_t *bof_int32(int32_t value) +_X_HIDDEN bof_t *bof_int32(int32_t value) { bof_t *int32 = bof_object();
@@ -213,7 +213,7 @@ bof_t *bof_int32(int32_t value) return int32; }
-int32_t bof_int32_value(bof_t *bof) +_X_HIDDEN int32_t bof_int32_value(bof_t *bof) { return *((uint32_t*)bof->value); } @@ -271,7 +271,7 @@ static void bof_print_rec(bof_t *bof, int level, int entry) } }
-void bof_print(bof_t *bof) +_X_HIDDEN void bof_print(bof_t *bof) { bof_print_rec(bof, 0, 0); } @@ -333,7 +333,7 @@ out_err: return -EINVAL; }
-bof_t *bof_load_file(const char *filename) +_X_HIDDEN bof_t *bof_load_file(const char *filename) { bof_t *root = bof_object(); int r; @@ -369,12 +369,12 @@ out_err: return NULL; }
-void bof_incref(bof_t *bof) +_X_HIDDEN void bof_incref(bof_t *bof) { bof->refcount++; }
-void bof_decref(bof_t *bof) +_X_HIDDEN void bof_decref(bof_t *bof) { unsigned i;
@@ -436,7 +436,7 @@ static int bof_file_write(bof_t *bof, FILE *file) return 0; }
-int bof_dump_file(bof_t *bof, const char *filename) +_X_HIDDEN int bof_dump_file(bof_t *bof, const char *filename) { unsigned i; int r = 0; diff --git a/radeon/bof.h b/radeon/bof.h index 014affb..14cf7e5 100644 --- a/radeon/bof.h +++ b/radeon/bof.h @@ -87,4 +87,14 @@ static inline int bof_is_int32(bof_t *bof){return (bof->type == BOF_TYPE_INT32); static inline int bof_is_array(bof_t *bof){return (bof->type == BOF_TYPE_ARRAY);} static inline int bof_is_string(bof_t *bof){return (bof->type == BOF_TYPE_STRING);}
+/* Taken from X11/Xfuncproto.h, keeping only _X_HIDDEN to hide symbols + * which shouldn't be exported */ +#if defined(__GNUC__) && (__GNUC__ >= 4) && !defined(__CYGWIN__) +# define _X_HIDDEN __attribute__((visibility("hidden"))) +#elif defined(__SUNPRO_C) && (__SUNPRO_C >= 0x550) +# define _X_HIDDEN __hidden +#else /* not gcc >= 4 and not Sun Studio >= 8 */ +# define _X_HIDDEN +#endif /* GNUC >= 4 */ + #endif
There's no reason to export those symbols, since they are only meant to be used internally, so mark them as such. An alternative might be to use a linker script.
Signed-off-by: Cyril Brulebois kibi@debian.org --- libkms/intel.c | 2 +- libkms/libkms.h | 10 ++++++++++ libkms/linux.c | 2 +- libkms/nouveau.c | 2 +- libkms/radeon.c | 2 +- libkms/vmwgfx.c | 2 +- 6 files changed, 15 insertions(+), 5 deletions(-)
diff --git a/libkms/intel.c b/libkms/intel.c index 8b8249b..7b3a915 100644 --- a/libkms/intel.c +++ b/libkms/intel.c @@ -214,7 +214,7 @@ intel_bo_destroy(struct kms_bo *_bo) return 0; }
-int +_X_HIDDEN int intel_create(int fd, struct kms_driver **out) { struct kms_driver *kms; diff --git a/libkms/libkms.h b/libkms/libkms.h index 4664442..e4c84e7 100644 --- a/libkms/libkms.h +++ b/libkms/libkms.h @@ -71,4 +71,14 @@ int kms_bo_map(struct kms_bo *bo, void **out); int kms_bo_unmap(struct kms_bo *bo); int kms_bo_destroy(struct kms_bo **bo);
+/* Taken from X11/Xfuncproto.h, keeping only _X_HIDDEN to hide symbols + * which shouldn't be exported */ +#if defined(__GNUC__) && (__GNUC__ >= 4) && !defined(__CYGWIN__) +# define _X_HIDDEN __attribute__((visibility("hidden"))) +#elif defined(__SUNPRO_C) && (__SUNPRO_C >= 0x550) +# define _X_HIDDEN __hidden +#else /* not gcc >= 4 and not Sun Studio >= 8 */ +# define _X_HIDDEN +#endif /* GNUC >= 4 */ + #endif diff --git a/libkms/linux.c b/libkms/linux.c index fc4f205..9eab83d 100644 --- a/libkms/linux.c +++ b/libkms/linux.c @@ -213,7 +213,7 @@ linux_from_udev(int fd, struct kms_driver **out) } #endif
-int +_X_HIDDEN int linux_create(int fd, struct kms_driver **out) { if (!dumb_create(fd, out)) diff --git a/libkms/nouveau.c b/libkms/nouveau.c index 0e24a15..16eec6d 100644 --- a/libkms/nouveau.c +++ b/libkms/nouveau.c @@ -196,7 +196,7 @@ nouveau_bo_destroy(struct kms_bo *_bo) return 0; }
-int +_X_HIDDEN int nouveau_create(int fd, struct kms_driver **out) { struct kms_driver *kms; diff --git a/libkms/radeon.c b/libkms/radeon.c index f5e382a..3bec92d 100644 --- a/libkms/radeon.c +++ b/libkms/radeon.c @@ -218,7 +218,7 @@ radeon_bo_destroy(struct kms_bo *_bo) return 0; }
-int +_X_HIDDEN int radeon_create(int fd, struct kms_driver **out) { struct kms_driver *kms; diff --git a/libkms/vmwgfx.c b/libkms/vmwgfx.c index d594b3b..bcf1b93 100644 --- a/libkms/vmwgfx.c +++ b/libkms/vmwgfx.c @@ -184,7 +184,7 @@ vmwgfx_bo_destroy(struct kms_bo *_bo) return 0; }
-int +_X_HIDDEN int vmwgfx_create(int fd, struct kms_driver **out) { struct kms_driver *kms;
dri-devel@lists.freedesktop.org