Skip to contentSkip to conversation

Remove libraries when updating autoconf.mk

PATCH New Grant Likely 2 participants 2 messages Nov 21, 2007 – Nov 22, 2007 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Remove libraries when updating autoconf.mk

From: Grant Likely <[email protected]>

Fix library problems caused by conditional compilation. Using autoconf.mk to decide which files to compile has caused a problem when changing configuration from one board to another without clearing out the library (*.a) files.

It used to be that the linker was always passed the same list of .o files when building the .a files. However, that is not longer true with conditional compilation. Now, a different board config will have a different file list passed to the linker. The problem occurs when a library has already been built and the board config is changed.

Since the linker will update instead of replace a preexisting library, then if the file list changes to remove some object files the old objects will still exist in the library.

The solution is to remove all old library files when autoconf.mk is made.

---

 Makefile |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
Makefile +2 -0
index 407b938..d94d158 100644
@@ -354,6 +354,8 @@ $(OBJTREE)/include/autoconf.mk: $(obj)include/config.h
 	@$(CC) -M $(HOST_CFLAGS) $(CPPFLAGS) -MQ $@ include/common.h > [email protected]
 	@# Extract the config macros
 	@$(CPP) $(CFLAGS) -dM include/common.h | sed -n -f tools/scripts/define2mk.sed >> $@
+	@# Remove the old libraries because the file list may have changed
+	@find $(OBJTREE) -type f -name '*.a' -print | xargs rm
 
 sinclude $(OBJTREE)/include/autoconf.mk.dep
 
#1 lore raw

PATCH 1/1 Remove libraries when updating autoconf.mk

Quoted 13 lines · In message <[email protected]> you…

From: Grant Likely <[email protected]>

Fix library problems caused by conditional compilation. Using autoconf.mk to decide which files to compile has caused a problem when changing configuration from one board to another without clearing out the library (*.a) files.

It used to be that the linker was always passed the same list of .o files when building the .a files. However, that is not longer true with conditional compilation. Now, a different board config will have a different file list passed to the linker. The problem occurs when a library has already been built and the board config is changed.

Quoted 8 lines

Since the linker will update instead of replace a preexisting library, then if the file list changes to remove some object files the old objects will still exist in the library.

The solution is to remove all old library files when autoconf.mk is made.

Merged into u-boot-testing repo. Thanks.

Best regards,

Wolfgang Denk

Signature · 7 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
There is an old custom among my people. When a woman  saves  a  man's
life, he is grateful.
	-- Nona, the Kanuto which woman, "A Private Little War",
	   stardate 4211.8.