diff mbox

[API-NEXT,PATCHv8] api: make only the API visible

Message ID 1461085575-25451-1-git-send-email-bill.fischofer@linaro.org
State New
Headers show

Commit Message

Bill Fischofer April 19, 2016, 5:06 p.m. UTC
From: Anders Roxell <anders.roxell@linaro.org>

Internal functions should not be part of symbols that are visible
outside the library. Using -fvisibility=hidden hides all internal
functions from the public ABI.

Suggested-by: Ricardo Salveti <ricardo.salveti@linaro.org>
Signed-off-by: Anders Roxell <anders.roxell@linaro.org>
Signed-off-by: Bill Fischofer <bill.fischofer@linaro.org>
---
Changes for v8:
- Add copyright and doxygen marking for new visibility_begin/end includes

Changes for v7:
- Rename abi_begin/end to visibility_begin/end to clarify intent of patch

Changes for v6:
- Include abi_begin/end.h in platform/linux-generic/Makefile.am

Changes for v5:
- Switch to use of odp/api/abi_begin/end.h to isolate #pragmas

 include/odp/api/spec/align.h                              |  2 ++
 include/odp/api/spec/atomic.h                             |  2 ++
 include/odp/api/spec/barrier.h                            |  2 ++
 include/odp/api/spec/buffer.h                             |  3 ++-
 include/odp/api/spec/byteorder.h                          |  2 ++
 include/odp/api/spec/classification.h                     |  3 ++-
 include/odp/api/spec/compiler.h                           |  2 ++
 include/odp/api/spec/config.h                             |  2 ++
 include/odp/api/spec/cpu.h                                |  2 ++
 include/odp/api/spec/cpumask.h                            |  2 ++
 include/odp/api/spec/crypto.h                             |  2 ++
 include/odp/api/spec/debug.h                              |  3 ++-
 include/odp/api/spec/errno.h                              |  2 ++
 include/odp/api/spec/event.h                              |  3 ++-
 include/odp/api/spec/hash.h                               |  2 ++
 include/odp/api/spec/hints.h                              |  2 ++
 include/odp/api/spec/init.h                               |  4 ++--
 include/odp/api/spec/packet.h                             |  2 ++
 include/odp/api/spec/packet_flags.h                       |  2 ++
 include/odp/api/spec/packet_io.h                          |  2 ++
 include/odp/api/spec/packet_io_stats.h                    |  2 ++
 include/odp/api/spec/pool.h                               |  4 ++--
 include/odp/api/spec/queue.h                              |  2 ++
 include/odp/api/spec/random.h                             |  3 ++-
 include/odp/api/spec/rwlock.h                             |  2 ++
 include/odp/api/spec/rwlock_recursive.h                   |  2 ++
 include/odp/api/spec/schedule.h                           |  3 ++-
 include/odp/api/spec/schedule_types.h                     |  2 ++
 include/odp/api/spec/shared_memory.h                      |  3 ++-
 include/odp/api/spec/spinlock.h                           |  2 ++
 include/odp/api/spec/spinlock_recursive.h                 |  2 ++
 include/odp/api/spec/std_clib.h                           |  2 ++
 include/odp/api/spec/std_types.h                          |  3 ++-
 include/odp/api/spec/sync.h                               |  2 ++
 include/odp/api/spec/system_info.h                        |  3 ++-
 include/odp/api/spec/thread.h                             |  2 ++
 include/odp/api/spec/thrmask.h                            |  2 ++
 include/odp/api/spec/ticketlock.h                         |  2 ++
 include/odp/api/spec/time.h                               |  3 ++-
 include/odp/api/spec/timer.h                              |  2 ++
 include/odp/api/spec/traffic_mngr.h                       |  2 ++
 include/odp/api/spec/version.h                            |  2 ++
 platform/Makefile.inc                                     |  1 +
 platform/linux-generic/Makefile.am                        |  2 ++
 platform/linux-generic/include/odp/api/visibility_begin.h | 15 +++++++++++++++
 platform/linux-generic/include/odp/api/visibility_end.h   | 15 +++++++++++++++
 platform/linux-generic/m4/configure.m4                    | 12 ++++++++++++
 47 files changed, 129 insertions(+), 14 deletions(-)
 create mode 100644 platform/linux-generic/include/odp/api/visibility_begin.h
 create mode 100644 platform/linux-generic/include/odp/api/visibility_end.h

Comments

Bill Fischofer April 20, 2016, 4:37 p.m. UTC | #1
Maxim: can you correct that on merge or would you prefer I sent a v9?

On Wed, Apr 20, 2016 at 10:18 AM, Savolainen, Petri (Nokia - FI/Espoo) <
petri.savolainen@nokia.com> wrote:

>

> Reviewed-by: Petri Savolainen <petri.savolainen@nokia.com>

>

> Couple of "visibiity" typos.

>

>

> >  odpapiplatincludedir= $(includedir)/odp/api/plat

> > diff --git a/platform/linux-generic/include/odp/api/visibility_begin.h

> > b/platform/linux-generic/include/odp/api/visibility_begin.h

> > new file mode 100644

> > index 0000000..9f45948

> > --- /dev/null

> > +++ b/platform/linux-generic/include/odp/api/visibility_begin.h

> > @@ -0,0 +1,15 @@

> > +/* Copyright (c) 2016, Linaro Limited

> > + * All rights reserved.

> > + *

> > + * SPDX-License-Identifier:  BSD-3-Clause

> > + */

> > +

> > +/*

> > + * @file

> > + *

> > + * Linker visibiity directives

>             ^^^^^^^^^^^

>

>

>

> > + */

> > +

> > +#if __GNUC__ >= 4

> > +#pragma GCC visibility push(default)

> > +#endif

> > diff --git a/platform/linux-generic/include/odp/api/visibility_end.h

> > b/platform/linux-generic/include/odp/api/visibility_end.h

> > new file mode 100644

> > index 0000000..f40ad0b

> > --- /dev/null

> > +++ b/platform/linux-generic/include/odp/api/visibility_end.h

> > @@ -0,0 +1,15 @@

> > +/* Copyright (c) 2016, Linaro Limited

> > + * All rights reserved.

> > + *

> > + * SPDX-License-Identifier:  BSD-3-Clause

> > + */

> > +

> > +/*

> > + * @file

> > + *

> > + * Linker visibiity directives

>              ^^^^^^^^^^

>

> > + */

> > +

> > +#if __GNUC__ >= 4

> > +#pragma GCC visibility pop

> > +#endif

> > diff --git a/platform/linux-generic/m4/configure.m4 b/platform/linux-

> > generic/m4/configure.m4

> > index f80c66c..75a3797 100644

> > --- a/platform/linux-generic/m4/configure.m4

> > +++ b/platform/linux-generic/m4/configure.m4

> > @@ -1,3 +1,15 @@

> > +# Enable -fvisibility=hidden if using a gcc that supports it

> > +OLD_CFLAGS="$CFLAGS"

> > +AC_MSG_CHECKING([whether $CC supports -fvisibility=hidden])

> > +VISIBILITY_CFLAGS="-fvisibility=hidden"

> > +CFLAGS="$CFLAGS $VISIBILITY_CFLAGS"

> > +AC_LINK_IFELSE([AC_LANG_PROGRAM()], AC_MSG_RESULT([yes]),

> > +       [VISIBILITY_CFLAGS=""; AC_MSG_RESULT([no])]);

> > +

> > +AC_SUBST(VISIBILITY_CFLAGS)

> > +# Restore CFLAGS; VISIBILITY_CFLAGS are added to it where needed.

> > +CFLAGS=$OLD_CFLAGS

> > +

> >  AC_MSG_CHECKING(for GCC atomic builtins)

> >  AC_LINK_IFELSE(

> >      [AC_LANG_SOURCE(

> > --

> > 2.5.0

> >

> > _______________________________________________

> > lng-odp mailing list

> > lng-odp@lists.linaro.org

> > https://lists.linaro.org/mailman/listinfo/lng-odp

>
Maxim Uvarov April 20, 2016, 6:09 p.m. UTC | #2
On 04/20/16 19:37, Bill Fischofer wrote:
> Maxim: can you correct that on merge or would you prefer I sent a v9?
>
I will fix.

Maxim.

> On Wed, Apr 20, 2016 at 10:18 AM, Savolainen, Petri (Nokia - FI/Espoo) 
> <petri.savolainen@nokia.com <mailto:petri.savolainen@nokia.com>> wrote:
>
>
>     Reviewed-by: Petri Savolainen <petri.savolainen@nokia.com
>     <mailto:petri.savolainen@nokia.com>>
>
>     Couple of "visibiity" typos.
>
>
>     >  odpapiplatincludedir= $(includedir)/odp/api/plat
>     > diff --git
>     a/platform/linux-generic/include/odp/api/visibility_begin.h
>     > b/platform/linux-generic/include/odp/api/visibility_begin.h
>     > new file mode 100644
>     > index 0000000..9f45948
>     > --- /dev/null
>     > +++ b/platform/linux-generic/include/odp/api/visibility_begin.h
>     > @@ -0,0 +1,15 @@
>     > +/* Copyright (c) 2016, Linaro Limited
>     > + * All rights reserved.
>     > + *
>     > + * SPDX-License-Identifier:  BSD-3-Clause
>     > + */
>     > +
>     > +/*
>     > + * @file
>     > + *
>     > + * Linker visibiity directives
>                 ^^^^^^^^^^^
>
>
>
>     > + */
>     > +
>     > +#if __GNUC__ >= 4
>     > +#pragma GCC visibility push(default)
>     > +#endif
>     > diff --git a/platform/linux-generic/include/odp/api/visibility_end.h
>     > b/platform/linux-generic/include/odp/api/visibility_end.h
>     > new file mode 100644
>     > index 0000000..f40ad0b
>     > --- /dev/null
>     > +++ b/platform/linux-generic/include/odp/api/visibility_end.h
>     > @@ -0,0 +1,15 @@
>     > +/* Copyright (c) 2016, Linaro Limited
>     > + * All rights reserved.
>     > + *
>     > + * SPDX-License-Identifier:  BSD-3-Clause
>     > + */
>     > +
>     > +/*
>     > + * @file
>     > + *
>     > + * Linker visibiity directives
>                  ^^^^^^^^^^
>
>     > + */
>     > +
>     > +#if __GNUC__ >= 4
>     > +#pragma GCC visibility pop
>     > +#endif
>     > diff --git a/platform/linux-generic/m4/configure.m4
>     b/platform/linux-
>     > generic/m4/configure.m4
>     > index f80c66c..75a3797 100644
>     > --- a/platform/linux-generic/m4/configure.m4
>     > +++ b/platform/linux-generic/m4/configure.m4
>     > @@ -1,3 +1,15 @@
>     > +# Enable -fvisibility=hidden if using a gcc that supports it
>     > +OLD_CFLAGS="$CFLAGS"
>     > +AC_MSG_CHECKING([whether $CC supports -fvisibility=hidden])
>     > +VISIBILITY_CFLAGS="-fvisibility=hidden"
>     > +CFLAGS="$CFLAGS $VISIBILITY_CFLAGS"
>     > +AC_LINK_IFELSE([AC_LANG_PROGRAM()], AC_MSG_RESULT([yes]),
>     > +       [VISIBILITY_CFLAGS=""; AC_MSG_RESULT([no])]);
>     > +
>     > +AC_SUBST(VISIBILITY_CFLAGS)
>     > +# Restore CFLAGS; VISIBILITY_CFLAGS are added to it where needed.
>     > +CFLAGS=$OLD_CFLAGS
>     > +
>     >  AC_MSG_CHECKING(for GCC atomic builtins)
>     >  AC_LINK_IFELSE(
>     >      [AC_LANG_SOURCE(
>     > --
>     > 2.5.0
>     >
>     > _______________________________________________
>     > lng-odp mailing list
>     > lng-odp@lists.linaro.org <mailto:lng-odp@lists.linaro.org>
>     > https://lists.linaro.org/mailman/listinfo/lng-odp
>
>
>
>
> _______________________________________________
> lng-odp mailing list
> lng-odp@lists.linaro.org
> https://lists.linaro.org/mailman/listinfo/lng-odp
Maxim Uvarov April 20, 2016, 6:50 p.m. UTC | #3
Merged,
Maxim.

On 04/20/16 19:37, Bill Fischofer wrote:
> Maxim: can you correct that on merge or would you prefer I sent a v9?
>
> On Wed, Apr 20, 2016 at 10:18 AM, Savolainen, Petri (Nokia - FI/Espoo) 
> <petri.savolainen@nokia.com <mailto:petri.savolainen@nokia.com>> wrote:
>
>
>     Reviewed-by: Petri Savolainen <petri.savolainen@nokia.com
>     <mailto:petri.savolainen@nokia.com>>
>
>     Couple of "visibiity" typos.
>
>
>     >  odpapiplatincludedir= $(includedir)/odp/api/plat
>     > diff --git
>     a/platform/linux-generic/include/odp/api/visibility_begin.h
>     > b/platform/linux-generic/include/odp/api/visibility_begin.h
>     > new file mode 100644
>     > index 0000000..9f45948
>     > --- /dev/null
>     > +++ b/platform/linux-generic/include/odp/api/visibility_begin.h
>     > @@ -0,0 +1,15 @@
>     > +/* Copyright (c) 2016, Linaro Limited
>     > + * All rights reserved.
>     > + *
>     > + * SPDX-License-Identifier:  BSD-3-Clause
>     > + */
>     > +
>     > +/*
>     > + * @file
>     > + *
>     > + * Linker visibiity directives
>                 ^^^^^^^^^^^
>
>
>
>     > + */
>     > +
>     > +#if __GNUC__ >= 4
>     > +#pragma GCC visibility push(default)
>     > +#endif
>     > diff --git a/platform/linux-generic/include/odp/api/visibility_end.h
>     > b/platform/linux-generic/include/odp/api/visibility_end.h
>     > new file mode 100644
>     > index 0000000..f40ad0b
>     > --- /dev/null
>     > +++ b/platform/linux-generic/include/odp/api/visibility_end.h
>     > @@ -0,0 +1,15 @@
>     > +/* Copyright (c) 2016, Linaro Limited
>     > + * All rights reserved.
>     > + *
>     > + * SPDX-License-Identifier:  BSD-3-Clause
>     > + */
>     > +
>     > +/*
>     > + * @file
>     > + *
>     > + * Linker visibiity directives
>                  ^^^^^^^^^^
>
>     > + */
>     > +
>     > +#if __GNUC__ >= 4
>     > +#pragma GCC visibility pop
>     > +#endif
>     > diff --git a/platform/linux-generic/m4/configure.m4
>     b/platform/linux-
>     > generic/m4/configure.m4
>     > index f80c66c..75a3797 100644
>     > --- a/platform/linux-generic/m4/configure.m4
>     > +++ b/platform/linux-generic/m4/configure.m4
>     > @@ -1,3 +1,15 @@
>     > +# Enable -fvisibility=hidden if using a gcc that supports it
>     > +OLD_CFLAGS="$CFLAGS"
>     > +AC_MSG_CHECKING([whether $CC supports -fvisibility=hidden])
>     > +VISIBILITY_CFLAGS="-fvisibility=hidden"
>     > +CFLAGS="$CFLAGS $VISIBILITY_CFLAGS"
>     > +AC_LINK_IFELSE([AC_LANG_PROGRAM()], AC_MSG_RESULT([yes]),
>     > +       [VISIBILITY_CFLAGS=""; AC_MSG_RESULT([no])]);
>     > +
>     > +AC_SUBST(VISIBILITY_CFLAGS)
>     > +# Restore CFLAGS; VISIBILITY_CFLAGS are added to it where needed.
>     > +CFLAGS=$OLD_CFLAGS
>     > +
>     >  AC_MSG_CHECKING(for GCC atomic builtins)
>     >  AC_LINK_IFELSE(
>     >      [AC_LANG_SOURCE(
>     > --
>     > 2.5.0
>     >
>     > _______________________________________________
>     > lng-odp mailing list
>     > lng-odp@lists.linaro.org <mailto:lng-odp@lists.linaro.org>
>     > https://lists.linaro.org/mailman/listinfo/lng-odp
>
>
>
>
> _______________________________________________
> lng-odp mailing list
> lng-odp@lists.linaro.org
> https://lists.linaro.org/mailman/listinfo/lng-odp
diff mbox

Patch

diff --git a/include/odp/api/spec/align.h b/include/odp/api/spec/align.h
index 677ff12..cbe7d67 100644
--- a/include/odp/api/spec/align.h
+++ b/include/odp/api/spec/align.h
@@ -13,6 +13,7 @@ 
 
 #ifndef ODP_API_ALIGN_H_
 #define ODP_API_ALIGN_H_
+#include <odp/api/visibility_begin.h>
 
 #ifdef __cplusplus
 extern "C" {
@@ -74,4 +75,5 @@  extern "C" {
 }
 #endif
 
+#include <odp/api/visibility_end.h>
 #endif
diff --git a/include/odp/api/spec/atomic.h b/include/odp/api/spec/atomic.h
index a16d90b..7638b93 100644
--- a/include/odp/api/spec/atomic.h
+++ b/include/odp/api/spec/atomic.h
@@ -13,6 +13,7 @@ 
 
 #ifndef ODP_API_ATOMIC_H_
 #define ODP_API_ATOMIC_H_
+#include <odp/api/visibility_begin.h>
 
 #ifdef __cplusplus
 extern "C" {
@@ -628,4 +629,5 @@  int odp_atomic_lock_free_u64(odp_atomic_op_t *atomic_op);
 }
 #endif
 
+#include <odp/api/visibility_end.h>
 #endif
diff --git a/include/odp/api/spec/barrier.h b/include/odp/api/spec/barrier.h
index 823eae6..01e3dc7 100644
--- a/include/odp/api/spec/barrier.h
+++ b/include/odp/api/spec/barrier.h
@@ -13,6 +13,7 @@ 
 
 #ifndef ODP_API_BARRIER_H_
 #define ODP_API_BARRIER_H_
+#include <odp/api/visibility_begin.h>
 
 #ifdef __cplusplus
 extern "C" {
@@ -63,4 +64,5 @@  void odp_barrier_wait(odp_barrier_t *barr);
 }
 #endif
 
+#include <odp/api/visibility_end.h>
 #endif
diff --git a/include/odp/api/spec/buffer.h b/include/odp/api/spec/buffer.h
index 6631f47..ddadc69 100644
--- a/include/odp/api/spec/buffer.h
+++ b/include/odp/api/spec/buffer.h
@@ -13,12 +13,12 @@ 
 
 #ifndef ODP_API_BUFFER_H_
 #define ODP_API_BUFFER_H_
+#include <odp/api/visibility_begin.h>
 
 #ifdef __cplusplus
 extern "C" {
 #endif
 
-
 /** @defgroup odp_buffer ODP BUFFER
  *  Operations on a buffer.
  *  @{
@@ -167,4 +167,5 @@  uint64_t odp_buffer_to_u64(odp_buffer_t hdl);
 }
 #endif
 
+#include <odp/api/visibility_end.h>
 #endif
diff --git a/include/odp/api/spec/byteorder.h b/include/odp/api/spec/byteorder.h
index a12a729..1018997 100644
--- a/include/odp/api/spec/byteorder.h
+++ b/include/odp/api/spec/byteorder.h
@@ -13,6 +13,7 @@ 
 
 #ifndef ODP_API_BYTEORDER_H_
 #define ODP_API_BYTEORDER_H_
+#include <odp/api/visibility_begin.h>
 
 #ifdef __cplusplus
 extern "C" {
@@ -177,4 +178,5 @@  odp_u64le_t odp_cpu_to_le_64(uint64_t cpu64);
 }
 #endif
 
+#include <odp/api/visibility_end.h>
 #endif
diff --git a/include/odp/api/spec/classification.h b/include/odp/api/spec/classification.h
index 076b3de..8cf8091 100644
--- a/include/odp/api/spec/classification.h
+++ b/include/odp/api/spec/classification.h
@@ -13,12 +13,12 @@ 
 
 #ifndef ODP_API_CLASSIFY_H_
 #define ODP_API_CLASSIFY_H_
+#include <odp/api/visibility_begin.h>
 
 #ifdef __cplusplus
 extern "C" {
 #endif
 
-
 /** @defgroup odp_classification ODP CLASSIFICATION
  *  Classification operations.
  *  @{
@@ -396,4 +396,5 @@  uint64_t odp_pmr_to_u64(odp_pmr_t hdl);
 }
 #endif
 
+#include <odp/api/visibility_end.h>
 #endif
diff --git a/include/odp/api/spec/compiler.h b/include/odp/api/spec/compiler.h
index 5a24bfb..d271e90 100644
--- a/include/odp/api/spec/compiler.h
+++ b/include/odp/api/spec/compiler.h
@@ -13,6 +13,7 @@ 
 
 #ifndef ODP_API_COMPILER_H_
 #define ODP_API_COMPILER_H_
+#include <odp/api/visibility_begin.h>
 
 #ifdef __cplusplus
 extern "C" {
@@ -48,4 +49,5 @@  extern "C" {
 }
 #endif
 
+#include <odp/api/visibility_end.h>
 #endif
diff --git a/include/odp/api/spec/config.h b/include/odp/api/spec/config.h
index c9879d6..7a2d18b 100644
--- a/include/odp/api/spec/config.h
+++ b/include/odp/api/spec/config.h
@@ -13,6 +13,7 @@ 
 
 #ifndef ODP_API_CONFIG_H_
 #define ODP_API_CONFIG_H_
+#include <odp/api/visibility_begin.h>
 
 #ifdef __cplusplus
 extern "C" {
@@ -161,4 +162,5 @@  int odp_config_shm_blocks(void);
 }
 #endif
 
+#include <odp/api/visibility_end.h>
 #endif
diff --git a/include/odp/api/spec/cpu.h b/include/odp/api/spec/cpu.h
index f0e20c4..2789511 100644
--- a/include/odp/api/spec/cpu.h
+++ b/include/odp/api/spec/cpu.h
@@ -13,6 +13,7 @@ 
 
 #ifndef ODP_CPU_H_
 #define ODP_CPU_H_
+#include <odp/api/visibility_begin.h>
 
 #ifdef __cplusplus
 extern "C" {
@@ -176,4 +177,5 @@  void odp_cpu_pause(void);
 }
 #endif
 
+#include <odp/api/visibility_end.h>
 #endif
diff --git a/include/odp/api/spec/cpumask.h b/include/odp/api/spec/cpumask.h
index 42098c2..129b3c1 100644
--- a/include/odp/api/spec/cpumask.h
+++ b/include/odp/api/spec/cpumask.h
@@ -13,6 +13,7 @@ 
 
 #ifndef ODP_API_CPUMASK_H_
 #define ODP_API_CPUMASK_H_
+#include <odp/api/visibility_begin.h>
 
 #ifdef __cplusplus
 extern "C" {
@@ -251,4 +252,5 @@  int odp_cpumask_all_available(odp_cpumask_t *mask);
 }
 #endif
 
+#include <odp/api/visibility_end.h>
 #endif
diff --git a/include/odp/api/spec/crypto.h b/include/odp/api/spec/crypto.h
index 7c6f9bc..05e3c35 100644
--- a/include/odp/api/spec/crypto.h
+++ b/include/odp/api/spec/crypto.h
@@ -13,6 +13,7 @@ 
 
 #ifndef ODP_API_CRYPTO_H_
 #define ODP_API_CRYPTO_H_
+#include <odp/api/visibility_begin.h>
 
 #ifdef __cplusplus
 extern "C" {
@@ -371,4 +372,5 @@  uint64_t odp_crypto_compl_to_u64(odp_crypto_compl_t hdl);
 }
 #endif
 
+#include <odp/api/visibility_end.h>
 #endif
diff --git a/include/odp/api/spec/debug.h b/include/odp/api/spec/debug.h
index 247b0c0..a49dff3 100644
--- a/include/odp/api/spec/debug.h
+++ b/include/odp/api/spec/debug.h
@@ -11,7 +11,7 @@ 
 
 #ifndef ODP_API_DEBUG_H_
 #define ODP_API_DEBUG_H_
-
+#include <odp/api/visibility_begin.h>
 
 #ifdef __cplusplus
 extern "C" {
@@ -32,4 +32,5 @@  extern "C" {
 }
 #endif
 
+#include <odp/api/visibility_end.h>
 #endif
diff --git a/include/odp/api/spec/errno.h b/include/odp/api/spec/errno.h
index 33998b6..a1e7642 100644
--- a/include/odp/api/spec/errno.h
+++ b/include/odp/api/spec/errno.h
@@ -12,6 +12,7 @@ 
 
 #ifndef ODP_ERRNO_H_
 #define ODP_ERRNO_H_
+#include <odp/api/visibility_begin.h>
 
 #ifdef __cplusplus
 extern "C" {
@@ -82,4 +83,5 @@  const char *odp_errno_str(int errnum);
 }
 #endif
 
+#include <odp/api/visibility_end.h>
 #endif
diff --git a/include/odp/api/spec/event.h b/include/odp/api/spec/event.h
index 29547f3..082768f 100644
--- a/include/odp/api/spec/event.h
+++ b/include/odp/api/spec/event.h
@@ -13,12 +13,12 @@ 
 
 #ifndef ODP_API_EVENT_H_
 #define ODP_API_EVENT_H_
+#include <odp/api/visibility_begin.h>
 
 #ifdef __cplusplus
 extern "C" {
 #endif
 
-
 /** @defgroup odp_event ODP EVENT
  *  Operations on an event.
  *  @{
@@ -83,4 +83,5 @@  void odp_event_free(odp_event_t event);
 }
 #endif
 
+#include <odp/api/visibility_end.h>
 #endif
diff --git a/include/odp/api/spec/hash.h b/include/odp/api/spec/hash.h
index a6bc753..07a0156 100644
--- a/include/odp/api/spec/hash.h
+++ b/include/odp/api/spec/hash.h
@@ -12,6 +12,7 @@ 
 
 #ifndef ODP_API_HASH_H_
 #define ODP_API_HASH_H_
+#include <odp/api/visibility_begin.h>
 
 #ifdef __cplusplus
 extern "C" {
@@ -95,4 +96,5 @@  int odp_hash_crc_gen64(const void *data, uint32_t data_len,
 }
 #endif
 
+#include <odp/api/visibility_end.h>
 #endif
diff --git a/include/odp/api/spec/hints.h b/include/odp/api/spec/hints.h
index ea67fc4..158f802 100644
--- a/include/odp/api/spec/hints.h
+++ b/include/odp/api/spec/hints.h
@@ -13,6 +13,7 @@ 
 
 #ifndef ODP_API_HINTS_H_
 #define ODP_API_HINTS_H_
+#include <odp/api/visibility_begin.h>
 
 #ifdef __cplusplus
 extern "C" {
@@ -113,4 +114,5 @@  extern "C" {
 }
 #endif
 
+#include <odp/api/visibility_end.h>
 #endif
diff --git a/include/odp/api/spec/init.h b/include/odp/api/spec/init.h
index 8560663..fec6774 100644
--- a/include/odp/api/spec/init.h
+++ b/include/odp/api/spec/init.h
@@ -21,13 +21,12 @@ 
 
 #ifndef ODP_API_INIT_H_
 #define ODP_API_INIT_H_
+#include <odp/api/visibility_begin.h>
 
 #ifdef __cplusplus
 extern "C" {
 #endif
 
-
-
 #include <odp/api/std_types.h>
 #include <odp/api/hints.h>
 #include <odp/api/thread.h>
@@ -278,4 +277,5 @@  int odp_term_local(void);
 }
 #endif
 
+#include <odp/api/visibility_end.h>
 #endif
diff --git a/include/odp/api/spec/packet.h b/include/odp/api/spec/packet.h
index 094e846..9880d8a 100644
--- a/include/odp/api/spec/packet.h
+++ b/include/odp/api/spec/packet.h
@@ -13,6 +13,7 @@ 
 
 #ifndef ODP_API_PACKET_H_
 #define ODP_API_PACKET_H_
+#include <odp/api/visibility_begin.h>
 
 #ifdef __cplusplus
 extern "C" {
@@ -1181,4 +1182,5 @@  uint64_t odp_packet_seg_to_u64(odp_packet_seg_t hdl);
 }
 #endif
 
+#include <odp/api/visibility_end.h>
 #endif
diff --git a/include/odp/api/spec/packet_flags.h b/include/odp/api/spec/packet_flags.h
index 35d44e1..c2998c1 100644
--- a/include/odp/api/spec/packet_flags.h
+++ b/include/odp/api/spec/packet_flags.h
@@ -13,6 +13,7 @@ 
 
 #ifndef ODP_API_PACKET_FLAGS_H_
 #define ODP_API_PACKET_FLAGS_H_
+#include <odp/api/visibility_begin.h>
 
 #ifdef __cplusplus
 extern "C" {
@@ -493,4 +494,5 @@  void odp_packet_has_ts_clr(odp_packet_t pkt);
 }
 #endif
 
+#include <odp/api/visibility_end.h>
 #endif
diff --git a/include/odp/api/spec/packet_io.h b/include/odp/api/spec/packet_io.h
index 466cab6..d95edb1 100644
--- a/include/odp/api/spec/packet_io.h
+++ b/include/odp/api/spec/packet_io.h
@@ -13,6 +13,7 @@ 
 
 #ifndef ODP_API_PACKET_IO_H_
 #define ODP_API_PACKET_IO_H_
+#include <odp/api/visibility_begin.h>
 
 #ifdef __cplusplus
 extern "C" {
@@ -1038,4 +1039,5 @@  odp_time_t odp_pktin_ts_from_ns(odp_pktio_t pktio, uint64_t ns);
 }
 #endif
 
+#include <odp/api/visibility_end.h>
 #endif
diff --git a/include/odp/api/spec/packet_io_stats.h b/include/odp/api/spec/packet_io_stats.h
index 148ad8d..e0a6547 100644
--- a/include/odp/api/spec/packet_io_stats.h
+++ b/include/odp/api/spec/packet_io_stats.h
@@ -12,6 +12,7 @@ 
 
 #ifndef ODP_API_PACKET_IO_STATS_H_
 #define ODP_API_PACKET_IO_STATS_H_
+#include <odp/api/visibility_begin.h>
 
 #ifdef __cplusplus
 extern "C" {
@@ -138,4 +139,5 @@  int odp_pktio_stats_reset(odp_pktio_t pktio);
 }
 #endif
 
+#include <odp/api/visibility_end.h>
 #endif
diff --git a/include/odp/api/spec/pool.h b/include/odp/api/spec/pool.h
index 94a302e..87a194c 100644
--- a/include/odp/api/spec/pool.h
+++ b/include/odp/api/spec/pool.h
@@ -13,13 +13,12 @@ 
 
 #ifndef ODP_API_POOL_H_
 #define ODP_API_POOL_H_
+#include <odp/api/visibility_begin.h>
 
 #ifdef __cplusplus
 extern "C" {
 #endif
 
-
-
 #include <odp/api/std_types.h>
 
 /** @defgroup odp_pool ODP POOL
@@ -210,4 +209,5 @@  void odp_pool_param_init(odp_pool_param_t *param);
 }
 #endif
 
+#include <odp/api/visibility_end.h>
 #endif
diff --git a/include/odp/api/spec/queue.h b/include/odp/api/spec/queue.h
index 51d94a2..7626ca7 100644
--- a/include/odp/api/spec/queue.h
+++ b/include/odp/api/spec/queue.h
@@ -13,6 +13,7 @@ 
 
 #ifndef ODP_API_QUEUE_H_
 #define ODP_API_QUEUE_H_
+#include <odp/api/visibility_begin.h>
 
 #ifdef __cplusplus
 extern "C" {
@@ -374,4 +375,5 @@  int odp_queue_info(odp_queue_t queue, odp_queue_info_t *info);
 }
 #endif
 
+#include <odp/api/visibility_end.h>
 #endif
diff --git a/include/odp/api/spec/random.h b/include/odp/api/spec/random.h
index 435783a..db77630 100644
--- a/include/odp/api/spec/random.h
+++ b/include/odp/api/spec/random.h
@@ -13,6 +13,7 @@ 
 
 #ifndef ODP_API_RANDOM_H_
 #define ODP_API_RANDOM_H_
+#include <odp/api/visibility_begin.h>
 
 #ifdef __cplusplus
 extern "C" {
@@ -22,7 +23,6 @@  extern "C" {
  *  @{
  */
 
-
 /**
  * Generate random byte data
  *
@@ -45,4 +45,5 @@  int32_t odp_random_data(uint8_t *buf, int32_t size, odp_bool_t use_entropy);
 }
 #endif
 
+#include <odp/api/visibility_end.h>
 #endif
diff --git a/include/odp/api/spec/rwlock.h b/include/odp/api/spec/rwlock.h
index 9ca8872..631df48 100644
--- a/include/odp/api/spec/rwlock.h
+++ b/include/odp/api/spec/rwlock.h
@@ -6,6 +6,7 @@ 
 
 #ifndef ODP_API_RWLOCK_H_
 #define ODP_API_RWLOCK_H_
+#include <odp/api/visibility_begin.h>
 
 /**
  * @file
@@ -99,4 +100,5 @@  void odp_rwlock_write_unlock(odp_rwlock_t *rwlock);
 }
 #endif
 
+#include <odp/api/visibility_end.h>
 #endif /* ODP_RWLOCK_H_ */
diff --git a/include/odp/api/spec/rwlock_recursive.h b/include/odp/api/spec/rwlock_recursive.h
index 965fcc0..9d50f20 100644
--- a/include/odp/api/spec/rwlock_recursive.h
+++ b/include/odp/api/spec/rwlock_recursive.h
@@ -12,6 +12,7 @@ 
 
 #ifndef ODP_API_RWLOCK_RECURSIVE_H_
 #define ODP_API_RWLOCK_RECURSIVE_H_
+#include <odp/api/visibility_begin.h>
 
 #ifdef __cplusplus
 extern "C" {
@@ -117,4 +118,5 @@  void odp_rwlock_recursive_write_unlock(odp_rwlock_recursive_t *lock);
 }
 #endif
 
+#include <odp/api/visibility_end.h>
 #endif
diff --git a/include/odp/api/spec/schedule.h b/include/odp/api/spec/schedule.h
index cd1325a..a720e03 100644
--- a/include/odp/api/spec/schedule.h
+++ b/include/odp/api/spec/schedule.h
@@ -13,12 +13,12 @@ 
 
 #ifndef ODP_API_SCHEDULE_H_
 #define ODP_API_SCHEDULE_H_
+#include <odp/api/visibility_begin.h>
 
 #ifdef __cplusplus
 extern "C" {
 #endif
 
-
 #include <odp/api/std_types.h>
 #include <odp/api/event.h>
 #include <odp/api/queue.h>
@@ -375,4 +375,5 @@  void odp_schedule_order_unlock(unsigned lock_index);
 }
 #endif
 
+#include <odp/api/visibility_end.h>
 #endif
diff --git a/include/odp/api/spec/schedule_types.h b/include/odp/api/spec/schedule_types.h
index 34046af..b394d53 100644
--- a/include/odp/api/spec/schedule_types.h
+++ b/include/odp/api/spec/schedule_types.h
@@ -12,6 +12,7 @@ 
 
 #ifndef ODP_API_SCHEDULE_TYPES_H_
 #define ODP_API_SCHEDULE_TYPES_H_
+#include <odp/api/visibility_begin.h>
 
 #ifdef __cplusplus
 extern "C" {
@@ -156,4 +157,5 @@  typedef	struct odp_schedule_param_t {
 }
 #endif
 
+#include <odp/api/visibility_end.h>
 #endif
diff --git a/include/odp/api/spec/shared_memory.h b/include/odp/api/spec/shared_memory.h
index 5d851ce..5d31f41 100644
--- a/include/odp/api/spec/shared_memory.h
+++ b/include/odp/api/spec/shared_memory.h
@@ -13,12 +13,12 @@ 
 
 #ifndef ODP_API_SHARED_MEMORY_H_
 #define ODP_API_SHARED_MEMORY_H_
+#include <odp/api/visibility_begin.h>
 
 #ifdef __cplusplus
 extern "C" {
 #endif
 
-
 /** @defgroup odp_shared_memory ODP SHARED MEMORY
  *  Operations on shared memory.
  *  @{
@@ -152,4 +152,5 @@  uint64_t odp_shm_to_u64(odp_shm_t hdl);
 }
 #endif
 
+#include <odp/api/visibility_end.h>
 #endif
diff --git a/include/odp/api/spec/spinlock.h b/include/odp/api/spec/spinlock.h
index a73359d..8263171 100644
--- a/include/odp/api/spec/spinlock.h
+++ b/include/odp/api/spec/spinlock.h
@@ -13,6 +13,7 @@ 
 
 #ifndef ODP_API_SPINLOCK_H_
 #define ODP_API_SPINLOCK_H_
+#include <odp/api/visibility_begin.h>
 
 #ifdef __cplusplus
 extern "C" {
@@ -88,4 +89,5 @@  int odp_spinlock_is_locked(odp_spinlock_t *splock);
 }
 #endif
 
+#include <odp/api/visibility_end.h>
 #endif
diff --git a/include/odp/api/spec/spinlock_recursive.h b/include/odp/api/spec/spinlock_recursive.h
index d98f2bb..07829fd 100644
--- a/include/odp/api/spec/spinlock_recursive.h
+++ b/include/odp/api/spec/spinlock_recursive.h
@@ -12,6 +12,7 @@ 
 
 #ifndef ODP_API_SPINLOCK_RECURSIVE_H_
 #define ODP_API_SPINLOCK_RECURSIVE_H_
+#include <odp/api/visibility_begin.h>
 
 #ifdef __cplusplus
 extern "C" {
@@ -82,4 +83,5 @@  int odp_spinlock_recursive_is_locked(odp_spinlock_recursive_t *lock);
 }
 #endif
 
+#include <odp/api/visibility_end.h>
 #endif
diff --git a/include/odp/api/spec/std_clib.h b/include/odp/api/spec/std_clib.h
index 791b72f..772732c 100644
--- a/include/odp/api/spec/std_clib.h
+++ b/include/odp/api/spec/std_clib.h
@@ -12,6 +12,7 @@ 
 
 #ifndef ODP_API_STD_CLIB_H_
 #define ODP_API_STD_CLIB_H_
+#include <odp/api/visibility_begin.h>
 
 #ifdef __cplusplus
 extern "C" {
@@ -79,4 +80,5 @@  int odp_memcmp(const void *ptr1, const void *ptr2, size_t num);
 }
 #endif
 
+#include <odp/api/visibility_end.h>
 #endif
diff --git a/include/odp/api/spec/std_types.h b/include/odp/api/spec/std_types.h
index 7558c64..47018d5 100644
--- a/include/odp/api/spec/std_types.h
+++ b/include/odp/api/spec/std_types.h
@@ -14,12 +14,12 @@ 
 
 #ifndef ODP_API_STD_TYPES_H_
 #define ODP_API_STD_TYPES_H_
+#include <odp/api/visibility_begin.h>
 
 #ifdef __cplusplus
 extern "C" {
 #endif
 
-
 /** @addtogroup odp_system ODP SYSTEM
  *  @{
  */
@@ -39,4 +39,5 @@  extern "C" {
 }
 #endif
 
+#include <odp/api/visibility_end.h>
 #endif
diff --git a/include/odp/api/spec/sync.h b/include/odp/api/spec/sync.h
index c6f790c..84b7cb9 100644
--- a/include/odp/api/spec/sync.h
+++ b/include/odp/api/spec/sync.h
@@ -13,6 +13,7 @@ 
 
 #ifndef ODP_API_SYNC_H_
 #define ODP_API_SYNC_H_
+#include <odp/api/visibility_begin.h>
 
 #ifdef __cplusplus
 extern "C" {
@@ -87,4 +88,5 @@  void odp_mb_full(void);
 }
 #endif
 
+#include <odp/api/visibility_end.h>
 #endif
diff --git a/include/odp/api/spec/system_info.h b/include/odp/api/spec/system_info.h
index bde3a60..6957731 100644
--- a/include/odp/api/spec/system_info.h
+++ b/include/odp/api/spec/system_info.h
@@ -13,12 +13,12 @@ 
 
 #ifndef ODP_API_SYSTEM_INFO_H_
 #define ODP_API_SYSTEM_INFO_H_
+#include <odp/api/visibility_begin.h>
 
 #ifdef __cplusplus
 extern "C" {
 #endif
 
-
 /** @defgroup odp_system ODP SYSTEM
  *  @{
  */
@@ -52,4 +52,5 @@  int odp_sys_cache_line_size(void);
 }
 #endif
 
+#include <odp/api/visibility_end.h>
 #endif
diff --git a/include/odp/api/spec/thread.h b/include/odp/api/spec/thread.h
index 3720249..6e2a817 100644
--- a/include/odp/api/spec/thread.h
+++ b/include/odp/api/spec/thread.h
@@ -13,6 +13,7 @@ 
 
 #ifndef ODP_API_THREAD_H_
 #define ODP_API_THREAD_H_
+#include <odp/api/visibility_begin.h>
 
 #ifdef __cplusplus
 extern "C" {
@@ -109,4 +110,5 @@  odp_thread_type_t odp_thread_type(void);
 }
 #endif
 
+#include <odp/api/visibility_end.h>
 #endif
diff --git a/include/odp/api/spec/thrmask.h b/include/odp/api/spec/thrmask.h
index a22da8c..73f3866 100644
--- a/include/odp/api/spec/thrmask.h
+++ b/include/odp/api/spec/thrmask.h
@@ -12,6 +12,7 @@ 
 
 #ifndef ODP_API_THRMASK_H_
 #define ODP_API_THRMASK_H_
+#include <odp/api/visibility_begin.h>
 
 #ifdef __cplusplus
 extern "C" {
@@ -236,4 +237,5 @@  int odp_thrmask_control(odp_thrmask_t *mask);
 }
 #endif
 
+#include <odp/api/visibility_end.h>
 #endif
diff --git a/include/odp/api/spec/ticketlock.h b/include/odp/api/spec/ticketlock.h
index 3f0e3f5..d485565 100644
--- a/include/odp/api/spec/ticketlock.h
+++ b/include/odp/api/spec/ticketlock.h
@@ -13,6 +13,7 @@ 
 
 #ifndef ODP_API_TICKETLOCK_H_
 #define ODP_API_TICKETLOCK_H_
+#include <odp/api/visibility_begin.h>
 
 #ifdef __cplusplus
 extern "C" {
@@ -87,4 +88,5 @@  int odp_ticketlock_is_locked(odp_ticketlock_t *tklock);
 }
 #endif
 
+#include <odp/api/visibility_end.h>
 #endif
diff --git a/include/odp/api/spec/time.h b/include/odp/api/spec/time.h
index 85692ec..a78fc2c 100644
--- a/include/odp/api/spec/time.h
+++ b/include/odp/api/spec/time.h
@@ -13,12 +13,12 @@ 
 
 #ifndef ODP_API_TIME_H_
 #define ODP_API_TIME_H_
+#include <odp/api/visibility_begin.h>
 
 #ifdef __cplusplus
 extern "C" {
 #endif
 
-
 /** @defgroup odp_time ODP TIME
  *  @{
  */
@@ -178,4 +178,5 @@  uint64_t odp_time_to_u64(odp_time_t time);
 }
 #endif
 
+#include <odp/api/visibility_end.h>
 #endif
diff --git a/include/odp/api/spec/timer.h b/include/odp/api/spec/timer.h
index 435c004..3f8fdd4 100644
--- a/include/odp/api/spec/timer.h
+++ b/include/odp/api/spec/timer.h
@@ -13,6 +13,7 @@ 
 
 #ifndef ODP_API_TIMER_H_
 #define ODP_API_TIMER_H_
+#include <odp/api/visibility_begin.h>
 
 #ifdef __cplusplus
 extern "C" {
@@ -412,4 +413,5 @@  uint64_t odp_timeout_to_u64(odp_timeout_t hdl);
 }
 #endif
 
+#include <odp/api/visibility_end.h>
 #endif
diff --git a/include/odp/api/spec/traffic_mngr.h b/include/odp/api/spec/traffic_mngr.h
index ce124a8..e4c15df 100644
--- a/include/odp/api/spec/traffic_mngr.h
+++ b/include/odp/api/spec/traffic_mngr.h
@@ -6,6 +6,7 @@ 
 
 #ifndef ODP_TRAFFIC_MNGR_H_
 #define ODP_TRAFFIC_MNGR_H_
+#include <odp/api/visibility_begin.h>
 
 #ifdef __cplusplus
 extern "C" {
@@ -1371,4 +1372,5 @@  void odp_tm_stats_print(odp_tm_t odp_tm);
 }
 #endif
 
+#include <odp/api/visibility_end.h>
 #endif
diff --git a/include/odp/api/spec/version.h b/include/odp/api/spec/version.h
index 642831c..004d9f6 100644
--- a/include/odp/api/spec/version.h
+++ b/include/odp/api/spec/version.h
@@ -13,6 +13,7 @@ 
 
 #ifndef ODP_API_VERSION_H_
 #define ODP_API_VERSION_H_
+#include <odp/api/visibility_begin.h>
 
 #ifdef __cplusplus
 extern "C" {
@@ -102,4 +103,5 @@  const char *odp_version_impl_str(void);
 }
 #endif
 
+#include <odp/api/visibility_end.h>
 #endif
diff --git a/platform/Makefile.inc b/platform/Makefile.inc
index 1cb7a71..5aa3fed 100644
--- a/platform/Makefile.inc
+++ b/platform/Makefile.inc
@@ -15,6 +15,7 @@  AM_LDFLAGS += -version-number '$(ODP_LIBSO_VERSION)'
 GIT_DESC = `$(top_srcdir)/scripts/get_impl_str.sh $(top_srcdir)`
 AM_CFLAGS += "-DGIT_HASH=$(GIT_DESC)"
 AM_CFLAGS += -DPLATFORM=${with_platform}
+AM_CFLAGS += $(VISIBILITY_CFLAGS)
 
 #The implementation will need to retain the deprecated implementation
 AM_CFLAGS += -Wno-deprecated-declarations
diff --git a/platform/linux-generic/Makefile.am b/platform/linux-generic/Makefile.am
index 5eb8cbc..c3cb51a 100644
--- a/platform/linux-generic/Makefile.am
+++ b/platform/linux-generic/Makefile.am
@@ -57,6 +57,8 @@  odpapiinclude_HEADERS = \
 		  $(srcdir)/include/odp/api/timer.h \
 		  $(srcdir)/include/odp/api/traffic_mngr.h \
 		  $(srcdir)/include/odp/api/version.h \
+		  $(srcdir)/include/odp/api/visibility_begin.h \
+		  $(srcdir)/include/odp/api/visibility_end.h \
 		  $(srcdir)/arch/@ARCH@/odp/api/cpu_arch.h
 
 odpapiplatincludedir= $(includedir)/odp/api/plat
diff --git a/platform/linux-generic/include/odp/api/visibility_begin.h b/platform/linux-generic/include/odp/api/visibility_begin.h
new file mode 100644
index 0000000..9f45948
--- /dev/null
+++ b/platform/linux-generic/include/odp/api/visibility_begin.h
@@ -0,0 +1,15 @@ 
+/* Copyright (c) 2016, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier:	BSD-3-Clause
+ */
+
+/*
+ * @file
+ *
+ * Linker visibiity directives
+ */
+
+#if __GNUC__ >= 4
+#pragma GCC visibility push(default)
+#endif
diff --git a/platform/linux-generic/include/odp/api/visibility_end.h b/platform/linux-generic/include/odp/api/visibility_end.h
new file mode 100644
index 0000000..f40ad0b
--- /dev/null
+++ b/platform/linux-generic/include/odp/api/visibility_end.h
@@ -0,0 +1,15 @@ 
+/* Copyright (c) 2016, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier:	BSD-3-Clause
+ */
+
+/*
+ * @file
+ *
+ * Linker visibiity directives
+ */
+
+#if __GNUC__ >= 4
+#pragma GCC visibility pop
+#endif
diff --git a/platform/linux-generic/m4/configure.m4 b/platform/linux-generic/m4/configure.m4
index f80c66c..75a3797 100644
--- a/platform/linux-generic/m4/configure.m4
+++ b/platform/linux-generic/m4/configure.m4
@@ -1,3 +1,15 @@ 
+# Enable -fvisibility=hidden if using a gcc that supports it
+OLD_CFLAGS="$CFLAGS"
+AC_MSG_CHECKING([whether $CC supports -fvisibility=hidden])
+VISIBILITY_CFLAGS="-fvisibility=hidden"
+CFLAGS="$CFLAGS $VISIBILITY_CFLAGS"
+AC_LINK_IFELSE([AC_LANG_PROGRAM()], AC_MSG_RESULT([yes]),
+       [VISIBILITY_CFLAGS=""; AC_MSG_RESULT([no])]);
+
+AC_SUBST(VISIBILITY_CFLAGS)
+# Restore CFLAGS; VISIBILITY_CFLAGS are added to it where needed.
+CFLAGS=$OLD_CFLAGS
+
 AC_MSG_CHECKING(for GCC atomic builtins)
 AC_LINK_IFELSE(
     [AC_LANG_SOURCE(