Skip to contentSkip to conversation

notes on cpu/mips/config.mk

PATCH New Rodolfo Giometti 3 participants 6 messages Sep 16, 2005 – Sep 30, 2005

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 notes on cpu/mips/config.mk

Hello,

I have a mips based board and during u-boot support developing I notice that in file ?cpu/mips/config.mk?:

* should be replaced this line

   -mips-linux-as --version|grep "GNU assembler"|awk '{print $$3}'|awk -F . '{print $$2}')
   +$(AS) --version|grep "GNU assembler"|awk '{print $$3}'|awk -F . '{print $$2}')

to avoid errors for user not having ?mips-linux-as? (I have mipsel-linux-as).

* should be used ?allow_branch_to_undefined? or ?mips_allow_branch_to_undefined? as GAS option? My toolchain use ?allow_branch_to_undefined?...

* Variable MIPSFLAGS is ambiguous, I suggest using MIPSCFLAGS and/or MIPSLDFLAGS.

In the end I suggest the following patch for file cpu/mips/config.mk:

Index: cpu/mips/config.mk
===================================================================
RCS file: /home/develop/cvs_private/uboot-mips-exadron/cpu/mips/config.mk,v retrieving revision 1.1.1.1

cpu/mips/config.mk 16 Sep 2005 14:19:29 -0000 renamed from cpu/mips/config.mk 16 Sep 2005 12:14:19 -0000 1.1.1.1 +10 -8
diff -u -r1.1.1.1 config.mk
@@ -21,20 +21,22 @@
 # MA 02111-1307 USA
 #
 v=$(shell \
-mips-linux-as --version|grep "GNU assembler"|awk '{print $$3}'|awk -F . '{print $$2}')
-MIPSFLAGS=$(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 -Wa,-mips_allow_branch_to_undefined"; \
+       echo "-march=4kc -mtune=4kc -Wa,-allow_branch_to_undefined"; \
 fi)
 
 ifneq (,$(findstring 4KCle,$(CROSS_COMPILE)))
-ENDIANNESS = -EL
-else
-ENDIANNESS = -EB
+MIPSCFLAGS += -EL
+endif
+ifneq (,$(findstring mipsel,$(CROSS_COMPILE)))
+MIPSLDFLAGS += -EL
 endif
 
-MIPSFLAGS += $(ENDIANNESS) -mabicalls
+MIPSCFLAGS += -mabicalls
 
-PLATFORM_CPPFLAGS += $(MIPSFLAGS)
+PLATFORM_CPPFLAGS += $(MIPSCFLAGS)
+PLATFORM_LDFLAGS += $(MIPSLDFLAGS)

Ciao,

Rodolfo

Signature · 4 lines
GNU/Linux Solutions                  e-mail:    giometti at linux.it
Linux Device Driver                             giometti at enneenne.com
Embedded Systems                     home page: giometti.enneenne.com
UNIX programming                     phone:     +39 349 2432127
#1 lore raw

PATCH 1/1 notes on cpu/mips/config.mk

Hi

Quoted 2 lines

I have a mips based board and during u-boot support developing I notice that in file ?cpu/mips/config.mk?:

Please, take a look at:
http://sourceforge.net/mailarchive/message.php?msg_id=12736269

where we have already discussed about this (A new version of config.mk is also attached.)

Quoted 3 lines

* should be used ?allow_branch_to_undefined? or ?mips_allow_branch_to_undefined? as GAS option? My toolchain use ?allow_branch_to_undefined?...

Mine too.

BR,
Matej

#2 lore raw

PATCH 1/1 notes on cpu/mips/config.mk

In reply to Rodolfo Giometti

Hi Rodolfo,

Quoted 5 lines

Hello,

I have a mips based board and during u-boot support developing I notice that in file ?cpu/mips/config.mk?:

Quoted 7 lines

* should be replaced this line

   -mips-linux-as --version|grep "GNU assembler"|awk '{print $$3}'|awk -F . '{print $$2}')
   +$(AS) --version|grep "GNU assembler"|awk '{print $$3}'|awk -F . '{print $$2}')

to avoid errors for user not having ?mips-linux-as? (I have mipsel-linux-as).

OK

...

Quoted 30 lines

In the end I suggest the following patch for file cpu/mips/config.mk:

Index: cpu/mips/config.mk
===================================================================
RCS file: /home/develop/cvs_private/uboot-mips-exadron/cpu/mips/config.mk,v retrieving revision 1.1.1.1
diff -u -r1.1.1.1 config.mk

cpu/mips/config.mk 16 Sep 2005 14:19:29 -0000 renamed from cpu/mips/config.mk 16 Sep 2005 12:14:19 -0000 1.1.1.1 +5 -6
@@ -21,20 +21,22 @@
 # MA 02111-1307 USA
 #
 v=$(shell \
-mips-linux-as --version|grep "GNU assembler"|awk '{print $$3}'|awk -F . '{print $$2}')
-MIPSFLAGS=$(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 -Wa,-mips_allow_branch_to_undefined"; \
+       echo "-march=4kc -mtune=4kc -Wa,-allow_branch_to_undefined"; \
 fi)
 
 ifneq (,$(findstring 4KCle,$(CROSS_COMPILE)))
-ENDIANNESS = -EL
-else
-ENDIANNESS = -EB
+MIPSCFLAGS += -EL
+endif

cpu/mips/config.mk 16 Sep 2005 14:19:29 -0000 line 42

Quoted 10 lines
cpu/mips/config.mk 16 Sep 2005 14:19:29 -0000 renamed from cpu/mips/config.mk 16 Sep 2005 12:14:19 -0000 1.1.1.1 +5 -2
+ifneq (,$(findstring mipsel,$(CROSS_COMPILE)))
+MIPSLDFLAGS += -EL
 endif
 
-MIPSFLAGS += $(ENDIANNESS) -mabicalls
+MIPSCFLAGS += -mabicalls
 
-PLATFORM_CPPFLAGS += $(MIPSFLAGS)
+PLATFORM_CPPFLAGS += $(MIPSCFLAGS)
+PLATFORM_LDFLAGS += $(MIPSLDFLAGS)

You removed any logical path by which "-EB" would be added to the flags. Your addition of the new flag variables is fine if it works, but it should not break the big endian code. Why don't you rework your patch to not break big endian support?

Chuck Meade
The PTR Group

#3 lore raw

PATCH 1/1 notes on cpu/mips/config.mk

Quoted 4 lines · Chuck Meade

You removed any logical path by which "-EB" would be added to the flags. Your addition of the new flag variables is fine if it works, but it should not break the big endian code. Why don't you rework your patch to not break big endian support?

I don't think I'm breaking big endian support with my patch since if you have the ld command:

OUTPUT_FORMAT("elf32-tradbigmips", "elf32-tradbigmips", "elf32-tradlittlemips")

you say to the linker that your default endian is "big", please see:

info -f /usr/local/mipsel/info/ld.info -n "Format Commands"

So if you do not specify "-EB" nor "-EL" the linker will use default (big endian in the above example).

The following patch also fixes examples compilations:

Index: examples/mips.lds
===================================================================
RCS file: /home/develop/cvs_private/uboot-mips-exadron/examples/mips.lds,v retrieving revision 1.1.1.1
retrieving revision 1.2

examples/mips.lds 16 Sep 2005 15:05:08 -0000 1.2 renamed from examples/mips.lds 16 Sep 2005 12:14:21 -0000 1.1.1.1 +1 -1
diff -u -r1.1.1.1 -r1.2
@@ -24,7 +24,7 @@
 /*
 OUTPUT_FORMAT("elf32-bigmips", "elf32-bigmips", "elf32-bigmips")
 */
-OUTPUT_FORMAT("elf32-tradbigmips", "elf32-tradbigmips", "elf32-tradbigmips")
+OUTPUT_FORMAT("elf32-tradbigmips", "elf32-tradbigmips", "elf32-tradlittlemips")
 OUTPUT_ARCH(mips)
 SECTIONS
 {

Ciao,

Rodolfo

Signature · 11 lines
GNU/Linux Solutions                  e-mail:    giometti at linux.it
Linux Device Driver                             giometti at enneenne.com
Embedded Systems                     home page: giometti.enneenne.com
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/20050929/c382cccb/attachment.pgp 
#4 lore raw

PATCH 1/1 notes on cpu/mips/config.mk

Hi Rodolfo,

Quoted 11 lines

I don't think I'm breaking big endian support with my patch since if you have the ld command:

   OUTPUT_FORMAT("elf32-tradbigmips", "elf32-tradbigmips", "elf32-tradlittlemips")

you say to the linker that your default endian is "big", please see:

info -f /usr/local/mipsel/info/ld.info -n "Format Commands"

So if you do not specify "-EB" nor "-EL" the linker will use default (big endian in the above example).

Your patch removes ENDIANNESS from MIPSFLAGS. MIPSFLAGS affects more than just the linker. Your patch removes the -EB flag being sent to all tools that have MIPSFLAGS, including the compiler. Your patch also changes the use of MIPSFLAGS itself, so this may be hard for you to see.

Look at the file after you have applied your patch, and you will see that there is now absolutely no way that PLATFORM_CPPFLAGS would *ever* have "-EB" appended to it. That is what you have removed.

Chuck Meade
The PTR Group

#5 lore raw

PATCH 1/1 notes on cpu/mips/config.mk

Quoted 4 lines · Chuck Meade

Your patch removes ENDIANNESS from MIPSFLAGS. MIPSFLAGS affects more than just the linker. Your patch removes the -EB flag being sent to all tools that have MIPSFLAGS, including the compiler. Your patch also changes the use of MIPSFLAGS itself, so this may be hard for you to see.

Mmm... I see what you mean. Option ?-EB? is used also by the compiler... I thought it was a linker option only.

Quoted 3 lines

Look at the file after you have applied your patch, and you will see that there is now absolutely no way that PLATFORM_CPPFLAGS would *ever* have "-EB" appended to it. That is what you have removed.

Ok, I'll fix better the code in my next patch since I'm working on removing ?-mips_allow_branch_to_undefined? option from gas.

Thanks,

Rodolfo

Signature · 11 lines
GNU/Linux Solutions                  e-mail:    giometti at linux.it
Linux Device Driver                             giometti at enneenne.com
Embedded Systems                     home page: giometti.enneenne.com
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/20050930/5a9f567a/attachment.pgp