Skip to contentSkip to conversation

Fix libsensors symbol visibility

PATCH In review Jean Delvare 2 participants 2 messages Feb 17, 2011 Library code

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix libsensors symbol visibility

From: Cristian Rodriguez <[email protected]>

Only export from libsensors symbols which are actually public (i.e. listed in the public header files and documented in the manual page.)
---
It worked fine on the 3 distributions I tested it on (openSUSE 11.3, Slackware 12.0 and 9.1, Debian) but I would welcome tests on more distributions (including old ones) just to make sure it doesn't break anything.

 lib/Module.mk      |    2 +-
 lib/libsensors.map |   23 +++++++++++++++++++++++
 2 files changed, 24 insertions(+), 1 deletion(-)
lib/libsensors.map new file +23 -0
@@ -0,0 +1,23 @@
+{
+global:
+  libsensors_version;
+  sensors_cleanup;
+  sensors_do_chip_sets;
+  sensors_free_chip_name;
+  sensors_get_adapter_name;
+  sensors_get_all_subfeatures;
+  sensors_get_detected_chips;
+  sensors_get_features;
+  sensors_get_label;
+  sensors_get_subfeature;
+  sensors_get_value;
+  sensors_init;
+  sensors_parse_chip_name;
+  sensors_set_value;
+  sensors_snprintf_chip_name;
+  sensors_strerror;
+  sensors_parse_error;
+  sensors_parse_error_wfn;
+  sensors_fatal_error;
+local: *;
+ };
lib/Module.mk +1 -1
@@ -63,7 +63,7 @@ LIBHEADERFILES := $(MODULE_DIR)/error.h
 
 # How to create the shared library
 $(MODULE_DIR)/$(LIBSHLIBNAME): $(LIBSHOBJECTS)
-	$(CC) -shared $(LDFLAGS) -Wl,-soname,$(LIBSHSONAME) -o $@ $^ -lc -lm
+	$(CC) -shared $(LDFLAGS) -Wl,--version-script=$(LIB_DIR)/libsensors.map -Wl,-soname,$(LIBSHSONAME) -o $@ $^ -lc -lm
 
 $(MODULE_DIR)/$(LIBSHSONAME): $(MODULE_DIR)/$(LIBSHLIBNAME)
 	$(RM) $@
Signature · 6 lines
Jean Delvare

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
#1 lore raw
Quoted 9 lines · Jean Delvare

From: Cristian Rodriguez <[email protected]>

Only export from libsensors symbols which are actually public (i.e. listed in the public header files and documented in the manual page.)
---
It worked fine on the 3 distributions I tested it on (openSUSE 11.3, Slackware 12.0 and 9.1, Debian) but I would welcome tests on more distributions (including old ones) just to make sure it doesn't break anything.

Works for me in Ubuntu 10.4 and 10.10.

Guenter

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors