Subject: AFLAGS lossage

From: Philip Blundell <[email-masked]>
Date: Thu, 09 Dec 1999 21:07:32 +0000

Despite what the name might suggest, $(AFLAGS) is only actually passed to gcc 
rather than the assembler.  The patch below (for 2.3.29) changes this 
variable to contain flags that the compiler actually understands.  This 
gives a measurable speedup on my machine.  (I've only tested with egcs-1.1.1 
and binutils 2.9.4.)

p.

Index: arch/arm/Makefile
===================================================================
RCS file: /cvsroot/pub/kernel/armlinux/arch/arm/Makefile,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- Makefile	1999/12/05 17:13:48	1.20
+++ Makefile	1999/12/09 21:03:35	1.21
@@ -83,10 +82,10 @@
  TEXTADDR	 = 0xC0008000
  ifeq ($(CONFIG_CPU_32v4),y)
   CFLAGS	+= $(CFLAGS_PROC_CPU_32v4)
-  AFLAGS	+= -mapcs-32 -marmv4
+  AFLAGS	+= $(CFLAGS_PROC_CPU_32v4)
  else
   CFLAGS	+= $(CFLAGS_PROC_CPU_32v3)
-  AFLAGS	+= -mapcs-32 -marmv3m
+  AFLAGS	+= $(CFLAGS_PROC_CPU_32v3)
  endif
  #
  # Exactly one of the following must be selected

unsubscribe: body of `unsubscribe linux-arm-kernel' to [email-masked]

---

From: Russell King - ARM Linux Admin <[email-masked]>
Date: Thu, 9 Dec 1999 21:11:14 +0000 (GMT)

> gives a measurable speedup on my machine.  (I've only tested with egcs-1.1.1 

I don't really believe the performance improvement, unless egcs somehow
optimises assembler code...

Before:

AFLAGS = -mapcs-32 -marmv4

After:

AFLAGS = -march=armv4

Please explain how this can speed up assembler code.

(Also, it breaks the compile with the old GCC 2.7.2.2)
   _____
  |_____| ------------------------------------------------- ---+---+-
  |   |        Russell King       [email-masked]      --- ---
  | | | |  http://www.arm.linux.org.uk/~rmk/armlinux.html    /  /  |
  | +-+-+                                                     --- -+-
  /   |               THE developer of ARM Linux              |+| /|\
 /  | | |                                                     ---  |
    +-+-+ -------------------------------------------------  /\\\  |

---

From: Philip Blundell <[email-masked]>
Date: Thu, 09 Dec 1999 21:25:56 +0000

>AFLAGS = -mapcs-32 -marmv4

"-marmv4" is not a legal compiler option; GCC just ignores it.

>AFLAGS = -march=armv4

This causes GCC to define __ARM_ARCH_4__, which various bits of assembler use 
when deciding what the best code sequence to use is.  Compare the syscall 
entry path before and after, for example.

>(Also, it breaks the compile with the old GCC 2.7.2.2)

That's not too much of a surprise.  I'll see if I can fix it up.

By the way, "-mapcs-32" in CFLAGS probably does more harm than good; I think 
we want to get rid of that.

p.

---

From: Philip Blundell <[email-masked]>
Date: Thu, 09 Dec 1999 21:31:17 +0000

>(Also, it breaks the compile with the old GCC 2.7.2.2)

I looked at the change again and I can't see what would cause this.  I guess I 
don't know in enough detail what the old GCC accepts.  Can you explain the 
problem a bit more?

p.

---

From: Russell King - ARM Linux Admin <[email-masked]>
Date: Thu, 9 Dec 1999 21:31:06 +0000 (GMT)

> we want to get rid of that.

That's why it's not in CFLAGS.

The alternative is - can you supply me the spec line from GCC for the
assembler please?
   _____

---

From: Philip Blundell <[email-masked]>
Date: Thu, 09 Dec 1999 21:39:03 +0000

>That's why it's not in CFLAGS.

Sorry, you're right.

>The alternative is - can you supply me the spec line from GCC for the

It varies from version to version.  Here is the one I happen to have 
installed locally.  Why do you want to know?

*asm:
%{mbig-endian:-EB} %{mapcs-float:-mfloat} 

p.