Commit 08cbf79d authored by Vladimír Čunát's avatar Vladimír Čunát

make: use -fvisibility=hidden by default

Symbols not marked by KR_EXPORT shouldn't be visible outside
the same output binary (e.g. sbin/kresd or lib/kdns_modules/hints.so)
Also mark `engine_hint_root_file`.
parent bf4fd314
......@@ -33,6 +33,7 @@ INSTALL := install
BUILD_LDFLAGS += $(LDFLAGS)
BUILD_CFLAGS := $(CFLAGS) -std=c99 -D_GNU_SOURCE -Wno-unused -Wtype-limits -Wformat -Wformat-security -Wall -I$(abspath .) -I$(abspath lib/generic) -I$(abspath contrib) -I$(abspath contrib/lmdb)
BUILD_CFLAGS += -DPACKAGE_VERSION="\"$(VERSION)\"" -DPREFIX="\"$(PREFIX)\"" -DMODULEDIR="\"$(MODULEDIR)\""
BUILD_CFLAGS += -fvisibility=hidden
ifeq (,$(findstring -O,$(CFLAGS)))
BUILD_CFLAGS += -O2
endif
......
......@@ -105,6 +105,8 @@ int engine_set_moduledir(struct engine *engine, const char *moduledir);
/** Load root hints from a zonefile (or config-time default if NULL).
*
* @return error message or NULL (statically allocated)
* @note exported to be usable from the hints module.
*/
KR_EXPORT
const char* engine_hint_root_file(struct kr_context *ctx, const char *file);
......@@ -42,7 +42,7 @@ libkres_HEADERS := \
# Dependencies
libkres_DEPEND := $(contrib)
libkres_CFLAGS := -fvisibility=hidden -fPIC $(lmdb_CFLAGS)
libkres_CFLAGS := -fPIC $(lmdb_CFLAGS)
libkres_LIBS := $(contrib_TARGET) $(libknot_LIBS) $(libdnssec_LIBS) $(lmdb_LIBS) \
$(libuv_LIBS) $(gnutls_LIBS)
libkres_TARGET := -L$(abspath lib) -lkres
......
cookies_CFLAGS := -fvisibility=hidden -fPIC
cookies_CFLAGS := -fPIC
cookies_SOURCES := \
modules/cookies/cookiectl.c \
modules/cookies/cookiemonster.c \
......
dnstap_CFLAGS := -fvisibility=hidden -fPIC
dnstap_CFLAGS := -fPIC
dnstap_SOURCES := modules/dnstap/dnstap.pb-c.c modules/dnstap/dnstap.c
dnstap_DEPEND := $(libkres) modules/dnstap/dnstap.pb-c.c # because of generated *.h
dnstap_LIBS := $(contrib_TARGET) $(libkres_TARGET) $(libkres_LIBS) $(libprotobuf-c_LIBS) $(libfstrm_LIBS)
......
hints_CFLAGS := -fvisibility=hidden -fPIC
hints_CFLAGS := -fPIC
# We use a symbol that's not in libkres but the daemon.
# On darwin this isn't accepted by default.
hints_LDFLAGS := -Wl,-undefined -Wl,dynamic_lookup
......
memcached_CFLAGS := -fvisibility=hidden -fPIC
memcached_CFLAGS := -fPIC
memcached_SOURCES := modules/memcached/memcached.c modules/memcached/cdb_memcached.c
memcached_DEPEND := $(libkres)
memcached_LIBS := $(libkres_TARGET) $(libkres_LIBS) $(libmemcached_LIBS)
......
redis_CFLAGS := -fvisibility=hidden -fPIC
redis_CFLAGS := -fPIC
redis_SOURCES := modules/redis/redis.c modules/redis/cdb_redis.c
redis_DEPEND := $(libkres)
redis_LIBS := $(libkres_TARGET) $(libkres_LIBS) $(hiredis_LIBS) $(libuv_LIBS)
......
stats_CFLAGS := -fvisibility=hidden -fPIC
stats_CFLAGS := -fPIC
stats_SOURCES := modules/stats/stats.c
stats_DEPEND := $(libkres)
stats_LIBS := $(contrib_TARGET) $(libkres_TARGET) $(libkres_LIBS)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment