From 6d8962e814c15807dd6ac5757904be2a02d187b8 Mon Sep 17 00:00:00 2001 From: Sebastien Carlier Date: Fri, 5 Nov 2010 15:48:07 +0100 Subject: Switch from archive libraries to partial linking Before this commit, weak symbols were not overridden by non-weak symbols found in archive libraries when linking with recent versions of binutils. As stated in the System V ABI, "the link editor does not extract archive members to resolve undefined weak symbols". This commit changes all Makefiles to use partial linking (ld -r) instead of creating library archives, which forces all symbols to participate in linking, allowing non-weak symbols to override weak symbols as intended. This approach is also used by Linux, from which the gmake function cmd_link_o_target (defined in config.mk and used in all Makefiles) is inspired. The name of each former library archive is preserved except for extensions which change from ".a" to ".o". This commit updates references accordingly where needed, in particular in some linker scripts. This commit reveals board configurations that exclude some features but include source files that depend these disabled features in the build, resulting in undefined symbols. Known such cases include: - disabling CMD_NET but not CMD_NFS; - enabling CONFIG_OF_LIBFDT but not CONFIG_QE. Signed-off-by: Sebastien Carlier --- fs/cramfs/Makefile | 4 ++-- fs/ext2/Makefile | 4 ++-- fs/fat/Makefile | 4 ++-- fs/fdos/Makefile | 4 ++-- fs/jffs2/Makefile | 4 ++-- fs/reiserfs/Makefile | 4 ++-- fs/ubifs/Makefile | 4 ++-- fs/yaffs2/Makefile | 4 ++-- 8 files changed, 16 insertions(+), 16 deletions(-) (limited to 'fs') diff --git a/fs/cramfs/Makefile b/fs/cramfs/Makefile index 7b6cc0ad3e..5f419329a5 100644 --- a/fs/cramfs/Makefile +++ b/fs/cramfs/Makefile @@ -23,7 +23,7 @@ include $(TOPDIR)/config.mk -LIB = $(obj)libcramfs.a +LIB = $(obj)libcramfs.o AOBJS = COBJS-$(CONFIG_CMD_CRAMFS) := cramfs.o @@ -37,7 +37,7 @@ OBJS := $(addprefix $(obj),$(AOBJS) $(COBJS-y)) all: $(LIB) $(AOBJS) $(LIB): $(obj).depend $(OBJS) - $(AR) $(ARFLAGS) $@ $(OBJS) + $(call cmd_link_o_target, $(OBJS)) ######################################################################### diff --git a/fs/ext2/Makefile b/fs/ext2/Makefile index 712e348395..3c65d252f5 100644 --- a/fs/ext2/Makefile +++ b/fs/ext2/Makefile @@ -27,7 +27,7 @@ include $(TOPDIR)/config.mk -LIB = $(obj)libext2fs.a +LIB = $(obj)libext2fs.o AOBJS = COBJS-$(CONFIG_CMD_EXT2) := ext2fs.o dev.o @@ -40,7 +40,7 @@ OBJS := $(addprefix $(obj),$(AOBJS) $(COBJS-y)) all: $(LIB) $(AOBJS) $(LIB): $(obj).depend $(OBJS) - $(AR) $(ARFLAGS) $@ $(OBJS) + $(call cmd_link_o_target, $(OBJS)) ######################################################################### diff --git a/fs/fat/Makefile b/fs/fat/Makefile index b711460f3a..bc459662ea 100644 --- a/fs/fat/Makefile +++ b/fs/fat/Makefile @@ -21,7 +21,7 @@ include $(TOPDIR)/config.mk -LIB = $(obj)libfat.a +LIB = $(obj)libfat.o AOBJS = COBJS-$(CONFIG_CMD_FAT) := fat.o file.o @@ -32,7 +32,7 @@ OBJS := $(addprefix $(obj),$(AOBJS) $(COBJS-y)) all: $(LIB) $(AOBJS) $(LIB): $(obj).depend $(OBJS) - $(AR) $(ARFLAGS) $@ $(OBJS) + $(call cmd_link_o_target, $(OBJS)) ######################################################################### diff --git a/fs/fdos/Makefile b/fs/fdos/Makefile index fce2032bdd..9cd4d91742 100644 --- a/fs/fdos/Makefile +++ b/fs/fdos/Makefile @@ -28,7 +28,7 @@ include $(TOPDIR)/config.mk -LIB = $(obj)libfdos.a +LIB = $(obj)libfdos.o AOBJS = COBJS-$(CONFIG_CMD_FDOS) := fat.o vfat.o dev.o fdos.o fs.o subdir.o @@ -41,7 +41,7 @@ OBJS := $(addprefix $(obj),$(AOBJS) $(COBJS-y)) all: $(LIB) $(AOBJS) $(LIB): $(obj).depend $(OBJS) - $(AR) $(ARFLAGS) $@ $(OBJS) + $(call cmd_link_o_target, $(OBJS)) ######################################################################### diff --git a/fs/jffs2/Makefile b/fs/jffs2/Makefile index 7c9fb41b8d..6db6145d2d 100644 --- a/fs/jffs2/Makefile +++ b/fs/jffs2/Makefile @@ -23,7 +23,7 @@ include $(TOPDIR)/config.mk -LIB = $(obj)libjffs2.a +LIB = $(obj)libjffs2.o AOBJS = ifdef CONFIG_CMD_JFFS2 @@ -44,7 +44,7 @@ OBJS := $(addprefix $(obj),$(AOBJS) $(COBJS)) all: $(LIB) $(AOBJS) $(LIB): $(obj).depend $(OBJS) - $(AR) $(ARFLAGS) $@ $(OBJS) + $(call cmd_link_o_target, $(OBJS)) ######################################################################### diff --git a/fs/reiserfs/Makefile b/fs/reiserfs/Makefile index 9cef8ee910..495759c8ca 100644 --- a/fs/reiserfs/Makefile +++ b/fs/reiserfs/Makefile @@ -27,7 +27,7 @@ include $(TOPDIR)/config.mk -LIB = $(obj)libreiserfs.a +LIB = $(obj)libreiserfs.o AOBJS = COBJS-$(CONFIG_CMD_REISER) := reiserfs.o dev.o mode_string.o @@ -40,7 +40,7 @@ OBJS := $(addprefix $(obj),$(AOBJS) $(COBJS-y)) all: $(LIB) $(AOBJS) $(LIB): $(obj).depend $(OBJS) - $(AR) $(ARFLAGS) $@ $(OBJS) + $(call cmd_link_o_target, $(OBJS)) ######################################################################### diff --git a/fs/ubifs/Makefile b/fs/ubifs/Makefile index 8328843fe1..ccffe85ee1 100644 --- a/fs/ubifs/Makefile +++ b/fs/ubifs/Makefile @@ -27,7 +27,7 @@ include $(TOPDIR)/config.mk -LIB = $(obj)libubifs.a +LIB = $(obj)libubifs.o COBJS-$(CONFIG_CMD_UBIFS) := ubifs.o io.o super.o sb.o master.o lpt.o COBJS-$(CONFIG_CMD_UBIFS) += lpt_commit.o scan.o lprops.o @@ -40,7 +40,7 @@ OBJS := $(addprefix $(obj),$(AOBJS) $(COBJS-y)) all: $(LIB) $(AOBJS) $(LIB): $(obj).depend $(OBJS) - $(AR) $(ARFLAGS) $@ $(OBJS) + $(call cmd_link_o_target, $(OBJS)) ######################################################################### diff --git a/fs/yaffs2/Makefile b/fs/yaffs2/Makefile index a2ef5e22f6..7753cfcf37 100644 --- a/fs/yaffs2/Makefile +++ b/fs/yaffs2/Makefile @@ -19,7 +19,7 @@ #EXTRA_COMPILE_FLAGS = -DYAFFS_IGNORE_TAGS_ECC include $(TOPDIR)/config.mk -LIB = $(obj)libyaffs2.a +LIB = $(obj)libyaffs2.o COBJS-$(CONFIG_YAFFS2) := \ yaffscfg.o yaffs_ecc.o yaffsfs.o yaffs_guts.o yaffs_packedtags1.o \ @@ -36,7 +36,7 @@ CFLAGS += -DCONFIG_YAFFS_DIRECT -DCONFIG_YAFFS_SHORT_NAMES_IN_RAM -DCONFIG_YA all: $(LIB) $(LIB): $(obj).depend $(OBJS) - $(AR) $(ARFLAGS) $@ $(OBJS) + $(call cmd_link_o_target, $(OBJS)) .PHONY: clean distclean clean: -- cgit v1.2.1