diff --git a/config.mk b/config.mk
index 8cb4b3ad4d474ff2c810bae55081e0bb6b553b10..9a7f08d66a83fe005ba0b89ce9fff7672efec554 100644
--- 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
diff --git a/daemon/main.c b/daemon/main.c
index 560aec2a7f0a1c571dde1de8c1d06c16dc6a66fe..046a19a279ba22aeea043d9aa50031a87d814ea3 100644
--- a/daemon/main.c
+++ b/daemon/main.c
@@ -475,7 +475,10 @@ static void args_init(struct args *args)
 	args->quiet = false;
 }
 
-int parse_args(int argc, char **argv, struct args *args)
+/** Process arguments into struct args.
+ * @return >=0 if main() should be exited immediately.
+ */
+static int parse_args(int argc, char **argv, struct args *args)
 {
 	/* Long options. */
 	int c = 0, li = 0;
@@ -554,11 +557,11 @@ int parse_args(int argc, char **argv, struct args *args)
 			help(argc, argv);
 			return EXIT_FAILURE;
 		}
-	}	
+	}
 	if (optind < argc) {
 		args->rundir = argv[optind];
 	}
-	return EXIT_SUCCESS;
+	return -1;
 }
 
 static int bind_fds(struct network *net, fd_array_t *fd_set, bool tls) {
@@ -595,7 +598,7 @@ int main(int argc, char **argv)
 	int ret = 0;
 	struct args args;
 	args_init(&args);
-	if ((ret = parse_args(argc, argv, &args)) != EXIT_SUCCESS) {
+	if ((ret = parse_args(argc, argv, &args)) >= 0) {
 		return ret;
 	}
 
@@ -651,7 +654,7 @@ int main(int argc, char **argv)
 	 * sockets etc. before forking, but at the same time can't touch it before
 	 * forking otherwise it crashes, so it's a chicken and egg problem.
 	 * Disabling until https://github.com/libuv/libuv/pull/846 is done. */
-	 if (forks > 1 && fd_set.len == 0 && tls_fd_set.len == 0) {
+	 if (args.forks > 1 && args.fd_set.len == 0 && args.tls_fd_set.len == 0) {
 	 	kr_log_error("[system] forking >1 workers supported only on Linux 3.9+ or with supervisor\n");
 	 	return EXIT_FAILURE;
 	 }
diff --git a/platform.mk b/platform.mk
index f2657ed15326889adae88e6f4a74d1cfbc2e57cd..d42c66e4ce6429c442f58ac57052be1dad3705e1 100644
--- a/platform.mk
+++ b/platform.mk
@@ -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