[Patch] Gas support for MIPS Compact EH
Maciej W. Rozycki
macro@codesourcery.com
Wed Feb 5 22:38:00 GMT 2014
On Tue, 4 Feb 2014, Moore, Catherine wrote:
> I finally got some time to work on fixing up (with some help from Bernd)
> the binutils submission for compact EH. Hopefully, the review comments
> have been addressed.
>
> The current patch has been expanded to include all of binutils.
>
> As a reminder, the spec is available here:
> https://github.com/MentorEmbedded/cxx-abi/blob/master/MIPSCompactEH.pdf
Just a couple of minor nits I found skimming over the change. These of
course by no means invalidate your excellent work!
> diff --git a/gas/config/tc-mips.c b/gas/config/tc-mips.c
> index 34f1bf0..90688f1 100644
> --- a/gas/config/tc-mips.c
> +++ b/gas/config/tc-mips.c
> @@ -18249,3 +18256,13 @@ tc_mips_regname_to_dw2regnum (char *regname)
>
> return regnum;
> }
> +
> +#if defined (OBJ_ELF)
> +bfd_reloc_code_real_type
> +mips_cfi_reloc_for_encoding (int encoding)
> +{
> + if ((encoding & 0x70) == DW_EH_PE_datarel)
> + return BFD_RELOC_GPREL32;
> + return BFD_RELOC_32_PCREL;
> +}
> +#endif
No need to check for OBJ_ELF anymore, we don't support non-ELF targets
these days (cf. commit f3ded42a5d397a8dd1548e68a647c690088d3fbd).
> diff --git a/gas/config/tc-mips.h b/gas/config/tc-mips.h
> index c7eaa04..a300062 100644
> --- a/gas/config/tc-mips.h
> +++ b/gas/config/tc-mips.h
> @@ -190,4 +192,18 @@ extern int tc_mips_regname_to_dw2regnum (char *regname);
> #define DWARF2_DEFAULT_RETURN_COLUMN 31
> #define DWARF2_CIE_DATA_ALIGNMENT (-4)
>
> +#if defined (OBJ_ELF)
> +
> +#define tc_cfi_reloc_for_encoding mips_cfi_reloc_for_encoding
> +extern bfd_reloc_code_real_type mips_cfi_reloc_for_encoding (int encoding);
> +
> +#define tc_cfi_special_encoding(e) \
> + ((e) == (DW_EH_PE_sdata4 | DW_EH_PE_datarel | DW_EH_PE_indirect) \
> + || (e) == (DW_EH_PE_sdata4 | DW_EH_PE_pcrel))
> +
> +#define tc_compact_eh_opcode_stop 0x5c
> +#define tc_compact_eh_opcode_pad 0x5f
> +
> +#endif /* OBJ_ELF */
> +
> #endif /* TC_MIPS */
Likewise.
> diff --git a/ld/emultempl/mipself.em b/ld/emultempl/mipself.em
> index 02043b7..252af0f 100644
> --- a/ld/emultempl/mipself.em
> +++ b/ld/emultempl/mipself.em
> @@ -252,11 +253,13 @@ EOF
> PARSE_AND_LIST_PROLOGUE='
> #define OPTION_INSN32 301
> #define OPTION_NO_INSN32 (OPTION_INSN32 + 1)
> +#define OPTION_PCREL_EH_RELOC 303
> '
(OPTION_NO_INSN32 + 1) please instead -- this allows easy option
insertion and removal without the need to renumber options or leaving
holes behind.
Maciej
More information about the Binutils
mailing list