diff -purN CVShead/mkconfig mkconfig/mkconfig
--- CVShead/mkconfig	2005-04-04 10:16:11.000000000 +0100
+++ mkconfig/mkconfig	2005-04-04 10:23:23.000000000 +0100
@@ -7,7 +7,121 @@
 #
 # (C) 2002 DENX Software Engineering, Wolfgang Denk <wd@denx.de>
 #
-
+# Changes for correcting gcc options (C) 2004 ARM Ltd, Peter.Pearse <peter.pearse@arm.com>
+#
+#========================================
+# Functions::
+# 
+# Function to replace any existing occurrence of an ARM specific 
+# option, opt, in all config.mk files with its alternative, alt.
+#========================================
+ARM_replace () { 
+   find .. -name config.mk -exec grep -H \\$opt {} \; > workfile1
+   #========================================
+   # Ensure the file name becomes $1
+   #========================================
+   $AWK '$0 ~ /config.mk:/ {gsub("config.mk" , "config.mk ", $0)}; {print $0}' workfile1 > workfile2
+   files_to_edit=`$AWK '{print $1}' workfile2`
+   if  [ ! -z  "$files_to_edit" ]
+   then
+      for f in  $files_to_edit
+      do
+          cmd1="$AWK '\$0 ~ /$opt/ {gsub(\"$opt\" , \"$alt\", \$0)}; {print \$0}' $f > workfile1"
+	  eval $cmd1
+          mv workfile1 $f
+          echo "Replaced |$opt| in $f with |$alt|"
+      done
+   fi
+   for f in workfile1 workfile2
+   do
+   	if [ -f $f ]
+       then
+          rm $f
+       fi
+   done
+}
+#========================================
+# Function to check whether specific ARM options  
+# are supported in the compiler.
+# If possible, unsupported options are replaced 
+# with the supported alternative, otherwise they are removed
+#
+# opt1, opt2 are options which replace one another 
+# in different versions of the compiler
+#
+#========================================
+ARM_options () { 
+    # ========================================================
+    # Provide a dummy source file
+    # ========================================================
+    echo "int main(void){return 0;}" > dummy.c 
+    # ========================================================
+    # Is option 1 recognized?
+    # ========================================================
+    if [ ok=`arm-linux-gcc -c -o dummy.o $opt1 dummy.c >& workfile` ]
+    then
+      ok=1
+    fi
+    if grep "invalid option" workfile
+    then
+       echo "$opt1 NOT supported"
+       ok1=0
+    else
+       echo "$opt1 is  supported"
+       ok1=1
+    fi
+    # ========================================================
+    # Is $opt2 recognized?
+    # ========================================================
+    if [ ok=`arm-linux-gcc -c -o dummy.o $opt2 dummy.c >& workfile` ]
+    then
+       ok=1
+    fi
+    if grep "invalid option" workfile
+    then
+       echo "$opt2 NOT supported"
+       ok2=0
+    else
+       echo "$opt2 is  supported"
+       ok2=1
+    fi
+    for f in dummy.c dummy.o
+    do
+    	if [ -f $f ]
+	then
+	   rm $f
+	fi
+    done
+    if [ $ok1 = 0 ]
+    then
+       # ========================================================
+       # Choose replacement
+       # ========================================================
+       if [ $ok2 = 0 ]
+       then
+          alt=""
+       else
+          alt=$opt2
+       fi
+       opt=$opt1
+       ARM_replace
+    fi
+    if [ $ok2 = 0 ]
+    then
+       # ========================================================
+       # Choose replacement
+       # ========================================================
+       if [ $ok1 = 0 ]
+       then
+          alt=""
+       else
+          alt=$opt1
+       fi
+       opt=$opt2
+       ARM_replace
+    fi
+}
+AWK=awk		# Perhaps we have to edit this to nawk or gawk.....
 APPEND=no	# Default: Create new config file
 
 while [ $# -gt 0 ] ; do
@@ -39,8 +153,22 @@ else
 fi
 
 if [ "$2" = "arm" ] ; then
-	rm -f asm-$2/proc
-	ln -s proc-armv asm-$2/proc
+    echo "ARM specific processing starts"
+    rm -f asm-$2/proc
+    ln -s proc-armv asm-$2/proc
+    # ========================================================
+    # Use correct half word alignment options for compiler
+    # ========================================================
+    opt1=-malignment-traps
+    opt2=-mshort-load-bytes
+    ARM_options
+    # ========================================================
+    # Use correct APCS alignment options for compiler
+    # ========================================================
+    opt1=-mapcs-32
+    opt2=-m6
+    ARM_options
+    echo "ARM specific processing ends"
 fi
 
 #
