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 --- arch/powerpc/cpu/74xx_7xx/Makefile | 4 ++-- arch/powerpc/cpu/mpc512x/Makefile | 4 ++-- arch/powerpc/cpu/mpc5xx/Makefile | 4 ++-- arch/powerpc/cpu/mpc5xxx/Makefile | 4 ++-- arch/powerpc/cpu/mpc8220/Makefile | 4 ++-- arch/powerpc/cpu/mpc824x/Makefile | 4 ++-- arch/powerpc/cpu/mpc8260/Makefile | 4 ++-- arch/powerpc/cpu/mpc83xx/Makefile | 4 ++-- arch/powerpc/cpu/mpc85xx/Makefile | 4 ++-- arch/powerpc/cpu/mpc86xx/Makefile | 4 ++-- arch/powerpc/cpu/mpc8xx/Makefile | 4 ++-- arch/powerpc/cpu/mpc8xxx/Makefile | 4 ++-- arch/powerpc/cpu/mpc8xxx/ddr/Makefile | 4 ++-- arch/powerpc/cpu/ppc4xx/Makefile | 4 ++-- 14 files changed, 28 insertions(+), 28 deletions(-) (limited to 'arch/powerpc/cpu') diff --git a/arch/powerpc/cpu/74xx_7xx/Makefile b/arch/powerpc/cpu/74xx_7xx/Makefile index fe905f31fe..8c2800b26b 100644 --- a/arch/powerpc/cpu/74xx_7xx/Makefile +++ b/arch/powerpc/cpu/74xx_7xx/Makefile @@ -26,7 +26,7 @@ include $(TOPDIR)/config.mk -LIB = $(obj)lib$(CPU).a +LIB = $(obj)lib$(CPU).o START = start.o SOBJS = cache.o kgdb.o io.o @@ -39,7 +39,7 @@ START := $(addprefix $(obj),$(START)) all: $(obj).depend $(START) $(LIB) $(LIB): $(OBJS) - $(AR) $(ARFLAGS) $@ $(OBJS) + $(call cmd_link_o_target, $(OBJS)) ######################################################################### diff --git a/arch/powerpc/cpu/mpc512x/Makefile b/arch/powerpc/cpu/mpc512x/Makefile index 37b06f346e..cb1263ab7c 100644 --- a/arch/powerpc/cpu/mpc512x/Makefile +++ b/arch/powerpc/cpu/mpc512x/Makefile @@ -24,7 +24,7 @@ include $(TOPDIR)/config.mk $(shell mkdir -p $(OBJTREE)/board/freescale/common) -LIB = $(obj)lib$(CPU).a +LIB = $(obj)lib$(CPU).o START = start.o COBJS-y := cpu.o @@ -50,7 +50,7 @@ START := $(addprefix $(obj),$(START)) all: $(obj).depend $(START) $(LIB) $(LIB): $(OBJS) - $(AR) $(ARFLAGS) $@ $(OBJS) + $(call cmd_link_o_target, $(OBJS)) ######################################################################### diff --git a/arch/powerpc/cpu/mpc5xx/Makefile b/arch/powerpc/cpu/mpc5xx/Makefile index 80c53203e9..078b52477a 100644 --- a/arch/powerpc/cpu/mpc5xx/Makefile +++ b/arch/powerpc/cpu/mpc5xx/Makefile @@ -35,7 +35,7 @@ include $(TOPDIR)/config.mk -LIB = $(obj)lib$(CPU).a +LIB = $(obj)lib$(CPU).o START = start.o COBJS = serial.o cpu.o cpu_init.o interrupts.o traps.o speed.o spi.o @@ -47,7 +47,7 @@ START := $(addprefix $(obj),$(START)) all: $(obj).depend $(START) $(LIB) $(LIB): $(OBJS) - $(AR) $(ARFLAGS) $@ $(OBJS) + $(call cmd_link_o_target, $(OBJS)) ######################################################################### diff --git a/arch/powerpc/cpu/mpc5xxx/Makefile b/arch/powerpc/cpu/mpc5xxx/Makefile index 0ee0611550..ecaeb22a64 100644 --- a/arch/powerpc/cpu/mpc5xxx/Makefile +++ b/arch/powerpc/cpu/mpc5xxx/Makefile @@ -23,7 +23,7 @@ include $(TOPDIR)/config.mk -LIB = $(obj)lib$(CPU).a +LIB = $(obj)lib$(CPU).o START = start.o SOBJS = io.o firmware_sc_task_bestcomm.impl.o @@ -37,7 +37,7 @@ START := $(addprefix $(obj),$(START)) all: $(obj).depend $(START) $(LIB) $(LIB): $(OBJS) - $(AR) $(ARFLAGS) $@ $(OBJS) + $(call cmd_link_o_target, $(OBJS)) ######################################################################### diff --git a/arch/powerpc/cpu/mpc8220/Makefile b/arch/powerpc/cpu/mpc8220/Makefile index b4fad286dc..b8529efe91 100644 --- a/arch/powerpc/cpu/mpc8220/Makefile +++ b/arch/powerpc/cpu/mpc8220/Makefile @@ -23,7 +23,7 @@ include $(TOPDIR)/config.mk -LIB = $(obj)lib$(CPU).a +LIB = $(obj)lib$(CPU).o START = start.o SOBJS = io.o fec_dma_tasks.o @@ -38,7 +38,7 @@ START := $(addprefix $(obj),$(START)) all: $(obj).depend $(START) $(LIB) $(LIB): $(OBJS) - $(AR) $(ARFLAGS) $@ $(OBJS) + $(call cmd_link_o_target, $(OBJS)) ######################################################################### diff --git a/arch/powerpc/cpu/mpc824x/Makefile b/arch/powerpc/cpu/mpc824x/Makefile index a57ad12c41..2bfcd8548c 100644 --- a/arch/powerpc/cpu/mpc824x/Makefile +++ b/arch/powerpc/cpu/mpc824x/Makefile @@ -27,7 +27,7 @@ $(shell mkdir -p $(obj)drivers/epic) $(shell mkdir -p $(obj)drivers/i2c) endif -LIB = $(obj)lib$(CPU).a +LIB = $(obj)lib$(CPU).o START = start.o COBJS = traps.o cpu.o cpu_init.o interrupts.o speed.o \ @@ -41,7 +41,7 @@ START := $(addprefix $(obj),$(START)) all: $(obj).depend $(START) $(LIB) $(LIB): $(OBJS) - $(AR) $(ARFLAGS) $@ $(OBJS) + $(call cmd_link_o_target, $(OBJS)) $(obj)bedbug_603e.c: ln -sf $(src)../mpc8260/bedbug_603e.c $(obj)bedbug_603e.c diff --git a/arch/powerpc/cpu/mpc8260/Makefile b/arch/powerpc/cpu/mpc8260/Makefile index 9f0c2dd50c..aa8b88105a 100644 --- a/arch/powerpc/cpu/mpc8260/Makefile +++ b/arch/powerpc/cpu/mpc8260/Makefile @@ -23,7 +23,7 @@ include $(TOPDIR)/config.mk -LIB = $(obj)lib$(CPU).a +LIB = $(obj)lib$(CPU).o START = start.o kgdb.o COBJS = traps.o serial_smc.o serial_scc.o cpu.o cpu_init.o speed.o \ @@ -41,7 +41,7 @@ START := $(addprefix $(obj),$(START)) all: $(obj).depend $(START) $(LIB) $(LIB): $(OBJS) - $(AR) $(ARFLAGS) $@ $(OBJS) $(obj)kgdb.o + $(call cmd_link_o_target, $(OBJS) $(obj)kgdb.o) ######################################################################### diff --git a/arch/powerpc/cpu/mpc83xx/Makefile b/arch/powerpc/cpu/mpc83xx/Makefile index 15e2c18b13..3979b6fbab 100644 --- a/arch/powerpc/cpu/mpc83xx/Makefile +++ b/arch/powerpc/cpu/mpc83xx/Makefile @@ -25,7 +25,7 @@ include $(TOPDIR)/config.mk -LIB = $(obj)lib$(CPU).a +LIB = $(obj)lib$(CPU).o START = start.o @@ -50,7 +50,7 @@ START := $(addprefix $(obj),$(START)) all: $(obj).depend $(START) $(LIB) $(LIB): $(OBJS) - $(AR) $(ARFLAGS) $@ $(OBJS) + $(call cmd_link_o_target, $(OBJS)) ######################################################################### diff --git a/arch/powerpc/cpu/mpc85xx/Makefile b/arch/powerpc/cpu/mpc85xx/Makefile index b7c0272105..63d79233d5 100644 --- a/arch/powerpc/cpu/mpc85xx/Makefile +++ b/arch/powerpc/cpu/mpc85xx/Makefile @@ -26,7 +26,7 @@ include $(TOPDIR)/config.mk -LIB = $(obj)lib$(CPU).a +LIB = $(obj)lib$(CPU).o START = start.o resetvec.o SOBJS-$(CONFIG_MP) += release.o @@ -95,7 +95,7 @@ START := $(addprefix $(obj),$(START)) all: $(obj).depend $(START) $(LIB) $(LIB): $(OBJS) - $(AR) $(ARFLAGS) $@ $(OBJS) + $(call cmd_link_o_target, $(OBJS)) ######################################################################### diff --git a/arch/powerpc/cpu/mpc86xx/Makefile b/arch/powerpc/cpu/mpc86xx/Makefile index daca79ad4f..9b2db1bccb 100644 --- a/arch/powerpc/cpu/mpc86xx/Makefile +++ b/arch/powerpc/cpu/mpc86xx/Makefile @@ -26,7 +26,7 @@ include $(TOPDIR)/config.mk -LIB = $(obj)lib$(CPU).a +LIB = $(obj)lib$(CPU).o START = start.o @@ -51,7 +51,7 @@ START := $(addprefix $(obj),$(START)) all: $(obj).depend $(START) $(LIB) $(LIB): $(OBJS) - $(AR) $(ARFLAGS) $@ $(ASOBJS) $(OBJS) + $(call cmd_link_o_target, $(OBJS)) ######################################################################### diff --git a/arch/powerpc/cpu/mpc8xx/Makefile b/arch/powerpc/cpu/mpc8xx/Makefile index 5f70459690..527771edaa 100644 --- a/arch/powerpc/cpu/mpc8xx/Makefile +++ b/arch/powerpc/cpu/mpc8xx/Makefile @@ -25,7 +25,7 @@ include $(TOPDIR)/config.mk # CFLAGS += -DET_DEBUG -LIB = $(obj)lib$(CPU).a +LIB = $(obj)lib$(CPU).o START-y += start.o START-y += kgdb.o @@ -54,7 +54,7 @@ START := $(addprefix $(obj),$(START-y)) all: $(obj).depend $(START) $(LIB) $(LIB): $(OBJS) - $(AR) $(ARFLAGS) $@ $(OBJS) $(obj)kgdb.o + $(call cmd_link_o_target, $(OBJS) $(obj)kgdb.o) ######################################################################### diff --git a/arch/powerpc/cpu/mpc8xxx/Makefile b/arch/powerpc/cpu/mpc8xxx/Makefile index ea5122289e..ab80dd7723 100644 --- a/arch/powerpc/cpu/mpc8xxx/Makefile +++ b/arch/powerpc/cpu/mpc8xxx/Makefile @@ -8,7 +8,7 @@ include $(TOPDIR)/config.mk -LIB = $(obj)lib8xxx.a +LIB = $(obj)lib8xxx.o ifneq ($(CPU),mpc83xx) COBJS-y += cpu.o @@ -24,7 +24,7 @@ OBJS := $(addprefix $(obj),$(SOBJS-y) $(COBJS-y)) all: $(obj).depend $(LIB) $(LIB): $(OBJS) - $(AR) $(ARFLAGS) $@ $(OBJS) + $(call cmd_link_o_target, $(OBJS)) include $(SRCTREE)/rules.mk diff --git a/arch/powerpc/cpu/mpc8xxx/ddr/Makefile b/arch/powerpc/cpu/mpc8xxx/ddr/Makefile index cb7f856554..4a5a78558b 100644 --- a/arch/powerpc/cpu/mpc8xxx/ddr/Makefile +++ b/arch/powerpc/cpu/mpc8xxx/ddr/Makefile @@ -8,7 +8,7 @@ include $(TOPDIR)/config.mk -LIB = $(obj)libddr.a +LIB = $(obj)libddr.o COBJS-$(CONFIG_FSL_DDR1) += main.o util.o ctrl_regs.o options.o \ lc_common_dimm_params.o @@ -28,7 +28,7 @@ OBJS := $(addprefix $(obj),$(SOBJS-y) $(COBJS-y)) all: $(obj).depend $(LIB) $(LIB): $(OBJS) - $(AR) $(ARFLAGS) $@ $(OBJS) + $(call cmd_link_o_target, $(OBJS)) include $(SRCTREE)/rules.mk diff --git a/arch/powerpc/cpu/ppc4xx/Makefile b/arch/powerpc/cpu/ppc4xx/Makefile index fa8d10c627..129a61e939 100644 --- a/arch/powerpc/cpu/ppc4xx/Makefile +++ b/arch/powerpc/cpu/ppc4xx/Makefile @@ -23,7 +23,7 @@ include $(TOPDIR)/config.mk -LIB = $(obj)lib$(CPU).a +LIB = $(obj)lib$(CPU).o START := resetvec.o START += start.o @@ -82,7 +82,7 @@ START := $(addprefix $(obj),$(START)) all: $(obj).depend $(START) $(LIB) $(LIB): $(OBJS) - $(AR) $(ARFLAGS) $@ $(OBJS) + $(call cmd_link_o_target, $(OBJS)) ######################################################################### -- cgit v1.2.3