aboutsummaryrefslogtreecommitdiff
path: root/post
diff options
context:
space:
mode:
authorSebastien Carlier2010-11-05 15:48:07 +0100
committerWolfgang Denk2010-11-17 21:02:18 +0100
commit6d8962e814c15807dd6ac5757904be2a02d187b8 (patch)
treeb899a91461cdc9b35a424cb45a28864da7889137 /post
parentd7b1970015e62d37b26bb6b94b64ae36728c63cc (diff)
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 <sebastien.carlier@gmail.com>
Diffstat (limited to 'post')
-rw-r--r--post/Makefile20
-rw-r--r--post/board/lwmon/Makefile2
-rw-r--r--post/board/lwmon5/Makefile2
-rw-r--r--post/board/netta/Makefile2
-rw-r--r--post/board/pdm360ng/Makefile2
-rw-r--r--post/cpu/mpc83xx/Makefile2
-rw-r--r--post/cpu/mpc8xx/Makefile2
-rw-r--r--post/cpu/ppc4xx/Makefile2
-rw-r--r--post/drivers/Makefile2
-rw-r--r--post/lib_powerpc/Makefile2
-rw-r--r--post/lib_powerpc/fpu/Makefile2
-rw-r--r--post/rules.mk2
12 files changed, 20 insertions, 22 deletions
diff --git a/post/Makefile b/post/Makefile
index 169d1263243..200e2f1b9ad 100644
--- a/post/Makefile
+++ b/post/Makefile
@@ -24,20 +24,20 @@
include $(TOPDIR)/config.mk
include $(OBJTREE)/include/autoconf.mk
-LIB = libpost.a
-GPLIB-$(CONFIG_HAS_POST) += libgenpost.a
+LIB = libpost.o
+GPLIB-$(CONFIG_HAS_POST) += libgenpost.o
COBJS-$(CONFIG_HAS_POST) += post.o
COBJS-$(CONFIG_POST_STD_LIST) += tests.o
-SPLIB-$(CONFIG_HAS_POST) = drivers/libpostdrivers.a
+SPLIB-$(CONFIG_HAS_POST) = drivers/libpostdrivers.o
SPLIB-$(CONFIG_HAS_POST) += $(shell if [ -d lib_$(ARCH) ]; then echo \
- "lib_$(ARCH)/libpost$(ARCH).a"; fi)
+ "lib_$(ARCH)/libpost$(ARCH).o"; fi)
SPLIB-$(CONFIG_HAS_POST) += $(shell if [ -d lib_$(ARCH)/fpu ]; then echo \
- "lib_$(ARCH)/fpu/libpost$(ARCH)fpu.a"; fi)
+ "lib_$(ARCH)/fpu/libpost$(ARCH)fpu.o"; fi)
SPLIB-$(CONFIG_HAS_POST) += $(shell if [ -d cpu/$(CPU) ]; then echo \
- "cpu/$(CPU)/libpost$(CPU).a"; fi)
+ "cpu/$(CPU)/libpost$(CPU).o"; fi)
SPLIB-$(CONFIG_HAS_POST) += $(shell if [ -d board/$(BOARD) ]; then echo \
- "board/$(BOARD)/libpost$(BOARD).a"; fi)
+ "board/$(BOARD)/libpost$(BOARD).o"; fi)
GPLIB := $(addprefix $(obj),$(GPLIB-y))
SPLIB := $(addprefix $(obj),$(SPLIB-y))
@@ -55,7 +55,7 @@ postdeps:
# generic POST library
$(GPLIB): $(obj).depend $(OBJS)
- $(AR) $(ARFLAGS) $@ $(OBJS)
+ $(call cmd_link_o_target, $(OBJS))
# specific POST libraries
$(SPLIB): $(obj).depend postdeps
@@ -63,9 +63,7 @@ $(SPLIB): $(obj).depend postdeps
# the POST lib archive
$(LIB): $(GPLIB) $(SPLIB)
- (echo create $(LIB); for lib in $(GPLIB) $(SPLIB) ; \
- do echo addlib $$lib; done; echo save) \
- | $(AR) -M
+ $(call cmd_link_o_target, $^)
#########################################################################
diff --git a/post/board/lwmon/Makefile b/post/board/lwmon/Makefile
index d2932bed133..83026c07137 100644
--- a/post/board/lwmon/Makefile
+++ b/post/board/lwmon/Makefile
@@ -22,7 +22,7 @@
#
include $(OBJTREE)/include/autoconf.mk
-LIB = libpostlwmon.a
+LIB = libpostlwmon.o
COBJS-$(CONFIG_HAS_POST) += sysmon.o
diff --git a/post/board/lwmon5/Makefile b/post/board/lwmon5/Makefile
index 4e95515ef1f..b1996887cd2 100644
--- a/post/board/lwmon5/Makefile
+++ b/post/board/lwmon5/Makefile
@@ -22,7 +22,7 @@
# MA 02111-1307 USA
include $(OBJTREE)/include/autoconf.mk
-LIB = libpostlwmon5.a
+LIB = libpostlwmon5.o
COBJS-$(CONFIG_HAS_POST) += sysmon.o watchdog.o dspic.o fpga.o dsp.o gdc.o
diff --git a/post/board/netta/Makefile b/post/board/netta/Makefile
index 8a8578f4394..2d34dd8d03d 100644
--- a/post/board/netta/Makefile
+++ b/post/board/netta/Makefile
@@ -22,7 +22,7 @@
#
include $(OBJTREE)/include/autoconf.mk
-LIB = libpostnetta.a
+LIB = libpostnetta.o
COBJS-$(CONFIG_HAS_POST) += codec.o dsp.o
diff --git a/post/board/pdm360ng/Makefile b/post/board/pdm360ng/Makefile
index d1538f67272..d25b0d151a5 100644
--- a/post/board/pdm360ng/Makefile
+++ b/post/board/pdm360ng/Makefile
@@ -22,7 +22,7 @@
#
include $(OBJTREE)/include/autoconf.mk
-LIB = libpostpdm360ng.a
+LIB = libpostpdm360ng.o
COBJS-$(CONFIG_HAS_POST) += coproc_com.o
diff --git a/post/cpu/mpc83xx/Makefile b/post/cpu/mpc83xx/Makefile
index 86d8784ca5c..a8b70059ff1 100644
--- a/post/cpu/mpc83xx/Makefile
+++ b/post/cpu/mpc83xx/Makefile
@@ -22,7 +22,7 @@
#
include $(OBJTREE)/include/autoconf.mk
-LIB = libpostmpc83xx.a
+LIB = libpostmpc83xx.o
AOBJS-$(CONFIG_HAS_POST) +=
COBJS-$(CONFIG_HAS_POST) += ecc.o
diff --git a/post/cpu/mpc8xx/Makefile b/post/cpu/mpc8xx/Makefile
index 162924f6b2f..3e1792f8926 100644
--- a/post/cpu/mpc8xx/Makefile
+++ b/post/cpu/mpc8xx/Makefile
@@ -22,7 +22,7 @@
#
include $(OBJTREE)/include/autoconf.mk
-LIB = libpostmpc8xx.a
+LIB = libpostmpc8xx.o
AOBJS-$(CONFIG_HAS_POST) += cache_8xx.o
COBJS-$(CONFIG_HAS_POST) += cache.o ether.o spr.o uart.o usb.o watchdog.o
diff --git a/post/cpu/ppc4xx/Makefile b/post/cpu/ppc4xx/Makefile
index 1cfd3bb59c3..922013131f2 100644
--- a/post/cpu/ppc4xx/Makefile
+++ b/post/cpu/ppc4xx/Makefile
@@ -22,7 +22,7 @@
#
include $(OBJTREE)/include/autoconf.mk
-LIB = libpostppc4xx.a
+LIB = libpostppc4xx.o
AOBJS-$(CONFIG_HAS_POST) += cache_4xx.o
COBJS-$(CONFIG_HAS_POST) += cache.o
diff --git a/post/drivers/Makefile b/post/drivers/Makefile
index 0b6cdf58c9b..0d87ae0f9d6 100644
--- a/post/drivers/Makefile
+++ b/post/drivers/Makefile
@@ -22,7 +22,7 @@
#
include $(TOPDIR)/config.mk
-LIB = libpostdrivers.a
+LIB = libpostdrivers.o
COBJS-$(CONFIG_HAS_POST) += i2c.o memory.o rtc.o
diff --git a/post/lib_powerpc/Makefile b/post/lib_powerpc/Makefile
index 0cd15cfa137..bc9b82ef248 100644
--- a/post/lib_powerpc/Makefile
+++ b/post/lib_powerpc/Makefile
@@ -22,7 +22,7 @@
#
include $(TOPDIR)/config.mk
-LIB = libpost$(ARCH).a
+LIB = libpost$(ARCH).o
AOBJS-$(CONFIG_HAS_POST) += asm.o
COBJS-$(CONFIG_HAS_POST) += cpu.o cmp.o cmpi.o two.o twox.o three.o threex.o
diff --git a/post/lib_powerpc/fpu/Makefile b/post/lib_powerpc/fpu/Makefile
index 25726db73db..b97ad6fbc8b 100644
--- a/post/lib_powerpc/fpu/Makefile
+++ b/post/lib_powerpc/fpu/Makefile
@@ -22,7 +22,7 @@
#
include $(TOPDIR)/config.mk
-LIB = libpost$(ARCH)fpu.a
+LIB = libpost$(ARCH)fpu.o
COBJS-$(CONFIG_HAS_POST) += fpu.o 20001122-1.o 20010114-2.o 20010226-1.o 980619-1.o
COBJS-$(CONFIG_HAS_POST) += acc1.o compare-fp-1.o mul-subnormal-single-1.o
diff --git a/post/rules.mk b/post/rules.mk
index 1efc9c7d97d..17f8ef76234 100644
--- a/post/rules.mk
+++ b/post/rules.mk
@@ -34,7 +34,7 @@ CPPFLAGS += -I$(TOPDIR)
all: $(LIB)
$(LIB): $(obj).depend $(OBJS)
- $(AR) $(ARFLAGS) $@ $(OBJS)
+ $(call cmd_link_o_target, $(OBJS))
#########################################################################