mirror of
https://github.com/openwrt/openwrt.git
synced 2024-12-19 05:38:00 +00:00
tools/mtd-utils: avoid linking libm statically
Rework static linker flags to not link libm statically, this should fix the build on CentOS where libm.a is not provided by the libc devel package. Signed-off-by: Jo-Philipp Wich <jow@openwrt.org> SVN-Revision: 46989
This commit is contained in:
parent
d6408aa9b4
commit
1ca571b6c2
@ -1,23 +1,43 @@
|
|||||||
--- a/common.mk
|
--- a/common.mk
|
||||||
+++ b/common.mk
|
+++ b/common.mk
|
||||||
@@ -2,6 +2,11 @@ CC := $(CROSS)gcc
|
@@ -2,6 +2,16 @@ CC := $(CROSS)gcc
|
||||||
AR := $(CROSS)ar
|
AR := $(CROSS)ar
|
||||||
RANLIB := $(CROSS)ranlib
|
RANLIB := $(CROSS)ranlib
|
||||||
|
|
||||||
+ifeq ($(STATIC),1)
|
+ifeq ($(STATIC),1)
|
||||||
+ LD_STATIC_ON := -Wl,-Bstatic
|
+ define static_link
|
||||||
+ LD_STATIC_OFF := -Wl,-Bdynamic
|
+ -Wl,-Bstatic $(1) -Wl,-Bdynamic
|
||||||
|
+ endef
|
||||||
|
+else
|
||||||
|
+ define static_link
|
||||||
|
+ $(1)
|
||||||
|
+ endef
|
||||||
+endif
|
+endif
|
||||||
+
|
+
|
||||||
# Stolen from Linux build system
|
# Stolen from Linux build system
|
||||||
comma = ,
|
comma = ,
|
||||||
try-run = $(shell set -e; ($(1)) >/dev/null 2>&1 && echo "$(2)" || echo "$(3)")
|
try-run = $(shell set -e; ($(1)) >/dev/null 2>&1 && echo "$(2)" || echo "$(3)")
|
||||||
@@ -68,7 +73,7 @@ endef
|
--- a/Makefile
|
||||||
|
+++ b/Makefile
|
||||||
|
@@ -89,10 +89,10 @@ obj-mkfs.jffs2 = compr_rtime.o compr_zli
|
||||||
|
compr_lzma.o lzma/LzFind.o lzma/LzmaEnc.o lzma/LzmaDec.o \
|
||||||
|
compr.o rbtree.o
|
||||||
|
LDFLAGS_mkfs.jffs2 = $(ZLIBLDFLAGS) $(LZOLDFLAGS)
|
||||||
|
-LDLIBS_mkfs.jffs2 = -lz $(LZOLDLIBS)
|
||||||
|
+LDLIBS_mkfs.jffs2 = $(call static_link,-lz $(LZOLDLIBS))
|
||||||
|
|
||||||
%: %.o $(LDDEPS)
|
LDFLAGS_jffs2reader = $(ZLIBLDFLAGS) $(LZOLDFLAGS)
|
||||||
$(call BECHO,LD)
|
-LDLIBS_jffs2reader = -lz $(LZOLDLIBS)
|
||||||
- $(Q)$(CC) $(CFLAGS) $(LDFLAGS) $(LDFLAGS_$(notdir $@)) -g -o $@ $^ $(LDLIBS) $(LDLIBS_$(notdir $@))
|
+LDLIBS_jffs2reader = $(call static_link,-lz $(LZOLDLIBS))
|
||||||
+ $(Q)$(CC) $(CFLAGS) $(LDFLAGS) $(LDFLAGS_$(notdir $@)) -g -o $@ $(LD_STATIC_ON) $^ $(LDLIBS) $(LDLIBS_$(notdir $@)) $(LD_STATIC_OFF)
|
|
||||||
|
|
||||||
$(BUILDDIR)/%.a:
|
$(foreach v,$(MTD_BINS),$(eval $(call mkdep,,$(v))))
|
||||||
$(call BECHO,AR)
|
|
||||||
|
@@ -119,7 +119,7 @@ else
|
||||||
|
XZLDLIBS = -llzma
|
||||||
|
endif
|
||||||
|
|
||||||
|
-LDLIBS_mkfs.ubifs = -lz $(LZOLDLIBS) $(XZLDLIBS) -lm -luuid
|
||||||
|
+LDLIBS_mkfs.ubifs = $(call static_link,-lz $(LZOLDLIBS) $(XZLDLIBS)) -lm $(call static_link,-luuid)
|
||||||
|
$(call mkdep,mkfs.ubifs/,mkfs.ubifs,,ubi-utils/libubi.a)
|
||||||
|
|
||||||
|
#
|
||||||
|
Loading…
Reference in New Issue
Block a user