Mark all symbols hidden by default, export only required ones

This commit is contained in:
Vitaliy Filippov
2025-08-24 16:55:58 +03:00
parent 9892fccfb0
commit 2ebe3a468c
25 changed files with 60 additions and 18 deletions
+4 -1
View File
@@ -21,12 +21,15 @@ if("${CMAKE_INSTALL_PREFIX}" MATCHES "^/usr/local/?$")
endif()
add_definitions(-DVITASTOR_VERSION="2.2.3")
add_definitions(-D_GNU_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -Wall -Wno-sign-compare -Wno-comment -Wno-parentheses -Wno-pointer-arith -fdiagnostics-color=always -fno-omit-frame-pointer -I ${CMAKE_SOURCE_DIR}/src)
add_definitions(-D_GNU_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -Wall -Wno-sign-compare -Wno-comment -Wno-parentheses -Wno-pointer-arith -fdiagnostics-color=always -fno-omit-frame-pointer -fvisibility=hidden -I ${CMAKE_SOURCE_DIR}/src)
add_link_options(-fno-omit-frame-pointer)
if (${WITH_ASAN})
add_definitions(-fsanitize=address)
add_link_options(-fsanitize=address -fno-omit-frame-pointer)
endif (${WITH_ASAN})
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -fvisibility-inlines-hidden")
set(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL} -fvisibility-inlines-hidden")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -fvisibility-inlines-hidden")
set(CMAKE_BUILD_TYPE RelWithDebInfo)
string(REGEX REPLACE "([\\/\\-]O)[^ \t\r\n]*" "\\13" CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}")
+2 -2
View File
@@ -135,7 +135,7 @@ Output:
*/
struct blockstore_op_t
struct __attribute__ ((visibility("default"))) blockstore_op_t
{
// operation
uint64_t opcode = 0;
@@ -173,7 +173,7 @@ typedef std::map<std::string, std::string> blockstore_config_t;
class blockstore_impl_t;
class blockstore_t
class __attribute__((visibility("default"))) blockstore_t
{
blockstore_impl_t *impl;
public:
+1 -1
View File
@@ -301,7 +301,7 @@ static int bs_invalidate(struct thread_data *td, struct fio_file *f)
return 0;
}
struct ioengine_ops ioengine = {
struct ioengine_ops __attribute__((visibility("default"))) ioengine = {
.name = "vitastor_blockstore",
.version = FIO_IOOPS_VERSION,
.flags = FIO_MEMALIGN | FIO_DISKLESSIO | FIO_NOEXTEND,
+2 -2
View File
@@ -31,7 +31,7 @@ struct cluster_op_part_t
osd_op_t op;
};
struct cluster_op_t
struct __attribute__((visibility("default"))) cluster_op_t
{
uint64_t opcode; // OSD_OP_READ, OSD_OP_WRITE, OSD_OP_SYNC, OSD_OP_DELETE, OSD_OP_READ_BITMAP, OSD_OP_READ_CHAIN_BITMAP
uint64_t inode;
@@ -81,7 +81,7 @@ struct inode_list_pg_t;
class writeback_cache_t;
// FIXME: Split into public and private interfaces
class cluster_client_t
class __attribute__((visibility("default"))) cluster_client_t
{
#ifdef __MOCK__
public:
+1 -1
View File
@@ -92,7 +92,7 @@ struct inode_watch_t
struct http_co_t;
struct etcd_state_client_t
struct __attribute__((visibility("default"))) etcd_state_client_t
{
protected:
std::vector<std::string> local_ips;
+1 -1
View File
@@ -525,7 +525,7 @@ static int sec_invalidate(struct thread_data *td, struct fio_file *f)
return 0;
}
struct ioengine_ops ioengine = {
struct ioengine_ops __attribute__((visibility("default"))) ioengine = {
.name = "vitastor_cluster",
.version = FIO_IOOPS_VERSION,
.flags = FIO_MEMALIGN | FIO_DISKLESSIO | FIO_NOEXTEND,
+1 -1
View File
@@ -437,7 +437,7 @@ static int sec_invalidate(struct thread_data *td, struct fio_file *f)
return 0;
}
struct ioengine_ops ioengine = {
struct ioengine_ops __attribute__((visibility("default"))) ioengine = {
.name = "vitastor_secondary_osd",
.version = FIO_IOOPS_VERSION,
.flags = FIO_MEMALIGN | FIO_DISKLESSIO | FIO_NOEXTEND,
+1 -1
View File
@@ -174,7 +174,7 @@ struct osd_messenger_t;
struct rdmacm_connecting_t;
#endif
struct osd_messenger_t
struct __attribute__((visibility("default"))) osd_messenger_t
{
protected:
int keepalive_timer_id = -1;
+1 -1
View File
@@ -152,7 +152,7 @@ struct blockstore_op_t;
struct osd_primary_op_data_t;
struct osd_op_t
struct __attribute__((visibility("default"))) osd_op_t
{
timespec tv_begin = { 0 }, tv_end = { 0 };
uint64_t op_type = OSD_OP_IN;
+4
View File
@@ -3,6 +3,8 @@
#pragma once
#pragma GCC visibility push(default)
// Placement group states
// STARTING -> [acquire lock] -> PEERING -> INCOMPLETE|ACTIVE
// ACTIVE -> REPEERING -> PEERING
@@ -50,3 +52,5 @@ extern const int pg_state_bit_count;
extern const int object_state_bits[];
extern const char *object_state_names[];
extern const int object_state_bit_count;
#pragma GCC visibility pop
+2 -2
View File
@@ -57,11 +57,11 @@
#include "vitastor_c.h"
#ifdef VITASTOR_SOURCE_TREE
void qemu_module_dummy(void)
void __attribute__((visibility("default"))) qemu_module_dummy(void)
{
}
void DSO_STAMP_FUN(void)
void __attribute__((visibility("default"))) DSO_STAMP_FUN(void)
{
}
#endif
+4
View File
@@ -22,6 +22,8 @@
#include <stdint.h>
#include <sys/uio.h>
#pragma GCC visibility push(default)
#ifdef __cplusplus
extern "C" {
#endif
@@ -85,4 +87,6 @@ uint32_t vitastor_c_inode_get_immediate_commit(vitastor_c *client, uint64_t inod
}
#endif
#pragma GCC visibility pop
#endif
+1 -1
View File
@@ -19,7 +19,7 @@ class cluster_client_t;
struct kv_db_t;
struct vitastorkv_dbw_t
struct __attribute__((visibility("default"))) vitastorkv_dbw_t
{
// cli = vitastor_c_get_internal_client(client)
vitastorkv_dbw_t(cluster_client_t *cli);
-1
View File
@@ -19,7 +19,6 @@
#include "liburing/io_uring_version.h"
#include "liburing/barrier.h"
#ifndef uring_unlikely
#define uring_unlikely(cond) __builtin_expect(!!(cond), 0)
#endif
+4
View File
@@ -13,6 +13,8 @@ struct addr_mask_t
uint8_t bits;
};
#pragma GCC visibility push(default)
bool string_to_addr(std::string str, bool parse_port, int default_port, struct sockaddr_storage *addr);
std::string addr_to_string(const sockaddr_storage &addr);
addr_mask_t cidr_parse(std::string mask);
@@ -22,3 +24,5 @@ bool cidr_sockaddr_match(const sockaddr_storage &addr, const addr_mask_t &mask);
std::vector<std::string> getifaddr_list(const std::vector<addr_mask_t> & masks = std::vector<addr_mask_t>(), bool include_v6 = false);
int create_and_bind_socket(std::string bind_address, int bind_port, int listen_backlog, int *listening_port);
std::string gethostname_str();
#pragma GCC visibility pop
+4
View File
@@ -5,6 +5,8 @@
#include <stdint.h>
#pragma GCC visibility push(default)
// Hierarchical bitmap allocator
class allocator_t
{
@@ -25,3 +27,5 @@ public:
void bitmap_set(void *bitmap, uint64_t start, uint64_t len, uint64_t bitmap_granularity);
void bitmap_clear(void *bitmap, uint64_t start, uint64_t len, uint64_t bitmap_granularity);
bool bitmap_check(void *bitmap, uint64_t start, uint64_t len, uint64_t bitmap_granularity);
#pragma GCC visibility pop
+4
View File
@@ -8,6 +8,8 @@
// unsigned __int64 _mm_crc32_u64 (unsigned __int64 crc, unsigned __int64 v)
// unsigned int _mm_crc32_u8 (unsigned int crc, unsigned char v)
#pragma GCC visibility push(default)
#ifdef __cplusplus
extern "C" {
#endif
@@ -17,3 +19,5 @@ uint32_t crc32c_nopad(uint32_t prev_crc, const void *buf, size_t len, size_t lef
#ifdef __cplusplus
};
#endif
#pragma GCC visibility pop
+1 -1
View File
@@ -8,7 +8,7 @@
#include "ringloop.h"
#include "timerfd_manager.h"
class epoll_manager_t
class __attribute__((visibility("default"))) epoll_manager_t
{
int epoll_fd;
bool pending;
+4
View File
@@ -8,7 +8,11 @@
#include "json11/json11.hpp"
#pragma GCC visibility push(default)
std::map<std::string, std::string> json_to_string_map(const json11::Json::object & config);
bool json_is_true(const json11::Json & val);
bool json_is_false(const json11::Json & val);
std::string implode(const std::string & sep, json11::Json array);
#pragma GCC visibility pop
+4
View File
@@ -6,6 +6,8 @@
#include <malloc.h>
#include <stdlib.h>
#pragma GCC visibility push(default)
inline void* memalign_or_die(size_t alignment, size_t size)
{
void *buf = memalign(alignment, size);
@@ -49,3 +51,5 @@ inline void* calloc_or_die(size_t nmemb, size_t size)
}
return buf;
}
#pragma GCC visibility pop
+1 -1
View File
@@ -32,7 +32,7 @@ struct ring_consumer_t
std::function<void(void)> loop;
};
class ring_loop_t
class __attribute__((visibility("default"))) ring_loop_t
{
std::vector<std::function<void()>> immediate_queue, immediate_queue2;
std::vector<ring_consumer_t*> consumers;
+4
View File
@@ -6,8 +6,12 @@
#include <unistd.h>
#include <sys/uio.h>
#pragma GCC visibility push(default)
size_t read_blocking(int fd, void *read_buf, size_t remaining);
size_t write_blocking(int fd, void *write_buf, size_t remaining);
int readv_blocking(int fd, iovec *iov, int iovcnt);
int writev_blocking(int fd, iovec *iov, int iovcnt);
int sendv_blocking(int fd, iovec *iov, int iovcnt, int flags);
#pragma GCC visibility pop
+4
View File
@@ -12,6 +12,8 @@
/*************************** HEADER FILES ***************************/
#include <stddef.h>
#pragma GCC visibility push(default)
/****************************** MACROS ******************************/
#define SHA256_BLOCK_SIZE 32 // SHA256 outputs a 32 byte digest
@@ -38,4 +40,6 @@ void sha256_final(SHA256_CTX *ctx, BYTE hash[]);
};
#endif
#pragma GCC visibility pop
#endif // SHA256_H
+4
View File
@@ -8,6 +8,8 @@
#define is_white(a) ((a) == ' ' || (a) == '\t' || (a) == '\r' || (a) == '\n')
#pragma GCC visibility push(default)
std::string base64_encode(const std::string &in);
std::string base64_decode(const std::string &in);
uint64_t parse_size(std::string size_str, bool *ok = NULL);
@@ -32,3 +34,5 @@ std::string addslashes(const std::string & str, const char *toescape = "\\\"");
std::string realpath_str(std::string path, bool nofail = true);
std::string format_datetime(uint64_t unixtime);
bool is_zero(void *buf, size_t size);
#pragma GCC visibility pop
+1 -1
View File
@@ -16,7 +16,7 @@ struct timerfd_timer_t
std::function<void(int)> callback;
};
class timerfd_manager_t
class __attribute__((visibility("default"))) timerfd_manager_t
{
int wait_state = 0;
int timerfd;