>From a42d7e17fa3e39a8306126c19f1b3b54f1fdd79e Mon Sep 17 00:00:00 2001
From: Michael Tremer <michael.tremer@ipfire.org>
Date: Thu, 21 Apr 2011 16:40:11 +0200
Subject: [PATCH] Create linker-scripts that do only export the needed symbols
 of libsatsolver{,ext}.

See these posts for reference:
	http://lists.opensuse.org/zypp-devel/2011-04/msg00012.html
	http://lists.opensuse.org/zypp-devel/2011-04/msg00014.html

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
---
 ext/CMakeLists.txt      |    1 +
 ext/libsatsolverext.ver |   25 ++++
 src/CMakeLists.txt      |    1 +
 src/libsatsolver.ver    |  355 +++++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 382 insertions(+), 0 deletions(-)
 create mode 100644 ext/libsatsolverext.ver
 create mode 100644 src/libsatsolver.ver

diff --git a/ext/CMakeLists.txt b/ext/CMakeLists.txt
index 68e1c3c..d51a43b 100644
--- a/ext/CMakeLists.txt
+++ b/ext/CMakeLists.txt
@@ -21,6 +21,7 @@ SET(libsatsolverext_HEADERS
     tools_util.h repo_deb.h sat_xfopen.h)
 
 SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC")
+SET(CMAKE_SHARED_LINKER_FLAGS "${LINK_FLAGS} -Wl,--version-script=${satsolver_SOURCE_DIR}/ext/libsatsolverext.ver")
 
 INSTALL(FILES ${libsatsolverext_HEADERS} DESTINATION "${CMAKE_INSTALL_PREFIX}/include/satsolver")
 INSTALL(TARGETS satsolverext LIBRARY DESTINATION ${LIB_INSTALL_DIR} ARCHIVE DESTINATION ${LIB_INSTALL_DIR})
diff --git a/ext/libsatsolverext.ver b/ext/libsatsolverext.ver
new file mode 100644
index 0000000..4869d37
--- /dev/null
+++ b/ext/libsatsolverext.ver
@@ -0,0 +1,25 @@
+EXT1.0 {
+	global:
+		repo_add_code11_products;
+		repo_add_content;
+		repo_add_deb;
+		repo_add_debdb;
+		repo_add_debpackages;
+		repo_add_debs;
+		repo_add_deltainfoxml;
+		repo_add_helix;
+		repo_add_products;
+		repo_add_releasefile_products;
+		repo_add_repomdxml;
+		repo_add_rpmmd;
+		repo_add_susetags;
+		repo_add_updateinfoxml;
+		repo_add_zyppdb_products;
+		repodata_write;
+		repo_write;
+		repo_write_stdkeyfilter;
+		sat_xfopen;
+		sat_xfopen_fd;
+	local:
+		*;
+};
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 6a14d10..b54d01d 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -20,6 +20,7 @@ SET(libsatsolver_HEADERS
     chksum.h md5.h sha1.h sha2.h ${CMAKE_BINARY_DIR}/src/satversion.h)
 
 SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC")
+SET(CMAKE_SHARED_LINKER_FLAGS "${LINK_FLAGS} -Wl,--version-script=${satsolver_SOURCE_DIR}/src/libsatsolver.ver")
 
 INSTALL(FILES ${libsatsolver_HEADERS} DESTINATION "${CMAKE_INSTALL_PREFIX}/include/satsolver")
 INSTALL(TARGETS satsolver LIBRARY DESTINATION ${LIB_INSTALL_DIR} ARCHIVE DESTINATION ${LIB_INSTALL_DIR})
diff --git a/src/libsatsolver.ver b/src/libsatsolver.ver
new file mode 100644
index 0000000..dab3576
--- /dev/null
+++ b/src/libsatsolver.ver
@@ -0,0 +1,355 @@
+SAT1.0 {
+	global:
+		dataiterator_clonepos;
+		dataiterator_entersub;
+		dataiterator_free;
+		dataiterator_init;
+		dataiterator_init_clone;
+		dataiterator_jump_to_repo;
+		dataiterator_jump_to_solvid;
+		dataiterator_match;
+		dataiterator_prepend_keyname;
+		dataiterator_seek;
+		dataiterator_set_keyname;
+		dataiterator_set_match;
+		dataiterator_setpos;
+		dataiterator_setpos_parent;
+		dataiterator_set_search;
+		dataiterator_skip_attribute;
+		dataiterator_skip_repo;
+		dataiterator_skip_solvable;
+		dataiterator_step;
+		datamatcher_free;
+		datamatcher_init;
+		datamatcher_match;
+		data_read_idarray;
+		data_read_rel_idarray;
+		data_skip_key;
+		dep2str;
+		dirpool_add_dir;
+		dirpool_free;
+		dirpool_init;
+		dirpool_make_dirtraverse;
+		evrcmp;
+		evrmatch;
+		id2str;
+		map_free;
+		map_grow;
+		map_init;
+		map_init_clone;
+		policy_create_obsolete_index;
+		policy_filter_unwanted;
+		policy_findupdatepackages;
+		policy_illegal2str;
+		policy_illegal_archchange;
+		policy_illegal_vendorchange;
+		policy_is_illegal;
+		pool_add_fileconflicts_deps;
+		pool_addfileprovides;
+		pool_addfileprovides_ids;
+		pool_addrelproviders;
+		pool_add_solvable;
+		pool_add_solvable_block;
+		pool_alloctmpspace;
+		pool_arch2color_slow;
+		pool_bin2hex;
+		pool_calc_duchanges;
+		pool_calc_installsizechange;
+		pool_clear_pos;
+		pool_create;
+		pool_create_state_maps;
+		pool_createwhatprovides;
+		pool_debug;
+		pool_free;
+		pool_freeidhashes;
+		pool_free_solvable_block;
+		pool_freetmpspace;
+		pool_freewhatprovides;
+		pool_id2langid;
+		pool_job2str;
+		pool_lookup_bin_checksum;
+		pool_lookup_checksum;
+		pool_lookup_id;
+		pool_lookup_num;
+		pool_lookup_str;
+		pool_lookup_void;
+		pool_match_dep;
+		pool_match_nevr_rel;
+		pool_queuetowhatprovides;
+		pool_search;
+		pool_setarch;
+		pool_setarchpolicy;
+		pool_setdebuglevel;
+		pool_set_installed;
+		pool_set_languages;
+		pool_setvendorclasses;
+		pool_shrink_rels;
+		pool_shrink_strings;
+		pool_tmpappend;
+		pool_tmpjoin;
+		pool_trivial_installable;
+		pool_trivial_installable_noobsoletesmap;
+		pool_vendor2mask;
+		prune_best_arch_name_version;
+		prune_to_best_arch;
+		prune_to_best_version;
+		queue_alloc_one;
+		queue_alloc_one_head;
+		queue_delete;
+		queue_delete2;
+		queue_deleten;
+		queue_free;
+		queue_init;
+		queue_init_buffer;
+		queue_init_clone;
+		queue_insert;
+		queue_insert2;
+		queue_insertn;
+		rel2id;
+		repo_addid;
+		repo_addid_dep;
+		repo_add_poolstr_array;
+		repo_add_repodata;
+		repo_add_solv;
+		repo_add_solv_flags;
+		repo_create;
+		repodata_add_dirnumnum;
+		repodata_add_dirstr;
+		repodata_add_fixarray;
+		repodata_add_flexarray;
+		repodata_add_idarray;
+		repodata_add_poolstr_array;
+		repodata_chk2str;
+		repodata_create;
+		repodata_create_stubs;
+		repodata_delete;
+		repodata_delete_uninternalized;
+		repodata_dir2str;
+		repodata_disable_paging;
+		repodata_empty;
+		repodata_extend;
+		repodata_extend_block;
+		repodata_filelistfilter_matches;
+		repodata_free;
+		repodata_freedata;
+		repodata_free_schemahash;
+		repodata_globalize_id;
+		repodata_initdata;
+		repodata_internalize;
+		repodata_key2id;
+		repodata_localize_id;
+		repodata_lookup_bin_checksum;
+		repodata_lookup_id;
+		repodata_lookup_idarray;
+		repodata_lookup_num;
+		repodata_lookup_str;
+		repodata_lookup_type;
+		repodata_lookup_void;
+		repodata_merge_attrs;
+		repodata_merge_some_attrs;
+		repodata_new_handle;
+		repodata_schema2id;
+		repodata_search;
+		repodata_set_binary;
+		repodata_set_bin_checksum;
+		repodata_set_checksum;
+		repodata_set_constant;
+		repodata_set_constantid;
+		repodata_set_id;
+		repodata_set_idarray;
+		repodata_set_location;
+		repodata_set_num;
+		repodata_set_poolstr;
+		repodata_setpos_kv;
+		repodata_set_str;
+		repodata_set_void;
+		repodata_shrink;
+		repodata_str2dir;
+		repodata_stringify;
+		repo_disable_paging;
+		repo_empty;
+		repo_fix_conflicts;
+		repo_fix_supplements;
+		repo_free;
+		repo_freeallrepos;
+		repo_free_solvable_block;
+		repo_internalize;
+		repo_last_repodata;
+		repo_lookup_bin_checksum;
+		repo_lookup_checksum;
+		repo_lookup_id;
+		repo_lookup_idarray;
+		repo_lookup_num;
+		repo_lookup_str;
+		repo_lookup_type;
+		repo_lookup_void;
+		repo_matchvalue;
+		repopagestore_compress_page;
+		repopagestore_disable_paging;
+		repopagestore_free;
+		repopagestore_init;
+		repopagestore_load_page_range;
+		repopagestore_read_or_setup_pages;
+		repo_reserve_ids;
+		repo_search;
+		repo_set_id;
+		repo_set_num;
+		repo_set_poolstr;
+		repo_set_str;
+		repo_sidedata_create;
+		repo_sidedata_extend;
+		sat_bin2hex;
+		sat_calloc;
+		sat_chksum_add;
+		sat_chksum_create;
+		sat_chksum_create_from_bin;
+		sat_chksum_free;
+		sat_chksum_get;
+		sat_chksum_get_type;
+		sat_chksum_isfinished;
+		sat_chksum_str2type;
+		sat_chksum_type2str;
+		sat_dupappend;
+		sat_dupjoin;
+		sat_free;
+		sat_hex2bin;
+		sat_malloc;
+		sat_malloc2;
+		sat_MD5_Final;
+		sat_MD5_Init;
+		sat_MD5_Update;
+		sat_oom;
+		sat_realloc;
+		sat_realloc2;
+		sat_SHA1_Final;
+		sat_SHA1_Init;
+		sat_SHA1_Update;
+		sat_SHA256_Data;
+		sat_SHA256_End;
+		sat_SHA256_Final;
+		sat_SHA256_Init;
+		sat_SHA256_Update;
+		sat_SHA384_Data;
+		sat_SHA384_End;
+		sat_SHA384_Final;
+		sat_SHA384_Init;
+		sat_SHA384_Update;
+		sat_SHA512_Data;
+		sat_SHA512_End;
+		sat_SHA512_Final;
+		sat_SHA512_Init;
+		sat_SHA512_Update;
+		sat_sort;
+		sat_timems;
+		sat_version;
+		sat_version_major;
+		sat_version_minor;
+		sat_version_patch;
+		solvable2str;
+		solvable_get_location;
+		solvable_identical;
+		solvable_lookup_bin_checksum;
+		solvable_lookup_bool;
+		solvable_lookup_checksum;
+		solvable_lookup_id;
+		solvable_lookup_idarray;
+		solvable_lookup_num;
+		solvable_lookup_str;
+		solvable_lookup_str_lang;
+		solvable_lookup_str_poollang;
+		solvable_lookup_void;
+		solvable_selfprovidedep;
+		solvable_trivial_installable_map;
+		solvable_trivial_installable_queue;
+		solvable_trivial_installable_repo;
+		solver_addchoicerules;
+		solver_addduprules;
+		solver_addinfarchrules;
+		solver_addrpmrulesforsolvable;
+		solver_addrpmrulesforupdaters;
+		solver_addrpmrulesforweak;
+		solver_addrule;
+		solver_addupdaterule;
+		solver_allruleinfos;
+		solver_calc_duchanges;
+		solver_calc_installsizechange;
+		solver_calculate_noobsmap;
+		solver_create;
+		solver_create_decisions_obsoletesmap;
+		solver_createdupmaps;
+		solver_dep_installed;
+		solver_disablechoicerules;
+		solver_disablepolicyrules;
+		solver_disableproblem;
+		solver_enableproblem;
+		solver_findallproblemrules;
+		solver_findproblemrule;
+		solver_free;
+		solver_freedupmaps;
+		solver_next_problem;
+		solver_next_solution;
+		solver_next_solutionelement;
+		solver_prepare_solutions;
+		solver_printallsolutions;
+		solver_printcompleteprobleminfo;
+		solver_printdecisionq;
+		solver_printdecisions;
+		solver_printproblem;
+		solver_printprobleminfo;
+		solver_printproblemruleinfo;
+		solver_printrule;
+		solver_printruleclass;
+		solver_printruleelement;
+		solver_printsolution;
+		solver_printtransaction;
+		solver_printtrivial;
+		solver_printwatches;
+		solver_problem_count;
+		solver_problemruleinfo;
+		solver_problemruleinfo2str;
+		solver_reenablepolicyrules;
+		solver_reset;
+		solver_ruleinfo;
+		solver_run_sat;
+		solver_samerule;
+		solver_select2str;
+		solver_solution_count;
+		solver_solutionelement2str;
+		solver_solutionelement_count;
+		solver_solve;
+		solver_splitprovides;
+		solver_take_solution;
+		solver_take_solutionelement;
+		solver_trivial_installable;
+		solver_unifyrules;
+		str2id;
+		strn2id;
+		stringpool_clone;
+		stringpool_free;
+		stringpool_freehash;
+		stringpool_init;
+		stringpool_init_empty;
+		stringpool_shrink;
+		stringpool_str2id;
+		stringpool_strn2id;
+		transaction_add_obsoleted;
+		transaction_all_obs_pkgs;
+		transaction_calc_duchanges;
+		transaction_calc_installsizechange;
+		transaction_calculate;
+		transaction_check_order;
+		transaction_classify;
+		transaction_classify_pkgs;
+		transaction_free;
+		transaction_free_orderdata;
+		transaction_init;
+		transaction_init_clone;
+		transaction_installedresult;
+		transaction_obs_pkg;
+		transaction_order;
+		transaction_order_add_choices;
+		transaction_type;
+		vercmp;
+	local:
+		*;
+};
-- 
1.7.4.4

