gas: make .lcomm to accept an optional aligmnet in eBPF targets
authorJose E. Marchesi <jose.marchesi@oracle.com>
Fri, 19 Jul 2019 13:35:02 +0000 (15:35 +0200)
committerJose E. Marchesi <jose.marchesi@oracle.com>
Fri, 19 Jul 2019 13:35:02 +0000 (15:35 +0200)
Tested in a x86_64 host.

gas/ChangeLog:

2019-07-19  Jose E. Marchesi  <jose.marchesi@oracle.com>

* config/tc-bpf.c (pe_lcomm_internal): Adapted from tc-i386.c.
(pe_lcomm): Likewise.
(md_pseudo_table): Use pe_lcomm to implement .lcomm.

gas/ChangeLog
gas/config/tc-bpf.c

index fa190309b6bf06a70269b146e7122f554193698a..e33802b0f6933b9df2464186d57be3eb0147ff01 100644 (file)
@@ -1,3 +1,9 @@
+2019-07-19  Jose E. Marchesi  <jose.marchesi@oracle.com>
+
+       * config/tc-bpf.c (pe_lcomm_internal): Adapted from tc-i386.c.
+       (pe_lcomm): Likewise.
+       (md_pseudo_table): Use pe_lcomm to implement .lcomm.
+
 2019-07-19  Richard Sandiford  <richard.sandiford@arm.com>
 
        * doc/c-aarch64.texi: Remame the +bitperm extension to +sve2-bitperm.
index 4b92b7794f377919799fea8dbed122ca43498891..d2da2feafb00707fadec05e836fc407b55fe8321 100644 (file)
@@ -35,16 +35,58 @@ const char line_separator_chars[] = "`";
 const char EXP_CHARS[]            = "eE";
 const char FLT_CHARS[]            = "fFdD";
 
+/* Like s_lcomm_internal in gas/read.c but the alignment string
+   is allowed to be optional.  */
+
+static symbolS *
+pe_lcomm_internal (int needs_align, symbolS *symbolP, addressT size)
+{
+  addressT align = 0;
+
+  SKIP_WHITESPACE ();
+
+  if (needs_align
+      && *input_line_pointer == ',')
+    {
+      align = parse_align (needs_align - 1);
+
+      if (align == (addressT) -1)
+       return NULL;
+    }
+  else
+    {
+      if (size >= 8)
+       align = 3;
+      else if (size >= 4)
+       align = 2;
+      else if (size >= 2)
+       align = 1;
+      else
+       align = 0;
+    }
+
+  bss_alloc (symbolP, size, align);
+  return symbolP;
+}
+
+static void
+pe_lcomm (int needs_align)
+{
+  s_comm_internal (needs_align * 2, pe_lcomm_internal);
+}
+
 /* The target specific pseudo-ops which we support.  */
 const pseudo_typeS md_pseudo_table[] =
 {
     { "half",      cons,              2 },
     { "word",      cons,              4 },
     { "dword",     cons,              8 },
-    { "lcomm",    s_lcomm,           1 },
+    { "lcomm",    pe_lcomm,          1 },
     { NULL,        NULL,              0 }
 };
 
+\f
+
 /* ISA handling.  */
 static CGEN_BITSET *bpf_isa;
 
This page took 0.027301 seconds and 4 git commands to generate.