m68k: tag floating-point ABI used

This patch adds GNU attribute support to m68k and utilises it to tag the
floating-point calling convention used (hard-float or soft-float). It enables
the linker to ensure linked objects use a consistent floating-point ABI and
allows tools like GDB to infer the ABI used from the ELF file. It is based on
similar work done for PowerPC.

bfd/
	* elf32-m68k.c (m68k_elf_merge_obj_attributes): New function.
	(elf32_m68k_merge_private_bfd_data): Merge GNU attributes.
binutils/
	* readelf.c (display_m68k_gnu_attribute): New function.
	(process_arch_specific): Call display_m68k_gnu_attribute for EM_68K.
gas/
	* config/tc-m68k.c (m68k_elf_gnu_attribute): New function.
	(md_pseudo_table): Handle "gnu_attribute".
	* doc/as.texi: Document GNU attribute for M68K.
include/
	* elf/m68k.h: Add enum for GNU object attribute with floating point
	tag name and values.
ld/
	* testsuite/ld-m68k/attr-gnu-4-0.s: New file.
	* testsuite/ld-m68k/attr-gnu-4-1.s: Likewise.
	* testsuite/ld-m68k/attr-gnu-4-2.s: Likewise.
	* testsuite/ld-m68k/attr-gnu-4-00.d: Likewise.
	* testsuite/ld-m68k/attr-gnu-4-01.d: Likewise.
	* testsuite/ld-m68k/attr-gnu-4-02.d: Likewise.
	* testsuite/ld-m68k/attr-gnu-4-10.d: Likewise.
	* testsuite/ld-m68k/attr-gnu-4-11.d: Likewise.
	* testsuite/ld-m68k/attr-gnu-4-12.d: Likewise.
	* testsuite/ld-m68k/attr-gnu-4-20.d: Likewise.
	* testsuite/ld-m68k/attr-gnu-4-21.d: Likewise.
	* testsuite/ld-m68k/attr-gnu-4-22.d: Likewise.
	* testsuite/ld-m68k/m68k.exp: Run the new tests.
This commit is contained in:
Pat Bernardi 2020-06-25 16:05:38 -04:00 committed by Alan Modra
parent ba9b3ef5ee
commit 85f7484a3a
23 changed files with 263 additions and 1 deletions

View file

@ -15367,6 +15367,44 @@ display_gnu_attribute (unsigned char * p,
return display_tag_value (tag, p, end);
}
static unsigned char *
display_m68k_gnu_attribute (unsigned char * p,
unsigned int tag,
const unsigned char * const end)
{
unsigned int val;
if (tag == Tag_GNU_M68K_ABI_FP)
{
printf (" Tag_GNU_M68K_ABI_FP: ");
if (p == end)
{
printf (_("<corrupt>\n"));
return p;
}
READ_ULEB (val, p, end);
if (val > 3)
printf ("(%#x), ", val);
switch (val & 3)
{
case 0:
printf (_("unspecified hard/soft float\n"));
break;
case 1:
printf (_("hard float\n"));
break;
case 2:
printf (_("soft float\n"));
break;
}
return p;
}
return display_tag_value (tag & 1, p, end);
}
static unsigned char *
display_power_gnu_attribute (unsigned char * p,
unsigned int tag,
@ -19928,6 +19966,10 @@ process_arch_specific (Filedata * filedata)
case EM_NDS32:
return process_nds32_specific (filedata);
case EM_68K:
return process_attributes (filedata, NULL, SHT_GNU_ATTRIBUTES, NULL,
display_m68k_gnu_attribute);
case EM_PPC:
case EM_PPC64:
return process_attributes (filedata, NULL, SHT_GNU_ATTRIBUTES, NULL,