From: Michael Tremer Date: Fri, 18 Oct 2019 18:36:21 +0000 (+0100) Subject: linker: Do not use --gc-sections on non-GNU platforms X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=afe514202a3155321b1f4f3e827f55cdb174a7bd;p=people%2Fsennis%2Flibloc.git linker: Do not use --gc-sections on non-GNU platforms Signed-off-by: Michael Tremer --- diff --git a/Makefile.am b/Makefile.am index 489458d..162956a 100644 --- a/Makefile.am +++ b/Makefile.am @@ -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