]> git.ipfire.org Git - people/ms/libloc.git/commitdiff
linker: Do not use --gc-sections on non-GNU platforms
authorMichael Tremer <michael.tremer@ipfire.org>
Fri, 18 Oct 2019 18:36:21 +0000 (19:36 +0100)
committerMichael Tremer <michael.tremer@ipfire.org>
Fri, 18 Oct 2019 18:39:42 +0000 (19:39 +0100)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Makefile.am

index 489458d9a6361b32d83daaa171e1138eed94ae44..162956a6e33be015c66db4f8a566ac616cdda7b6 100644 (file)
@@ -6,6 +6,8 @@ AM_MAKEFLAGS = --no-print-directory
 SUBDIRS = . po
 BINDINGS =
 
+OS = $(shell uname -s)
+
 if ENABLE_PERL
 BINDINGS += perl
 endif
@@ -19,9 +21,16 @@ AM_CFLAGS = ${my_CFLAGS} \
        -ffunction-sections \
        -fdata-sections
 
-AM_LDFLAGS = \
-       -Wl,--gc-sections \
-       -Wl,--as-needed
+AM_LDFLAGS =
+
+# leaving a space here to work around automake's conditionals
+ ifeq ($(OS),Darwin)
+       AM_LDFLAGS += -Wl,-dead_strip
+ else
+       AM_LDFLAGS += \
+               -Wl,--as-needed \
+               -Wl,--gc-sections
+ endif
 
 LIBLOC_CURRENT=0
 LIBLOC_REVISION=0