]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
make: fixup passing export-dynamic flags
authorVladimír Čunát <vladimir.cunat@nic.cz>
Tue, 30 Jan 2018 10:19:17 +0000 (11:19 +0100)
committerVladimír Čunát <vladimir.cunat@nic.cz>
Tue, 30 Jan 2018 12:49:32 +0000 (13:49 +0100)
It was breaking on Darwin, and clang was throwing warnings.
Problem since ddb699d364.

config.mk
platform.mk

index 8cb4b3ad4d474ff2c810bae55081e0bb6b553b10..9a7f08d66a83fe005ba0b89ce9fff7672efec554 100644 (file)
--- a/config.mk
+++ b/config.mk
@@ -40,11 +40,6 @@ BUILD_CFLAGS += -I$(abspath .) -I$(abspath lib/generic) -I$(abspath contrib)
 BUILD_CFLAGS += -DPACKAGE_VERSION="\"$(VERSION)\"" -DPREFIX="\"$(PREFIX)\"" -DMODULEDIR="\"$(MODULEDIR)\""
 BUILD_CFLAGS += -fvisibility=hidden
 
-# Otherwise Fedora is making kresd symbols inaccessible for modules
-# TODO: clang needs different flag name, etc.
-BUILD_CFLAGS += -rdynamic
-BUILD_LDFLAGS += -export-dynamic
-
 ifeq (,$(findstring -O,$(CFLAGS)))
        BUILD_CFLAGS += -O2
 endif
index f2657ed15326889adae88e6f4a74d1cfbc2e57cd..d42c66e4ce6429c442f58ac57052be1dad3705e1 100644 (file)
@@ -36,6 +36,7 @@ else
                PLATFORM := Darwin
                LIBEXT := .dylib
                MODTYPE := dynamiclib
+               LDFLAGS += -Wl,-export_dynamic
                 # OS X specific hardening since -pie doesn't work
                ifneq ($(HARDENING),no)
                        BINFLAGS += -Wl,-pie
@@ -45,14 +46,18 @@ else
                SOVER = $(if $(1), -compatibility_version $(2) -current_version $(1),)
        else
                PLATFORM := POSIX
-               LDFLAGS += -pthread -lm -Wl,-E
+               LDFLAGS += -pthread -lm -Wl,--export-dynamic
                 # ELF hardening options
                ifneq ($(HARDENING),no)
                        BINFLAGS += -pie
                        LDFLAGS += -Wl,-z,relro,-z,now
                endif
                ifeq ($(UNAME),Linux)
-               LDFLAGS += -ldl
+                       LDFLAGS += -ldl
+               endif
+               ifeq ($(firstword $(shell $(CC) --version)),gcc)
+                       # Otherwise Fedora is making kresd symbols inaccessible for modules?
+                       CFLAGS += -rdynamic
                endif
        endif
 endif