2019年1月24日木曜日

Renesas V850 64bit Linux版gccコンパイラの、本家との差分をとった

Renesas V850 64bit Linux版gccコンパイラ - Qiitaに、以下の記述があったので、公開されている変更後ソースコード本家のソースコードの差分をとってみた。

というわけで,ルネサスさんのサイトの binutilsを使用する方が良いと判断しました.
最初からそうすればよかったのですが,ルネサスさんのサイトのbinutilsはビルドエラーが発生するので,GNUサイトから取得していたという経緯があります.

いずれにせよ,発生したコンパイルエラーは,それほど難しいものではないので,強引に修正しビルドを通しました.本 binutilsを使用することで,bcond 問題も -msoft-float 問題も無事解決できました!

差分は以下の通り。

diff --git a/binutils/objcopy.c b/binutils/objcopy.c
index 14f6b96..e4ee7e6 100644
--- a/binutils/objcopy.c
+++ b/binutils/objcopy.c
@@ -1890,7 +1890,8 @@ copy_object (bfd *ibfd, bfd *obfd, const bfd_arch_info_type *input_arch)
        /* Umm, not sure what to do in this case.  */
        debuglink_vma = 0x1000;
 
-         bfd_set_section_vma (obfd, gnu_debuglink_section, debuglink_vma);
+         int tmp = bfd_set_section_vma (obfd, gnu_debuglink_section, debuglink_vma);
+              if (tmp == FALSE) return 0;
        }
    }
     }
diff --git a/gas/config/obj-elf.c b/gas/config/obj-elf.c
index 3377261..6d74846 100644
--- a/gas/config/obj-elf.c
+++ b/gas/config/obj-elf.c
@@ -1937,7 +1937,8 @@ obj_elf_init_stab_section (segT seg)
 
   /* Force the section to align to a longword boundary.  Without this,
      UnixWare ar crashes.  */
-  bfd_set_section_alignment (stdoutput, seg, 2);
+  int tmp = bfd_set_section_alignment (stdoutput, seg, 2);
+  if (tmp == FALSE) return;
 
   /* Make space for this first symbol.  */
   p = frag_more (12);
diff --git a/gas/config/tc-v850.c b/gas/config/tc-v850.c
index 8ac805b..5c4a029 100644
--- a/gas/config/tc-v850.c
+++ b/gas/config/tc-v850.c
@@ -238,7 +238,8 @@ do_v850_seg (int i, subsegT sub)
       bfd_set_section_flags (stdoutput, seg->s, seg->flags);
       if ((seg->flags & SEC_LOAD) == 0)
    seg_info (seg->s)->bss = 1;
-      bfd_set_section_alignment (stdoutput, seg->s, 2); 
+      int tmp = bfd_set_section_alignment (stdoutput, seg->s, 2); 
+      if (tmp == TRUE) return;
     }
 }
 
@@ -3747,7 +3748,8 @@ v850_md_end (void)
 
   note_sec = subseg_new (V850_NOTE_SECNAME, 0);
   bfd_set_section_flags (stdoutput, note_sec, SEC_HAS_CONTENTS | SEC_READONLY | SEC_MERGE);
-  bfd_set_section_alignment (stdoutput, note_sec, 2);
+  int tmp = bfd_set_section_alignment (stdoutput, note_sec, 2);
+  if (tmp == FALSE) return;
 
   /* Provide default values for all of the notes.  */
   for (id = V850_NOTE_ALIGNMENT; id <= NUM_V850_NOTES; id++)
diff --git a/gas/subsegs.c b/gas/subsegs.c
index 69f837b..2b90858 100644
--- a/gas/subsegs.c
+++ b/gas/subsegs.c
@@ -67,7 +67,8 @@ subseg_change (register segT seg, register int subseg)
     {
       seginfo = (segment_info_type *) xcalloc (1, sizeof (*seginfo));
       seginfo->bfd_section = seg;
-      bfd_set_section_userdata (stdoutput, seg, seginfo);
+      int tmp = bfd_set_section_userdata (stdoutput, seg, seginfo);
+      if (tmp == TRUE) return;
     }
 }
  
@@ -169,7 +170,8 @@ subseg_get (const char *segname, int force_new)
       secptr->output_section = secptr;
       seginfo = (segment_info_type *) xcalloc (1, sizeof (*seginfo));
       seginfo->bfd_section = secptr;
-      bfd_set_section_userdata (stdoutput, secptr, seginfo);
+      int tmp = bfd_set_section_userdata (stdoutput, secptr, seginfo);
+      if (tmp == TRUE) return secptr;
     }
   return secptr;
 }
diff --git a/gas/write.c b/gas/write.c
index 745abe6..f2887c3 100644
--- a/gas/write.c
+++ b/gas/write.c
@@ -362,8 +362,10 @@ record_alignment (/* Segment to which alignment pertains.  */
   if (seg == absolute_section)
     return;
 
-  if ((unsigned int) align > bfd_get_section_alignment (stdoutput, seg))
-    bfd_set_section_alignment (stdoutput, seg, align);
+  if ((unsigned int) align > bfd_get_section_alignment (stdoutput, seg)) {
+    int tmp = bfd_set_section_alignment (stdoutput, seg, align);
+    if (tmp == TRUE) return;
+  }
 }
 
 int
diff --git a/ld/ldlang.c b/ld/ldlang.c
index ba7f493..f12f258 100644
--- a/ld/ldlang.c
+++ b/ld/ldlang.c
@@ -4831,10 +4831,12 @@ lang_size_sections_1
               " section %s\n"), os->name);
 
        input = os->children.head->input_section.section;
-       bfd_set_section_vma (os->bfd_section->owner,
+       int tmp = bfd_set_section_vma (os->bfd_section->owner,
                     os->bfd_section,
                     bfd_section_vma (input->owner, input));
-       os->bfd_section->size = input->size;
+       if (tmp == TRUE) {
+           os->bfd_section->size = input->size;
+       }
        break;
          }
 
@@ -4916,9 +4918,10 @@ lang_size_sections_1
                 os->name, (unsigned long) (newdot - savedot));
          }
 
-       bfd_set_section_vma (0, os->bfd_section, newdot);
-
-       os->bfd_section->output_offset = 0;
+       int tmp = bfd_set_section_vma (0, os->bfd_section, newdot);
+       if (tmp == TRUE) {
+           os->bfd_section->output_offset = 0;
+       }
          }
 
        lang_size_sections_1 (&os->children.head, os,
diff --git a/opcodes/v850-dis.c b/opcodes/v850-dis.c
index 9433274..91cf998 100644
--- a/opcodes/v850-dis.c
+++ b/opcodes/v850-dis.c
@@ -434,7 +434,20 @@ disassemble (bfd_vma memaddr,
          info->fprintf_func (info->stream, "ep");
          break;
        case V850_OPERAND_SRG:
+#if 1
+{
+         if (value <= 31) {
+           info->fprintf_func (info->stream, "%s", v850_sreg_names[value]);
+         }
+         else {
+           char buf[128];
+           sprintf(buf, "unknown(%ld)", value);
+           info->fprintf_func (info->stream, "%s", buf);
+         }
+}
+#else
          info->fprintf_func (info->stream, "%s", v850_sreg_names[value]);
+#endif
          break;
        case V850E_OPERAND_REG_LIST:
          {

この修正が何を意味するのかは全く確認していないが、 その辺はおいおい見ていきましょう。

以上。

0 件のコメント:

コメントを投稿