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.
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
--- /dev/null
+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.
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
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
// -*- 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
/// 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
{
// -*- 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()
#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"
#include "abg-libzip-utils.h"
#endif
+ABG_END_EXPORT_DECLARATIONS
+// </headers defining libabigail's API>
+
namespace abigail
{
// -*- 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
#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
/// @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
{
// -*- 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
///(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
#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
// -*- 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
{
// -*- 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
{
// -*- 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
{
/// 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
{
#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
// -*- 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
{
// 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
{
// -*- 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
{
// -*- 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
{
#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
{
// -*- 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"
#include "abg-writer.h"
#include "abg-libxml-utils.h"
+ABG_END_EXPORT_DECLARATIONS
+// </headers defining libabigail's API>
+
namespace abigail
{
using std::cerr;
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 =
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