Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hide more symbols in ELF shared libs #447

Merged
merged 1 commit into from
Aug 12, 2023

Conversation

haampie
Copy link
Contributor

@haampie haampie commented Aug 12, 2023

In Spack we'd like to distribute optimized libclingo.so, to be dlopened by
Python. In practice two optimizations make a big difference: (a) profile-guided
optimization and (b) use of mimalloc as an allocator.

To make (b) work, we either have to use a custom allocator in the code base,
which is a lot of work, or override operator new and friends locally with
mimalloc's version. The latter is pretty easy, but we have to deal with some
load order issues when using libclingo from Python: if another module gets
imported and pulls in libstdc++, libclingo would be using libstdc++'s operator
new instead of mimalloc's.

So, the current solution is to put mimalloc's operator new symbol inside of
libclingo.so, statically link libstdc++ (doesn't error about duplicate
symbols), and make all non-clingo C++ symbols local to the library.

The latter requires a version script, cause -fvisibility=hidden affects
compilation, but not symbols of statically linked libraries. Even if we use the
mimalloc implementation header in a clingo source file, -fvisibility=hidden
doesn't help, cause mimalloc marks operator new as visible.

Long story short: this PR adds a linker script and ensures that only
clingo_*, gringo_* and g_clingo_* are global, to also hide symbols
that aren't coming from clingo sources.

Global symbols
clingo_add_string
clingo_assignment_at
clingo_assignment_decision
clingo_assignment_decision_level
clingo_assignment_has_conflict
clingo_assignment_has_literal
clingo_assignment_is_false
clingo_assignment_is_fixed
clingo_assignment_is_total
clingo_assignment_is_true
clingo_assignment_level
clingo_assignment_root_level
clingo_assignment_size
clingo_assignment_trail_at
clingo_assignment_trail_begin
clingo_assignment_trail_end
clingo_assignment_trail_size
clingo_assignment_truth_value
clingo_ast_acquire
clingo_ast_attribute_delete_ast_at
clingo_ast_attribute_delete_string_at
clingo_ast_attribute_get_ast
clingo_ast_attribute_get_ast_at
clingo_ast_attribute_get_location
clingo_ast_attribute_get_number
clingo_ast_attribute_get_optional_ast
clingo_ast_attribute_get_string
clingo_ast_attribute_get_string_at
clingo_ast_attribute_get_symbol
clingo_ast_attribute_insert_ast_at
clingo_ast_attribute_insert_string_at
clingo_ast_attribute_set_ast
clingo_ast_attribute_set_ast_at
clingo_ast_attribute_set_location
clingo_ast_attribute_set_number
clingo_ast_attribute_set_optional_ast
clingo_ast_attribute_set_string
clingo_ast_attribute_set_string_at
clingo_ast_attribute_set_symbol
clingo_ast_attribute_size_ast_array
clingo_ast_attribute_size_string_array
clingo_ast_attribute_type
clingo_ast_build
clingo_ast_copy
clingo_ast_deep_copy
clingo_ast_equal
clingo_ast_get_type
clingo_ast_has_attribute
clingo_ast_hash
clingo_ast_less_than
clingo_ast_parse_files
clingo_ast_parse_string
clingo_ast_release
clingo_ast_to_string
clingo_ast_to_string_size
clingo_ast_unpool
clingo_backend_acyc_edge
clingo_backend_add_atom
clingo_backend_assume
clingo_backend_begin
clingo_backend_end
clingo_backend_external
clingo_backend_heuristic
clingo_backend_minimize
clingo_backend_project
clingo_backend_rule
clingo_backend_theory_atom
clingo_backend_theory_atom_with_guard
clingo_backend_theory_element
clingo_backend_theory_term_function
clingo_backend_theory_term_number
clingo_backend_theory_term_sequence
clingo_backend_theory_term_string
clingo_backend_theory_term_symbol
clingo_backend_weight_rule
clingo_configuration_array_at
clingo_configuration_array_size
clingo_configuration_description
clingo_configuration_map_at
clingo_configuration_map_has_subkey
clingo_configuration_map_size
clingo_configuration_map_subkey_name
clingo_configuration_root
clingo_configuration_type
clingo_configuration_value_get
clingo_configuration_value_get_size
clingo_configuration_value_is_assigned
clingo_configuration_value_set
clingo_control_add
clingo_control_assign_external
clingo_control_backend
clingo_control_clasp_facade
clingo_control_cleanup
clingo_control_configuration
clingo_control_free
clingo_control_get_const
clingo_control_get_enable_cleanup
clingo_control_get_enable_enumeration_assumption
clingo_control_ground
clingo_control_has_const
clingo_control_interrupt
clingo_control_is_conflicting
clingo_control_load
clingo_control_new
clingo_control_register_observer
clingo_control_register_propagator
clingo_control_release_external
clingo_control_set_enable_cleanup
clingo_control_set_enable_enumeration_assumption
clingo_control_solve
clingo_control_statistics
clingo_control_symbolic_atoms
clingo_control_theory_atoms
clingo_error_code
clingo_error_message
clingo_error_string
clingo_main
clingo_main_
clingo_model_contains
clingo_model_context
clingo_model_cost
clingo_model_cost_size
clingo_model_extend
clingo_model_is_true
clingo_model_number
clingo_model_optimality_proven
clingo_model_symbols
clingo_model_symbols_size
clingo_model_thread_id
clingo_model_type
clingo_options_add
clingo_options_add_flag
clingo_parse_term
clingo_program_builder_add
clingo_program_builder_begin
clingo_program_builder_end
clingo_program_builder_init
clingo_propagate_control_add_clause
clingo_propagate_control_add_literal
clingo_propagate_control_add_watch
clingo_propagate_control_assignment
clingo_propagate_control_has_watch
clingo_propagate_control_propagate
clingo_propagate_control_remove_watch
clingo_propagate_control_thread_id
clingo_propagate_init_add_clause
clingo_propagate_init_add_literal
clingo_propagate_init_add_minimize
clingo_propagate_init_add_watch
clingo_propagate_init_add_watch_to_thread
clingo_propagate_init_add_weight_constraint
clingo_propagate_init_assignment
clingo_propagate_init_freeze_literal
clingo_propagate_init_get_check_mode
clingo_propagate_init_number_of_threads
clingo_propagate_init_propagate
clingo_propagate_init_remove_watch
clingo_propagate_init_remove_watch_from_thread
clingo_propagate_init_set_check_mode
clingo_propagate_init_solver_literal
clingo_propagate_init_symbolic_atoms
clingo_propagate_init_theory_atoms
clingo_register_script
clingo_script_version
clingo_set_error
clingo_signature_arity
clingo_signature_create
clingo_signature_hash
clingo_signature_is_equal_to
clingo_signature_is_less_than
clingo_signature_is_negative
clingo_signature_is_positive
clingo_signature_name
clingo_solve_control_add_clause
clingo_solve_control_symbolic_atoms
clingo_solve_handle_cancel
clingo_solve_handle_close
clingo_solve_handle_core
clingo_solve_handle_get
clingo_solve_handle_model
clingo_solve_handle_resume
clingo_solve_handle_wait
clingo_statistics_array_at
clingo_statistics_array_push
clingo_statistics_array_size
clingo_statistics_map_add_subkey
clingo_statistics_map_at
clingo_statistics_map_has_subkey
clingo_statistics_map_size
clingo_statistics_map_subkey_name
clingo_statistics_root
clingo_statistics_type
clingo_statistics_value_get
clingo_statistics_value_set
clingo_symbol_arguments
clingo_symbol_create_function
clingo_symbol_create_id
clingo_symbol_create_infimum
clingo_symbol_create_number
clingo_symbol_create_string
clingo_symbol_create_supremum
clingo_symbol_hash
clingo_symbolic_atoms_begin
clingo_symbolic_atoms_end
clingo_symbolic_atoms_find
clingo_symbolic_atoms_is_external
clingo_symbolic_atoms_is_fact
clingo_symbolic_atoms_is_valid
clingo_symbolic_atoms_iterator_is_equal_to
clingo_symbolic_atoms_literal
clingo_symbolic_atoms_next
clingo_symbolic_atoms_signatures
clingo_symbolic_atoms_signatures_size
clingo_symbolic_atoms_size
clingo_symbolic_atoms_symbol
clingo_symbol_is_equal_to
clingo_symbol_is_less_than
clingo_symbol_is_negative
clingo_symbol_is_positive
clingo_symbol_name
clingo_symbol_number
clingo_symbol_string
clingo_symbol_to_string
clingo_symbol_to_string_size
clingo_symbol_type
clingo_theory_atoms_atom_elements
clingo_theory_atoms_atom_guard
clingo_theory_atoms_atom_has_guard
clingo_theory_atoms_atom_literal
clingo_theory_atoms_atom_term
clingo_theory_atoms_atom_to_string
clingo_theory_atoms_atom_to_string_size
clingo_theory_atoms_element_condition
clingo_theory_atoms_element_condition_id
clingo_theory_atoms_element_to_string
clingo_theory_atoms_element_to_string_size
clingo_theory_atoms_element_tuple
clingo_theory_atoms_size
clingo_theory_atoms_term_arguments
clingo_theory_atoms_term_name
clingo_theory_atoms_term_number
clingo_theory_atoms_term_to_string
clingo_theory_atoms_term_to_string_size
clingo_theory_atoms_term_type
clingo_version
clingo_warning_string
g_clingo_ast_attribute_names
g_clingo_ast_constructors
gringo_main_

@rkaminsk
Copy link
Member

This looks okay. I think it is fine to just export the clingo related C symbols. I am just not sure if it is necessary to enable this in general. The advantage seems to be limited to your specific case where there are other static libraries contained within libclingo. Not enabling by default might prevent breakage (even though I don't see a reason) elsewhere. 😄

@haampie
Copy link
Contributor Author

haampie commented Aug 12, 2023

I sort of agree, but I decided to open the PR anyways because it's cleaner in general, given that even when doing shared linking against libstdc++, still around ~110 C++ symbols end up as public in the library:

$ nm --defined-only --extern-only libclingo.so | awk '{ print $3; }' | c++filt | wc -l
359
List of exported C++ symbols
std::_Hashtable<unsigned int, std::pair<unsigned int const, unsigned int>, std::allocator<std::pair<unsigned int const, unsigned int> >, std::__detail::_Select1st, std::equal_to<unsigned int>, std::hash<unsigned int>, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<false, false, false> >::find(unsigned int const&) const
std::_Hashtable<unsigned long, unsigned long, std::allocator<unsigned long>, std::__detail::_Identity, std::equal_to<unsigned long>, std::hash<unsigned long>, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<false, true, true> >::find(unsigned long const&) const
std::ctype<char>::do_widen(char) const
std::_Rb_tree<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::_Identity<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >::find(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const
std::_Hashtable<int, std::pair<int const, unsigned long>, std::allocator<std::pair<int const, unsigned long> >, std::__detail::_Select1st, std::equal_to<int>, std::hash<int>, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<false, false, true> >::_M_rehash(unsigned long, unsigned long const&)
std::_Hashtable<unsigned int, unsigned int, std::allocator<unsigned int>, std::__detail::_Identity, std::equal_to<unsigned int>, std::hash<unsigned int>, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<false, true, true> >::_M_rehash(unsigned long, unsigned long const&)
std::_Hashtable<unsigned int, std::pair<unsigned int const, unsigned int>, std::allocator<std::pair<unsigned int const, unsigned int> >, std::__detail::_Select1st, std::equal_to<unsigned int>, std::hash<unsigned int>, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<false, false, false> >::equal_range(unsigned int const&)
std::_Hashtable<unsigned int, std::pair<unsigned int const, unsigned int>, std::allocator<std::pair<unsigned int const, unsigned int> >, std::__detail::_Select1st, std::equal_to<unsigned int>, std::hash<unsigned int>, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<false, false, false> >::_M_insert_multi_node(std::__detail::_Hash_node<std::pair<unsigned int const, unsigned int>, false>*, unsigned long, std::__detail::_Hash_node<std::pair<unsigned int const, unsigned int>, false>*)
std::_Hashtable<unsigned int, std::pair<unsigned int const, unsigned int>, std::allocator<std::pair<unsigned int const, unsigned int> >, std::__detail::_Select1st, std::equal_to<unsigned int>, std::hash<unsigned int>, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<false, false, false> >::~_Hashtable()
std::_Hashtable<unsigned int, std::pair<unsigned int const, unsigned int>, std::allocator<std::pair<unsigned int const, unsigned int> >, std::__detail::_Select1st, std::equal_to<unsigned int>, std::hash<unsigned int>, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<false, false, false> >::~_Hashtable()
std::_Hashtable<unsigned int, std::pair<unsigned int const, char const*>, std::allocator<std::pair<unsigned int const, char const*> >, std::__detail::_Select1st, std::equal_to<unsigned int>, std::hash<unsigned int>, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<false, false, true> >::_M_rehash(unsigned long, unsigned long const&)
std::_Hashtable<unsigned long, unsigned long, std::allocator<unsigned long>, std::__detail::_Identity, std::equal_to<unsigned long>, std::hash<unsigned long>, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<false, true, true> >::_M_insert_unique_node(unsigned long, unsigned long, std::__detail::_Hash_node<unsigned long, false>*, unsigned long)
std::_Hashtable<unsigned long, unsigned long, std::allocator<unsigned long>, std::__detail::_Identity, std::equal_to<unsigned long>, std::hash<unsigned long>, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<false, true, true> >::find(unsigned long const&)
std::_Hashtable<unsigned long, unsigned long, std::allocator<unsigned long>, std::__detail::_Identity, std::equal_to<unsigned long>, std::hash<unsigned long>, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<false, true, true> >::_M_rehash(unsigned long, unsigned long const&)
std::_Hashtable<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, unsigned int>, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, unsigned int> >, std::__detail::_Select1st, std::equal_to<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::hash<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<true, false, true> >::_M_rehash(unsigned long, unsigned long const&)
std::unique_lock<std::mutex>::unlock()
void std::_Destroy_aux<false>::__destroy<Gringo::TheoryAtomDef*>(Gringo::TheoryAtomDef*, Gringo::TheoryAtomDef*)
void std::__exception_ptr::__dest_thunk<std::runtime_error>(void*)
std::__exception_ptr::exception_ptr::~exception_ptr()
std::__exception_ptr::exception_ptr::~exception_ptr()
std::_Sp_counted_base<(__gnu_cxx::_Lock_policy)2>::_M_release()
std::_Sp_counted_base<(__gnu_cxx::_Lock_policy)2>::_M_release_last_use_cold()
std::_Sp_counted_ptr_inplace<unsigned int, std::allocator<void>, (__gnu_cxx::_Lock_policy)2>::_M_destroy()
std::_Sp_counted_ptr_inplace<unsigned int, std::allocator<void>, (__gnu_cxx::_Lock_policy)2>::_M_dispose()
std::_Sp_counted_ptr_inplace<unsigned int, std::allocator<void>, (__gnu_cxx::_Lock_policy)2>::_M_get_deleter(std::type_info const&)
std::_Sp_counted_ptr_inplace<unsigned int, std::allocator<void>, (__gnu_cxx::_Lock_policy)2>::~_Sp_counted_ptr_inplace()
std::_Sp_counted_ptr_inplace<unsigned int, std::allocator<void>, (__gnu_cxx::_Lock_policy)2>::~_Sp_counted_ptr_inplace()
std::_Sp_counted_ptr_inplace<unsigned int, std::allocator<void>, (__gnu_cxx::_Lock_policy)2>::~_Sp_counted_ptr_inplace()
std::thread::_State_impl<std::thread::_Invoker<std::tuple<std::_Mem_fn<void (Clasp::ClaspFacade::SolveStrategy::*)(Clasp::SolveMode_t)>, Clasp::ClaspFacade::SolveStrategy::Async*, Clasp::SolveMode_t::E> > >::_M_run()
std::thread::_State_impl<std::thread::_Invoker<std::tuple<std::_Mem_fn<void (Clasp::ClaspFacade::SolveStrategy::*)(Clasp::SolveMode_t)>, Clasp::ClaspFacade::SolveStrategy::Async*, Clasp::SolveMode_t::E> > >::~_State_impl()
std::thread::_State_impl<std::thread::_Invoker<std::tuple<std::_Mem_fn<void (Clasp::ClaspFacade::SolveStrategy::*)(Clasp::SolveMode_t)>, Clasp::ClaspFacade::SolveStrategy::Async*, Clasp::SolveMode_t::E> > >::~_State_impl()
std::thread::_State_impl<std::thread::_Invoker<std::tuple<std::_Mem_fn<void (Clasp::ClaspFacade::SolveStrategy::*)(Clasp::SolveMode_t)>, Clasp::ClaspFacade::SolveStrategy::Async*, Clasp::SolveMode_t::E> > >::~_State_impl()
std::thread::_State_impl<std::thread::_Invoker<std::tuple<std::_Mem_fn<void (Clasp::mt::ParallelSolve::*)(unsigned int)>, Clasp::mt::ParallelSolve*, unsigned int> > >::_M_run()
std::thread::_State_impl<std::thread::_Invoker<std::tuple<std::_Mem_fn<void (Clasp::mt::ParallelSolve::*)(unsigned int)>, Clasp::mt::ParallelSolve*, unsigned int> > >::~_State_impl()
std::thread::_State_impl<std::thread::_Invoker<std::tuple<std::_Mem_fn<void (Clasp::mt::ParallelSolve::*)(unsigned int)>, Clasp::mt::ParallelSolve*, unsigned int> > >::~_State_impl()
std::thread::_State_impl<std::thread::_Invoker<std::tuple<std::_Mem_fn<void (Clasp::mt::ParallelSolve::*)(unsigned int)>, Clasp::mt::ParallelSolve*, unsigned int> > >::~_State_impl()
void std::vector<char, std::allocator<char> >::emplace_back<char>(char&&)
std::vector<char, std::allocator<char> >::_M_default_append(unsigned long)
void std::vector<int, std::allocator<int> >::_M_realloc_insert<int>(__gnu_cxx::__normal_iterator<int*, std::vector<int, std::allocator<int> > >, int&&)
void std::vector<int, std::allocator<int> >::_M_realloc_insert<unsigned int&>(__gnu_cxx::__normal_iterator<int*, std::vector<int, std::allocator<int> > >, unsigned int&)
void std::vector<unsigned int, std::allocator<unsigned int> >::emplace_back<unsigned int>(unsigned int&&)
void std::vector<unsigned int, std::allocator<unsigned int> >::emplace_back<unsigned int&>(unsigned int&)
std::vector<unsigned int, std::allocator<unsigned int> >::_M_default_append(unsigned long)
void std::vector<unsigned int, std::allocator<unsigned int> >::_M_realloc_insert<unsigned int>(__gnu_cxx::__normal_iterator<unsigned int*, std::vector<unsigned int, std::allocator<unsigned int> > >, unsigned int&&)
void std::vector<unsigned int, std::allocator<unsigned int> >::_M_realloc_insert<unsigned int&>(__gnu_cxx::__normal_iterator<unsigned int*, std::vector<unsigned int, std::allocator<unsigned int> > >, unsigned int&)
void std::vector<unsigned int, std::allocator<unsigned int> >::_M_realloc_insert<unsigned int const&>(__gnu_cxx::__normal_iterator<unsigned int*, std::vector<unsigned int, std::allocator<unsigned int> > >, unsigned int const&)
std::vector<unsigned int, std::allocator<unsigned int> >::reserve(unsigned long)
void std::vector<long, std::allocator<long> >::_M_realloc_insert<long const&>(__gnu_cxx::__normal_iterator<long*, std::vector<long, std::allocator<long> > >, long const&)
void std::vector<Gringo::Input::TermVecUid, std::allocator<Gringo::Input::TermVecUid> >::_M_realloc_insert<Gringo::Input::TermVecUid const&>(__gnu_cxx::__normal_iterator<Gringo::Input::TermVecUid*, std::vector<Gringo::Input::TermVecUid, std::allocator<Gringo::Input::TermVecUid> > >, Gringo::Input::TermVecUid const&)
void std::vector<Gringo::Input::BdLitVecUid, std::allocator<Gringo::Input::BdLitVecUid> >::_M_realloc_insert<Gringo::Input::BdLitVecUid const&>(__gnu_cxx::__normal_iterator<Gringo::Input::BdLitVecUid*, std::vector<Gringo::Input::BdLitVecUid, std::allocator<Gringo::Input::BdLitVecUid> > >, Gringo::Input::BdLitVecUid const&)
void std::vector<Gringo::Input::BoundVecUid, std::allocator<Gringo::Input::BoundVecUid> >::_M_realloc_insert<Gringo::Input::BoundVecUid const&>(__gnu_cxx::__normal_iterator<Gringo::Input::BoundVecUid*, std::vector<Gringo::Input::BoundVecUid, std::allocator<Gringo::Input::BoundVecUid> > >, Gringo::Input::BoundVecUid const&)
void std::vector<Gringo::Input::RelLitVecUid, std::allocator<Gringo::Input::RelLitVecUid> >::_M_realloc_insert<Gringo::Input::RelLitVecUid const&>(__gnu_cxx::__normal_iterator<Gringo::Input::RelLitVecUid*, std::vector<Gringo::Input::RelLitVecUid, std::allocator<Gringo::Input::RelLitVecUid> > >, Gringo::Input::RelLitVecUid const&)
void std::vector<Gringo::Input::CondLitVecUid, std::allocator<Gringo::Input::CondLitVecUid> >::_M_realloc_insert<Gringo::Input::CondLitVecUid const&>(__gnu_cxx::__normal_iterator<Gringo::Input::CondLitVecUid*, std::vector<Gringo::Input::CondLitVecUid, std::allocator<Gringo::Input::CondLitVecUid> > >, Gringo::Input::CondLitVecUid const&)
void std::vector<Gringo::Input::TermVecVecUid, std::allocator<Gringo::Input::TermVecVecUid> >::_M_realloc_insert<Gringo::Input::TermVecVecUid const&>(__gnu_cxx::__normal_iterator<Gringo::Input::TermVecVecUid*, std::vector<Gringo::Input::TermVecVecUid, std::allocator<Gringo::Input::TermVecVecUid> > >, Gringo::Input::TermVecVecUid const&)
void std::vector<Gringo::Input::TheoryAtomUid, std::allocator<Gringo::Input::TheoryAtomUid> >::_M_realloc_insert<Gringo::Input::TheoryAtomUid const&>(__gnu_cxx::__normal_iterator<Gringo::Input::TheoryAtomUid*, std::vector<Gringo::Input::TheoryAtomUid, std::allocator<Gringo::Input::TheoryAtomUid> > >, Gringo::Input::TheoryAtomUid const&)
void std::vector<Gringo::Input::TheoryTermUid, std::allocator<Gringo::Input::TheoryTermUid> >::_M_realloc_insert<Gringo::Input::TheoryTermUid const&>(__gnu_cxx::__normal_iterator<Gringo::Input::TheoryTermUid*, std::vector<Gringo::Input::TheoryTermUid, std::allocator<Gringo::Input::TheoryTermUid> > >, Gringo::Input::TheoryTermUid const&)
void std::vector<Gringo::Input::TheoryOpDefUid, std::allocator<Gringo::Input::TheoryOpDefUid> >::_M_realloc_insert<Gringo::Input::TheoryOpDefUid const&>(__gnu_cxx::__normal_iterator<Gringo::Input::TheoryOpDefUid*, std::vector<Gringo::Input::TheoryOpDefUid, std::allocator<Gringo::Input::TheoryOpDefUid> > >, Gringo::Input::TheoryOpDefUid const&)
void std::vector<Gringo::Input::TheoryOpVecUid, std::allocator<Gringo::Input::TheoryOpVecUid> >::_M_realloc_insert<Gringo::Input::TheoryOpVecUid const&>(__gnu_cxx::__normal_iterator<Gringo::Input::TheoryOpVecUid*, std::vector<Gringo::Input::TheoryOpVecUid, std::allocator<Gringo::Input::TheoryOpVecUid> > >, Gringo::Input::TheoryOpVecUid const&)
void std::vector<Gringo::Input::TheoryDefVecUid, std::allocator<Gringo::Input::TheoryDefVecUid> >::_M_realloc_insert<Gringo::Input::TheoryDefVecUid const&>(__gnu_cxx::__normal_iterator<Gringo::Input::TheoryDefVecUid*, std::vector<Gringo::Input::TheoryDefVecUid, std::allocator<Gringo::Input::TheoryDefVecUid> > >, Gringo::Input::TheoryDefVecUid const&)
void std::vector<Gringo::Input::TheoryOptermUid, std::allocator<Gringo::Input::TheoryOptermUid> >::_M_realloc_insert<Gringo::Input::TheoryOptermUid const&>(__gnu_cxx::__normal_iterator<Gringo::Input::TheoryOptermUid*, std::vector<Gringo::Input::TheoryOptermUid, std::allocator<Gringo::Input::TheoryOptermUid> > >, Gringo::Input::TheoryOptermUid const&)
void std::vector<Gringo::Input::BdAggrElemVecUid, std::allocator<Gringo::Input::BdAggrElemVecUid> >::_M_realloc_insert<Gringo::Input::BdAggrElemVecUid const&>(__gnu_cxx::__normal_iterator<Gringo::Input::BdAggrElemVecUid*, std::vector<Gringo::Input::BdAggrElemVecUid, std::allocator<Gringo::Input::BdAggrElemVecUid> > >, Gringo::Input::BdAggrElemVecUid const&)
void std::vector<Gringo::Input::HdAggrElemVecUid, std::allocator<Gringo::Input::HdAggrElemVecUid> >::_M_realloc_insert<Gringo::Input::HdAggrElemVecUid const&>(__gnu_cxx::__normal_iterator<Gringo::Input::HdAggrElemVecUid*, std::vector<Gringo::Input::HdAggrElemVecUid, std::allocator<Gringo::Input::HdAggrElemVecUid> > >, Gringo::Input::HdAggrElemVecUid const&)
void std::vector<Gringo::Input::TheoryAtomDefUid, std::allocator<Gringo::Input::TheoryAtomDefUid> >::_M_realloc_insert<Gringo::Input::TheoryAtomDefUid const&>(__gnu_cxx::__normal_iterator<Gringo::Input::TheoryAtomDefUid*, std::vector<Gringo::Input::TheoryAtomDefUid, std::allocator<Gringo::Input::TheoryAtomDefUid> > >, Gringo::Input::TheoryAtomDefUid const&)
void std::vector<Gringo::Input::TheoryElemVecUid, std::allocator<Gringo::Input::TheoryElemVecUid> >::_M_realloc_insert<Gringo::Input::TheoryElemVecUid const&>(__gnu_cxx::__normal_iterator<Gringo::Input::TheoryElemVecUid*, std::vector<Gringo::Input::TheoryElemVecUid, std::allocator<Gringo::Input::TheoryElemVecUid> > >, Gringo::Input::TheoryElemVecUid const&)
void std::vector<Gringo::Input::TheoryTermDefUid, std::allocator<Gringo::Input::TheoryTermDefUid> >::_M_realloc_insert<Gringo::Input::TheoryTermDefUid const&>(__gnu_cxx::__normal_iterator<Gringo::Input::TheoryTermDefUid*, std::vector<Gringo::Input::TheoryTermDefUid, std::allocator<Gringo::Input::TheoryTermDefUid> > >, Gringo::Input::TheoryTermDefUid const&)
void std::vector<Gringo::Input::TheoryOpDefVecUid, std::allocator<Gringo::Input::TheoryOpDefVecUid> >::_M_realloc_insert<Gringo::Input::TheoryOpDefVecUid const&>(__gnu_cxx::__normal_iterator<Gringo::Input::TheoryOpDefVecUid*, std::vector<Gringo::Input::TheoryOpDefVecUid, std::allocator<Gringo::Input::TheoryOpDefVecUid> > >, Gringo::Input::TheoryOpDefVecUid const&)
void std::vector<Gringo::Input::TheoryOptermVecUid, std::allocator<Gringo::Input::TheoryOptermVecUid> >::_M_realloc_insert<Gringo::Input::TheoryOptermVecUid const&>(__gnu_cxx::__normal_iterator<Gringo::Input::TheoryOptermVecUid*, std::vector<Gringo::Input::TheoryOptermVecUid, std::allocator<Gringo::Input::TheoryOptermVecUid> > >, Gringo::Input::TheoryOptermVecUid const&)
void std::vector<Gringo::Input::LitUid, std::allocator<Gringo::Input::LitUid> >::_M_realloc_insert<Gringo::Input::LitUid const&>(__gnu_cxx::__normal_iterator<Gringo::Input::LitUid*, std::vector<Gringo::Input::LitUid, std::allocator<Gringo::Input::LitUid> > >, Gringo::Input::LitUid const&)
void std::vector<Gringo::Input::TermUid, std::allocator<Gringo::Input::TermUid> >::_M_realloc_insert<Gringo::Input::TermUid const&>(__gnu_cxx::__normal_iterator<Gringo::Input::TermUid*, std::vector<Gringo::Input::TermUid, std::allocator<Gringo::Input::TermUid> > >, Gringo::Input::TermUid const&)
void std::vector<Gringo::Input::HdLitUid, std::allocator<Gringo::Input::HdLitUid> >::_M_realloc_insert<Gringo::Input::HdLitUid const&>(__gnu_cxx::__normal_iterator<Gringo::Input::HdLitUid*, std::vector<Gringo::Input::HdLitUid, std::allocator<Gringo::Input::HdLitUid> > >, Gringo::Input::HdLitUid const&)
void std::vector<Gringo::Input::IdVecUid, std::allocator<Gringo::Input::IdVecUid> >::_M_realloc_insert<Gringo::Input::IdVecUid const&>(__gnu_cxx::__normal_iterator<Gringo::Input::IdVecUid*, std::vector<Gringo::Input::IdVecUid, std::allocator<Gringo::Input::IdVecUid> > >, Gringo::Input::IdVecUid const&)
void std::vector<Gringo::Input::LitVecUid, std::allocator<Gringo::Input::LitVecUid> >::_M_realloc_insert<Gringo::Input::LitVecUid const&>(__gnu_cxx::__normal_iterator<Gringo::Input::LitVecUid*, std::vector<Gringo::Input::LitVecUid, std::allocator<Gringo::Input::LitVecUid> > >, Gringo::Input::LitVecUid const&)
std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >::_M_default_append(unsigned long)
void std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >::_M_realloc_insert<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&>(__gnu_cxx::__normal_iterator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)
void std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >::_M_realloc_insert<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >(__gnu_cxx::__normal_iterator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&&)
std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >::~vector()
std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >::~vector()
void std::vector<char*, std::allocator<char*> >::_M_realloc_insert<char*>(__gnu_cxx::__normal_iterator<char**, std::vector<char*, std::allocator<char*> > >, char*&&)
void std::vector<char const*, std::allocator<char const*> >::_M_realloc_insert<char const* const&>(__gnu_cxx::__normal_iterator<char const**, std::vector<char const*, std::allocator<char const*> > >, char const* const&)
void std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > >::_M_realloc_insert<>(__gnu_cxx::__normal_iterator<std::vector<int, std::allocator<int> >*, std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > > >)
void std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > >::_M_realloc_insert<int const*, int const*>(__gnu_cxx::__normal_iterator<std::vector<int, std::allocator<int> >*, std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > > >, int const*&&, int const*&&)
void std::vector<std::unique_ptr<char [], std::default_delete<char []> >, std::allocator<std::unique_ptr<char [], std::default_delete<char []> > > >::_M_realloc_insert<char*>(__gnu_cxx::__normal_iterator<std::unique_ptr<char [], std::default_delete<char []> >*, std::vector<std::unique_ptr<char [], std::default_delete<char []> >, std::allocator<std::unique_ptr<char [], std::default_delete<char []> > > > >, char*&&)
void std::vector<std::pair<unsigned int, unsigned int>, std::allocator<std::pair<unsigned int, unsigned int> > >::emplace_back<unsigned int&, unsigned int>(unsigned int&, unsigned int&&)
void std::vector<std::pair<unsigned int, unsigned int>, std::allocator<std::pair<unsigned int, unsigned int> > >::emplace_back<std::pair<unsigned int, unsigned int> >(std::pair<unsigned int, unsigned int>&&)
void std::vector<std::pair<unsigned int, unsigned int>, std::allocator<std::pair<unsigned int, unsigned int> > >::_M_realloc_insert<unsigned int&, unsigned int>(__gnu_cxx::__normal_iterator<std::pair<unsigned int, unsigned int>*, std::vector<std::pair<unsigned int, unsigned int>, std::allocator<std::pair<unsigned int, unsigned int> > > >, unsigned int&, unsigned int&&)
void std::vector<std::pair<unsigned int, unsigned int>, std::allocator<std::pair<unsigned int, unsigned int> > >::_M_realloc_insert<std::pair<unsigned int, unsigned int> >(__gnu_cxx::__normal_iterator<std::pair<unsigned int, unsigned int>*, std::vector<std::pair<unsigned int, unsigned int>, std::allocator<std::pair<unsigned int, unsigned int> > > >, std::pair<unsigned int, unsigned int>&&)
void std::vector<std::pair<unsigned int, std::vector<int, std::allocator<int> > >, std::allocator<std::pair<unsigned int, std::vector<int, std::allocator<int> > > > >::_M_realloc_insert<unsigned int, std::vector<int, std::allocator<int> > >(__gnu_cxx::__normal_iterator<std::pair<unsigned int, std::vector<int, std::allocator<int> > >*, std::vector<std::pair<unsigned int, std::vector<int, std::allocator<int> > >, std::allocator<std::pair<unsigned int, std::vector<int, std::allocator<int> > > > > >, unsigned int&&, std::vector<int, std::allocator<int> >&&)
void std::vector<std::pair<char const*, int>, std::allocator<std::pair<char const*, int> > >::_M_realloc_insert<std::pair<char const*, int> >(__gnu_cxx::__normal_iterator<std::pair<char const*, int>*, std::vector<std::pair<char const*, int>, std::allocator<std::pair<char const*, int> > > >, std::pair<char const*, int>&&)
void std::__cxx11::list<unsigned int, std::allocator<unsigned int> >::sort<Clasp::ClaspVmtf::LessLevel>(Clasp::ClaspVmtf::LessLevel)
std::pair<std::_Rb_tree_iterator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, bool> std::_Rb_tree<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::_Identity<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >::_M_insert_unique<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&>(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)
std::_Rb_tree<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::_Identity<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >::_M_get_insert_unique_pos(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)
std::pair<std::_Rb_tree_iterator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, unsigned long> >, bool> std::_Rb_tree<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, unsigned long>, std::_Select1st<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, unsigned long> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, unsigned long> > >::_M_insert_unique<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, unsigned long> >(std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, unsigned long>&&)
unsigned int* std::__rotate_adaptive<unsigned int*, unsigned int*, long>(unsigned int*, unsigned int*, unsigned int*, long, long, unsigned int*, long)
typeinfo for std::thread::_State_impl<std::thread::_Invoker<std::tuple<std::_Mem_fn<void (Clasp::ClaspFacade::SolveStrategy::*)(Clasp::SolveMode_t)>, Clasp::ClaspFacade::SolveStrategy::Async*, Clasp::SolveMode_t::E> > >
typeinfo for std::thread::_State_impl<std::thread::_Invoker<std::tuple<std::_Mem_fn<void (Clasp::mt::ParallelSolve::*)(unsigned int)>, Clasp::mt::ParallelSolve*, unsigned int> > >
typeinfo for std::_Mutex_base<(__gnu_cxx::_Lock_policy)2>
typeinfo for std::_Sp_counted_base<(__gnu_cxx::_Lock_policy)2>
typeinfo for std::_Sp_counted_ptr_inplace<unsigned int, std::allocator<void>, (__gnu_cxx::_Lock_policy)2>
typeinfo name for std::thread::_State_impl<std::thread::_Invoker<std::tuple<std::_Mem_fn<void (Clasp::ClaspFacade::SolveStrategy::*)(Clasp::SolveMode_t)>, Clasp::ClaspFacade::SolveStrategy::Async*, Clasp::SolveMode_t::E> > >
typeinfo name for std::thread::_State_impl<std::thread::_Invoker<std::tuple<std::_Mem_fn<void (Clasp::mt::ParallelSolve::*)(unsigned int)>, Clasp::mt::ParallelSolve*, unsigned int> > >
typeinfo name for std::_Mutex_base<(__gnu_cxx::_Lock_policy)2>
typeinfo name for std::_Sp_counted_base<(__gnu_cxx::_Lock_policy)2>
typeinfo name for std::_Sp_make_shared_tag
typeinfo name for std::_Sp_counted_ptr_inplace<unsigned int, std::allocator<void>, (__gnu_cxx::_Lock_policy)2>
vtable for std::thread::_State_impl<std::thread::_Invoker<std::tuple<std::_Mem_fn<void (Clasp::ClaspFacade::SolveStrategy::*)(Clasp::SolveMode_t)>, Clasp::ClaspFacade::SolveStrategy::Async*, Clasp::SolveMode_t::E> > >
vtable for std::thread::_State_impl<std::thread::_Invoker<std::tuple<std::_Mem_fn<void (Clasp::mt::ParallelSolve::*)(unsigned int)>, Clasp::mt::ParallelSolve*, unsigned int> > >
vtable for std::_Sp_counted_ptr_inplace<unsigned int, std::allocator<void>, (__gnu_cxx::_Lock_policy)2>
std::_Sp_make_shared_tag::_S_ti()::__tag
std::__detail::__to_chars_10_impl<unsigned int>(char*, unsigned int, unsigned int)::__digits
std::__detail::__to_chars_10_impl<unsigned long>(char*, unsigned int, unsigned long)::__digits

@haampie
Copy link
Contributor Author

haampie commented Aug 12, 2023

Dug into the pros and cons a bit further: to be able to catch exceptions in a different binary from libclingo.so, you need visible typeinfo for each exception type in libclingo.

If libclingo.so is supposed to be basically a C library, I guess that's not an issue.

@rkaminsk rkaminsk added this to the v5.7.0 milestone Aug 12, 2023
@rkaminsk
Copy link
Member

Dug into the pros and cons a bit further: to be able to catch exceptions in a different binary from libclingo.so, you need visible typeinfo for each exception type in libclingo.

If libclingo.so is supposed to be basically a C library, I guess that's not an issue.

All exceptions are caught internally. Anything else is a bug.

@rkaminsk
Copy link
Member

We can just give it a try. If there are issues on some platform, it is still possible to switch to a more conservative change.

@rkaminsk rkaminsk merged commit 488f3b7 into potassco:master Aug 12, 2023
3 checks passed
@haampie haampie deleted the fix/hide-symbols branch August 12, 2023 12:03
@rkaminsk
Copy link
Member

I (again) missed that this PR was against the master. All PRs have to go to the wip branch first. Can you please reopen?

@haampie
Copy link
Contributor Author

haampie commented Aug 12, 2023

See #449, perhaps set the default branch to wip?

@rkaminsk
Copy link
Member

See #449, perhaps set the default branch to wip?

I wanted the latest stable code to be shown but PR against the wip.

tgamblin added a commit to spack/spack that referenced this pull request Feb 15, 2024
5.7.0 was just released. It includes a number of changes requested and/or
upstreamed by Spack developers, e.g.:

* API for accessing optimization priorities: potassco/clingo#406
* Hash optimization: potassco/clingo#441
* Contributing Guide: potassco/clingo#465
* Hiding more ELF symbols:
  * potassco/clingo#447
  * potassco/clingo#449
alalazo pushed a commit to spack/spack that referenced this pull request Feb 16, 2024
5.7.0 was just released. It includes a number of changes requested and/or
upstreamed by Spack developers, e.g.:

* API for accessing optimization priorities: potassco/clingo#406
* Hash optimization: potassco/clingo#441
* Contributing Guide: potassco/clingo#465
* Hiding more ELF symbols:
  * potassco/clingo#447
  * potassco/clingo#449
mathomp4 pushed a commit to mathomp4/spack that referenced this pull request Mar 27, 2024
5.7.0 was just released. It includes a number of changes requested and/or
upstreamed by Spack developers, e.g.:

* API for accessing optimization priorities: potassco/clingo#406
* Hash optimization: potassco/clingo#441
* Contributing Guide: potassco/clingo#465
* Hiding more ELF symbols:
  * potassco/clingo#447
  * potassco/clingo#449
teaguesterling pushed a commit to teaguesterling/spack that referenced this pull request Jun 15, 2024
5.7.0 was just released. It includes a number of changes requested and/or
upstreamed by Spack developers, e.g.:

* API for accessing optimization priorities: potassco/clingo#406
* Hash optimization: potassco/clingo#441
* Contributing Guide: potassco/clingo#465
* Hiding more ELF symbols:
  * potassco/clingo#447
  * potassco/clingo#449
kwryankrattiger pushed a commit to kwryankrattiger/spack that referenced this pull request Jul 9, 2024
5.7.0 was just released. It includes a number of changes requested and/or
upstreamed by Spack developers, e.g.:

* API for accessing optimization priorities: potassco/clingo#406
* Hash optimization: potassco/clingo#441
* Contributing Guide: potassco/clingo#465
* Hiding more ELF symbols:
  * potassco/clingo#447
  * potassco/clingo#449
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants