aarch64: handle .variant_pcs directive in gas
authorSzabolcs Nagy <szabolcs.nagy@arm.com>
Thu, 25 Apr 2019 14:06:53 +0000 (15:06 +0100)
committerSzabolcs Nagy <szabolcs.nagy@arm.com>
Fri, 24 May 2019 14:07:42 +0000 (15:07 +0100)
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.

gas/ChangeLog
gas/config/tc-aarch64.c
gas/doc/c-aarch64.texi
gas/testsuite/gas/aarch64/symbol-variant_pcs-1.d [new file with mode: 0644]
gas/testsuite/gas/aarch64/symbol-variant_pcs-1.s [new file with mode: 0644]
gas/testsuite/gas/aarch64/symbol-variant_pcs-2.d [new file with mode: 0644]
gas/testsuite/gas/aarch64/symbol-variant_pcs-2.s [new file with mode: 0644]

index 2fe4a12d9545a142e75b8376efe40b57a8c44b98..ed69e9a8126762aaf3247af39da4062ce5dfe2ce 100644 (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.
index 1f8d94ea1e295782402d0deda298e18627332dd3..3bccfa24ba7412214a176e0ef47c1d3bb12ce9b7 100644 (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}
 };
index 74ffc8f83ed4ce8ba41f455a4be5347b2bdcfbdd..e6630610010744b75fb2b6a3a2cb008d08c9c97a 100644 (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
 
diff --git a/gas/testsuite/gas/aarch64/symbol-variant_pcs-1.d b/gas/testsuite/gas/aarch64/symbol-variant_pcs-1.d
new file mode 100644 (file)
index 0000000..6257ce1
--- /dev/null
@@ -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
diff --git a/gas/testsuite/gas/aarch64/symbol-variant_pcs-1.s b/gas/testsuite/gas/aarch64/symbol-variant_pcs-1.s
new file mode 100644 (file)
index 0000000..aecb9bd
--- /dev/null
@@ -0,0 +1,8 @@
+.text
+.variant_pcs foobar
+func:
+       bl      foobar
+       b       foobar
+
+.data
+.xword foobar
diff --git a/gas/testsuite/gas/aarch64/symbol-variant_pcs-2.d b/gas/testsuite/gas/aarch64/symbol-variant_pcs-2.d
new file mode 100644 (file)
index 0000000..d9b60ac
--- /dev/null
@@ -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
diff --git a/gas/testsuite/gas/aarch64/symbol-variant_pcs-2.s b/gas/testsuite/gas/aarch64/symbol-variant_pcs-2.s
new file mode 100644 (file)
index 0000000..820733b
--- /dev/null
@@ -0,0 +1,4 @@
+.text
+.variant_pcs foo
+foo:
+       ret
This page took 0.031707 seconds and 4 git commands to generate.