diff options
author | Jo-Philipp Wich <jow@openwrt.org> | 2015-09-17 13:07:48 +0000 |
---|---|---|
committer | Jo-Philipp Wich <jow@openwrt.org> | 2015-09-17 13:07:48 +0000 |
commit | 34a9bcdcca51fbfd735062b88d5e69675128db9f (patch) | |
tree | 262fcab4bc252fd0c4c2bd8b9493468469b913c1 /tools/mtd-utils | |
parent | a1715e9e11471a3eca943ca17ffc0e893386c9e0 (diff) | |
download | master-187ad058-34a9bcdcca51fbfd735062b88d5e69675128db9f.tar.gz master-187ad058-34a9bcdcca51fbfd735062b88d5e69675128db9f.tar.bz2 master-187ad058-34a9bcdcca51fbfd735062b88d5e69675128db9f.zip |
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>
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@46989 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'tools/mtd-utils')
-rw-r--r-- | tools/mtd-utils/patches/310-add-static-linking-option.patch | 40 |
1 files changed, 30 insertions, 10 deletions
diff --git a/tools/mtd-utils/patches/310-add-static-linking-option.patch b/tools/mtd-utils/patches/310-add-static-linking-option.patch index 273aa85e14..810aea9a54 100644 --- a/tools/mtd-utils/patches/310-add-static-linking-option.patch +++ b/tools/mtd-utils/patches/310-add-static-linking-option.patch @@ -1,23 +1,43 @@ --- a/common.mk +++ b/common.mk -@@ -2,6 +2,11 @@ CC := $(CROSS)gcc +@@ -2,6 +2,16 @@ CC := $(CROSS)gcc AR := $(CROSS)ar RANLIB := $(CROSS)ranlib +ifeq ($(STATIC),1) -+ LD_STATIC_ON := -Wl,-Bstatic -+ LD_STATIC_OFF := -Wl,-Bdynamic ++ define static_link ++ -Wl,-Bstatic $(1) -Wl,-Bdynamic ++ endef ++else ++ define static_link ++ $(1) ++ endef +endif + # Stolen from Linux build system comma = , 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) - $(call BECHO,LD) -- $(Q)$(CC) $(CFLAGS) $(LDFLAGS) $(LDFLAGS_$(notdir $@)) -g -o $@ $^ $(LDLIBS) $(LDLIBS_$(notdir $@)) -+ $(Q)$(CC) $(CFLAGS) $(LDFLAGS) $(LDFLAGS_$(notdir $@)) -g -o $@ $(LD_STATIC_ON) $^ $(LDLIBS) $(LDLIBS_$(notdir $@)) $(LD_STATIC_OFF) + LDFLAGS_jffs2reader = $(ZLIBLDFLAGS) $(LZOLDFLAGS) +-LDLIBS_jffs2reader = -lz $(LZOLDLIBS) ++LDLIBS_jffs2reader = $(call static_link,-lz $(LZOLDLIBS)) - $(BUILDDIR)/%.a: - $(call BECHO,AR) + $(foreach v,$(MTD_BINS),$(eval $(call mkdep,,$(v)))) + +@@ -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) + + # |