Sun Sep 1 10:01:50 2019 UTC ()
Apply patch, requested by mrg in ticket #1704:

	external/gpl3/gdb/dist/bfd/coffgen.c
	external/gpl3/gdb/dist/bfd/elf.c
	external/gpl3/gdb/dist/bfd/elflink.c
	external/gpl3/gdb/dist/bfd/reloc.c
	external/gpl3/gdb/dist/bfd/srec.c

Cherry-pick fixes for newer compilers (fixing fallthrough warnings)
from -current.


(martin)
diff -r1.1.1.3 -r1.1.1.3.2.1 src/external/gpl3/gdb/dist/bfd/coffgen.c
diff -r1.1.1.3 -r1.1.1.3.2.1 src/external/gpl3/gdb/dist/bfd/elflink.c
diff -r1.1.1.3 -r1.1.1.3.2.1 src/external/gpl3/gdb/dist/bfd/reloc.c
diff -r1.1.1.3 -r1.1.1.3.2.1 src/external/gpl3/gdb/dist/bfd/srec.c
diff -r1.4 -r1.4.2.1 src/external/gpl3/gdb/dist/bfd/elf.c

cvs diff -r1.1.1.3 -r1.1.1.3.2.1 src/external/gpl3/gdb/dist/bfd/coffgen.c (expand / switch to unified diff)

--- src/external/gpl3/gdb/dist/bfd/coffgen.c 2014/06/22 23:39:47 1.1.1.3
+++ src/external/gpl3/gdb/dist/bfd/coffgen.c 2019/09/01 10:01:50 1.1.1.3.2.1
@@ -2106,47 +2106,47 @@ coff_print_symbol (bfd *abfd, @@ -2106,47 +2106,47 @@ coff_print_symbol (bfd *abfd,
2106 fprintf (file, "AUX scnlen 0x%lx nreloc %d nlnno %d", 2106 fprintf (file, "AUX scnlen 0x%lx nreloc %d nlnno %d",
2107 (unsigned long) auxp->u.auxent.x_scn.x_scnlen, 2107 (unsigned long) auxp->u.auxent.x_scn.x_scnlen,
2108 auxp->u.auxent.x_scn.x_nreloc, 2108 auxp->u.auxent.x_scn.x_nreloc,
2109 auxp->u.auxent.x_scn.x_nlinno); 2109 auxp->u.auxent.x_scn.x_nlinno);
2110 if (auxp->u.auxent.x_scn.x_checksum != 0 2110 if (auxp->u.auxent.x_scn.x_checksum != 0
2111 || auxp->u.auxent.x_scn.x_associated != 0 2111 || auxp->u.auxent.x_scn.x_associated != 0
2112 || auxp->u.auxent.x_scn.x_comdat != 0) 2112 || auxp->u.auxent.x_scn.x_comdat != 0)
2113 fprintf (file, " checksum 0x%lx assoc %d comdat %d", 2113 fprintf (file, " checksum 0x%lx assoc %d comdat %d",
2114 auxp->u.auxent.x_scn.x_checksum, 2114 auxp->u.auxent.x_scn.x_checksum,
2115 auxp->u.auxent.x_scn.x_associated, 2115 auxp->u.auxent.x_scn.x_associated,
2116 auxp->u.auxent.x_scn.x_comdat); 2116 auxp->u.auxent.x_scn.x_comdat);
2117 break; 2117 break;
2118 } 2118 }
2119 /* Otherwise fall through. */ 2119 /* Fall through. */
2120 case C_EXT: 2120 case C_EXT:
2121 case C_AIX_WEAKEXT: 2121 case C_AIX_WEAKEXT:
2122 if (ISFCN (combined->u.syment.n_type)) 2122 if (ISFCN (combined->u.syment.n_type))
2123 { 2123 {
2124 long next, llnos; 2124 long next, llnos;
2125 2125
2126 if (auxp->fix_end) 2126 if (auxp->fix_end)
2127 next = (auxp->u.auxent.x_sym.x_fcnary.x_fcn.x_endndx.p 2127 next = (auxp->u.auxent.x_sym.x_fcnary.x_fcn.x_endndx.p
2128 - root); 2128 - root);
2129 else 2129 else
2130 next = auxp->u.auxent.x_sym.x_fcnary.x_fcn.x_endndx.l; 2130 next = auxp->u.auxent.x_sym.x_fcnary.x_fcn.x_endndx.l;
2131 llnos = auxp->u.auxent.x_sym.x_fcnary.x_fcn.x_lnnoptr; 2131 llnos = auxp->u.auxent.x_sym.x_fcnary.x_fcn.x_lnnoptr;
2132 fprintf (file, 2132 fprintf (file,
2133 "AUX tagndx %ld ttlsiz 0x%lx lnnos %ld next %ld", 2133 "AUX tagndx %ld ttlsiz 0x%lx lnnos %ld next %ld",
2134 tagndx, 2134 tagndx,
2135 (unsigned long) auxp->u.auxent.x_sym.x_misc.x_fsize, 2135 (unsigned long) auxp->u.auxent.x_sym.x_misc.x_fsize,
2136 llnos, next); 2136 llnos, next);
2137 break; 2137 break;
2138 } 2138 }
2139 /* Otherwise fall through. */ 2139 /* Fall through. */
2140 default: 2140 default:
2141 fprintf (file, "AUX lnno %d size 0x%x tagndx %ld", 2141 fprintf (file, "AUX lnno %d size 0x%x tagndx %ld",
2142 auxp->u.auxent.x_sym.x_misc.x_lnsz.x_lnno, 2142 auxp->u.auxent.x_sym.x_misc.x_lnsz.x_lnno,
2143 auxp->u.auxent.x_sym.x_misc.x_lnsz.x_size, 2143 auxp->u.auxent.x_sym.x_misc.x_lnsz.x_size,
2144 tagndx); 2144 tagndx);
2145 if (auxp->fix_end) 2145 if (auxp->fix_end)
2146 fprintf (file, " endndx %ld", 2146 fprintf (file, " endndx %ld",
2147 ((long) 2147 ((long)
2148 (auxp->u.auxent.x_sym.x_fcnary.x_fcn.x_endndx.p 2148 (auxp->u.auxent.x_sym.x_fcnary.x_fcn.x_endndx.p
2149 - root))); 2149 - root)));
2150 break; 2150 break;
2151 } 2151 }
2152 } 2152 }

cvs diff -r1.1.1.3 -r1.1.1.3.2.1 src/external/gpl3/gdb/dist/bfd/elflink.c (expand / switch to unified diff)

--- src/external/gpl3/gdb/dist/bfd/elflink.c 2014/06/22 23:39:55 1.1.1.3
+++ src/external/gpl3/gdb/dist/bfd/elflink.c 2019/09/01 10:01:50 1.1.1.3.2.1
@@ -7688,26 +7688,27 @@ eval_symbol (bfd_vma *result, @@ -7688,26 +7688,27 @@ eval_symbol (bfd_vma *result,
7688 { 7688 {
7689 case '.': 7689 case '.':
7690 *result = dot; 7690 *result = dot;
7691 *symp = sym + 1; 7691 *symp = sym + 1;
7692 return TRUE; 7692 return TRUE;
7693 7693
7694 case '#': 7694 case '#':
7695 ++sym; 7695 ++sym;
7696 *result = strtoul (sym, (char **) symp, 16); 7696 *result = strtoul (sym, (char **) symp, 16);
7697 return TRUE; 7697 return TRUE;
7698 7698
7699 case 'S': 7699 case 'S':
7700 symbol_is_section = TRUE; 7700 symbol_is_section = TRUE;
 7701 /* Fall through. */
7701 case 's': 7702 case 's':
7702 ++sym; 7703 ++sym;
7703 symlen = strtol (sym, (char **) symp, 10); 7704 symlen = strtol (sym, (char **) symp, 10);
7704 sym = *symp + 1; /* Skip the trailing ':'. */ 7705 sym = *symp + 1; /* Skip the trailing ':'. */
7705 7706
7706 if (symend < sym || symlen + 1 > sizeof (symbuf)) 7707 if (symend < sym || symlen + 1 > sizeof (symbuf))
7707 { 7708 {
7708 bfd_set_error (bfd_error_invalid_operation); 7709 bfd_set_error (bfd_error_invalid_operation);
7709 return FALSE; 7710 return FALSE;
7710 } 7711 }
7711 7712
7712 memcpy (symbuf, sym, symlen); 7713 memcpy (symbuf, sym, symlen);
7713 symbuf[symlen] = '\0'; 7714 symbuf[symlen] = '\0';

cvs diff -r1.1.1.3 -r1.1.1.3.2.1 src/external/gpl3/gdb/dist/bfd/reloc.c (expand / switch to unified diff)

--- src/external/gpl3/gdb/dist/bfd/reloc.c 2014/06/22 23:39:47 1.1.1.3
+++ src/external/gpl3/gdb/dist/bfd/reloc.c 2019/09/01 10:01:50 1.1.1.3.2.1
@@ -7244,32 +7244,35 @@ DESCRIPTION @@ -7244,32 +7244,35 @@ DESCRIPTION
7244 7244
7245reloc_howto_type * 7245reloc_howto_type *
7246bfd_default_reloc_type_lookup (bfd *abfd, bfd_reloc_code_real_type code) 7246bfd_default_reloc_type_lookup (bfd *abfd, bfd_reloc_code_real_type code)
7247{ 7247{
7248 switch (code) 7248 switch (code)
7249 { 7249 {
7250 case BFD_RELOC_CTOR: 7250 case BFD_RELOC_CTOR:
7251 /* The type of reloc used in a ctor, which will be as wide as the 7251 /* The type of reloc used in a ctor, which will be as wide as the
7252 address - so either a 64, 32, or 16 bitter. */ 7252 address - so either a 64, 32, or 16 bitter. */
7253 switch (bfd_arch_bits_per_address (abfd)) 7253 switch (bfd_arch_bits_per_address (abfd))
7254 { 7254 {
7255 case 64: 7255 case 64:
7256 BFD_FAIL (); 7256 BFD_FAIL ();
 7257 break;
7257 case 32: 7258 case 32:
7258 return &bfd_howto_32; 7259 return &bfd_howto_32;
7259 case 16: 7260 case 16:
7260 BFD_FAIL (); 7261 BFD_FAIL ();
 7262 break;
7261 default: 7263 default:
7262 BFD_FAIL (); 7264 BFD_FAIL ();
 7265 break;
7263 } 7266 }
7264 default: 7267 default:
7265 BFD_FAIL (); 7268 BFD_FAIL ();
7266 } 7269 }
7267 return NULL; 7270 return NULL;
7268} 7271}
7269 7272
7270/* 7273/*
7271FUNCTION 7274FUNCTION
7272 bfd_get_reloc_code_name 7275 bfd_get_reloc_code_name
7273 7276
7274SYNOPSIS 7277SYNOPSIS
7275 const char *bfd_get_reloc_code_name (bfd_reloc_code_real_type code); 7278 const char *bfd_get_reloc_code_name (bfd_reloc_code_real_type code);

cvs diff -r1.1.1.3 -r1.1.1.3.2.1 src/external/gpl3/gdb/dist/bfd/srec.c (expand / switch to unified diff)

--- src/external/gpl3/gdb/dist/bfd/srec.c 2014/06/22 23:39:53 1.1.1.3
+++ src/external/gpl3/gdb/dist/bfd/srec.c 2019/09/01 10:01:50 1.1.1.3.2.1
@@ -951,30 +951,32 @@ srec_write_record (bfd *abfd, @@ -951,30 +951,32 @@ srec_write_record (bfd *abfd,
951 951
952 *dst++ = 'S'; 952 *dst++ = 'S';
953 *dst++ = '0' + type; 953 *dst++ = '0' + type;
954 954
955 length = dst; 955 length = dst;
956 dst += 2; /* Leave room for dst. */ 956 dst += 2; /* Leave room for dst. */
957 957
958 switch (type) 958 switch (type)
959 { 959 {
960 case 3: 960 case 3:
961 case 7: 961 case 7:
962 TOHEX (dst, (address >> 24), check_sum); 962 TOHEX (dst, (address >> 24), check_sum);
963 dst += 2; 963 dst += 2;
 964 /* Fall through. */
964 case 8: 965 case 8:
965 case 2: 966 case 2:
966 TOHEX (dst, (address >> 16), check_sum); 967 TOHEX (dst, (address >> 16), check_sum);
967 dst += 2; 968 dst += 2;
 969 /* Fall through. */
968 case 9: 970 case 9:
969 case 1: 971 case 1:
970 case 0: 972 case 0:
971 TOHEX (dst, (address >> 8), check_sum); 973 TOHEX (dst, (address >> 8), check_sum);
972 dst += 2; 974 dst += 2;
973 TOHEX (dst, (address), check_sum); 975 TOHEX (dst, (address), check_sum);
974 dst += 2; 976 dst += 2;
975 break; 977 break;
976 978
977 } 979 }
978 for (src = data; src < end; src++) 980 for (src = data; src < end; src++)
979 { 981 {
980 TOHEX (dst, *src, check_sum); 982 TOHEX (dst, *src, check_sum);

cvs diff -r1.4 -r1.4.2.1 src/external/gpl3/gdb/dist/bfd/elf.c (expand / switch to unified diff)

--- src/external/gpl3/gdb/dist/bfd/elf.c 2014/06/22 23:52:57 1.4
+++ src/external/gpl3/gdb/dist/bfd/elf.c 2019/09/01 10:01:50 1.4.2.1
@@ -1585,27 +1585,27 @@ bfd_section_from_shdr (bfd *abfd, unsign @@ -1585,27 +1585,27 @@ bfd_section_from_shdr (bfd *abfd, unsign
1585 if (! _bfd_elf_make_section_from_shdr (abfd, hdr, name, shindex)) 1585 if (! _bfd_elf_make_section_from_shdr (abfd, hdr, name, shindex))
1586 return FALSE; 1586 return FALSE;
1587 if (hdr->sh_link > elf_numsections (abfd)) 1587 if (hdr->sh_link > elf_numsections (abfd))
1588 { 1588 {
1589 /* PR 10478: Accept Solaris binaries with a sh_link 1589 /* PR 10478: Accept Solaris binaries with a sh_link
1590 field set to SHN_BEFORE or SHN_AFTER. */ 1590 field set to SHN_BEFORE or SHN_AFTER. */
1591 switch (bfd_get_arch (abfd)) 1591 switch (bfd_get_arch (abfd))
1592 { 1592 {
1593 case bfd_arch_i386: 1593 case bfd_arch_i386:
1594 case bfd_arch_sparc: 1594 case bfd_arch_sparc:
1595 if (hdr->sh_link == (SHN_LORESERVE & 0xffff) /* SHN_BEFORE */ 1595 if (hdr->sh_link == (SHN_LORESERVE & 0xffff) /* SHN_BEFORE */
1596 || hdr->sh_link == ((SHN_LORESERVE + 1) & 0xffff) /* SHN_AFTER */) 1596 || hdr->sh_link == ((SHN_LORESERVE + 1) & 0xffff) /* SHN_AFTER */)
1597 break; 1597 break;
1598 /* Otherwise fall through. */ 1598 /* Fall through. */
1599 default: 1599 default:
1600 return FALSE; 1600 return FALSE;
1601 } 1601 }
1602 } 1602 }
1603 else if (elf_elfsections (abfd)[hdr->sh_link] == NULL) 1603 else if (elf_elfsections (abfd)[hdr->sh_link] == NULL)
1604 return FALSE; 1604 return FALSE;
1605 else if (elf_elfsections (abfd)[hdr->sh_link]->sh_type != SHT_STRTAB) 1605 else if (elf_elfsections (abfd)[hdr->sh_link]->sh_type != SHT_STRTAB)
1606 { 1606 {
1607 Elf_Internal_Shdr *dynsymhdr; 1607 Elf_Internal_Shdr *dynsymhdr;
1608 1608
1609 /* The shared libraries distributed with hpux11 have a bogus 1609 /* The shared libraries distributed with hpux11 have a bogus
1610 sh_link field for the ".dynamic" section. Find the 1610 sh_link field for the ".dynamic" section. Find the
1611 string table for the ".dynsym" section instead. */ 1611 string table for the ".dynsym" section instead. */