diff options
author | Anders Roxell <anders.roxell@linaro.org> | 2016-04-13 19:30:13 +0200 |
---|---|---|
committer | Maxim Uvarov <maxim.uvarov@linaro.org> | 2016-04-15 13:18:21 +0300 |
commit | f562a886695fc8eb3832f4e7a13d4bff80db529a (patch) | |
tree | 4b8a5d879dbe9ace1e46be65bf6b2dcfc2b0419a | |
parent | fc68b7d7277dc1a7b0034fbdf349c7028577d9b0 (diff) |
api: make only the API visible
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>
Reviewed-by: Bill Fischofer <bill.fischofer@linaro.org>
Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
44 files changed, 349 insertions, 0 deletions
diff --git a/include/odp/api/spec/align.h b/include/odp/api/spec/align.h index 677ff12ce..027b0802c 100644 --- a/include/odp/api/spec/align.h +++ b/include/odp/api/spec/align.h @@ -18,6 +18,10 @@ extern "C" { #endif +#if __GNUC__ >= 4 +#pragma GCC visibility push(default) +#endif + /** @addtogroup odp_compiler_optim * Macros that allow cache line size configuration, check that * alignment is a power of two etc. @@ -70,6 +74,10 @@ extern "C" { * @} */ +#if __GNUC__ >= 4 +#pragma GCC visibility pop +#endif + #ifdef __cplusplus } #endif diff --git a/include/odp/api/spec/atomic.h b/include/odp/api/spec/atomic.h index a16d90bfb..b926964d1 100644 --- a/include/odp/api/spec/atomic.h +++ b/include/odp/api/spec/atomic.h @@ -18,6 +18,10 @@ extern "C" { #endif +#if __GNUC__ >= 4 +#pragma GCC visibility push(default) +#endif + /** * @defgroup odp_atomic ODP ATOMIC * @details @@ -624,6 +628,10 @@ int odp_atomic_lock_free_u64(odp_atomic_op_t *atomic_op); * @} */ +#if __GNUC__ >= 4 +#pragma GCC visibility pop +#endif + #ifdef __cplusplus } #endif diff --git a/include/odp/api/spec/barrier.h b/include/odp/api/spec/barrier.h index 823eae66c..34c3658cb 100644 --- a/include/odp/api/spec/barrier.h +++ b/include/odp/api/spec/barrier.h @@ -18,6 +18,10 @@ extern "C" { #endif +#if __GNUC__ >= 4 +#pragma GCC visibility push(default) +#endif + /** * @defgroup odp_barrier ODP BARRIER * Thread excution and memory ordering barriers. @@ -59,6 +63,10 @@ void odp_barrier_wait(odp_barrier_t *barr); * @} */ +#if __GNUC__ >= 4 +#pragma GCC visibility pop +#endif + #ifdef __cplusplus } #endif diff --git a/include/odp/api/spec/buffer.h b/include/odp/api/spec/buffer.h index 6631f478c..caa2cb668 100644 --- a/include/odp/api/spec/buffer.h +++ b/include/odp/api/spec/buffer.h @@ -19,6 +19,10 @@ extern "C" { #endif +#if __GNUC__ >= 4 +#pragma GCC visibility push(default) +#endif + /** @defgroup odp_buffer ODP BUFFER * Operations on a buffer. * @{ @@ -163,6 +167,10 @@ uint64_t odp_buffer_to_u64(odp_buffer_t hdl); * @} */ +#if __GNUC__ >= 4 +#pragma GCC visibility pop +#endif + #ifdef __cplusplus } #endif diff --git a/include/odp/api/spec/byteorder.h b/include/odp/api/spec/byteorder.h index a12a7296f..17f7ebe08 100644 --- a/include/odp/api/spec/byteorder.h +++ b/include/odp/api/spec/byteorder.h @@ -18,6 +18,10 @@ extern "C" { #endif +#if __GNUC__ >= 4 +#pragma GCC visibility push(default) +#endif + /** @defgroup odp_compiler_optim ODP COMPILER / OPTIMIZATION * Macros that check byte order and operations for byte order conversion. * @{ @@ -173,6 +177,10 @@ odp_u64le_t odp_cpu_to_le_64(uint64_t cpu64); * @} */ +#if __GNUC__ >= 4 +#pragma GCC visibility pop +#endif + #ifdef __cplusplus } #endif diff --git a/include/odp/api/spec/classification.h b/include/odp/api/spec/classification.h index 076b3defe..f20086947 100644 --- a/include/odp/api/spec/classification.h +++ b/include/odp/api/spec/classification.h @@ -19,6 +19,10 @@ extern "C" { #endif +#if __GNUC__ >= 4 +#pragma GCC visibility push(default) +#endif + /** @defgroup odp_classification ODP CLASSIFICATION * Classification operations. * @{ @@ -392,6 +396,10 @@ uint64_t odp_pmr_to_u64(odp_pmr_t hdl); * @} */ +#if __GNUC__ >= 4 +#pragma GCC visibility pop +#endif + #ifdef __cplusplus } #endif diff --git a/include/odp/api/spec/compiler.h b/include/odp/api/spec/compiler.h index 5a24bfb2a..1b6d05ff5 100644 --- a/include/odp/api/spec/compiler.h +++ b/include/odp/api/spec/compiler.h @@ -18,6 +18,10 @@ extern "C" { #endif +#if __GNUC__ >= 4 +#pragma GCC visibility push(default) +#endif + /** @addtogroup odp_compiler_optim * Macro for old compilers * @{ @@ -44,6 +48,10 @@ extern "C" { * @} */ +#if __GNUC__ >= 4 +#pragma GCC visibility pop +#endif + #ifdef __cplusplus } #endif diff --git a/include/odp/api/spec/config.h b/include/odp/api/spec/config.h index c9879d6d8..14e54e122 100644 --- a/include/odp/api/spec/config.h +++ b/include/odp/api/spec/config.h @@ -18,6 +18,10 @@ extern "C" { #endif +#if __GNUC__ >= 4 +#pragma GCC visibility push(default) +#endif + /** @defgroup odp_config ODP CONFIG * Platform-specific configuration limits. * @@ -157,6 +161,10 @@ int odp_config_shm_blocks(void); * @} */ +#if __GNUC__ >= 4 +#pragma GCC visibility pop +#endif + #ifdef __cplusplus } #endif diff --git a/include/odp/api/spec/cpu.h b/include/odp/api/spec/cpu.h index f0e20c458..e87875ee7 100644 --- a/include/odp/api/spec/cpu.h +++ b/include/odp/api/spec/cpu.h @@ -20,6 +20,10 @@ extern "C" { #include <odp/api/std_types.h> +#if __GNUC__ >= 4 +#pragma GCC visibility push(default) +#endif + /** @defgroup odp_cpu ODP CPU * @{ */ @@ -172,6 +176,10 @@ void odp_cpu_pause(void); * @} */ +#if __GNUC__ >= 4 +#pragma GCC visibility pop +#endif + #ifdef __cplusplus } #endif diff --git a/include/odp/api/spec/cpumask.h b/include/odp/api/spec/cpumask.h index 42098c2e4..3fc76946c 100644 --- a/include/odp/api/spec/cpumask.h +++ b/include/odp/api/spec/cpumask.h @@ -20,6 +20,10 @@ extern "C" { #include <odp/api/config.h> +#if __GNUC__ >= 4 +#pragma GCC visibility push(default) +#endif + /** @defgroup odp_cpumask ODP CPUMASK * CPU mask operations. * @{ @@ -247,6 +251,10 @@ int odp_cpumask_all_available(odp_cpumask_t *mask); * @} */ +#if __GNUC__ >= 4 +#pragma GCC visibility pop +#endif + #ifdef __cplusplus } #endif diff --git a/include/odp/api/spec/crypto.h b/include/odp/api/spec/crypto.h index 7c6f9bc5b..7ac5ad140 100644 --- a/include/odp/api/spec/crypto.h +++ b/include/odp/api/spec/crypto.h @@ -18,6 +18,10 @@ extern "C" { #endif +#if __GNUC__ >= 4 +#pragma GCC visibility push(default) +#endif + /** @defgroup odp_crypto ODP CRYPTO * Macros, enums, types and operations to utilise crypto. * @{ @@ -367,6 +371,10 @@ uint64_t odp_crypto_compl_to_u64(odp_crypto_compl_t hdl); * @} */ +#if __GNUC__ >= 4 +#pragma GCC visibility pop +#endif + #ifdef __cplusplus } #endif diff --git a/include/odp/api/spec/debug.h b/include/odp/api/spec/debug.h index 252a82f55..c1ecd78de 100644 --- a/include/odp/api/spec/debug.h +++ b/include/odp/api/spec/debug.h @@ -17,6 +17,10 @@ extern "C" { #endif +#if __GNUC__ >= 4 +#pragma GCC visibility push(default) +#endif + #if defined(__GNUC__) && !defined(__clang__) @@ -43,6 +47,10 @@ extern "C" { #define _ODP_STATIC_ASSERT(cond, msg) _Static_assert(cond, msg) +#if __GNUC__ >= 4 +#pragma GCC visibility pop +#endif + #ifdef __cplusplus } #endif diff --git a/include/odp/api/spec/errno.h b/include/odp/api/spec/errno.h index 33998b61b..a33733419 100644 --- a/include/odp/api/spec/errno.h +++ b/include/odp/api/spec/errno.h @@ -17,6 +17,10 @@ extern "C" { #endif +#if __GNUC__ >= 4 +#pragma GCC visibility push(default) +#endif + /** * @defgroup odp_errno ODP ERRNO * @details @@ -78,6 +82,10 @@ const char *odp_errno_str(int errnum); * @} */ +#if __GNUC__ >= 4 +#pragma GCC visibility pop +#endif + #ifdef __cplusplus } #endif diff --git a/include/odp/api/spec/event.h b/include/odp/api/spec/event.h index 29547f335..3a7c14939 100644 --- a/include/odp/api/spec/event.h +++ b/include/odp/api/spec/event.h @@ -19,6 +19,10 @@ extern "C" { #endif +#if __GNUC__ >= 4 +#pragma GCC visibility push(default) +#endif + /** @defgroup odp_event ODP EVENT * Operations on an event. * @{ @@ -79,6 +83,10 @@ void odp_event_free(odp_event_t event); * @} */ +#if __GNUC__ >= 4 +#pragma GCC visibility pop +#endif + #ifdef __cplusplus } #endif diff --git a/include/odp/api/spec/hash.h b/include/odp/api/spec/hash.h index a6bc75310..b00a6adcd 100644 --- a/include/odp/api/spec/hash.h +++ b/include/odp/api/spec/hash.h @@ -19,6 +19,10 @@ extern "C" { #include <odp/api/std_types.h> +#if __GNUC__ >= 4 +#pragma GCC visibility push(default) +#endif + /** @defgroup odp_hash ODP HASH FUNCTIONS * ODP Hash functions * @{ @@ -91,6 +95,10 @@ int odp_hash_crc_gen64(const void *data, uint32_t data_len, * @} */ +#if __GNUC__ >= 4 +#pragma GCC visibility pop +#endif + #ifdef __cplusplus } #endif diff --git a/include/odp/api/spec/hints.h b/include/odp/api/spec/hints.h index ea67fc401..325ef153d 100644 --- a/include/odp/api/spec/hints.h +++ b/include/odp/api/spec/hints.h @@ -18,6 +18,10 @@ extern "C" { #endif +#if __GNUC__ >= 4 +#pragma GCC visibility push(default) +#endif + /** @addtogroup odp_compiler_optim * Macros that will give hints to the compiler. * @{ @@ -109,6 +113,10 @@ extern "C" { * @} */ +#if __GNUC__ >= 4 +#pragma GCC visibility pop +#endif + #ifdef __cplusplus } #endif diff --git a/include/odp/api/spec/init.h b/include/odp/api/spec/init.h index 8560663da..ff9e3439d 100644 --- a/include/odp/api/spec/init.h +++ b/include/odp/api/spec/init.h @@ -33,6 +33,10 @@ extern "C" { #include <odp/api/thread.h> #include <odp/api/cpumask.h> +#if __GNUC__ >= 4 +#pragma GCC visibility push(default) +#endif + /** @defgroup odp_initialization ODP INITIALIZATION * Initialisation operations. * @{ @@ -274,6 +278,10 @@ int odp_term_local(void); * @} */ +#if __GNUC__ >= 4 +#pragma GCC visibility pop +#endif + #ifdef __cplusplus } #endif diff --git a/include/odp/api/spec/packet.h b/include/odp/api/spec/packet.h index 7da353b26..4305ea0de 100644 --- a/include/odp/api/spec/packet.h +++ b/include/odp/api/spec/packet.h @@ -20,6 +20,10 @@ extern "C" { #include <odp/api/time.h> +#if __GNUC__ >= 4 +#pragma GCC visibility push(default) +#endif + /** @defgroup odp_packet ODP PACKET * Operations on a packet. * @{ @@ -1060,6 +1064,10 @@ uint64_t odp_packet_seg_to_u64(odp_packet_seg_t hdl); * @} */ +#if __GNUC__ >= 4 +#pragma GCC visibility pop +#endif + #ifdef __cplusplus } #endif diff --git a/include/odp/api/spec/packet_flags.h b/include/odp/api/spec/packet_flags.h index 35d44e16c..cc63cda50 100644 --- a/include/odp/api/spec/packet_flags.h +++ b/include/odp/api/spec/packet_flags.h @@ -21,6 +21,10 @@ extern "C" { #include <odp/api/std_types.h> #include <odp/api/packet.h> +#if __GNUC__ >= 4 +#pragma GCC visibility push(default) +#endif + /** @addtogroup odp_packet * Boolean operations on a packet. * @{ @@ -489,6 +493,10 @@ void odp_packet_has_ts_clr(odp_packet_t pkt); * @} */ +#if __GNUC__ >= 4 +#pragma GCC visibility pop +#endif + #ifdef __cplusplus } #endif diff --git a/include/odp/api/spec/packet_io.h b/include/odp/api/spec/packet_io.h index 466cab648..ddf9e052f 100644 --- a/include/odp/api/spec/packet_io.h +++ b/include/odp/api/spec/packet_io.h @@ -22,6 +22,10 @@ extern "C" { #include <odp/api/queue.h> #include <odp/api/time.h> +#if __GNUC__ >= 4 +#pragma GCC visibility push(default) +#endif + /** @defgroup odp_packet_io ODP PACKET IO * Operations on a packet Input/Output interface. * @@ -1034,6 +1038,10 @@ odp_time_t odp_pktin_ts_from_ns(odp_pktio_t pktio, uint64_t ns); * @} */ +#if __GNUC__ >= 4 +#pragma GCC visibility pop +#endif + #ifdef __cplusplus } #endif diff --git a/include/odp/api/spec/packet_io_stats.h b/include/odp/api/spec/packet_io_stats.h index 148ad8d40..3fe31d780 100644 --- a/include/odp/api/spec/packet_io_stats.h +++ b/include/odp/api/spec/packet_io_stats.h @@ -17,6 +17,10 @@ extern "C" { #endif +#if __GNUC__ >= 4 +#pragma GCC visibility push(default) +#endif + /** @addtogroup odp_packet_io * @{ */ @@ -134,6 +138,10 @@ int odp_pktio_stats_reset(odp_pktio_t pktio); * @} */ +#if __GNUC__ >= 4 +#pragma GCC visibility pop +#endif + #ifdef __cplusplus } #endif diff --git a/include/odp/api/spec/pool.h b/include/odp/api/spec/pool.h index 94a302e73..8f3c19ea2 100644 --- a/include/odp/api/spec/pool.h +++ b/include/odp/api/spec/pool.h @@ -22,6 +22,10 @@ extern "C" { #include <odp/api/std_types.h> +#if __GNUC__ >= 4 +#pragma GCC visibility push(default) +#endif + /** @defgroup odp_pool ODP POOL * Operations on a pool. * @{ @@ -206,6 +210,10 @@ void odp_pool_param_init(odp_pool_param_t *param); * @} */ +#if __GNUC__ >= 4 +#pragma GCC visibility pop +#endif + #ifdef __cplusplus } #endif diff --git a/include/odp/api/spec/queue.h b/include/odp/api/spec/queue.h index 51d94a23a..2e767e7e1 100644 --- a/include/odp/api/spec/queue.h +++ b/include/odp/api/spec/queue.h @@ -21,6 +21,10 @@ extern "C" { #include <odp/api/schedule_types.h> #include <odp/api/event.h> +#if __GNUC__ >= 4 +#pragma GCC visibility push(default) +#endif + /** @defgroup odp_queue ODP QUEUE * Macros and operation on a queue. * @{ @@ -370,6 +374,10 @@ int odp_queue_info(odp_queue_t queue, odp_queue_info_t *info); * @} */ +#if __GNUC__ >= 4 +#pragma GCC visibility pop +#endif + #ifdef __cplusplus } #endif diff --git a/include/odp/api/spec/random.h b/include/odp/api/spec/random.h index 435783a4f..d1f926750 100644 --- a/include/odp/api/spec/random.h +++ b/include/odp/api/spec/random.h @@ -18,6 +18,10 @@ extern "C" { #endif +#if __GNUC__ >= 4 +#pragma GCC visibility push(default) +#endif + /** @defgroup odp_random ODP RANDOM * @{ */ @@ -41,6 +45,10 @@ int32_t odp_random_data(uint8_t *buf, int32_t size, odp_bool_t use_entropy); * @} */ +#if __GNUC__ >= 4 +#pragma GCC visibility pop +#endif + #ifdef __cplusplus } #endif diff --git a/include/odp/api/spec/rwlock.h b/include/odp/api/spec/rwlock.h index 9ca887262..7d23430ba 100644 --- a/include/odp/api/spec/rwlock.h +++ b/include/odp/api/spec/rwlock.h @@ -17,6 +17,10 @@ extern "C" { #endif +#if __GNUC__ >= 4 +#pragma GCC visibility push(default) +#endif + /** * @defgroup odp_locks ODP LOCKS * @details @@ -95,6 +99,10 @@ void odp_rwlock_write_unlock(odp_rwlock_t *rwlock); * @} */ +#if __GNUC__ >= 4 +#pragma GCC visibility pop +#endif + #ifdef __cplusplus } #endif diff --git a/include/odp/api/spec/rwlock_recursive.h b/include/odp/api/spec/rwlock_recursive.h index 965fcc0bf..163149197 100644 --- a/include/odp/api/spec/rwlock_recursive.h +++ b/include/odp/api/spec/rwlock_recursive.h @@ -17,6 +17,10 @@ extern "C" { #endif +#if __GNUC__ >= 4 +#pragma GCC visibility push(default) +#endif + /** * @addtogroup odp_locks * @details @@ -113,6 +117,10 @@ void odp_rwlock_recursive_write_unlock(odp_rwlock_recursive_t *lock); * @} */ +#if __GNUC__ >= 4 +#pragma GCC visibility pop +#endif + #ifdef __cplusplus } #endif diff --git a/include/odp/api/spec/schedule.h b/include/odp/api/spec/schedule.h index cd1325ad7..cff56ac93 100644 --- a/include/odp/api/spec/schedule.h +++ b/include/odp/api/spec/schedule.h @@ -25,6 +25,10 @@ extern "C" { #include <odp/api/schedule_types.h> #include <odp/api/thrmask.h> +#if __GNUC__ >= 4 +#pragma GCC visibility push(default) +#endif + /** @defgroup odp_scheduler ODP SCHEDULER * Operations on the scheduler. * @{ @@ -371,6 +375,10 @@ void odp_schedule_order_unlock(unsigned lock_index); * @} */ +#if __GNUC__ >= 4 +#pragma GCC visibility pop +#endif + #ifdef __cplusplus } #endif diff --git a/include/odp/api/spec/schedule_types.h b/include/odp/api/spec/schedule_types.h index 34046af9c..11fc00174 100644 --- a/include/odp/api/spec/schedule_types.h +++ b/include/odp/api/spec/schedule_types.h @@ -17,6 +17,10 @@ extern "C" { #endif +#if __GNUC__ >= 4 +#pragma GCC visibility push(default) +#endif + /** @addtogroup odp_scheduler * @{ */ @@ -152,6 +156,10 @@ typedef struct odp_schedule_param_t { * @} */ +#if __GNUC__ >= 4 +#pragma GCC visibility pop +#endif + #ifdef __cplusplus } #endif diff --git a/include/odp/api/spec/shared_memory.h b/include/odp/api/spec/shared_memory.h index 5d851ce12..8969462c2 100644 --- a/include/odp/api/spec/shared_memory.h +++ b/include/odp/api/spec/shared_memory.h @@ -19,6 +19,10 @@ extern "C" { #endif +#if __GNUC__ >= 4 +#pragma GCC visibility push(default) +#endif + /** @defgroup odp_shared_memory ODP SHARED MEMORY * Operations on shared memory. * @{ @@ -148,6 +152,10 @@ uint64_t odp_shm_to_u64(odp_shm_t hdl); * @} */ +#if __GNUC__ >= 4 +#pragma GCC visibility pop +#endif + #ifdef __cplusplus } #endif diff --git a/include/odp/api/spec/spinlock.h b/include/odp/api/spec/spinlock.h index a73359ddb..02e9d1a0d 100644 --- a/include/odp/api/spec/spinlock.h +++ b/include/odp/api/spec/spinlock.h @@ -18,6 +18,10 @@ extern "C" { #endif +#if __GNUC__ >= 4 +#pragma GCC visibility push(default) +#endif + /** * @addtogroup odp_locks * @details @@ -84,6 +88,10 @@ int odp_spinlock_is_locked(odp_spinlock_t *splock); * @} */ +#if __GNUC__ >= 4 +#pragma GCC visibility pop +#endif + #ifdef __cplusplus } #endif diff --git a/include/odp/api/spec/spinlock_recursive.h b/include/odp/api/spec/spinlock_recursive.h index d98f2bbb6..457998a03 100644 --- a/include/odp/api/spec/spinlock_recursive.h +++ b/include/odp/api/spec/spinlock_recursive.h @@ -17,6 +17,10 @@ extern "C" { #endif +#if __GNUC__ >= 4 +#pragma GCC visibility push(default) +#endif + /** * @addtogroup odp_locks * @details @@ -78,6 +82,10 @@ int odp_spinlock_recursive_is_locked(odp_spinlock_recursive_t *lock); * @} */ +#if __GNUC__ >= 4 +#pragma GCC visibility pop +#endif + #ifdef __cplusplus } #endif diff --git a/include/odp/api/spec/std_clib.h b/include/odp/api/spec/std_clib.h index 791b72f1c..de5976c98 100644 --- a/include/odp/api/spec/std_clib.h +++ b/include/odp/api/spec/std_clib.h @@ -17,6 +17,10 @@ extern "C" { #endif +#if __GNUC__ >= 4 +#pragma GCC visibility push(default) +#endif + /** * @defgroup odp_std_clib ODP STD CLIB * @details @@ -75,6 +79,10 @@ int odp_memcmp(const void *ptr1, const void *ptr2, size_t num); * @} */ +#if __GNUC__ >= 4 +#pragma GCC visibility pop +#endif + #ifdef __cplusplus } #endif diff --git a/include/odp/api/spec/std_types.h b/include/odp/api/spec/std_types.h index 7558c647d..f138e9452 100644 --- a/include/odp/api/spec/std_types.h +++ b/include/odp/api/spec/std_types.h @@ -20,6 +20,10 @@ extern "C" { #endif +#if __GNUC__ >= 4 +#pragma GCC visibility push(default) +#endif + /** @addtogroup odp_system ODP SYSTEM * @{ */ @@ -35,6 +39,10 @@ extern "C" { * @} */ +#if __GNUC__ >= 4 +#pragma GCC visibility pop +#endif + #ifdef __cplusplus } #endif diff --git a/include/odp/api/spec/sync.h b/include/odp/api/spec/sync.h index c6f790c6f..1faa49b27 100644 --- a/include/odp/api/spec/sync.h +++ b/include/odp/api/spec/sync.h @@ -18,6 +18,10 @@ extern "C" { #endif +#if __GNUC__ >= 4 +#pragma GCC visibility push(default) +#endif + /** * @addtogroup odp_barrier * @details @@ -83,6 +87,10 @@ void odp_mb_full(void); * @} */ +#if __GNUC__ >= 4 +#pragma GCC visibility pop +#endif + #ifdef __cplusplus } #endif diff --git a/include/odp/api/spec/system_info.h b/include/odp/api/spec/system_info.h index bde3a6031..0191b8831 100644 --- a/include/odp/api/spec/system_info.h +++ b/include/odp/api/spec/system_info.h @@ -19,6 +19,10 @@ extern "C" { #endif +#if __GNUC__ >= 4 +#pragma GCC visibility push(default) +#endif + /** @defgroup odp_system ODP SYSTEM * @{ */ @@ -48,6 +52,10 @@ int odp_sys_cache_line_size(void); * @} */ +#if __GNUC__ >= 4 +#pragma GCC visibility pop +#endif + #ifdef __cplusplus } #endif diff --git a/include/odp/api/spec/thread.h b/include/odp/api/spec/thread.h index 37202497a..94101c874 100644 --- a/include/odp/api/spec/thread.h +++ b/include/odp/api/spec/thread.h @@ -18,6 +18,10 @@ extern "C" { #endif +#if __GNUC__ >= 4 +#pragma GCC visibility push(default) +#endif + /** @defgroup odp_thread ODP THREAD * @{ */ @@ -105,6 +109,10 @@ odp_thread_type_t odp_thread_type(void); * @} */ +#if __GNUC__ >= 4 +#pragma GCC visibility pop +#endif + #ifdef __cplusplus } #endif diff --git a/include/odp/api/spec/thrmask.h b/include/odp/api/spec/thrmask.h index a22da8c42..4eb8e294c 100644 --- a/include/odp/api/spec/thrmask.h +++ b/include/odp/api/spec/thrmask.h @@ -19,6 +19,10 @@ extern "C" { #include <odp/api/std_types.h> +#if __GNUC__ >= 4 +#pragma GCC visibility push(default) +#endif + /** @addtogroup odp_thread * Thread mask operations. * @{ @@ -232,6 +236,10 @@ int odp_thrmask_control(odp_thrmask_t *mask); * @} */ +#if __GNUC__ >= 4 +#pragma GCC visibility pop +#endif + #ifdef __cplusplus } #endif diff --git a/include/odp/api/spec/ticketlock.h b/include/odp/api/spec/ticketlock.h index 3f0e3f556..071a5f040 100644 --- a/include/odp/api/spec/ticketlock.h +++ b/include/odp/api/spec/ticketlock.h @@ -18,6 +18,10 @@ extern "C" { #endif +#if __GNUC__ >= 4 +#pragma GCC visibility push(default) +#endif + /** * @addtogroup odp_locks * @details @@ -83,6 +87,10 @@ int odp_ticketlock_is_locked(odp_ticketlock_t *tklock); * @} */ +#if __GNUC__ >= 4 +#pragma GCC visibility pop +#endif + #ifdef __cplusplus } #endif diff --git a/include/odp/api/spec/time.h b/include/odp/api/spec/time.h index 85692ec11..62873bc80 100644 --- a/include/odp/api/spec/time.h +++ b/include/odp/api/spec/time.h @@ -19,6 +19,10 @@ extern "C" { #endif +#if __GNUC__ >= 4 +#pragma GCC visibility push(default) +#endif + /** @defgroup odp_time ODP TIME * @{ */ @@ -174,6 +178,10 @@ uint64_t odp_time_to_u64(odp_time_t time); * @} */ +#if __GNUC__ >= 4 +#pragma GCC visibility pop +#endif + #ifdef __cplusplus } #endif diff --git a/include/odp/api/spec/timer.h b/include/odp/api/spec/timer.h index 435c0045f..e83a76ca5 100644 --- a/include/odp/api/spec/timer.h +++ b/include/odp/api/spec/timer.h @@ -18,6 +18,10 @@ extern "C" { #endif +#if __GNUC__ >= 4 +#pragma GCC visibility push(default) +#endif + /** @defgroup odp_timer ODP TIMER * @{ */ @@ -408,6 +412,10 @@ uint64_t odp_timeout_to_u64(odp_timeout_t hdl); * @} */ +#if __GNUC__ >= 4 +#pragma GCC visibility pop +#endif + #ifdef __cplusplus } #endif diff --git a/include/odp/api/spec/traffic_mngr.h b/include/odp/api/spec/traffic_mngr.h index ce124a83f..d7a624832 100644 --- a/include/odp/api/spec/traffic_mngr.h +++ b/include/odp/api/spec/traffic_mngr.h @@ -14,6 +14,10 @@ extern "C" { #include <odp/api/std_types.h> #include <odp/api/packet_io.h> +#if __GNUC__ >= 4 +#pragma GCC visibility push(default) +#endif + /** * @file * @@ -1367,6 +1371,10 @@ void odp_tm_stats_print(odp_tm_t odp_tm); * @} */ +#if __GNUC__ >= 4 +#pragma GCC visibility pop +#endif + #ifdef __cplusplus } #endif diff --git a/include/odp/api/spec/version.h b/include/odp/api/spec/version.h index 642831c23..22cb37169 100644 --- a/include/odp/api/spec/version.h +++ b/include/odp/api/spec/version.h @@ -18,6 +18,10 @@ extern "C" { #endif +#if __GNUC__ >= 4 +#pragma GCC visibility push(default) +#endif + /** * @defgroup odp_version ODP VERSION * @details @@ -98,6 +102,10 @@ const char *odp_version_impl_str(void); * @} */ +#if __GNUC__ >= 4 +#pragma GCC visibility pop +#endif + #ifdef __cplusplus } #endif diff --git a/platform/Makefile.inc b/platform/Makefile.inc index 1cb7a7194..5aa3fedc4 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/m4/configure.m4 b/platform/linux-generic/m4/configure.m4 index f80c66c02..75a3797e2 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( |