Blame SOURCES/binutils-gcc-10-fixes.patch

2e9b04
diff -rup binutils.orig/gold/gdb-index.cc binutils-2.34.0/gold/gdb-index.cc
2e9b04
--- binutils.orig/gold/gdb-index.cc	2020-07-24 09:12:29.241306445 +0100
2e9b04
+++ binutils-2.34.0/gold/gdb-index.cc	2020-07-24 09:15:48.332095898 +0100
2e9b04
@@ -817,7 +817,7 @@ Gdb_index_info_reader::get_qualified_nam
2e9b04
 void
2e9b04
 Gdb_index_info_reader::record_cu_ranges(Dwarf_die* die)
2e9b04
 {
2e9b04
-  unsigned int shndx;
2e9b04
+  unsigned int shndx = 0;
2e9b04
   unsigned int shndx2;
2e9b04
 
2e9b04
   off_t ranges_offset = die->ref_attribute(elfcpp::DW_AT_ranges, &shndx);
2e9b04
diff -rup binutils.orig/gold/layout.cc binutils-2.34.0/gold/layout.cc
2e9b04
--- binutils.orig/gold/layout.cc	2020-07-24 09:12:29.243306433 +0100
2e9b04
+++ binutils-2.34.0/gold/layout.cc	2020-07-24 09:15:11.464320064 +0100
2e9b04
@@ -1986,7 +1986,7 @@ Layout::attach_allocated_section_to_segm
2e9b04
   seg_flags |= os->extra_segment_flags();
2e9b04
 
2e9b04
   // Check for --section-start.
2e9b04
-  uint64_t addr;
2e9b04
+  uint64_t addr = 0;
2e9b04
   bool is_address_set = parameters->options().section_start(os->name(), &addr);
2e9b04
 
2e9b04
   // In general the only thing we really care about for PT_LOAD
2e9b04
diff -rup binutils.orig/binutils/dlltool.c binutils-2.34.0/binutils/dlltool.c
2e9b04
--- binutils.orig/binutils/dlltool.c	2020-07-24 09:12:28.974308069 +0100
2e9b04
+++ binutils-2.34.0/binutils/dlltool.c	2020-07-24 12:09:37.527121295 +0100
2e9b04
@@ -1305,7 +1305,7 @@ run (const char *what, char *args)
2e9b04
   int pid, wait_status;
2e9b04
   int i;
2e9b04
   const char **argv;
2e9b04
-  char *errmsg_fmt, *errmsg_arg;
2e9b04
+  char *errmsg_fmt = "", *errmsg_arg = "";
2e9b04
   char *temp_base = choose_temp_base ();
2e9b04
 
2e9b04
   inform (_("run: %s %s"), what, args);
2e9b04
diff -rup binutils.orig/gas/config/tc-arm.c binutils-2.34.0/gas/config/tc-arm.c
2e9b04
--- binutils.orig/gas/config/tc-arm.c	2020-07-24 09:12:32.368287432 +0100
2e9b04
+++ binutils-2.34.0/gas/config/tc-arm.c	2020-07-24 12:14:19.842360634 +0100
2e9b04
@@ -28416,9 +28416,12 @@ md_apply_fix (fixS *	fixP,
2e9b04
 	 perform relaxation.  */
2e9b04
       if (value == -2)
2e9b04
 	{
2e9b04
-	  newval = md_chars_to_number (buf, THUMB_SIZE);
2e9b04
-	  newval = 0xbf00; /* NOP encoding T1 */
2e9b04
-	  md_number_to_chars (buf, newval, THUMB_SIZE);
2e9b04
+	  if (fixP->fx_done || !seg->use_rela_p)
2e9b04
+	    {
2e9b04
+	      newval = md_chars_to_number (buf, THUMB_SIZE);
2e9b04
+	      newval = 0xbf00; /* NOP encoding T1 */
2e9b04
+	      md_number_to_chars (buf, newval, THUMB_SIZE);
2e9b04
+	    }
2e9b04
 	}
2e9b04
       else
2e9b04
 	{
2e9b04
@@ -28631,17 +28634,14 @@ md_apply_fix (fixS *	fixP,
2e9b04
     case BFD_RELOC_ARM_GOTFUNCDESC:
2e9b04
     case BFD_RELOC_ARM_GOTOFFFUNCDESC:
2e9b04
     case BFD_RELOC_ARM_FUNCDESC:
2e9b04
-      if (arm_fdpic)
2e9b04
-	{
2e9b04
-	  if (fixP->fx_done || !seg->use_rela_p)
2e9b04
-	    md_number_to_chars (buf, 0, 4);
2e9b04
-	}
2e9b04
-      else
2e9b04
+      if (!arm_fdpic)
2e9b04
 	{
2e9b04
 	  as_bad_where (fixP->fx_file, fixP->fx_line,
2e9b04
 			_("Relocation supported only in FDPIC mode"));
2e9b04
-      }
2e9b04
-      break;
2e9b04
+	  break;
2e9b04
+	}
2e9b04
+      value = 0;
2e9b04
+      /* Fall through.  */
2e9b04
 #endif
2e9b04
 
2e9b04
     case BFD_RELOC_RVA:
2e9b04
diff -rup binutils.orig/gas/config/tc-arm.c binutils-2.34.0/gas/config/tc-arm.c
2e9b04
--- binutils.orig/gas/config/tc-arm.c	2020-07-24 12:16:02.099719884 +0100
2e9b04
+++ binutils-2.34.0/gas/config/tc-arm.c	2020-07-24 12:34:17.690858328 +0100
2e9b04
@@ -28641,7 +28641,7 @@ md_apply_fix (fixS *	fixP,
2e9b04
 	  break;
2e9b04
 	}
2e9b04
       value = 0;
2e9b04
-      /* Fall through.  */
2e9b04
+      goto fred;
2e9b04
 #endif
2e9b04
 
2e9b04
     case BFD_RELOC_RVA:
2e9b04
@@ -28653,6 +28653,7 @@ md_apply_fix (fixS *	fixP,
2e9b04
 #ifdef TE_PE
2e9b04
     case BFD_RELOC_32_SECREL:
2e9b04
 #endif
2e9b04
+    fred:
2e9b04
       if (fixP->fx_done || !seg->use_rela_p)
2e9b04
 #ifdef TE_WINCE
2e9b04
 	/* For WinCE we only do this for pcrel fixups.  */
2e9b04
diff -rup binutils.orig/gas/config/tc-arm.c binutils-2.34.0/gas/config/tc-arm.c
2e9b04
--- binutils.orig/gas/config/tc-arm.c	2020-07-24 13:28:26.926553452 +0100
2e9b04
+++ binutils-2.34.0/gas/config/tc-arm.c	2020-07-24 13:31:57.835215763 +0100
2e9b04
@@ -28416,12 +28416,8 @@ md_apply_fix (fixS *	fixP,
2e9b04
 	 perform relaxation.  */
2e9b04
       if (value == -2)
2e9b04
 	{
2e9b04
-	  if (fixP->fx_done || !seg->use_rela_p)
2e9b04
-	    {
2e9b04
-	      newval = md_chars_to_number (buf, THUMB_SIZE);
2e9b04
-	      newval = 0xbf00; /* NOP encoding T1 */
2e9b04
-	      md_number_to_chars (buf, newval, THUMB_SIZE);
2e9b04
-	    }
2e9b04
+	  newval = 0xbf00; /* NOP encoding T1 */
2e9b04
+	  goto jim;
2e9b04
 	}
2e9b04
       else
2e9b04
 	{
2e9b04
@@ -28432,6 +28428,7 @@ md_apply_fix (fixS *	fixP,
2e9b04
 	    {
2e9b04
 	      newval = md_chars_to_number (buf, THUMB_SIZE);
2e9b04
 	      newval |= ((value & 0x3e) << 2) | ((value & 0x40) << 3);
2e9b04
+	    jim:
2e9b04
 	      md_number_to_chars (buf, newval, THUMB_SIZE);
2e9b04
 	    }
2e9b04
 	}
2e9b04
diff -rup binutils.orig/binutils/mclex.c binutils-2.34.0/binutils/mclex.c
2e9b04
--- binutils.orig/binutils/mclex.c	2020-07-24 13:28:26.297557441 +0100
2e9b04
+++ binutils-2.34.0/binutils/mclex.c	2020-07-24 14:46:53.587940149 +0100
2e9b04
@@ -207,7 +207,7 @@ enum_severity (int e)
2e9b04
 static void
2e9b04
 mc_add_keyword_ascii (const char *sz, int rid, const char *grp, rc_uint_type nv, const char *sv)
2e9b04
 {
2e9b04
-  unichar *usz, *usv = NULL;
2e9b04
+  unichar *usz = NULL, *usv = NULL;
2e9b04
   rc_uint_type usz_len;
2e9b04
 
2e9b04
   unicode_from_codepage (&usz_len, &usz, sz, CP_ACP);
2e9b04
diff -rup binutils.orig/binutils/windmc.c binutils-2.34.0/binutils/windmc.c
2e9b04
--- binutils.orig/binutils/windmc.c	2020-07-24 13:28:26.279557556 +0100
2e9b04
+++ binutils-2.34.0/binutils/windmc.c	2020-07-24 14:48:05.460477478 +0100
2e9b04
@@ -338,7 +338,7 @@ mc_add_node_lang (mc_node *root, const m
2e9b04
 static char *
2e9b04
 convert_unicode_to_ACP (const unichar *usz)
2e9b04
 {
2e9b04
-  char *s;
2e9b04
+  char *s = NULL;
2e9b04
   rc_uint_type l;
2e9b04
 
2e9b04
   if (! usz)
2e9b04
@@ -607,10 +607,10 @@ mc_generate_bin_item (mc_node_lang *n, r
2e9b04
   else
2e9b04
     {
2e9b04
       rc_uint_type txt_len, l;
2e9b04
-      char *cvt_txt;
2e9b04
+      char *cvt_txt = NULL;
2e9b04
 
2e9b04
       codepage_from_unicode( &l, n->message, &cvt_txt, n->lang->lang_info.wincp);
2e9b04
-      if (! cvt_txt)
2e9b04
+      if (cvt_txt == NULL)
2e9b04
 	fatal ("Failed to convert message to language codepage.\n");
2e9b04
       txt_len = strlen (cvt_txt);
2e9b04
       if (mcset_automatic_null_termination && txt_len > 0)
2e9b04
@@ -1107,7 +1107,7 @@ main (int argc, char **argv)
2e9b04
 
2e9b04
   /* Load the input file and do code page transformations to UTF16.  */
2e9b04
   {
2e9b04
-    unichar *u;
2e9b04
+    unichar *u = NULL;
2e9b04
     rc_uint_type ul;
2e9b04
     char *buff;
2e9b04
     bfd_size_type flen;
2e9b04
--- binutils.orig/binutils/srconv.c	2020-07-24 15:37:25.847459208 +0100
2e9b04
+++ binutils-2.34.0/binutils/srconv.c	2020-07-24 15:39:12.853773423 +0100
2e9b04
@@ -316,6 +316,7 @@ wr_hd (struct coff_ofile *p)
2e9b04
   struct IT_hd hd;
2e9b04
 
2e9b04
   hd.spare1 = 0;
2e9b04
+  hd.spare2 = 0;
2e9b04
   if (bfd_get_file_flags (abfd) & EXEC_P)
2e9b04
     hd.mt = MTYPE_ABS_LM;
2e9b04
   else