[U-Boot-Users] [PATCH] Mips AS call fixed.

Rodolfo Giometti giometti at linux.it
Tue Apr 11 11:55:10 CEST 2006


On Tue, Apr 11, 2006 at 09:17:12AM +0200, Matej Kupljen wrote:
> 
> I posted a new version of config.mk on August 24. 
> Please see this post:
> http://sourceforge.net/mailarchive/message.php?msg_id=12736269
> 
> This config.mk tries to solve the big/little endian
> toolchain problems. It works for me, but Wolfgang did
> not include it in the official tree.
> Maybe you can test it, if it works for you.

Yes it works... even if I made some little modifications. Here my
proposal:

v=$(shell \
$(AS) --version|grep "GNU assembler"|awk '{print $$3}'|awk -F . '{print $$2}')
MIPSCFLAGS=$(shell \
if [ "$v" -lt "14" ]; then \
        echo "-mcpu=4kc"; \
else \
        echo "-march=4kc -mtune=4kc"; \
fi)

MIPSCFLAGS += -mabicalls

# Check the default ENDIANNESS of the cross compiler
e=$(shell \
TMPDIR=`mktemp -d`; \
trap 'rm -fr ${TMPDIR}' 0 1 2 3 15; \
>$${TMPDIR}/foo.c; \
${CROSS_COMPILE}gcc -c $${TMPDIR}/foo.c -o $${TMPDIR}/foo.o; \
readelf -h $${TMPDIR}/foo.o | \
sed -n 's/.*Data:.* \([^ ][^ ]*\) endian/\1/p'; \
)

ifneq ($e,"little")
MIPSLDFLAGS += -EL
else
MIPSLDFLAGS += -EB
endif

PLATFORM_CPPFLAGS += $(MIPSCFLAGS)
PLATFORM_LDFLAGS += $(MIPSLDFLAGS)

As you can see I call AS with "$(AS)" and not with
"$(CROSS_COMPILE)as" since variable "AS" is already defined and I
added "MIPSCFLAGS" and "MIPSLDFLAGS" where I specify "-EL" or "-EB".

Please, note also that "-Wa,-allow_branch_to_undefined" is no more
necessary due my patch
"http://sourceforge.net/mailarchive/message.php?msg_id=13328221".

Also I suggest this patch for the examples directory:

diff --git a/examples/Makefile b/examples/Makefile
index 62c4e6d..30ce77d 100644
--- a/examples/Makefile
+++ b/examples/Makefile
@@ -100,10 +100,6 @@ SREC   += eepro100_eeprom.srec
 BIN    += eepro100_eeprom.bin eepro100_eeprom
 endif
 
-ifeq ($(BIG_ENDIAN),y)
-EX_LDFLAGS += -EB
-endif
-
 OBJS   = $(SREC:.srec=.o)
 
 LIB    = libstubs.a
@@ -129,7 +125,7 @@ $(LIB): .depend $(LIBOBJS)
        $(AR) crv $@ $(LIBOBJS)
 
 %:     %.o $(LIB)
-       $(LD) -g $(EX_LDFLAGS) -Ttext $(LOAD_ADDR) \
+       $(LD) -g $(PLATFORM_LDFLAGS) -Ttext $(LOAD_ADDR) \
                -o $@ -e $(<:.o=) $< $(LIB) \
                -L$(gcclibdir) -lgcc
 %.srec:        %

since endianess should be defined each time by "PLATFORM_LDFLAGS"
instead of "EX_LDFLAGS".

Ciao,

Rodolfo

-- 

GNU/Linux Solutions                  e-mail:    giometti at enneenne.com
Linux Device Driver                             giometti at gnudd.com
Embedded Systems                     		giometti at linux.it
UNIX programming                     phone:     +39 349 2432127
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://lists.denx.de/pipermail/u-boot/attachments/20060411/eb00b730/attachment.pgp 


More information about the U-Boot mailing list