From 47d87b8a650de39d42123f3b9083264a3f409eba Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Wed, 7 Jun 2000 03:43:33 +0000 Subject: [PATCH] Get rid of the -1 dummy valued enum in START_RELOC_NUMBERS. Remove duplicate reloc enums in elf32-d[13]0v.c Remove EMPTY_HOWTOs in elf32-i386.c --- include/elf/ChangeLog | 35 +++++++++++++++++++++++++++++++++++ include/elf/alpha.h | 3 +-- include/elf/arc.h | 3 +-- include/elf/arm.h | 2 +- include/elf/avr.h | 3 +-- include/elf/d10v.h | 2 +- include/elf/d30v.h | 2 +- include/elf/fr30.h | 3 +-- include/elf/hppa.h | 3 +-- include/elf/i386.h | 3 +-- include/elf/i960.h | 3 +-- include/elf/ia64.h | 2 +- include/elf/m32r.h | 3 +-- include/elf/m68k.h | 3 +-- include/elf/mcore.h | 3 +-- include/elf/mips.h | 2 +- include/elf/mn10200.h | 2 +- include/elf/mn10300.h | 3 +-- include/elf/pj.h | 3 +-- include/elf/ppc.h | 3 +-- include/elf/reloc-macros.h | 34 ++++++++++++---------------------- include/elf/sh.h | 3 +-- include/elf/sparc.h | 3 +-- include/elf/v850.h | 4 +--- 24 files changed, 69 insertions(+), 61 deletions(-) diff --git a/include/elf/ChangeLog b/include/elf/ChangeLog index ecbae349f..521bd808c 100644 --- a/include/elf/ChangeLog +++ b/include/elf/ChangeLog @@ -1,3 +1,38 @@ +2000-06-06 Alan Modra + + * reloc-macros.h (START_RELOC_NUMBERS): Don't define initial dummy + -1 valued enum. + (RELOC_NUMBER, FAKE_RELOC, EMPTY_RELOC): Append rather than + prepend comma. + (END_RELOC_NUMBERS): Give macro an arg to define as last enum. + + * alpha.h (R_ALPHA_max): Define via END_RELOC_NUMBERS rather than + with EMPTY_RELOC. + * arc.h (R_ARC_max): Likewise. + * avr.h (R_AVR_max): Likewise. + * fr30.h (R_FR30_max): Likewise. + * hppa.h (R_PARISC_UNIMPLEMENTED): Likewise. + * i960.h (R_960_max): Likewise. + * m32r.h (R_M32R_max): Likewise. + * m68k.h (R_68K_max): Likewise. + * mcore.h (R_MCORE_max): Likewise. + * mn10300.h (R_MN10300_MAX): Likewise. + * pj.h (R_PJ_max): Likewise. + * ppc.h (R_PPC_max): Likewise. + * sh.h (R_SH_max): Likewise. + * sparc.h (R_SPARC_max): Likewise. + * v850.h (R_V850_max): Likewise. + + * arm.h (R_ARM_max): Define via END_RELOC_NUMBERS. + * d10v.h (R_D10V_max): Likewise. + * d30v.h (R_D30V_max): Likewise. + * ia64.h (R_IA64_max): Likewise. + * mips.h (R_MIPS_maxext): Likewise. + * mn10200.h (R_MN10200_max): Likewise. + + * i386.h (R_386_max): Remove old RELOC_NUMBER definition, and + define via END_RELOC_NUMBERS. + 2000-06-03 Alan Modra * reloc-macros.h (START_RELOC_NUMBERS): Fix name clash for diff --git a/include/elf/alpha.h b/include/elf/alpha.h index 1ae9d5efd..1f6b377c4 100644 --- a/include/elf/alpha.h +++ b/include/elf/alpha.h @@ -102,7 +102,6 @@ START_RELOC_NUMBERS (elf_alpha_reloc_type) RELOC_NUMBER (R_ALPHA_JMP_SLOT, 26) /* Create PLT entry */ RELOC_NUMBER (R_ALPHA_RELATIVE, 27) /* Adjust by program base */ - EMPTY_RELOC (R_ALPHA_max) -END_RELOC_NUMBERS +END_RELOC_NUMBERS (R_ALPHA_max) #endif /* _ELF_ALPHA_H */ diff --git a/include/elf/arc.h b/include/elf/arc.h index 334b55fa6..c552bf09d 100644 --- a/include/elf/arc.h +++ b/include/elf/arc.h @@ -31,8 +31,7 @@ START_RELOC_NUMBERS (elf_arc_reloc_type) RELOC_NUMBER (R_ARC_32, 1) RELOC_NUMBER (R_ARC_B26, 2) RELOC_NUMBER (R_ARC_B22_PCREL, 3) - EMPTY_RELOC (R_ARC_max) -END_RELOC_NUMBERS +END_RELOC_NUMBERS (R_ARC_max) /* Processor specific flags for the ELF header e_flags field. */ diff --git a/include/elf/arm.h b/include/elf/arm.h index 04c46dea6..049925185 100644 --- a/include/elf/arm.h +++ b/include/elf/arm.h @@ -124,6 +124,6 @@ START_RELOC_NUMBERS (elf_arm_reloc_type) RELOC_NUMBER (R_ARM_RABS32, 253) RELOC_NUMBER (R_ARM_RPC24, 254) RELOC_NUMBER (R_ARM_RBASE, 255) -END_RELOC_NUMBERS +END_RELOC_NUMBERS (R_ARM_max) #endif /* _ELF_ARM_H */ diff --git a/include/elf/avr.h b/include/elf/avr.h index 152745599..c4cb860f3 100644 --- a/include/elf/avr.h +++ b/include/elf/avr.h @@ -52,7 +52,6 @@ START_RELOC_NUMBERS (elf_avr_reloc_type) RELOC_NUMBER (R_AVR_HI8_LDI_PM_NEG, 16) RELOC_NUMBER (R_AVR_HH8_LDI_PM_NEG, 17) RELOC_NUMBER (R_AVR_CALL, 18) - EMPTY_RELOC (R_AVR_max) -END_RELOC_NUMBERS +END_RELOC_NUMBERS (R_AVR_max) #endif /* _ELF_AVR_H */ diff --git a/include/elf/d10v.h b/include/elf/d10v.h index 63b79c801..2e3275074 100644 --- a/include/elf/d10v.h +++ b/include/elf/d10v.h @@ -33,6 +33,6 @@ START_RELOC_NUMBERS (elf_d10v_reloc_type) RELOC_NUMBER (R_D10V_32, 6) RELOC_NUMBER (R_D10V_GNU_VTINHERIT, 7) RELOC_NUMBER (R_D10V_GNU_VTENTRY, 8) -END_RELOC_NUMBERS +END_RELOC_NUMBERS (R_D10V_max) #endif diff --git a/include/elf/d30v.h b/include/elf/d30v.h index adbad1923..c0f3bc86a 100644 --- a/include/elf/d30v.h +++ b/include/elf/d30v.h @@ -37,6 +37,6 @@ START_RELOC_NUMBERS (elf_d30v_reloc_type) RELOC_NUMBER (R_D30V_32, 10) RELOC_NUMBER (R_D30V_32_PCREL, 11) RELOC_NUMBER (R_D30V_32_NORMAL, 12) -END_RELOC_NUMBERS +END_RELOC_NUMBERS (R_D30V_max) #endif diff --git a/include/elf/fr30.h b/include/elf/fr30.h index 223b05297..65ca90755 100644 --- a/include/elf/fr30.h +++ b/include/elf/fr30.h @@ -37,7 +37,6 @@ START_RELOC_NUMBERS (elf_fr30_reloc_type) RELOC_NUMBER (R_FR30_12_PCREL, 10) RELOC_NUMBER (R_FR30_GNU_VTINHERIT, 11) RELOC_NUMBER (R_FR30_GNU_VTENTRY, 12) - EMPTY_RELOC (R_FR30_max) -END_RELOC_NUMBERS +END_RELOC_NUMBERS (R_FR30_max) #endif /* _ELF_FR30_H */ diff --git a/include/elf/hppa.h b/include/elf/hppa.h index 0e45d7451..af326363f 100644 --- a/include/elf/hppa.h +++ b/include/elf/hppa.h @@ -267,8 +267,7 @@ START_RELOC_NUMBERS (elf_hppa_reloc_type) RELOC_NUMBER (R_PARISC_LTOFF_TP16F, 229) RELOC_NUMBER (R_PARISC_LTOFF_TP16WF, 230) RELOC_NUMBER (R_PARISC_LTOFF_TP16DF, 231) - EMPTY_RELOC (R_PARISC_UNIMPLEMENTED) -END_RELOC_NUMBERS +END_RELOC_NUMBERS (R_PARISC_UNIMPLEMENTED) #ifndef RELOC_MACROS_GEN_FUNC typedef enum elf_hppa_reloc_type elf_hppa_reloc_type; diff --git a/include/elf/i386.h b/include/elf/i386.h index 058666172..a8e1bf436 100644 --- a/include/elf/i386.h +++ b/include/elf/i386.h @@ -40,10 +40,9 @@ START_RELOC_NUMBERS (elf_i386_reloc_type) RELOC_NUMBER (R_386_PC16, 21) RELOC_NUMBER (R_386_8, 22) RELOC_NUMBER (R_386_PC8, 23) - RELOC_NUMBER (R_386_max, 24) /* These are GNU extensions to enable C++ vtable garbage collection. */ RELOC_NUMBER (R_386_GNU_VTINHERIT, 250) RELOC_NUMBER (R_386_GNU_VTENTRY, 251) -END_RELOC_NUMBERS +END_RELOC_NUMBERS (R_386_max) #endif diff --git a/include/elf/i960.h b/include/elf/i960.h index 3e60289ea..2c7a143c6 100644 --- a/include/elf/i960.h +++ b/include/elf/i960.h @@ -32,7 +32,6 @@ START_RELOC_NUMBERS (elf_i960_reloc_type) RELOC_NUMBER (R_960_OPTCALL, 5) RELOC_NUMBER (R_960_OPTCALLX, 6) RELOC_NUMBER (R_960_OPTCALLXA, 7) - EMPTY_RELOC (R_960_max) -END_RELOC_NUMBERS +END_RELOC_NUMBERS (R_960_max) #endif /* _ELF_I960_H */ diff --git a/include/elf/ia64.h b/include/elf/ia64.h index 9d50030e5..15847c80f 100644 --- a/include/elf/ia64.h +++ b/include/elf/ia64.h @@ -167,6 +167,6 @@ START_RELOC_NUMBERS (elf_ia64_reloc_type) RELOC_NUMBER (R_IA64_LTOFF_TP22, 0x9a) /* @ltoff(sym-TP+add), add imm22 ## */ FAKE_RELOC (R_IA64_MAX_RELOC_CODE, 0x9a) -END_RELOC_NUMBERS +END_RELOC_NUMBERS (R_IA64_max) #endif /* _ELF_IA64_H */ diff --git a/include/elf/m32r.h b/include/elf/m32r.h index a12ae16ae..e4b5dbfc5 100644 --- a/include/elf/m32r.h +++ b/include/elf/m32r.h @@ -37,8 +37,7 @@ START_RELOC_NUMBERS (elf_m32r_reloc_type) RELOC_NUMBER (R_M32R_SDA16, 10) RELOC_NUMBER (R_M32R_GNU_VTINHERIT, 11) RELOC_NUMBER (R_M32R_GNU_VTENTRY, 12) - EMPTY_RELOC (R_M32R_max) -END_RELOC_NUMBERS +END_RELOC_NUMBERS (R_M32R_max) /* Processor specific section indices. These sections do not actually exist. Symbols with a st_shndx field corresponding to one of these diff --git a/include/elf/m68k.h b/include/elf/m68k.h index e2d51ef4a..2c44a58a6 100644 --- a/include/elf/m68k.h +++ b/include/elf/m68k.h @@ -50,8 +50,7 @@ START_RELOC_NUMBERS (elf_m68k_reloc_type) /* These are GNU extensions to enable C++ vtable garbage collection. */ RELOC_NUMBER (R_68K_GNU_VTINHERIT, 23) RELOC_NUMBER (R_68K_GNU_VTENTRY, 24) - EMPTY_RELOC (R_68K_max) -END_RELOC_NUMBERS +END_RELOC_NUMBERS (R_68K_max) #define EF_CPU32 0x00810000 diff --git a/include/elf/mcore.h b/include/elf/mcore.h index 62a88c909..b96ab60a0 100644 --- a/include/elf/mcore.h +++ b/include/elf/mcore.h @@ -38,8 +38,7 @@ START_RELOC_NUMBERS (elf_mcore_reloc_type) RELOC_NUMBER (R_MCORE_COPY, 10) RELOC_NUMBER (R_MCORE_GLOB_DAT, 11) RELOC_NUMBER (R_MCORE_JUMP_SLOT, 12) - EMPTY_RELOC (R_MCORE_max) -END_RELOC_NUMBERS +END_RELOC_NUMBERS (R_MCORE_max) /* Section Attributes. */ #define SHF_MCORE_NOREAD 0x80000000 diff --git a/include/elf/mips.h b/include/elf/mips.h index e5e37393d..f7f03d94f 100644 --- a/include/elf/mips.h +++ b/include/elf/mips.h @@ -84,7 +84,7 @@ START_RELOC_NUMBERS (elf_mips_reloc_type) /* These are GNU extensions to enable C++ vtable garbage collection. */ RELOC_NUMBER (R_MIPS_GNU_VTINHERIT, 253) RELOC_NUMBER (R_MIPS_GNU_VTENTRY, 254) -END_RELOC_NUMBERS +END_RELOC_NUMBERS (R_MIPS_maxext) /* Processor specific flags for the ELF header e_flags field. */ diff --git a/include/elf/mn10200.h b/include/elf/mn10200.h index 5e29e0ad2..d7c102e00 100644 --- a/include/elf/mn10200.h +++ b/include/elf/mn10200.h @@ -34,6 +34,6 @@ START_RELOC_NUMBERS (elf_mn10200_reloc_type) RELOC_NUMBER (R_MN10200_PCREL8, 5) RELOC_NUMBER (R_MN10200_PCREL16, 6) RELOC_NUMBER (R_MN10200_PCREL24, 7) -END_RELOC_NUMBERS +END_RELOC_NUMBERS (R_MN10200_max) #endif /* _ELF_MN10200_H */ diff --git a/include/elf/mn10300.h b/include/elf/mn10300.h index 4e7fce5c8..29fea0f69 100644 --- a/include/elf/mn10300.h +++ b/include/elf/mn10300.h @@ -36,8 +36,7 @@ START_RELOC_NUMBERS (elf_mn10300_reloc_type) RELOC_NUMBER (R_MN10300_GNU_VTINHERIT, 7) RELOC_NUMBER (R_MN10300_GNU_VTENTRY, 8) RELOC_NUMBER (R_MN10300_24, 9) - EMPTY_RELOC (R_MN10300_MAX) -END_RELOC_NUMBERS +END_RELOC_NUMBERS (R_MN10300_MAX) /* Machine variant if we know it. This field was invented at Cygnus, but it is hoped that other vendors will adopt it. If some standard diff --git a/include/elf/pj.h b/include/elf/pj.h index 6bb830652..07d4583b0 100644 --- a/include/elf/pj.h +++ b/include/elf/pj.h @@ -35,8 +35,7 @@ START_RELOC_NUMBERS (elf_pj_reloc_type) RELOC_NUMBER (R_PJ_CODE_HI16, 14) RELOC_NUMBER (R_PJ_GNU_VTINHERIT, 15) RELOC_NUMBER (R_PJ_GNU_VTENTRY, 16) - EMPTY_RELOC (R_PJ_max) -END_RELOC_NUMBERS +END_RELOC_NUMBERS (R_PJ_max) #define EF_PICOJAVA_ARCH 0x0000000f #define EF_PICOJAVA_NEWCALLS 0x00000010 diff --git a/include/elf/ppc.h b/include/elf/ppc.h index b3116d8ad..b37be7c33 100644 --- a/include/elf/ppc.h +++ b/include/elf/ppc.h @@ -96,8 +96,7 @@ START_RELOC_NUMBERS (elf_ppc_reloc_type) that may still be in object files. */ RELOC_NUMBER (R_PPC_TOC16, 255) - EMPTY_RELOC (R_PPC_max) -END_RELOC_NUMBERS +END_RELOC_NUMBERS (R_PPC_max) /* Processor specific flags for the ELF header e_flags field. */ diff --git a/include/elf/reloc-macros.h b/include/elf/reloc-macros.h index 9c27e8930..d00614746 100644 --- a/include/elf/reloc-macros.h +++ b/include/elf/reloc-macros.h @@ -27,20 +27,20 @@ START_RELOC_NUMBERS (foo) RELOC_NUMBER (R_foo_NONE, 0) RELOC_NUMBER (R_foo_32, 1) - FAKE_RELOC (R_foo_illegal, 2) - EMPTY_RELOC (R_foo_max) - END_RELOC_NUMBERS + EMPTY_RELOC (R_foo_good) + FAKE_RELOC (R_foo_illegal, 9) + END_RELOC_NUMBERS (R_foo_count) Then the following will be produced by default (ie if RELOC_MACROS_GEN_FUNC is *not* defined). enum foo { - foo = -1, R_foo_NONE = 0, R_foo_32 = 1, - R_foo_illegal = 2, - R_foo_max + R_foo_good, + R_foo_illegal = 9, + R_foo_count }; If RELOC_MACROS_GEN_FUNC *is* defined, then instead the @@ -87,7 +87,7 @@ name (rtype) \ #define FAKE_RELOC(name, number) #define EMPTY_RELOC(name) -#define END_RELOC_NUMBERS \ +#define END_RELOC_NUMBERS(name) \ default: return NULL; \ } \ } @@ -95,21 +95,11 @@ name (rtype) \ #else /* Default to generating enum. */ -/* Some compilers cannot cope with an enum that ends with a trailing - comma, so START_RELOC_NUMBERS creates a fake reloc entry, (initialised - to -1 so that the first real entry will still default to 0). Further - entries then prepend a comma to their definitions, creating a list - of enumerator entries that will satisfy these compilers. */ -#if defined (__STDC__) || defined (ALMOST_STDC) -#define START_RELOC_NUMBERS(name) enum name { _##name = -1 -#else -#define START_RELOC_NUMBERS(name) enum name { _/**/name = -1 -#endif - -#define RELOC_NUMBER(name, number) , name = number -#define FAKE_RELOC(name, number) , name = number -#define EMPTY_RELOC(name) , name -#define END_RELOC_NUMBERS }; +#define START_RELOC_NUMBERS(name) enum name { +#define RELOC_NUMBER(name, number) name = number, +#define FAKE_RELOC(name, number) name = number, +#define EMPTY_RELOC(name) name, +#define END_RELOC_NUMBERS(name) name }; #endif diff --git a/include/elf/sh.h b/include/elf/sh.h index 2b132c1cb..ae096984c 100644 --- a/include/elf/sh.h +++ b/include/elf/sh.h @@ -78,7 +78,6 @@ START_RELOC_NUMBERS (elf_sh_reloc_type) RELOC_NUMBER (R_SH_GNU_VTENTRY, 35) RELOC_NUMBER (R_SH_LOOP_START, 36) RELOC_NUMBER (R_SH_LOOP_END, 37) - EMPTY_RELOC (R_SH_max) -END_RELOC_NUMBERS +END_RELOC_NUMBERS (R_SH_max) #endif diff --git a/include/elf/sparc.h b/include/elf/sparc.h index 390e4a844..7b2380f7c 100644 --- a/include/elf/sparc.h +++ b/include/elf/sparc.h @@ -134,8 +134,7 @@ START_RELOC_NUMBERS (elf_sparc_reloc_type) RELOC_NUMBER (R_SPARC_GNU_VTINHERIT, 250) RELOC_NUMBER (R_SPARC_GNU_VTENTRY, 251) - EMPTY_RELOC (R_SPARC_max) -END_RELOC_NUMBERS +END_RELOC_NUMBERS (R_SPARC_max) /* Relocation macros. */ diff --git a/include/elf/v850.h b/include/elf/v850.h index d443b7fdc..45b0e39bc 100644 --- a/include/elf/v850.h +++ b/include/elf/v850.h @@ -77,9 +77,7 @@ START_RELOC_NUMBERS (v850_reloc_type) /* END CYGNUS LOCAL */ RELOC_NUMBER (R_V850_GNU_VTINHERIT, 23) RELOC_NUMBER (R_V850_GNU_VTENTRY, 24) - - EMPTY_RELOC (R_V850_max) -END_RELOC_NUMBERS +END_RELOC_NUMBERS (R_V850_max) /* Processor specific section indices. These sections do not actually