makefiles: fixes for building build tools
PATCH v2 1/1 makefiles: fixes for building build tools
Currently, some of the tools instead set CC to be HOSTCC in order to re-use some pattern rules -- but this fails when the user overrides CC on the make command line. Also, the HOSTCFLAGS in tools/Makefile are currently not being used because config.mk overwrites them.
This patch adds static pattern rules for files that have been requested to be built with the native compiler using $(HOSTSRCS) and $(HOSTOBJS), and converts the tools to use them.
It restores easylogo to using the host compiler, which was broken by commit 38d299c2db81bd889c601b5dfc12c4e83ef83333 (if this was an intentional change, please let me know -- but it seems to be a build tool).
It restores -pedantic and the special flags for darwin and cygwin that were requested in tools/makefile (but keeps the flags added by config.mk) -- hopefully someone can test this on those platforms. It no longer conditionalizes -pedantic on not being darwin; it wasn't clear that that was intentional, and unless there's a real problem it's just inviting people to contribute non-pedantic patches to those files (I'm not a fan of -pedantic personally, but if it's on for one platform it should be on for all).
HOST_LDFLAGS is renamed HOSTLDFLAGS for consistency with the previous HOST_CFLAGS to HOSTCFLAGS rename. A new HOSTCFLAGS_NOPED is made available for those files which currently cannot be built with -pedantic, and replaces the old FIT_CFLAGS.
imls now uses the cross compiler properly, rather than by trying to reconstruct CC using the typoed $(CROSS_COMPILER).
envcrc.c is now dependency-processed unconditionally -- previously it would be built without being on (HOST)SRCS if CONFIG_ENV_IS_EMBEDDED was not selected.
---
since v1:
HOSTCFLAGS becomes HOSTCFLAGS_NOPED
PEDCFLAGS becomes HOSTCFLAGS
rebased to next branch
I added some missing HOSTLDFLAGS references, but I decided against doing HOSTCOMPILE/HOSTLINK because of the number of combinations -- compile, compile noped, link, and link noped (because we could be compiling at the same time), and questions about whether we'll necessarily want HOSTCFLAGS if we're purely linking, whether LDFLAGS are harmful if purely compiling (and thus we could get rid of HOSTLINK), etc.
Plus, we don't have anything analogous for the non-host case.
config.mk | 34 ++++++++++++- rules.mk | 13 ++++- tools/Makefile | 121 +++++++++++++--------------------------------- tools/easylogo/Makefile | 9 ++- tools/gdb/Makefile | 15 ++---- tools/imls/Makefile | 29 ++++------- 6 files changed, 98 insertions(+), 123 deletions(-)
config.mk +31 -3
@@ -46,13 +46,41 @@ PLATFORM_LDFLAGS = ######################################################################### +HOSTCFLAGS = -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer \ + $(HOSTCPPFLAGS) +HOSTSTRIP = strip + +# +# Mac OS X / Darwin's C preprocessor is Apple specific. It +# generates numerous errors and warnings. We want to bypass it +# and use GNU C's cpp. To do this we pass the -traditional-cpp +# option to the compiler. Note that the -traditional-cpp flag +# DOES NOT have the same semantics as GNU C's flag, all it does +# is invoke the GNU preprocessor in stock ANSI/ISO C fashion. +# +# Apple's linker is similar, thanks to the new 2 stage linking +# multiple symbol definitions are treated as errors, hence the +# -multiply_defined suppress option to turn off this error. +# + ifeq ($(HOSTOS),darwin) HOSTCC = cc +HOSTCFLAGS += -traditional-cpp +HOSTLDFLAGS += -multiply_defined suppress else HOSTCC = gcc endif -HOSTCFLAGS = -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer -HOSTSTRIP = strip + +ifeq ($(HOSTOS),cygwin) +HOSTCFLAGS += -ansi +endif + +# We build some files with extra pedantic flags to try to minimize things +# that won't build on some weird host compiler -- though there are lots of +# exceptions for files that aren't complaint. + +HOSTCFLAGS_NOPED = $(filter-out -pedantic,$(HOSTCFLAGS)) +HOSTCFLAGS += -pedantic ######################################################################### #
@@ -200,7 +228,7 @@ endif ######################################################################### -export HOSTCC HOSTCFLAGS CROSS_COMPILE \ +export HOSTCC HOSTCFLAGS HOSTLDFLAGS PEDCFLAGS HOSTSTRIP CROSS_COMPILE \ AS LD CC CPP AR NM STRIP OBJCOPY OBJDUMP MAKE export TEXT_BASE PLATFORM_CPPFLAGS PLATFORM_RELFLAGS CPPFLAGS CFLAGS AFLAGS
rules.mk +11 -2
@@ -25,11 +25,20 @@ _depend: $(obj).depend -$(obj).depend: $(src)Makefile $(TOPDIR)/config.mk $(SRCS) +$(obj).depend: $(src)Makefile $(TOPDIR)/config.mk $(SRCS) $(HOSTSRCS) @rm -f $@ @for f in $(SRCS); do \ g=`basename $$f | sed -e 's/\(.*\)\.\w/\1.o/'`; \ - $(CC) -M $(HOSTCFLAGS) $(CPPFLAGS) -MQ $(obj)$$g $$f >> $@ ; \ + $(CC) -M $(CPPFLAGS) -MQ $(obj)$$g $$f >> $@ ; \ done + @for f in $(HOSTSRCS); do \ + g=`basename $$f | sed -e 's/\(.*\)\.\w/\1.o/'`; \ + $(HOSTCC) -M $(HOSTCPPFLAGS) -MQ $(obj)$$g $$f >> $@ ; \ + done + +$(HOSTOBJS): $(obj)%.o: %.c + $(HOSTCC) $(HOSTCFLAGS) $(HOSTCFLAGS_$(@F)) $(HOSTCFLAGS_$(BCURDIR)) -o $@ $< -c +$(NOPEDOBJS): $(obj)%.o: %.c + $(HOSTCC) $(HOSTCFLAGS_NOPED) $(HOSTCFLAGS_$(@F)) $(HOSTCFLAGS_$(BCURDIR)) -o $@ $< -c #########################################################################
tools/Makefile +34 -87
196 lines not on this page · raw message
tools/easylogo/Makefile +6 -3
@@ -1,8 +1,11 @@ -CFLAGS += -Wall +include $(TOPDIR)/config.mk -all: easylogo +all: $(obj)easylogo + +$(obj)easylogo: $(SRCTREE)/tools/easylogo/easylogo.c + $(HOSTCC) $(HOSTCFLAGS_NOPED) $(HOSTLDFLAGS) -o $@ $^ clean: - rm -f easylogo *.o + rm -f $(obj)easylogo .PHONY: all clean
tools/gdb/Makefile +6 -9
@@ -30,17 +30,14 @@ BINS = gdbsend gdbcont COBJS = gdbsend.o gdbcont.o error.o remote.o serial.o -OBJS := $(addprefix $(obj),$(COBJS)) -SRCS := $(COBJS:.o=.c) +HOSTOBJS := $(addprefix $(obj),$(COBJS)) +HOSTSRCS := $(COBJS:.o=.c) BINS := $(addprefix $(obj),$(BINS)) # # Use native tools and options # -CPPFLAGS = -I$(BFD_ROOT_DIR)/include -CFLAGS = $(HOSTCFLAGS) -O $(CPPFLAGS) -CC = $(HOSTCC) -MAKEDEPEND = makedepend +HOSTCPPFLAGS = -I$(BFD_ROOT_DIR)/include HOSTOS := $(shell uname -s | sed -e 's/\([Cc][Yy][Gg][Ww][Ii][Nn]\).*/cygwin/')
@@ -54,13 +51,13 @@ else # ! CYGWIN all: $(obj).depend $(BINS) $(obj)gdbsend: $(obj)gdbsend.o $(obj)error.o $(obj)remote.o $(obj)serial.o - $(CC) $(CFLAGS) $(HOST_LDFLAGS) -o $@ $^ + $(HOSTCC) $(HOSTCFLAGS) $(HOSTLDFLAGS) -o $@ $^ $(obj)gdbcont: $(obj)gdbcont.o $(obj)error.o $(obj)remote.o $(obj)serial.o - $(CC) $(CFLAGS) $(HOST_LDFLAGS) -o $@ $^ + $(HOSTCC) $(HOSTCFLAGS) $(HOSTLDFLAGS) -o $@ $^ clean: - rm -f $(OBJS) + rm -f $(HOSTOBJS) distclean: clean rm -f $(BINS) $(obj)core $(obj)*.bak $(obj).depend
tools/imls/Makefile +10 -19
@@ -19,8 +19,6 @@ include $(TOPDIR)/config.mk -HOSTCFLAGS = -Wall -pedantic - # Generated executable files BIN_FILES-y += imls
@@ -48,50 +46,43 @@ BINS := $(addprefix $(obj),$(sort $(BIN_FILES-y))) LIBFDT_OBJS := $(addprefix $(obj),$(LIBFDT_OBJ_FILES-y)) # -# Use native tools and options +# Compile for a hosted environment on the target # Define __KERNEL_STRICT_NAMES to prevent typedef overlaps # -CPPFLAGS = -idirafter $(SRCTREE)/include \ +HOSTCPPFLAGS = -idirafter $(SRCTREE)/include \ -idirafter $(OBJTREE)/include2 \ -idirafter $(OBJTREE)/include \ -I $(SRCTREE)/libfdt \ -I $(SRCTREE)/tools \ -DUSE_HOSTCC -D__KERNEL_STRICT_NAMES -CFLAGS = $(HOSTCFLAGS) $(CPPFLAGS) -O - -# No -pedantic switch to avoid libfdt compilation warnings -FIT_CFLAGS = -Wall $(CPPFLAGS) -O - -CC = $(CROSS_COMPILER)gcc -STRIP = $(CROSS_COMPILER)strip ifeq ($(MTD_VERSION),old) -CPPFLAGS += -DMTD_OLD +HOSTCPPFLAGS += -DMTD_OLD endif all: $(BINS) $(obj)imls: $(obj)imls.o $(obj)crc32.o $(obj)image.o $(obj)md5.o \ $(obj)sha1.o $(LIBFDT_OBJS) - $(CC) $(CFLAGS) -o $@ $^ + $(CC) $(HOSTCFLAGS) $(HOSTLDFLAGS) -o $@ $^ $(STRIP) $@ # Some files complain if compiled with -pedantic, use FIT_CFLAGS $(obj)image.o: $(SRCTREE)/common/image.c - $(CC) -g $(FIT_CFLAGS) -c -o $@ $< + $(CC) -g $(HOSTCFLAGS_NOPED) -c -o $@ $< -$(obj)imls.o: imls.c - $(CC) -g $(FIT_CFLAGS) -c -o $@ $< +$(obj)imls.o: $(SRCTREE)/tools/imls/imls.c + $(CC) -g $(HOSTCFLAGS_NOPED) -c -o $@ $< # Some of the tool objects need to be accessed from outside the tools/imls directory $(obj)%.o: $(SRCTREE)/common/%.c - $(CC) -g $(FIT_CFLAGS) -c -o $@ $< + $(CC) -g $(HOSTCFLAGS_NOPED) -c -o $@ $< $(obj)%.o: $(SRCTREE)/lib_generic/%.c - $(CC) -g $(CFLAGS) -c -o $@ $< + $(CC) -g $(HOSTCFLAGS) -c -o $@ $< $(obj)%.o: $(SRCTREE)/libfdt/%.c - $(CC) -g $(FIT_CFLAGS) -c -o $@ $< + $(CC) -g $(HOSTCFLAGS_NOPED) -c -o $@ $< clean: rm -rf *.o imls
Signature · 1 line
1.6.4.4
PATCH v2 1/1 makefiles: fixes for building build tools
rules.mk
Quoted 9 lines · On Wednesday 04 November 2009 19:41:41 Scott Wood wrote:
rules.mk +3
-0+$(HOSTOBJS): $(obj)%.o: %.c + $(HOSTCC) $(HOSTCFLAGS) $(HOSTCFLAGS_$(@F)) $(HOSTCFLAGS_$(BCURDIR)) -o $@ $< -c +$(NOPEDOBJS): $(obj)%.o: %.c + $(HOSTCC) $(HOSTCFLAGS_NOPED) $(HOSTCFLAGS_$(@F)) $(HOSTCFLAGS_$(BCURDIR)) -o $@ $< -c
wouldnt these make more sense in config.mk with all the other patterns. and create a pattern target for creating host executables. you should be able to combine all the duplicated patterns in tools/Makefile once you do.
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20091113/a7804200/attachment.pgp
PATCH v2 1/1 makefiles: fixes for building build tools
Quoted 4 lines · Mike Frysinger
Quoted 3 lines · On Wednesday 04 November 2009 19:41:41 Scott Wood wrote:
rules.mk +0
-0
Quoted 8 lines
rules.mk
Quoted 6 lines
+$(HOSTOBJS): $(obj)%.o: %.c
rules.mk +2
-0+ $(HOSTCC) $(HOSTCFLAGS) $(HOSTCFLAGS_$(@F)) $(HOSTCFLAGS_$(BCURDIR)) -o $@ $< -c +$(NOPEDOBJS): $(obj)%.o: %.c + $(HOSTCC) $(HOSTCFLAGS_NOPED) $(HOSTCFLAGS_$(@F)) $(HOSTCFLAGS_$(BCURDIR)) -o $@ $< -cwouldnt these make more sense in config.mk with all the other patterns.
The static pattern rules won't work unless $(HOSTOBJS)/$(NOPEDOBJS) has been filled in by the makefile. config.mk is included too early for that.
A non-static pattern won't work unless we can distinguish between target, host-pedantic, and host-no-pedantic from the filename or path alone.
Plus, the name of the file is *rules*.mk. :-)
Quoted 1 line
and create a pattern target for creating host executables.
That would be nice to have, but is orthogonal to what this patch does. One thing at a time.
-Scott
PATCH v2 1/1 makefiles: fixes for building build tools
Quoted 14 lines · On Friday 13 November 2009 13:53:45 Scott Wood wrote:
Quoted 4 lines · Mike Frysinger
Quoted 3 lines · On Wednesday 04 November 2009 19:41:41 Scott Wood wrote:
rules.mk +0
-0Quoted 8 lines
rules.mk
Quoted 6 lines
+$(HOSTOBJS): $(obj)%.o: %.c
rules.mk +2
-1+ $(HOSTCC) $(HOSTCFLAGS) $(HOSTCFLAGS_$(@F)) $(HOSTCFLAGS_$(BCURDIR)) -o $@ $< -c +$(NOPEDOBJS): $(obj)%.o: %.c + $(HOSTCC) $(HOSTCFLAGS_NOPED) $(HOSTCFLAGS_$(@F)) $(HOSTCFLAGS_$(BCURDIR)) -o $@ $< -cwouldnt these make more sense in config.mk with all the other patterns.
Quoted 8 lines
The static pattern rules won't work unless $(HOSTOBJS)/$(NOPEDOBJS) has been filled in by the makefile. config.mk is included too early for that.
A non-static pattern won't work unless we can distinguish between target, host-pedantic, and host-no-pedantic from the filename or path
alone.Plus, the name of the file is *rules*.mk. :-)
yes, but so far, all the rules have been in config.mk. i'm ok with them all being in rules.mk ... they should just be together.
i guess a comment above them for now explaining why they arent in the same place as all other pattern rules would be nice ...
Quoted 4 lines
Quoted 1 line
and create a pattern target for creating host executables.
That would be nice to have, but is orthogonal to what this patch does. One thing at a time.
the point was to avoid duplicating everything again. declaring variables to contain the common steps would work as well ...
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20091113/5366857a/attachment.pgp
Wolfgang Denk
AppliedPATCH v2 1/1 makefiles: fixes for building build tools
In reply to Scott WoodDear Scott Wood,
Quoted 49 lines · In message <[email protected]> you wrote:
Currently, some of the tools instead set CC to be HOSTCC in order to re-use some pattern rules -- but this fails when the user overrides CC on the make command line. Also, the HOSTCFLAGS in
tools/Makefileare currently not being used because config.mk overwrites them.This patch adds static pattern rules for files that have been requested to be built with the native compiler using $(HOSTSRCS) and $(HOSTOBJS), and converts the tools to use them.
It restores easylogo to using the host compiler, which was broken by commit
38d299c2db81bd889c601b5dfc12c4e83ef83333(if this was an intentional change, please let me know -- but it seems to be a build tool).It restores -pedantic and the special flags for darwin and cygwin that were requested in
tools/makefile(but keeps the flags added by config.mk) -- hopefully someone can test this on those platforms. It no longer conditionalizes -pedantic on not being darwin; it wasn't clear that that was intentional, and unless there's a real problem it's just inviting people to contribute non-pedantic patches to those files (I'm not a fan of -pedantic personally, but if it's on for one platform it should be on for all).
HOST_LDFLAGSis renamed HOSTLDFLAGS for consistency with the previousHOST_CFLAGSto HOSTCFLAGS rename. A newHOSTCFLAGS_NOPEDis made available for those files which currently cannot be built with -pedantic, and replaces the oldFIT_CFLAGS.imls now uses the cross compiler properly, rather than by trying to reconstruct CC using the typoed $(CROSS_COMPILER).
envcrc.cis now dependency-processed unconditionally -- previously it would be built without being on (HOST)SRCS ifCONFIG_ENV_IS_EMBEDDEDwas not selected.Signed-off-by Scott Wood <[email protected]>---
since v1:
HOSTCFLAGS becomesHOSTCFLAGS_NOPED
PEDCFLAGS becomes HOSTCFLAGS
rebased to next branchI added some missing HOSTLDFLAGS references, but I decided against doing HOSTCOMPILE/HOSTLINK because of the number of combinations -- compile, compile noped, link, and link noped (because we could be compiling at the same time), and questions about whether we'll necessarily want HOSTCFLAGS if we're purely linking, whether LDFLAGS are harmful if purely compiling (and thus we could get rid of HOSTLINK), etc.
Plus, we don't have anything analogous for the non-host case.
Quoted 7 lines
config.mk | 34 ++++++++++++- rules.mk | 13 ++++- tools/Makefile | 121 +++++++++++++--------------------------------- tools/easylogo/Makefile | 9 ++- tools/gdb/Makefile | 15 ++---- tools/imls/Makefile | 29 ++++------- 6 files changed, 98 insertions(+), 123 deletions(-)
Applied to "next". Thanks.
Best regards,
Wolfgang Denk
Signature · 5 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 The man on tops walks a lonely street; the "chain" of command is often a noose.
PATCH v2 1/1 makefiles: fixes for building build tools
Hi Scott,
Quoted 10 lines · On Wednesday 02 December 2009 22:59:03 Wolfgang Denk wrote:
Quoted 8 lines
config.mk | 34 ++++++++++++- rules.mk | 13 ++++- tools/Makefile | 121 +++++++++++++--------------------------------- tools/easylogo/Makefile | 9 ++- tools/gdb/Makefile | 15 ++---- tools/imls/Makefile | 29 ++++------- 6 files changed, 98 insertions(+), 123 deletions(-)Applied to "next". Thanks.
This patch causes some problems, at least on 4xx platforms (others as well I suspect):
[stefan at stefan-desktop u-boot (next)]$ ./MAKEALL kilauea Configuring for kilauea board.../usr/bin/ld: crc32.o: Relocations in generic ELF (EM: 20) /usr/bin/ld: crc32.o: Relocations in generic ELF (EM: 20) /usr/bin/ld: crc32.o: Relocations in generic ELF (EM: 20) /usr/bin/ld: crc32.o: Relocations in generic ELF (EM: 20) /usr/bin/ld: crc32.o: Relocations in generic ELF (EM: 20) /usr/bin/ld: crc32.o: Relocations in generic ELF (EM: 20) /usr/bin/ld: crc32.o: Relocations in generic ELF (EM: 20) crc32.o: could not read symbols: File in wrong format
collect2: ld returned 1 exit status
This is on "next" with ELDK 4.2. Scott, do you have any ideas what's going wrong here?
Cheers,
Stefan
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-0 Fax: (+49)-8142-66989-80 Email: office at denx.de
PATCH v2 1/1 makefiles: fixes for building build tools
Quoted 29 lines · Stefan Roese
Hi Scott,
Quoted 9 lines · On Wednesday 02 December 2009 22:59:03 Wolfgang Denk wrote:
Quoted 8 lines
config.mk | 34 ++++++++++++- rules.mk | 13 ++++- tools/Makefile | 121 +++++++++++++--------------------------------- tools/easylogo/Makefile | 9 ++- tools/gdb/Makefile | 15 ++---- tools/imls/Makefile | 29 ++++------- 6 files changed, 98 insertions(+), 123 deletions(-)Applied to "next". Thanks.
This patch causes some problems, at least on 4xx platforms (others as well I suspect):
[stefan at stefan-desktop u-boot (next)]$ ./MAKEALL kilauea Configuring for kilauea board...
/usr/bin/ld: crc32.o: Relocations in generic ELF (EM: 20)/usr/bin/ld: crc32.o: Relocations in generic ELF (EM: 20)/usr/bin/ld: crc32.o: Relocations in generic ELF (EM: 20)/usr/bin/ld: crc32.o: Relocations in generic ELF (EM: 20)/usr/bin/ld: crc32.o: Relocations in generic ELF (EM: 20)/usr/bin/ld: crc32.o: Relocations in generic ELF (EM: 20)/usr/bin/ld: crc32.o: Relocations in generic ELF (EM: 20) crc32.o: could not read symbols: File in wrong format
collect2: ld returned 1 exit status
Quoted 2 lines
This is on "next" with ELDK 4.2. Scott, do you have any ideas what's going wrong here?
I don't see that here -- instead, I get this, with or without this patch:
$ CROSS_COMPILE=powerpc-linux- ./MAKEALL kilauea Configuring for kilauea board... powerpc-linux-ld: u-boot: section `.text' can't be allocated in segment 0 powerpc-linux-ld: final link failed: Bad value make: *** [u-boot] Error 1
This is with binutils 2.18. Do I need to upgrade?
Git bisect says:4649913ea5f440d756d150a6fdf2fb2e8ecb75fd is the first bad commit commit 4649913ea5f440d756d150a6fdf2fb2e8ecb75fd
Author: Stefan Roese <[email protected]> Date: Tue Oct 27 16:11:26 2009 +0100
ppc4xx: Add common ppc4xx linker script
This linker script can be used by all PPC4xx platforms. It works for PPC405 and PPC440 platforms. Boards which need a board specific linker script can override this default linker script in board/*/config.mk.
Can you post a full boot log of your error? I'm guessing host crc32.o is getting linked into target code or vice versa, though I don't see why that would happen only on 4xx. One should be tools/crc32.o and the other should be lib_generic/crc32.o.
-Scott
PATCH v2 1/1 makefiles: fixes for building build tools
Quoted 19 lines · On Thursday 03 December 2009 18:49:26 Scott Wood wrote:
Quoted 2 lines
This is on "next" with ELDK 4.2. Scott, do you have any ideas what's going wrong here?
I don't see that here -- instead, I get this, with or without this patch:
$ CROSS_COMPILE=powerpc-linux- ./MAKEALL kilauea Configuring for kilauea board... powerpc-linux-ld: u-boot: section `.text' can't be allocated in segment 0 powerpc-linux-ld: final link failed: Bad value make: *** [u-boot] Error 1This is with binutils 2.18. Do I need to upgrade?
Git bisect says:
4649913ea5f440d756d150a6fdf2fb2e8ecb75fdis the first bad commit commit4649913ea5f440d756d150a6fdf2fb2e8ecb75fdAuthor: Stefan Roese <[email protected]> Date: Tue Oct 27 16:11:26 2009 +0100
Quoted 7 lines
ppc4xx: Add common ppc4xx linker script
This linker script can be used by all PPC4xx platforms. It works for PPC405 and PPC440 platforms. Boards which need a board specific linker script can override this default linker script in
board/*/config.mk.Signed-off-by Stefan Roese <[email protected]>
Hmmm. I don't see this here. Do you only see this for katmai, or for other 4xx targets as well? kilauea, sequoia?
Quoted 4 lines
Can you post a full boot log of your error? I'm guessing host crc32.o is getting linked into target code or vice versa, though I don't see why that
would happen only on 4xx. One should betools/crc32.oand the other should belib_generic/crc32.o.
OK, here some more output:
[stefan at stefan-desktop u-boot (next)]$ CROSS_COMPILE=powerpc-linux- make kilauea_config Configuring for kilauea board...
[stefan at stefan-desktop u-boot (next)]$ CROSS_COMPILE=powerpc-linux- make Generating include/autoconf.mk
Generating include/autoconf.mk.dep
for dir in tools examples/standalone examples/api ; do make -C $dir _depend ; done make[1]: Entering directory `/home/stefan/git/u-boot/u-boot/tools'
make[1]: Leaving directory `/home/stefan/git/u-boot/u-boot/tools'
make[1]: Entering directory `/home/stefan/git/u-boot/u-boot/tools'
make[1]: Nothing to be done for `_depend'.
make[1]: Leaving directory `/home/stefan/git/u-boot/u-boot/tools'
make[1]: Entering directory /home/stefan/git/u-boot/u-boot/examples/standalone' make[1]: Leaving directory /home/stefan/git/u-boot/u-boot/examples/standalone' make[1]: Entering directory /home/stefan/git/u-boot/u-boot/examples/standalone' make[1]: Nothing to be done for _depend'.
make[1]: Leaving directory /home/stefan/git/u-boot/u-boot/examples/standalone' make[1]: Entering directory /home/stefan/git/u-boot/u-boot/examples/api' make[1]: Nothing to be done for `_depend'.
make[1]: Leaving directory `/home/stefan/git/u-boot/u-boot/examples/api' make -C tools all
make[1]: Entering directory `/home/stefan/git/u-boot/u-boot/tools'
powerpc-linux-gcc -g -Os -mrelocatable -fPIC -ffixed-r14 -meabi -D__KERNEL__ -
DTEXT_BASE=0xFFFA0000 -I/home/stefan/git/u-boot/u-boot/include -fno-builtin - ffreestanding -nostdinc -isystem /opt/eldk-4.2/usr/bin/../lib/gcc/powerpc- linux/4.2.2/include -pipe -DCONFIG_PPC -D__powerpc__ -DCONFIG_4xx -ffixed-r2 -mstring -
msoft-float -Wa,-m405 -mcpu=405 -Wall -Wstrict-prototypes -fno-stack-protector -o
crc32.o crc32.c -c
powerpc-linux-gcc -g -Os -mrelocatable -fPIC -ffixed-r14 -meabi -D__KERNEL__ -
DTEXT_BASE=0xFFFA0000 -I/home/stefan/git/u-boot/u-boot/include -fno-builtin - ffreestanding -nostdinc -isystem /opt/eldk-4.2/usr/bin/../lib/gcc/powerpc- linux/4.2.2/include -pipe -DCONFIG_PPC -D__powerpc__ -DCONFIG_4xx -ffixed-r2 -mstring -
msoft-float -Wa,-m405 -mcpu=405 -Wall -Wstrict-prototypes -fno-stack-protector -o
env_embedded.o env_embedded.c -c
gcc -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer -idirafter /home/stefan/git/u- boot/u-boot/include -idirafter /home/stefan/git/u-boot/u-boot/include2 -idirafter /home/stefan/git/u-boot/u-boot/include -I /home/stefan/git/u-boot/u-boot/libfdt -I /home/stefan/git/u-boot/u-boot/tools -DTEXT_BASE=0xFFFA0000 -DUSE_HOSTCC -D__KERNEL_STRICT_NAMES -pedantic -o envcrc.o envcrc.c -c
powerpc-linux-gcc -g -Os -mrelocatable -fPIC -ffixed-r14 -meabi -D__KERNEL__ -
DTEXT_BASE=0xFFFA0000 -I/home/stefan/git/u-boot/u-boot/include -fno-builtin - ffreestanding -nostdinc -isystem /opt/eldk-4.2/usr/bin/../lib/gcc/powerpc- linux/4.2.2/include -pipe -DCONFIG_PPC -D__powerpc__ -DCONFIG_4xx -ffixed-r2 -mstring -
msoft-float -Wa,-m405 -mcpu=405 -Wall -Wstrict-prototypes -fno-stack-protector -o
sha1.o sha1.c -c
gcc -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer -idirafter /home/stefan/git/u- boot/u-boot/include -idirafter /home/stefan/git/u-boot/u-boot/include2 -idirafter /home/stefan/git/u-boot/u-boot/include -I /home/stefan/git/u-boot/u-boot/libfdt -I /home/stefan/git/u-boot/u-boot/tools -DTEXT_BASE=0xFFFA0000 -DUSE_HOSTCC - D__KERNEL_STRICT_NAMES -pedantic -o envcrc crc32.o env_embedded.o envcrc.o sha1.o /usr/bin/ld: crc32.o: Relocations in generic ELF (EM: 20)/usr/bin/ld: crc32.o: Relocations in generic ELF (EM: 20)/usr/bin/ld: crc32.o: Relocations in generic ELF (EM: 20)/usr/bin/ld: crc32.o: Relocations in generic ELF (EM: 20)/usr/bin/ld: crc32.o: Relocations in generic ELF (EM: 20)/usr/bin/ld: crc32.o: Relocations in generic ELF (EM: 20)/usr/bin/ld: crc32.o: Relocations in generic ELF (EM: 20)
crc32.o: could not read symbols: File in wrong format
collect2: ld returned 1 exit status
make[1]: *** [envcrc] Error 1
make[1]: Leaving directory `/home/stefan/git/u-boot/u-boot/tools'
make: *** [tools] Error 2
[stefan at stefan-desktop u-boot (next)]$ file tools/crc32.otools/crc32.o: ELF 32-bit MSB relocatable, PowerPC or cisco 4500, version 1 (SYSV), not stripped
So the complete tools directory is compiled for powerpc!
Cheers,
Stefan
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-0 Fax: (+49)-8142-66989-80 Email: office at denx.de
PATCH v2 1/1 makefiles: fixes for building build tools
Quoted 9 lines · Stefan Roese
Quoted 8 lines · On Thursday 03 December 2009 18:49:26 Scott Wood wrote:
Git bisect says:
4649913ea5f440d756d150a6fdf2fb2e8ecb75fdis the first bad commit commit4649913ea5f440d756d150a6fdf2fb2e8ecb75fdAuthor: Stefan Roese <[email protected]> Date: Tue Oct 27 16:11:26 2009 +0100ppc4xx: Add common ppc4xx linker script
Quoted 8 lines
Quoted 5 lines
This linker script can be used by all PPC4xx platforms. It works for PPC405 and PPC440 platforms. Boards which need a board specific linker script can override this default linker script in
board/*/config.mk.Signed-off-by Stefan Roese <[email protected]>Hmmm. I don't see this here. Do you only see this for katmai, or for other 4xx targets as well? kilauea, sequoia?
Looks like all of them.
Quoted 45 lines
make[1]: Entering directory `/home/stefan/git/u-boot/u-boot/tools'
powerpc-linux-gcc -g -Os -mrelocatable -fPIC -ffixed-r14 -meabi -D__KERNEL__ -
DTEXT_BASE=0xFFFA0000 -I/home/stefan/git/u-boot/u-boot/include -fno-builtin - ffreestanding -nostdinc -isystem/opt/eldk-4.2/usr/bin/../lib/gcc/powerpc-linux/4.2.2/include -pipe -DCONFIG_PPC -D__powerpc__ -DCONFIG_4xx -ffixed-r2 -mstring -
msoft-float -Wa,-m405 -mcpu=405 -Wall -Wstrict-prototypes -fno-stack-protector -o
crc32.ocrc32.c-c
powerpc-linux-gcc -g -Os -mrelocatable -fPIC -ffixed-r14 -meabi -D__KERNEL__ -
DTEXT_BASE=0xFFFA0000 -I/home/stefan/git/u-boot/u-boot/include -fno-builtin - ffreestanding -nostdinc -isystem/opt/eldk-4.2/usr/bin/../lib/gcc/powerpc-linux/4.2.2/include -pipe -DCONFIG_PPC -D__powerpc__ -DCONFIG_4xx -ffixed-r2 -mstring -
msoft-float -Wa,-m405 -mcpu=405 -Wall -Wstrict-prototypes -fno-stack-protector -o
env_embedded.oenv_embedded.c-c
gcc -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer -idirafter/home/stefan/git/u-boot/u-boot/include -idirafter/home/stefan/git/u-boot/u-boot/include2-idirafter/home/stefan/git/u-boot/u-boot/include-I/home/stefan/git/u-boot/u-boot/libfdt-I/home/stefan/git/u-boot/u-boot/tools-DTEXT_BASE=0xFFFA0000 -DUSE_HOSTCC -D__KERNEL_STRICT_NAMES-pedantic -o envcrc.oenvcrc.c-c
powerpc-linux-gcc -g -Os -mrelocatable -fPIC -ffixed-r14 -meabi -D__KERNEL__ -
DTEXT_BASE=0xFFFA0000 -I/home/stefan/git/u-boot/u-boot/include -fno-builtin - ffreestanding -nostdinc -isystem/opt/eldk-4.2/usr/bin/../lib/gcc/powerpc-linux/4.2.2/include -pipe -DCONFIG_PPC -D__powerpc__ -DCONFIG_4xx -ffixed-r2 -mstring -
msoft-float -Wa,-m405 -mcpu=405 -Wall -Wstrict-prototypes -fno-stack-protector -o
sha1.osha1.c-c
gcc -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer -idirafter/home/stefan/git/u-boot/u-boot/include -idirafter/home/stefan/git/u-boot/u-boot/include2-idirafter/home/stefan/git/u-boot/u-boot/include-I/home/stefan/git/u-boot/u-boot/libfdt-I/home/stefan/git/u-boot/u-boot/tools-DTEXT_BASE=0xFFFA0000 -DUSE_HOSTCC -D__KERNEL_STRICT_NAMES-pedantic -o envcrc crc32.o env_embedded.o envcrc.o sha1.o/usr/bin/ld: crc32.o: Relocations in generic ELF (EM: 20)/usr/bin/ld: crc32.o: Relocations in generic ELF (EM: 20)/usr/bin/ld: crc32.o: Relocations in generic ELF (EM: 20)/usr/bin/ld: crc32.o: Relocations in generic ELF (EM: 20)/usr/bin/ld: crc32.o: Relocations in generic ELF (EM: 20)/usr/bin/ld: crc32.o: Relocations in generic ELF (EM: 20)/usr/bin/ld: crc32.o: Relocations in generic ELF (EM: 20)
crc32.o: could not read symbols: File in wrong format
collect2: ld returned 1 exit status
make[1]: *** [envcrc] Error 1
make[1]: Leaving directory `/home/stefan/git/u-boot/u-boot/tools'
make: *** [tools] Error 2
[stefan at stefan-desktop u-boot (next)]$ filetools/crc32.otools/crc32.o: ELF 32-bit MSB relocatable, PowerPC or cisco 4500, version 1 (SYSV), not stripped
Quoted 1 line
So the complete tools directory is compiled for powerpc!
Actually, it looks like it's just the files whose sources live somewhere else (look at envcrc.c, for example). Those files should be hitting these rules inside tools/Makefile:
# Some of the tool objects need to be accessed from outside the tools directory $(obj)%.o: $(SRCTREE)/common/%.c
$(HOSTCC) -g $(HOSTCFLAGS_NOPED) -c -o $@ $<
$(obj)%.o: $(SRCTREE)/lib_generic/%.c
$(HOSTCC) -g $(HOSTCFLAGS) -c -o $@ $<
Do you by any chance have a copy of/link to crc32.c, env_embedded.c, etc. sitting in your tools directory, allowing it to match the normal pattern rule?
-Scott
PATCH v2 1/1 makefiles: fixes for building build tools
Quoted 4 lines · On Thursday 03 December 2009 20:09:45 Scott Wood wrote:
Quoted 2 lines
Hmmm. I don't see this here. Do you only see this for katmai, or for other 4xx targets as well? kilauea, sequoia?
Looks like all of them.
Thanks. I'll try to investigate here further soon.
<snip>
Quoted 8 lines
Quoted 1 line
So the complete tools directory is compiled for powerpc!
Actually, it looks like it's just the files whose sources live somewhere
else (look atenvcrc.c, for example). Those files should be hitting these rules insidetools/Makefile:# Some of the tool objects need to be accessed from outside the tools
directory $(obj)%.o: $(SRCTREE)/common/%.c
Quoted 8 lines
$(HOSTCC) -g $(HOSTCFLAGS_NOPED) -c -o $@ $<$(obj)%.o: $(SRCTREE)/lib_generic/%.c
$(HOSTCC) -g $(HOSTCFLAGS) -c -o $@ $<Do you by any chance have a copy of/link to
crc32.c,env_embedded.c, etc. sitting in your tools directory, allowing it to match the normal pattern
rule?
Yes. I had links of those files there. After removing those it works fine. Thanks.
Cheers,
Stefan
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-0 Fax: (+49)-8142-66989-80 Email: office at denx.de