aarch64: handle .variant_pcs directive in gas

In ELF objects the specified symbol is marked with STO_AARCH64_VARIANT_PCS.

gas/ChangeLog:

	* config/tc-aarch64.c (s_variant_pcs): New function.
	* doc/c-aarch64.texi: Document .variant_pcs.
	* testsuite/gas/aarch64/symbol-variant_pcs-1.d: New test.
	* testsuite/gas/aarch64/symbol-variant_pcs-1.s: New test.
	* testsuite/gas/aarch64/symbol-variant_pcs-2.d: New test.
	* testsuite/gas/aarch64/symbol-variant_pcs-2.s: New test.
This commit is contained in:
Szabolcs Nagy 2019-04-25 15:06:53 +01:00
parent 2301ed1c9a
commit f166ae0188
7 changed files with 69 additions and 0 deletions

View File

@ -1,3 +1,12 @@
2019-05-24 Szabolcs Nagy <szabolcs.nagy@arm.com>
* config/tc-aarch64.c (s_variant_pcs): New function.
* doc/c-aarch64.texi: Document .variant_pcs.
* testsuite/gas/aarch64/symbol-variant_pcs-1.d: New test.
* testsuite/gas/aarch64/symbol-variant_pcs-1.s: New test.
* testsuite/gas/aarch64/symbol-variant_pcs-2.d: New test.
* testsuite/gas/aarch64/symbol-variant_pcs-2.s: New test.
2019-05-24 Alan Modra <amodra@gmail.com>
* po/POTFILES.in: Regenerate.

View File

@ -1936,6 +1936,28 @@ s_aarch64_elf_cons (int nbytes)
demand_empty_rest_of_line ();
}
/* Mark symbol that it follows a variant PCS convention. */
static void
s_variant_pcs (int ignored ATTRIBUTE_UNUSED)
{
char *name;
char c;
symbolS *sym;
asymbol *bfdsym;
elf_symbol_type *elfsym;
c = get_symbol_name (&name);
if (!*name)
as_bad (_("Missing symbol name in directive"));
sym = symbol_find_or_make (name);
restore_line_pointer (c);
demand_empty_rest_of_line ();
bfdsym = symbol_get_bfdsym (sym);
elfsym = elf_symbol_from (bfd_asymbol_bfd (bfdsym), bfdsym);
gas_assert (elfsym);
elfsym->internal_elf_sym.st_other |= STO_AARCH64_VARIANT_PCS;
}
#endif /* OBJ_ELF */
/* Output a 32-bit word, but mark as an instruction. */
@ -2082,6 +2104,7 @@ const pseudo_typeS md_pseudo_table[] = {
{"long", s_aarch64_elf_cons, 4},
{"xword", s_aarch64_elf_cons, 8},
{"dword", s_aarch64_elf_cons, 8},
{"variant_pcs", s_variant_pcs, 0},
#endif
{0, 0, 0}
};

View File

@ -439,6 +439,12 @@ should only be done if it is really necessary.
@c VVVVVVVVVVVVVVVVVVVVVVVVVV
@cindex @code{.variant_pcs} directive, AArch64
@item .variant_pcs @var{symbol}
This directive marks @var{symbol} referencing a function that may
follow a variant procedure call standard with different register
usage convention from the base procedure call standard.
@c WWWWWWWWWWWWWWWWWWWWWWWWWW
@c XXXXXXXXXXXXXXXXXXXXXXXXXX

View File

@ -0,0 +1,10 @@
#objdump: -t
.*: file format .*
SYMBOL TABLE:
0+ l d \.text 0+ \.text
0+ l d \.data 0+ \.data
0+ l d \.bss 0+ \.bss
0+ l \.text 0+ func
0+ \*UND\* 0+ 0x80 foobar

View File

@ -0,0 +1,8 @@
.text
.variant_pcs foobar
func:
bl foobar
b foobar
.data
.xword foobar

View File

@ -0,0 +1,9 @@
#objdump: -t
.*: file format .*
SYMBOL TABLE:
0+ l d \.text 0+ \.text
0+ l d \.data 0+ \.data
0+ l d \.bss 0+ \.bss
0+ l \.text 0+ 0x80 foo

View File

@ -0,0 +1,4 @@
.text
.variant_pcs foo
foo:
ret