Control symbols exported from libabigail.so
authorDodji Seketeli <dodji@redhat.com>
Wed, 27 Jul 2016 10:18:58 +0000 (12:18 +0200)
committerDodji Seketeli <dodji@redhat.com>
Wed, 27 Jul 2016 10:51:02 +0000 (12:51 +0200)
Symbols of pretty much all member functions of types that are meant to
be "private" to translation units that contribute to libabigail.so
were exported because we didn't do much to prevent that.

This patch starts controlling the set of symbols that are exported.

By default, symbols of any entity declared in a translation unit that
contributes to libabigail.so are hidden by default.  Only symbols of
entities declared in public headers (headers in include/*.h) are
exported.

There are many ways to achieve that.  This patch chooses to avoid
cluttering declarations of entities in the public header by adding
__attribute__((visibility="default")) to every declared type of
function in there.

Rather, the patch uses "#pragma GCC visibility push(default)" before
entities declared on those headers.  By doing so, all those entities
have their symbol marked as "visible" by the compiler.  Once the
header are #included, the #pragma GCC visibility pop" is used, so that
anything else has its symbol be hidden from that point on.

Note that for ease of maintenance the patch uses the macros
ABG_BEGIN_EXPORT_DECLARATIONS and ABG_END_EXPORT_DECLARATIONS rather
than using the pragma directive directly.

I believe this is a more elegant way of handling visibility, compared
to cluttering every single declaration in public headers with a
"__attribute__((visibility=("default")))" or with a macro which
expands to it.

This reduces the the set of symbols exported by libabigail.so from
20000+ to less than 5000.

* VISIBILITY: New documentation about this visiblity business.
* CONTRIBUTING: Update the "contributing guide" to refer to symbol
visibility issues.
* configure.ac: Define a variable VISIBILITY_FLAGS that is set to
the -fvisibility=hidden flag to pass to GCC, when its available.
* src/Makefile.am: Add VISIBILITY to source distribution.  Also
add COMPILING and COMMIT-LOG-GUIDELINES that were missing.
* src/Makefile.am: Use the new $(VISIBILITY_FLAGS) when buiding
the library.
* tests/Makefile.am: Use the new $(VISIBILITY_FLAGS) when buiding
tests.
* tools/Makefile.am: Use the new $(VISIBILITY_FLAGS) when buiding
tools.
* src/abg-comp-filter.cc: Enclose inclusion of public headers in
ABG_BEGIN_EXPORT_DECLARATIONS and ABG_END_EXPORT_DECLARATIONS to
export the symbols of entities declared in there.
* src/abg-comparison.cc: Likewise.
* src/abg-config.cc: Likewise.
* src/abg-corpus.cc: Likewise.
* src/abg-diff-utils.cc: Likewise.
* src/abg-dwarf-reader.cc: Likewise.
* src/abg-hash.cc: Likewise.
* src/abg-ini.cc: Likewise.
* src/abg-ir.cc: Likewise.
* src/abg-libxml-utils.cc: Likewise.
* src/abg-libzip-utils.cc: Likewise.
* src/abg-reader.cc: Likewise.
* src/abg-suppression.cc: Likewise.
* src/abg-tools-utils.cc: Likewise.
* src/abg-traverse.cc: Likewise.
* src/abg-viz-common.cc: Likewise.
* src/abg-viz-dot.cc: Likewise.
* src/abg-viz-svg.cc: Likewise.
* src/abg-workers.cc: Likewise.
* src/abg-writer.cc: Likewise.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
28 files changed:
CONTRIBUTING
Makefile.am
VISIBILITY [new file with mode: 0644]
configure.ac
src/Makefile.am
src/abg-comp-filter.cc
src/abg-comparison.cc
src/abg-config.cc
src/abg-corpus.cc
src/abg-diff-utils.cc
src/abg-dwarf-reader.cc
src/abg-hash.cc
src/abg-ini.cc
src/abg-internal.h
src/abg-ir.cc
src/abg-libxml-utils.cc
src/abg-libzip-utils.cc
src/abg-reader.cc
src/abg-suppression.cc
src/abg-tools-utils.cc
src/abg-traverse.cc
src/abg-viz-common.cc
src/abg-viz-dot.cc
src/abg-viz-svg.cc
src/abg-workers.cc
src/abg-writer.cc
tests/Makefile.am
tools/Makefile.am

index 2796abc420007ac9029f068315010e543f0aa91e..0b0f9044621896a0b7a2d086ac9e43e76b715a18 100644 (file)
@@ -30,6 +30,11 @@ Patches have to be sent by email to libabigail@sourceware.org.
 Please read the file COMMIT-LOG-GUIDELINES in the source tree to learn
 about how to write the commit log accompanying the patch.
 
+If you are adding a new public header file to the project, or if you
+are defining a new entry point to the API of libabigail, please take
+some time to read the file VISIBILITY about how you need to handle the
+visibility of symbols that are part of the API and ABI of libabigail.
+
 Make sure you sign your patch.  To learn about signing, please read
 the "Sign your work" chapter below.
 
index 6e2a32f99c2317fb13ab9126fa701e6ca6ea2c85..9d2876df5e5afcf3f8235ecaf1ecf8d5296851e9 100644 (file)
@@ -19,8 +19,9 @@ EXTRA_DIST =                  \
 autoconf-archive/ax_check_python_modules.m4 \
 autoconf-archive/ax_prog_python_version.m4 \
 autoconf-archive/ax_compare_version.m4 \
-NEWS README COPYING ChangeLog  \
-COPYING-LGPLV2 COPYING-LGPLV3  \
+NEWS README COPYING COMPILING  \
+COMMIT-LOG-GUIDELINES VISIBILITY \
+ChangeLog COPYING-LGPLV2 COPYING-LGPLV3        \
 COPYING-GPLV3 gen-changelog.py \
 $(headers) $(m4data_DATA)      \
 libabigail.pc.in
diff --git a/VISIBILITY b/VISIBILITY
new file mode 100644 (file)
index 0000000..b78111b
--- /dev/null
@@ -0,0 +1,68 @@
+PLEASE READ ALL OF THIS FILE, ESPECIALLY IF YOU ARE DEFINING A NEW
+PUBLIC HEADER IN LIBABIGAIL.
+
+How symbols that are exported are controlled in libabigail
+==========================================================
+
+We try to limit the number of ELF symbols that are exported by the
+libabigail.so shared library.  We call this symbols visibility
+control.
+
+As GNU/Linux is our development platform, we control symbol visibility
+by using the visibility support of the G++ compiler.
+
+How to do so is properly explained at https://gcc.gnu.org/wiki/Visibility.
+
+All symbols are hidden by default
+=================================
+
+When building translation units that make up the libabigail.so shared
+library, G++ is invoked with the -fvisibility=hidden directive.  Which
+instructs it to make symbols of functions and global variables
+*locally* defined in the shared library, *NOT* exported (or global).
+
+Exporting symbols of entities declared in public headers
+========================================================
+
+In a translation unit that is part of the libabigail.so shared
+library, before including a header file that is a public libabigail
+header (e.g, abg-ir.h), one need to declare:
+
+    #include "abg-internal.h"
+    ABG_BEGIN_EXPORT_DECLARATIONS
+
+then all the public header files inclusion (using #include directives)
+follow.  At the end of these public header files inclusion, one need
+to declare:
+
+    ABG_END_EXPORT_DECLARATIONS
+
+
+The ABG_BEGIN_EXPORT_DECLARATIONS is a macro defined in abg-internal.h
+which expands to:
+
+    #pragma GCC visibility push(default)
+
+This instructs G++ to export the symbol of all global functions and
+variables definitions that are declared from that point on.
+
+The ABG_END_EXPORT_DECLARATIONS is a macro defined in abg-internal.h
+which expands to:
+
+    #pragma GCC visibility pop
+
+It instructs G++ to stop exporting symbols of global functions and
+variable definition from that point on.
+
+In practice, the pair ABG_BEGIN_EXPORT_DECLARATIONS,
+ABG_END_EXPORT_DECLARATIONS allows us to only export symbols of
+global functions and variables declared in the block denoted by these
+two macros. Symbols of anything else that is declared outside of that block
+are going to be hidden, thanks to the -fvisibility=hidden option
+passed to G++.
+
+So whenever you are defining a new header file with declarations that
+ought to be part of the API of libabigail, the *definition* file which
+defines the declarations of the header file must use
+the ABG_BEGIN_EXPORT_DECLARATIONS and ABG_END_EXPORT_DECLARATIONS
+macro to include the public header.
index 84f423adce27ce6fd97fea1a1a34a6a4cb883c93..eb9caebc946a22b69f14c1b8c7e5fa86f1fb2996 100644 (file)
@@ -134,10 +134,14 @@ if test x$SUPPORTS_GCC_VISIBILITY_ATTRIBUTE = xyes; then
    AC_MSG_NOTICE([GCC visibility attribute is supported])
    AC_DEFINE([HAS_GCC_VISIBILITY_ATTRIBUTE], 1,
             [Defined if the compiler supports the attribution visibility syntax __attribute__((visibility("hidden")))])
+   VISIBILITY_FLAGS="-fvisibility=hidden"
 else
    AC_MSG_NOTICE([GCC visibility attribute is not supported])
+   VISIBILITY_FLAGS=
 fi
 
+AC_SUBST(VISIBILITY_FLAGS)
+
 dnl Check for dependency: libelf, libdw, libebl (elfutils)
 dnl Note that we need to use at least elfutils 0.159 but
 dnl at that time elfutils didnt have pkgconfig capabilities
index b7adc24ed65fc084700842d967233d67fdb11598..7b5156ca0229b54cd137680ef5585f76c9a0e9c8 100644 (file)
@@ -1,11 +1,13 @@
 lib_LTLIBRARIES=libabigail.la
 libabigaildir=$(libdir)
 
+AM_CXXFLAGS = $(VISIBILITY_FLAGS)
+
 if ENABLE_CXX11
 CXX11_SOURCES = abg-viz-common.cc                      \
                abg-viz-dot.cc                          \
                abg-viz-svg.cc
-AM_CXXFLAGS="-std=gnu++11"
+AM_CXXFLAGS += "-std=gnu++11"
 else
 CXX11_SOURCES =
 endif
index de89f1b093860ddc44a59e58d23aadc2f8fe5b7f..62c6213932d8941a885462b87e56efb8ec761453 100644 (file)
@@ -1,6 +1,6 @@
 // -*- Mode: C++ -*-
 //
-// Copyright (C) 2013-2015 Red Hat, Inc.
+// Copyright (C) 2013-2016 Red Hat, Inc.
 //
 // This file is part of the GNU Application Binary Interface Generic
 // Analysis and Instrumentation Library (libabigail).  This library is
 /// This file contains definitions of diff objects filtering
 /// facilities.
 
+#include "abg-internal.h"
+// <headers defining libabigail's API go under here>
+ABG_BEGIN_EXPORT_DECLARATIONS
+
 #include "abg-comp-filter.h"
 
+ABG_END_EXPORT_DECLARATIONS
+// </headers defining libabigail's API>
+
 namespace abigail
 {
 namespace comparison
index 0243f3ca5874db2828e168923b021166cf96a9bc..9f1dec72d88801171fdb189a0d031a7cc616ef81 100644 (file)
 /// libabigail.
 
 #include <ctype.h>
+#include <libgen.h>
 #include <algorithm>
 #include <sstream>
-#include <libgen.h>
+
+#include "abg-internal.h"
+// <headers defining libabigail's API go under here>
+ABG_BEGIN_EXPORT_DECLARATIONS
+
 #include "abg-hash.h"
 #include "abg-suppression.h"
 #include "abg-comp-filter.h"
 #include "abg-sptr-utils.h"
 #include "abg-tools-utils.h"
 
+ABG_END_EXPORT_DECLARATIONS
+// </headers defining libabigail's API>
+
 namespace abigail
 {
 
index 8b1f7eb23e58410df2e62e7795151ea70a1ccd17..88e54652fe24ebee852fd6c7bff56a4bce81c09f 100644 (file)
@@ -1,6 +1,6 @@
 // -*- Mode: C++ -*-
 //
-// Copyright (C) 2013-2015 Red Hat, Inc.
+// Copyright (C) 2013-2016 Red Hat, Inc.
 //
 // This file is part of the GNU Application Binary Interface Generic
 // Analysis and Instrumentation Library (libabigail).  This library is
 
 /// @file
 
-#include "config.h"
+#include "abg-internal.h"
+// <headers defining libabigail's API go under here>
+ABG_BEGIN_EXPORT_DECLARATIONS
+
 #include "abg-config.h"
 #include "abg-version.h"
 
+ABG_END_EXPORT_DECLARATIONS
+// </headers defining libabigail's API>
+
 namespace abigail
 {
 config::config()
index 465d960b394e614a57b48cb76070b9554f9d4f12..891ca27bc5deed49128b505a1c58262ccbab45dc 100644 (file)
 #include <stdexcept>
 #include <algorithm>
 #include <tr1/unordered_map>
+
+#include "abg-internal.h"
+// <headers defining libabigail's API go under here>
+ABG_BEGIN_EXPORT_DECLARATIONS
+
 #include "abg-sptr-utils.h"
 #include "abg-ir.h"
 #include "abg-corpus.h"
@@ -38,6 +43,9 @@
 #include "abg-libzip-utils.h"
 #endif
 
+ABG_END_EXPORT_DECLARATIONS
+// </headers defining libabigail's API>
+
 namespace abigail
 {
 
index bf2a1db3906a8ab8462d45a8d405dd3614496d0a..b8c69261da7981b32040d476504e8a400dae8d19 100644 (file)
@@ -1,6 +1,6 @@
 // -*- Mode: C++ -*-
 //
-// Copyright (C) 2013-2015 Red Hat, Inc.
+// Copyright (C) 2013-2016 Red Hat, Inc.
 //
 // This file is part of the GNU Application Binary Interface Generic
 // Analysis and Instrumentation Library (libabigail).  This library is
 // not, see <http://www.gnu.org/licenses/>.
 
 #include <cstring>
+
+#include "abg-internal.h"
+// <headers defining libabigail's API go under here>
+ABG_BEGIN_EXPORT_DECLARATIONS
+
 #include "abg-diff-utils.h"
 
+ABG_END_EXPORT_DECLARATIONS
+// </headers defining libabigail's API>
+
 /// @file
 ///
 /// This file defines the declarations found in abg-diff-utils.h
index 57110ffc72b1a0d362617b8c1616e082b3fce871..5e8ee0d4bc37775922a09b41fb1fcb957865f41e 100644 (file)
 #include <list>
 #include <ostream>
 #include <sstream>
+
+#include "abg-internal.h"
+// <headers defining libabigail's API go under here>
+ABG_BEGIN_EXPORT_DECLARATIONS
+
 #include "abg-dwarf-reader.h"
 #include "abg-sptr-utils.h"
 #include "abg-tools-utils.h"
 
+ABG_END_EXPORT_DECLARATIONS
+// </headers defining libabigail's API>
+
 using std::string;
 
 namespace abigail
index 8a680535a90fce19dadef799d2e665dc59d33b79..c03cdda998215899f8103b54db7871cf92e7da24 100644 (file)
 
 /// @file
 
+#include "abg-internal.h"
+// <headers defining libabigail's API go under here>
+ABG_BEGIN_EXPORT_DECLARATIONS
+
 #include "abg-hash.h"
 #include "abg-ir.h"
 
+ABG_END_EXPORT_DECLARATIONS
+// </headers defining libabigail's API>
+
 namespace abigail
 {
 
index 4573ec109680db4195c11edfb2bcfd4d8e03b541..e1848762d6794c74079ca79512b4c01b22f9091f 100644 (file)
@@ -1,6 +1,6 @@
 // -*- Mode: C++ -*-
 //
-// Copyright (C) 2013-2015 Red Hat, Inc.
+// Copyright (C) 2013-2016 Red Hat, Inc.
 //
 // This file is part of the GNU Application Binary Interface Generic
 // Analysis and Instrumentation Library (libabigail).  This library is
 #include <memory>
 #include <fstream>
 #include <sstream>
+
+#include "abg-internal.h"
+// <headers defining libabigail's API go under here>
+ABG_BEGIN_EXPORT_DECLARATIONS
+
 #include "abg-ini.h"
 
+ABG_END_EXPORT_DECLARATIONS
+// </headers defining libabigail's API>
+
 namespace abigail
 {
 namespace ini
index 521a9f339e482225d05efa2abfa5c22878d159a6..6a6ef70a64c5e9be48f11cde982d3aa2bb73943a 100644 (file)
@@ -39,8 +39,8 @@
 ///(function or variable) is going to be global.  External ELF files
 ///will be able to link against the symbol.
 #define ABG_EXPORTED __attribute__((visibility("default")))
-#define ABG_BEGIN_EXPORT_DECLARATIONS #pagma GCC visibility push(default)
-#define ABG_END_EXPORT_DECLARATIONS #pragma GCC visibility pop
+#define ABG_BEGIN_EXPORT_DECLARATIONS _Pragma("GCC visibility push(default)")
+#define ABG_END_EXPORT_DECLARATIONS _Pragma("GCC visibility pop")
 #else
 #define ABG_HIDDEN
 #define ABG_EXPORTED
index 3b3573abefdb9558d7a2d6fdf999cb7ff5298ffa..a9674c936922e23ebd73af2d48f408cb15fcb430 100644 (file)
 #include <sstream>
 #include <tr1/memory>
 #include <tr1/unordered_map>
+
+#include "abg-internal.h"
+// <headers defining libabigail's API go under here>
+ABG_BEGIN_EXPORT_DECLARATIONS
+
 #include "abg-sptr-utils.h"
 #include "abg-interned-str.h"
 #include "abg-ir.h"
 #include "abg-corpus.h"
 
+ABG_END_EXPORT_DECLARATIONS
+// </headers defining libabigail's API>
+
 namespace
 {
 /// This internal type is a tree walker that walks the sub-tree of a
index 64a735d64760041544d21de471b183a6f4a3c6f1..9cb302062dddbff074906715181664d0848d5b26 100644 (file)
@@ -1,6 +1,6 @@
 // -*- mode: C++ -*-
 //
-// Copyright (C) 2013-2015 Red Hat, Inc.
+// Copyright (C) 2013-2016 Red Hat, Inc.
 //
 // This file is part of the GNU Application Binary Interface Generic
 // Analysis and Instrumentation Library (libabigail).  This library is
 
 #include <string>
 #include <iostream>
+
+#include "abg-internal.h"
+// <headers defining libabigail's API go under here>
+ABG_BEGIN_EXPORT_DECLARATIONS
+
 #include "abg-libxml-utils.h"
 
+ABG_END_EXPORT_DECLARATIONS
+// </headers defining libabigail's API>
+
 namespace abigail
 {
 
index 5d8ad8f69ab00d0ea10627d4bd89ee5f1db1681d..ba025d5ac5e585ceb7209cca09f8ad8b238f988f 100644 (file)
@@ -1,6 +1,6 @@
 // -*- mode: C++ -*-
 //
-// Copyright (C) 2013-2015 Red Hat, Inc.
+// Copyright (C) 2013-2016 Red Hat, Inc.
 //
 // This file is part of the GNU Application Binary Interface Generic
 // Analysis and Instrumentation Library (libabigail).  This library is
 
 /// @file
 
-#include "config.h"
+#include "abg-internal.h"
 #ifdef WITH_ZIP_ARCHIVE
+// <headers defining libabigail's API go under here>
+ABG_BEGIN_EXPORT_DECLARATIONS
 
-#include <string>
 #include "abg-libzip-utils.h"
 
+ABG_END_EXPORT_DECLARATIONS
+// </headers defining libabigail's API>
+
+#include <string>
 namespace abigail
 {
 
index 76349c6c687fa7c15aa651e77f21899d84daaf96..61118d4cafc5c5fa0c1bde71b92485c8bf42a6db 100644 (file)
@@ -1,6 +1,6 @@
 // -*- mode: C++ -*-
 //
-// Copyright (C) 2013-2015 Red Hat, Inc.
+// Copyright (C) 2013-2016 Red Hat, Inc.
 //
 // This file is part of the GNU Application Binary Interface Generic
 // Analysis and Instrumentation Library (libabigail).  This library is
 #include <sstream>
 #include <libxml/xmlstring.h>
 #include <libxml/xmlreader.h>
+
+#include "abg-internal.h"
+// <headers defining libabigail's API go under here>
+ABG_BEGIN_EXPORT_DECLARATIONS
+
 #include "abg-libxml-utils.h"
+#include "abg-reader.h"
 #include "abg-corpus.h"
 
 #ifdef WITH_ZIP_ARCHIVE
 #include "abg-libzip-utils.h"
 #endif
 
+ABG_END_EXPORT_DECLARATIONS
+// </headers defining libabigail's API>
+
 namespace abigail
 {
 
index e5743a43840e0e7dea62140d53fdab09e7e5c650..4e1a7ee6eb59faee1469867fa364657cfdf12750 100644 (file)
 /// This contains the implementation of the suppression engine of
 /// libabigail.
 
+#include "abg-internal.h"
+// <headers defining libabigail's API go under here>
+ABG_BEGIN_EXPORT_DECLARATIONS
+
 #include "abg-suppression.h"
 #include "abg-ini.h"
 #include "abg-sptr-utils.h"
 #include "abg-comp-filter.h"
 #include "abg-tools-utils.h"
 
+// <headers defining libabigail's API go under here>
+ABG_BEGIN_EXPORT_DECLARATIONS
+
 namespace abigail
 {
 
index bece9a17a970f82e1e432e3427704eaf38abc558..480155b08c869246e1d4cd774b328b7b01c88634 100644 (file)
 #include <fstream>
 #include <iostream>
 #include <sstream>
+
+#include "abg-internal.h"
+// <headers defining libabigail's API go under here>
+ABG_BEGIN_EXPORT_DECLARATIONS
+
 #include <abg-ir.h>
 #include "abg-tools-utils.h"
 
+ABG_END_EXPORT_DECLARATIONS
+// </headers defining libabigail's API>
+
 using std::string;
 
 namespace abigail
index 9d5b11841b21a0e6e86162f96f797bfd7daf57c5..98e2690a591a1094027a04e52fd98fde5bda3e38 100644 (file)
@@ -1,6 +1,6 @@
 // -*- Mode: C++ -*-
 //
-// Copyright (C) 2013-2015 Red Hat, Inc.
+// Copyright (C) 2013-2016 Red Hat, Inc.
 //
 // This file is part of the GNU Application Binary Interface Generic
 // Analysis and Instrumentation Library (libabigail).  This library is
 
 /// @file
 
+#include "abg-internal.h"
+// <headers defining libabigail's API go under here>
+ABG_BEGIN_EXPORT_DECLARATIONS
+
 #include "abg-traverse.h"
 
+ABG_END_EXPORT_DECLARATIONS
+// </headers defining libabigail's API>
+
 namespace abigail
 {
 
index 531182e55a8716cbf904007c0ec604b4559b5898..e7a975368233e20391209e4d0287ec332327fba7 100644 (file)
 // License along with this program; see the file COPYING-LGPLV3.  If
 // not, see <http://www.gnu.org/licenses/>.
 
-#include "abg-viz-svg.h"
 #include <stdexcept>
 #include <fstream>
 
+#include "abg-internal.h"
+// <headers defining libabigail's API go under here>
+ABG_BEGIN_EXPORT_DECLARATIONS
+
+#include "abg-viz-svg.h"
+
+ABG_END_EXPORT_DECLARATIONS
+// </headers defining libabigail's API>
+
 namespace abigail
 {
 
index ec86710e31e343d5428658ffb6b9e1e14d8a0dfc..03be99f3dc65292f1e77696b13c1ad109b0b6cef 100644 (file)
@@ -1,6 +1,6 @@
 // -*- mode: C++ -*-
 //
-// Copyright (C) 2013-2015 Red Hat, Inc.
+// Copyright (C) 2013-2016 Red Hat, Inc.
 //
 // This file is part of the GNU Application Binary Interface Generic
 // Analysis and Instrumentation Library (libabigail).  This library is
 // License along with this program; see the file COPYING-LGPLV3.  If
 // not, see <http://www.gnu.org/licenses/>.
 
-#include "abg-viz-dot.h"
+
 #include <stdexcept>
 #include <fstream>
 
+#include "abg-internal.h"
+// <headers defining libabigail's API go under here>
+ABG_BEGIN_EXPORT_DECLARATIONS
+
+#include "abg-viz-dot.h"
+
+ABG_END_EXPORT_DECLARATIONS
+// </headers defining libabigail's API>
+
 namespace abigail
 {
 
index 79a009dbe879785d1a7d28c1d7c55b1bd0dfce45..8cdca6d5bb2b8f772f7a49d09dd8163d89e744fd 100644 (file)
@@ -1,6 +1,6 @@
 // -*- mode: C++ -*-
 //
-// Copyright (C) 2013-2015 Red Hat, Inc.
+// Copyright (C) 2013-2016 Red Hat, Inc.
 //
 // This file is part of the GNU Application Binary Interface Generic
 // Analysis and Instrumentation Library (libabigail).  This library is
 // License along with this program; see the file COPYING-LGPLV3.  If
 // not, see <http://www.gnu.org/licenses/>.
 
-#include "abg-viz-svg.h"
 #include <stdexcept>
 #include <fstream>
 
+#include "abg-internal.h"
+// <headers defining libabigail's API go under here>
+ABG_BEGIN_EXPORT_DECLARATIONS
+
+#include "abg-viz-svg.h"
+
+ABG_END_EXPORT_DECLARATIONS
+// </headers defining libabigail's API>
+
 namespace abigail
 {
 
index 0bc3235710ae682c183b8ddfa86a679268384a63..49a8ea6243472397345f06fa65344f6355ae5085 100644 (file)
 #include <queue>
 #include <vector>
 #include <iostream>
+
+#include "abg-internal.h"
+// <headers defining libabigail's API go under here>
+ABG_BEGIN_EXPORT_DECLARATIONS
+
 #include "abg-workers.h"
+
+ABG_END_EXPORT_DECLARATIONS
+// </headers defining libabigail's API>
+
 namespace abigail
 {
 
index ab6141dd42128e920395271135591afe31cf0a12..834938a7ab5f27add26e3138009e7fd169b89c43 100644 (file)
@@ -1,6 +1,6 @@
 // -*- mode: C++ -*-
 //
-// Copyright (C) 2013-2015 Red Hat, Inc.
+// Copyright (C) 2013-2016 Red Hat, Inc.
 //
 // This file is part of the GNU Application Binary Interface Generic
 // Analysis and Instrumentation Library (libabigail).  This library is
 #include <stack>
 #include <algorithm>
 #include <tr1/unordered_map>
+
+#include "abg-internal.h"
+// <headers defining libabigail's API go under here>
+ABG_BEGIN_EXPORT_DECLARATIONS
+
 #include "abg-config.h"
 #include "abg-corpus.h"
 #include "abg-diff-utils.h"
@@ -46,6 +51,9 @@
 #include "abg-writer.h"
 #include "abg-libxml-utils.h"
 
+ABG_END_EXPORT_DECLARATIONS
+// </headers defining libabigail's API>
+
 namespace abigail
 {
 using std::cerr;
index becadaa2e82fb46a0285d79228e8dc2d031603d0..33732fa3f11dbdc5737b429c6451b6dbcc85c63f 100644 (file)
@@ -8,10 +8,12 @@ ZIP_ARCHIVE_TESTS += runtestdot
 endif
 endif
 
+AM_CXXFLAGS = $(VISIBILITY_FLAGS)
+
 CXX11_TESTS =
 if ENABLE_CXX11
 CXX11_TESTS += runtestsvg
-AM_CXXFLAGS = "-std=gnu++11"
+AM_CXXFLAGS += "-std=gnu++11"
 endif
 
 FEDABIPKGDIFF_TEST =
index 3e53eb115a1101dfd97b89a57b2b021f9e30f3cd..de35ad47b1d0fad04df36bd8d914ec5cf1005de5 100644 (file)
@@ -49,4 +49,6 @@ abipkgdiffdir = $(bindir)
 abipkgdiff_LDADD = $(abs_top_builddir)/src/libabigail.la
 abipkgdiff_LDFLAGS = -pthread
 
-AM_CPPFLAGS=-I$(abs_top_srcdir)/include -I$(abs_top_srcdir)/tools -fPIC
+AM_CXXFLAGS = \
+$(VISIBILITY_FLAGS) -I$(abs_top_srcdir)/include \
+-I$(abs_top_srcdir)/tools -fPIC