RISC-V: Don't generate the ELF privilege attributes when no CSR are used.
[deliverable/binutils-gdb.git] / gas / config / tc-score.c
index 648e0d22ebb1244c59d2e9d9289916c03d3b325d..72c5de8926c24d7575214cde76ee86fbeb557c7b 100644 (file)
@@ -1,5 +1,5 @@
 /* tc-score.c -- Assembler for Score
-   Copyright (C) 2006-2019 Free Software Foundation, Inc.
+   Copyright (C) 2006-2020 Free Software Foundation, Inc.
    Contributed by:
    Brain.lin (brain.lin@sunplusct.com)
    Mei Ligang (ligang@sunnorth.com.cn)
@@ -4537,9 +4537,10 @@ s3_do_macro_bcmp (char *str)
              if (s3_append_insn (append_str, TRUE) == (int) s3_FAIL)
                goto out;
              if ((inst_main.instruction & 0x3e00007e) == 0x0000004c)
-               sprintf (append_str, "beq %s", keep_data);
+               memcpy (append_str, "beq ", 4);
              else
-               sprintf (append_str, "bne %s", keep_data);
+               memcpy (append_str, "bne ", 4);
+             memmove (append_str + 4, keep_data, strlen (keep_data) + 1);
              if (s3_append_insn (append_str, TRUE) == (int) s3_FAIL)
                goto out;
            }
@@ -4570,9 +4571,10 @@ s3_do_macro_bcmp (char *str)
          memcpy (&inst_expand[0], &s3_inst, sizeof (struct s3_score_it));
 
          if ((inst_main.instruction & 0x3e00007e) == 0x0000004c)
-           sprintf (append_str, "beq %s", keep_data);
+           memcpy (append_str, "beq ", 4);
          else
-           sprintf (append_str, "bne %s", keep_data);
+           memcpy (append_str, "bne ", 4);
+         memmove (append_str + 4, keep_data, strlen (keep_data) + 1);
          if (s3_append_insn (append_str, FALSE) == (int) s3_FAIL)
            goto out;
          memcpy (&inst_expand[1], &s3_inst, sizeof (struct s3_score_it));
@@ -4685,9 +4687,10 @@ s3_do_macro_bcmpz (char *str)
              if (s3_append_insn (append_str, TRUE) == (int) s3_FAIL)
                goto out;
              if ((inst_main.instruction & 0x3e00007e) == 0x0000004c)
-               sprintf (append_str, "beq %s", keep_data);
+               memcpy (append_str, "beq ", 4);
              else
-               sprintf (append_str, "bne %s", keep_data);
+               memcpy (append_str, "bne ", 4);
+             memmove (append_str + 4, keep_data, strlen (keep_data) + 1);
              if (s3_append_insn (append_str, TRUE) == (int) s3_FAIL)
                goto out;
             }
@@ -4717,9 +4720,10 @@ s3_do_macro_bcmpz (char *str)
            goto out;
          memcpy (&inst_expand[0], &s3_inst, sizeof (struct s3_score_it));
          if ((inst_main.instruction & 0x3e00007e) == 0x0000004c)
-           sprintf (append_str, "beq %s", keep_data);
+           memcpy (append_str, "beq ", 4);
          else
-           sprintf (append_str, "bne %s", keep_data);
+           memcpy (append_str, "bne ", 4);
+         memmove (append_str + 4, keep_data, strlen (keep_data) + 1);
          if (s3_append_insn (append_str, FALSE) == (int) s3_FAIL)
            goto out;
          memcpy (&inst_expand[1], &s3_inst, sizeof (struct s3_score_it));
@@ -5300,7 +5304,7 @@ s3_pic_need_relax (symbolS *sym, asection *segtype)
   linkonce = FALSE;
   if (symsec != segtype && ! S_IS_LOCAL (sym))
     {
-      if ((bfd_get_section_flags (stdoutput, symsec) & SEC_LINK_ONCE) != 0)
+      if ((bfd_section_flags (symsec) & SEC_LINK_ONCE) != 0)
        linkonce = TRUE;
 
       /* The GNU toolchain uses an extension for ELF: a section
@@ -5546,7 +5550,7 @@ static void
 s3_score_s_section (int ignore)
 {
   obj_elf_section (ignore);
-  if ((bfd_get_section_flags (stdoutput, now_seg) & SEC_CODE) != 0)
+  if ((bfd_section_flags (now_seg) & SEC_CODE) != 0)
     record_alignment (now_seg, 2);
 
 }
@@ -5569,14 +5573,16 @@ s3_s_change_sec (int sec)
     {
     case 'r':
       seg = subseg_new (s3_RDATA_SECTION_NAME, (subsegT) get_absolute_expression ());
-      bfd_set_section_flags (stdoutput, seg, (SEC_ALLOC | SEC_LOAD | SEC_READONLY | SEC_RELOC | SEC_DATA));
+      bfd_set_section_flags (seg, (SEC_ALLOC | SEC_LOAD | SEC_READONLY
+                                  | SEC_RELOC | SEC_DATA));
       if (strcmp (TARGET_OS, "elf") != 0)
         record_alignment (seg, 4);
       demand_empty_rest_of_line ();
       break;
     case 's':
       seg = subseg_new (".sdata", (subsegT) get_absolute_expression ());
-      bfd_set_section_flags (stdoutput, seg, SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_DATA);
+      bfd_set_section_flags (seg, (SEC_ALLOC | SEC_LOAD | SEC_RELOC
+                                  | SEC_DATA | SEC_SMALL_DATA));
       if (strcmp (TARGET_OS, "elf") != 0)
         record_alignment (seg, 4);
       demand_empty_rest_of_line ();
@@ -5685,17 +5691,10 @@ s3_s_score_ent (int aent)
   if (ISDIGIT (*input_line_pointer) || *input_line_pointer == '-')
     s3_get_number ();
 
-#ifdef BFD_ASSEMBLER
-  if ((bfd_get_section_flags (stdoutput, now_seg) & SEC_CODE) != 0)
+  if ((bfd_section_flags (now_seg) & SEC_CODE) != 0)
     maybe_text = 1;
   else
     maybe_text = 0;
-#else
-  if (now_seg != data_section && now_seg != bss_section)
-    maybe_text = 1;
-  else
-    maybe_text = 0;
-#endif
   if (!maybe_text)
     as_warn (_(".ent or .aent not in text section."));
   if (!aent && s3_cur_proc_ptr)
@@ -5794,17 +5793,10 @@ s3_s_score_end (int x ATTRIBUTE_UNUSED)
   else
     p = NULL;
 
-#ifdef BFD_ASSEMBLER
-  if ((bfd_get_section_flags (stdoutput, now_seg) & SEC_CODE) != 0)
-    maybe_text = 1;
-  else
-    maybe_text = 0;
-#else
-  if (now_seg != data_section && now_seg != bss_section)
+  if ((bfd_section_flags (now_seg) & SEC_CODE) != 0)
     maybe_text = 1;
   else
     maybe_text = 0;
-#endif
 
   if (!maybe_text)
     as_warn (_(".end not in text section"));
@@ -6128,15 +6120,14 @@ s3_s_score_lcomm (int bytes_p)
   if (OUTPUT_FLAVOR == bfd_target_ecoff_flavour || OUTPUT_FLAVOR == bfd_target_elf_flavour)
     {
       /* For Score and Alpha ECOFF or ELF, small objects are put in .sbss.  */
-      if ((unsigned)temp <= bfd_get_gp_size (stdoutput))
-        {
-          bss_seg = subseg_new (".sbss", 1);
-          seg_info (bss_seg)->bss = 1;
-#ifdef BFD_ASSEMBLER
-          if (!bfd_set_section_flags (stdoutput, bss_seg, SEC_ALLOC))
-            as_warn (_("error setting flags for \".sbss\": %s"), bfd_errmsg (bfd_get_error ()));
-#endif
-        }
+      if ((unsigned) temp <= bfd_get_gp_size (stdoutput))
+       {
+         bss_seg = subseg_new (".sbss", 1);
+         seg_info (bss_seg)->bss = 1;
+         if (!bfd_set_section_flags (bss_seg, SEC_ALLOC | SEC_SMALL_DATA))
+           as_warn (_("error setting flags for \".sbss\": %s"),
+                    bfd_errmsg (bfd_get_error ()));
+       }
     }
 #endif
 
@@ -6214,12 +6205,8 @@ s3_s_score_lcomm (int bytes_p)
 
   if (
 #if (defined (OBJ_AOUT) || defined (OBJ_MAYBE_AOUT))
-#ifdef BFD_ASSEMBLER
       (OUTPUT_FLAVOR != bfd_target_aout_flavour
        || (S_GET_OTHER (symbolP) == 0 && S_GET_DESC (symbolP) == 0)) &&
-#else
-      (S_GET_OTHER (symbolP) == 0 && S_GET_DESC (symbolP) == 0) &&
-#endif
 #endif
       (S_GET_SEGMENT (symbolP) == bss_seg || (!S_IS_DEFINED (symbolP) && S_GET_VALUE (symbolP) == 0)))
     {
@@ -6538,8 +6525,8 @@ s3_begin (void)
   seg = now_seg;
   subseg = now_subseg;
   s3_pdr_seg = subseg_new (".pdr", (subsegT) 0);
-  (void)bfd_set_section_flags (stdoutput, s3_pdr_seg, SEC_READONLY | SEC_RELOC | SEC_DEBUGGING);
-  (void)bfd_set_section_alignment (stdoutput, s3_pdr_seg, 2);
+  bfd_set_section_flags (s3_pdr_seg, SEC_READONLY | SEC_RELOC | SEC_DEBUGGING);
+  bfd_set_section_alignment (s3_pdr_seg, 2);
   subseg_set (seg, subseg);
 
   if (s3_USE_GLOBAL_POINTER_OPT)
@@ -7076,7 +7063,7 @@ s3_pcrel_from (fixS * fixP)
 static valueT
 s3_section_align (segT segment ATTRIBUTE_UNUSED, valueT size)
 {
-  int align = bfd_get_section_alignment (stdoutput, segment);
+  int align = bfd_section_alignment (segment);
   return ((size + (1 << align) - 1) & -(1 << align));
 }
 
This page took 0.025674 seconds and 4 git commands to generate.