This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
patch for arm-coff cross compiler
- To: egcs-bugs at cygnus dot com
- Subject: patch for arm-coff cross compiler
- From: Raffaele Sena <raff at aromatic dot com>
- Date: Mon, 24 Nov 1997 00:14:34 +0000 (GMT)
I needed the following patch to make the arm-coff cross compiler generate
usable code for an ARM7500 processor.
The code generated by the standard version is formally correct, but is
suited for APCS-26 compliant arm processors (while the ARM7500 is APCS-32
compliant).
Basically the default for the arm-coff compiler is APCS-32, but this
default is correctly set up for the c preprocessor (the -D__APCS_32__
option is added to the default options), but is left unset for cc1, that
defaults to APCS-26 compliant code.
The problem I had was the generated code assumes the processor flags are
left untouched across calls and this is the correct behaviour for APCS-26
compliant processors, but it's not for APCS-32 compliant ones.
(note that everything works fine if you specify the -mapcs-32 option when
calling arm-coff-gcc)
So the patch consists in forcing the same kind of options to cpp and cc1
(basically I added a new specification for cc1 to use a default set of
options if no -m option has been specified on the command line. And the
options for cpp and cc1 are kept close, so that it should be easy to
remember to change both of them if necessary).
The 2 modified files (arm.h and semi.h) follows this note.
I found and fixed the problem using egcs-971023 and then made sure it
works fine on egcs-971114.
Regards,
Raffaele Sena
http://www.aromatic.com/~raff
-------------------------- 8< CUT HERE >8 ---------------------------
gcc/config/arm/arm.h
----------------------------------------------------------------------------
*** arm.h.orig Mon Aug 11 15:57:24 1997
--- arm.h Sun Nov 23 23:43:13 1997
***************
*** 181,186 ****
--- 181,187 ----
"
#define CPP_APCS_PC_DEFAULT_SPEC "-D__APCS_26__"
+ #define CC1_DEFAULT_SPEC "-mcpu=arm2 -mapcs-26"
#define CPP_FLOAT_SPEC "\
%{msoft-float:\
***************
*** 210,215 ****
--- 211,217 ----
%{m2:-mcpu=arm2 -mapcs-26} \
%{m3:-mcpu=arm3 -mapcs-26} \
%{m6:-mcpu=arm6 -mapcs-32} \
+ %{!m*:%(cc1_default)} \
"
/* This macro defines names of additional specifications to put in the specs
***************
*** 230,235 ****
--- 232,238 ----
{ "cpp_float_default", CPP_FLOAT_DEFAULT_SPEC }, \
{ "cpp_endian", CPP_ENDIAN_SPEC }, \
{ "cpp_endian_default", CPP_ENDIAN_DEFAULT_SPEC }, \
+ { "cc1_default", CC1_DEFAULT_SPEC }, \
{ "subtarget_cpp_spec", SUBTARGET_CPP_SPEC }, \
SUBTARGET_EXTRA_SPECS
gcc/config/arm/semi.h
----------------------------------------------------------------------------
*** semi.h.orig Mon Aug 11 15:57:24 1997
--- semi.h Sun Nov 23 23:43:13 1997
***************
*** 38,40 ****
--- 38,44 ----
#undef CPP_APCS_PC_DEFAULT_SPEC
#define CPP_APCS_PC_DEFAULT_SPEC "-D__APCS_32__"
+
+ #undef CC1_DEFAULT_SPEC
+ #define CC1_DEFAULT_SPEC "-mcpu=arm6 -mapcs-32"
+