Commit ec8581eb authored by Christopher James Halse Rogers's avatar Christopher James Halse Rogers Committed by Simon Quigley

Misc cleanups

parent d7e9fc18
......@@ -16,6 +16,15 @@ yaml-cpp (0.6.2-1) UNRELEASED; urgency=medium
* d/copyright: Use https protocol in Format field
* d/changelog: Remove trailing whitespaces
[ Christopher James Halse Rogers ]
* patches/symbol-visibility.patch: Hide non-public-API symbols.
- Cuts down the number of exported symbols by over half, and makes
it more feasible to use a .symbols file
* d/rules: Use VERBOSE make.
- Lets the hardening buildlog scanning check that the appropriate
flags have been passed, and makes it easier to debug build
failures.
-- Andreas Tille <tille@debian.org> Tue, 19 Jun 2018 14:12:09 +0200
yaml-cpp (0.5.2-4) unstable; urgency=medium
......
install-cmake-dev-files.patch
reproducible-build.patch
symbol-visibility.patch
commit df9206778fe9ff1bdd56d975c29c43dfe1e66de7
Author: Christopher James Halse Rogers <christopher.halse.rogers@canonical.com>
Date: Fri Nov 23 15:26:53 2018 +1100
Export only YAML_CPP_API-tagged symbols on Linux.
This marks classes tagged with YAML_CPP_API with visibility("default"), to
explicitly export them, and then makes the default visibility "hidden" via
-fvisibility=hidden.
This reduces the number of exported symbols by more than 50%, which has
a small application start-up time and memory useage benefit. It also
makes it more feasible to audit the set of exported symbols in automated
ABI compatibility systems.
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1aa7839..e97d054 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -142,6 +142,14 @@ if(WIN32)
endif()
endif()
+if(CMAKE_SYSTEM_NAME MATCHES "Linux")
+ set(CMAKE_CXX_VISIBILITY_PRESET hidden)
+ if (POLICY CMP0063)
+ cmake_policy(SET CMP0063 NEW)
+ endif()
+ add_definitions(-DYAML_CPP_USE_VISIBILITY)
+endif()
+
# GCC or Clang or Intel Compiler specialities
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU" OR
CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR
diff --git a/include/yaml-cpp/dll.h b/include/yaml-cpp/dll.h
index a32c06b..5b8c905 100644
--- a/include/yaml-cpp/dll.h
+++ b/include/yaml-cpp/dll.h
@@ -27,7 +27,11 @@
#define YAML_CPP_API __declspec(dllimport)
#endif // yaml_cpp_EXPORTS
#else // YAML_CPP_DLL
+#ifdef YAML_CPP_USE_VISIBILITY
+#define YAML_CPP_API __attribute__ ((visibility("default")))
+#else
#define YAML_CPP_API
+#endif // YAML_CPP_USE_VISIBILITY
#endif // YAML_CPP_DLL
#endif // DLL_H_62B23520_7C8E_11DE_8A39_0800200C9A66
......@@ -37,8 +37,8 @@ override_dh_auto_configure:
override_dh_auto_build:
dh_testdir
$(MAKE) -C build-static
$(MAKE) -C build-shared
$(MAKE) -C build-static VERBOSE=1
$(MAKE) -C build-shared VERBOSE=1
# It might make sense to also provide the utils in a separate package
# $(MAKE) -C build-shared util
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment