This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: [PATCH] Add sh4-nommu-nofpu architecture
- From: Joern Rennecke <joern dot rennecke at superh dot com>
- To: aoliva at redhat dot com (Alexandre Oliva)
- Cc: andrew dot stubbs at superh dot com (Andrew Stubbs), binutils at sources dot redhat dot com (binutils), joern dot rennecke at superh dot com (Joern Rennecke)
- Date: Thu, 4 Mar 2004 13:42:22 +0000 (GMT)
- Subject: Re: [PATCH] Add sh4-nommu-nofpu architecture
> > +#define EF_SH4_NOMMU_NOFPU 0x12
>
> You must adjust EF_SH_MERGE_MACH to match this new value.
You are right; I also see that the EF_* section has gone to seed.
I think we want something like this for mainline and the gdb 6.1 branch
(The latter because of the EF_SH4_NOFPU / EF_SH4A_NOFPU renumbering):
2004-03-04 J"orn Rennecke <joern.rennecke@superh.com>
* sh.h (EF_SH4_NOMMU_NOFPU, EF_SH4_NOFPU, EF_SH4A_NOFPU): Re-order.
(EF_GENERIC_SH4_NOFPU): Define.
(EF_SH_MERGE_MACH): Factor out & fix EF_SH_UNKNOWN tests.
Handle EF_SH4_NOMMU_NOFPU.
Index: sh.h
===================================================================
RCS file: /cvs/src/src/include/elf/sh.h,v
retrieving revision 1.17
diff -p -r1.17 sh.h
*** sh.h 3 Mar 2004 18:01:49 -0000 1.17
--- sh.h 4 Mar 2004 13:36:40 -0000
***************
*** 37,81 ****
#define EF_SH2E 11
#define EF_SH4A 12
! #define EF_SH4_NOFPU 0x10
! #define EF_SH4A_NOFPU 0x11
! #define EF_SH4_NOMMU_NOFPU 0x12
/* This one can only mix in objects from other EF_SH5 objects. */
#define EF_SH5 10
#define EF_SH_MERGE_MACH(mach1, mach2) \
! (((((mach1) == EF_SH3 || (mach1) == EF_SH_UNKNOWN) && (mach2) == EF_SH_DSP) \
! || ((mach1) == EF_SH_DSP \
! && ((mach2) == EF_SH3 || (mach2) == EF_SH_UNKNOWN))) \
? EF_SH3_DSP \
- : (((mach1) < EF_SH3 && (mach2) == EF_SH_UNKNOWN) \
- || ((mach2) < EF_SH3 && (mach1) == EF_SH_UNKNOWN)) \
- ? EF_SH3 \
: ((mach1) == EF_SH2E && EF_SH_HAS_FP (mach2)) \
? (mach2) \
: ((mach2) == EF_SH2E && EF_SH_HAS_FP (mach1)) \
? (mach1) \
! : (((mach1) == EF_SH2E && (mach2) == EF_SH_UNKNOWN) \
! || ((mach2) == EF_SH2E && (mach1) == EF_SH_UNKNOWN)) \
! ? EF_SH2E \
! : (((mach1) == EF_SH3E && (mach2) == EF_SH_UNKNOWN) \
! || ((mach2) == EF_SH3E && (mach1) == EF_SH_UNKNOWN)) \
! ? EF_SH4 \
! /* ??? SH4? Why not SH3E? */ \
! : ((((mach1) == EF_SH4_NOFPU || (mach1) == EF_SH4A_NOFPU) \
! && EF_SH_HAS_DSP (mach2)) \
! || (((mach2) == EF_SH4_NOFPU || (mach2) == EF_SH4A_NOFPU) \
! && EF_SH_HAS_DSP (mach1))) \
? EF_SH4AL_DSP \
- : ((mach1) == EF_SH4_NOFPU && EF_SH_HAS_FP (mach2)) \
- ? ((mach2) < EF_SH4A) ? EF_SH4 : (mach2) \
- : ((mach2) == EF_SH4_NOFPU && EF_SH_HAS_FP (mach1)) \
- ? ((mach1) < EF_SH4A) ? EF_SH4 : (mach1) \
: ((mach1) == EF_SH4A_NOFPU && EF_SH_HAS_FP (mach2)) \
? ((mach2) <= EF_SH4A) ? EF_SH4A : (mach2) \
: ((mach2) == EF_SH4A_NOFPU && EF_SH_HAS_FP (mach1)) \
? ((mach1) <= EF_SH4A) ? EF_SH4A : (mach1) \
: (((mach1) == EF_SH2E ? 7 : (mach1)) > ((mach2) == EF_SH2E ? 7 : (mach2)) \
? (mach1) : (mach2)))
--- 37,84 ----
#define EF_SH2E 11
#define EF_SH4A 12
! #define EF_GENERIC_SH4_NOFPU(flags) ((flags & 0x1c) == 0x10)
! #define EF_SH4_NOMMU_NOFPU 0x10
! #define EF_SH4_NOFPU 0x11
! #define EF_SH4A_NOFPU 0x12
/* This one can only mix in objects from other EF_SH5 objects. */
#define EF_SH5 10
+ /* All the checks for combinations with EF_SH_UNKNOWN are for backwards
+ compatibility when linking with object files that were generated before
+ EF_* bits were introduced to describe the various SH variants. These
+ could have been compiled for CPUs up to SH3_DSP or SH4. */
#define EF_SH_MERGE_MACH(mach1, mach2) \
! (((mach1) == EF_SH_UNKNOWN || (mach2) == EF_SH_UNKNOWN) \
! ? (((mach1) == EF_SH_DSP || (mach2) == EF_SH_DSP) \
! ? EF_SH3_DSP \
! : ((mach1) == EF_SH3 || (mach2) == EF_SH3) \
! ? EF_SH3 \
! : ((mach1) == EF_SH2E || (mach2) == EF_SH2E \
! || (mach1) == EF_SH3E || (mach2) == EF_SH3E) \
! ? EF_SH4 \
! /* Else, use the non-unknown mach, or EF_SH_UNKNOWN if both are unknown. \
! This can be expressed with | because EF_SH_UNKNOWN is 0. */ \
! : ((mach1) | (mach2))) \
! : (((mach1) == EF_SH3 && (mach2) == EF_SH_DSP) \
! || ((mach1) == EF_SH_DSP && (mach2) == EF_SH3 )) \
? EF_SH3_DSP \
: ((mach1) == EF_SH2E && EF_SH_HAS_FP (mach2)) \
? (mach2) \
: ((mach2) == EF_SH2E && EF_SH_HAS_FP (mach1)) \
? (mach1) \
! : ((EF_GENERIC_SH4_NOFPU (mach1) && EF_SH_HAS_DSP (mach2)) \
! || (EF_GENERIC_SH4_NOFPU (mach2) && EF_SH_HAS_DSP (mach1))) \
? EF_SH4AL_DSP \
: ((mach1) == EF_SH4A_NOFPU && EF_SH_HAS_FP (mach2)) \
? ((mach2) <= EF_SH4A) ? EF_SH4A : (mach2) \
: ((mach2) == EF_SH4A_NOFPU && EF_SH_HAS_FP (mach1)) \
? ((mach1) <= EF_SH4A) ? EF_SH4A : (mach1) \
+ : (EF_GENERIC_SH4_NOFPU (mach1) && EF_SH_HAS_FP (mach2)) \
+ ? ((mach2) < EF_SH4A) ? EF_SH4 : (mach2) \
+ : (EF_GENERIC_SH4_NOFPU (mach2) && EF_SH_HAS_FP (mach1)) \
+ ? ((mach1) < EF_SH4A) ? EF_SH4 : (mach1) \
: (((mach1) == EF_SH2E ? 7 : (mach1)) > ((mach2) == EF_SH2E ? 7 : (mach2)) \
? (mach1) : (mach2)))