diff -Nru /Users/io/Downloads/binutils-2.45/bfd/Makefile.in dist/bfd/Makefile.in --- /Users/io/Downloads/binutils-2.45/bfd/Makefile.in 2025-07-27 01:00:00 +++ dist/bfd/Makefile.in 2025-11-14 02:19:36 @@ -610,6 +610,7 @@ cpu-nds32.lo \ cpu-nfp.lo \ cpu-ns32k.lo \ + cpu-openrisc.lo \ cpu-or1k.lo \ cpu-pdp11.lo \ cpu-pj.lo \ @@ -736,6 +737,7 @@ coff-go32.lo \ coff-i386.lo \ coff-mips.lo \ + coff-or1k.lo \ coff-rs6000.lo \ coff-sh.lo \ coff-stgo32.lo \ @@ -870,6 +872,7 @@ coff-go32.c \ coff-i386.c \ coff-mips.c \ + coff-or1k.c \ coff-rs6000.c \ coff-sh.c \ coff-stgo32.c \ @@ -1456,6 +1459,7 @@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/coff-go32.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/coff-i386.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/coff-mips.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/coff-or1k.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/coff-rs6000.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/coff-sh.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/coff-stgo32.Plo@am__quote@ @@ -1520,6 +1524,7 @@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpu-nds32.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpu-nfp.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpu-ns32k.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpu-openrisc.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpu-or1k.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpu-pdp11.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpu-pj.Plo@am__quote@ @@ -1607,6 +1612,7 @@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf32-moxie.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf32-msp430.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf32-mt.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf32-or1k.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf32-nds32.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf32-or1k.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf32-pj.Plo@am__quote@ @@ -1672,6 +1678,7 @@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/i386bsd.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/i386lynx.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/i386msdos.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/i386netbsd.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ihex.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/irix-core.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libbfd.Plo@am__quote@ diff -Nru /Users/io/Downloads/binutils-2.45/bfd/aoutx.h dist/bfd/aoutx.h --- /Users/io/Downloads/binutils-2.45/bfd/aoutx.h 2025-07-27 01:00:00 +++ dist/bfd/aoutx.h 2025-11-14 01:50:18 @@ -772,7 +772,7 @@ break; case bfd_arch_arm: - if (machine == 0) + if (machine == 0 || machine == 5) arch_flags = M_ARM; break; diff -Nru /Users/io/Downloads/binutils-2.45/bfd/archive.c dist/bfd/archive.c --- /Users/io/Downloads/binutils-2.45/bfd/archive.c 2025-07-27 01:00:00 +++ dist/bfd/archive.c 2025-11-14 01:50:18 @@ -193,6 +193,9 @@ #define ar_maxnamelen(abfd) ((abfd)->xvec->ar_max_namelen) #define arch_eltdata(bfd) ((struct areltdata *) ((bfd)->arelt_data)) + +static const char * normalize (bfd *, const char *); + #define arch_hdr(bfd) ((struct ar_hdr *) arch_eltdata (bfd)->arch_header) /* True iff NAME designated a BSD 4.4 extended name. */ @@ -2233,10 +2236,21 @@ current = current->archive_next) { bfd_size_type remaining = arelt_size (current); + bfd_size_type saved_size = remaining; + struct ar_hdr *hdr = arch_hdr (current); /* Write ar header. */ if (!_bfd_write_ar_hdr (arch, current)) goto input_err; + /* Write filename if it is a 4.4BSD extended file, and add to size. */ + if (!strncmp (hdr->ar_name, "#1/", 3)) + { + const char *normal = normalize (current, current->filename); + unsigned int thislen = strlen (normal); + if (bfd_write (normal, thislen, arch) != thislen) + goto input_err; + saved_size += thislen; + } if (bfd_is_thin_archive (arch)) continue; if (bfd_seek (current, 0, SEEK_SET) != 0) @@ -2564,11 +2578,19 @@ { do { +#if 1 + bfd_size_type size = arelt_size (current); + if (!strncmp(arch_hdr (current)->ar_name, "#1/", 3)) + size += strlen(normalize(current, current->filename)); + firstreal += size + sizeof (struct ar_hdr); + firstreal += size % 2; +#else struct areltdata *ared = arch_eltdata (current); firstreal += (ared->parsed_size + ared->extra_size + sizeof (struct ar_hdr)); firstreal += firstreal % 2; +#endif current = current->archive_next; } while (current != map[count].u.abfd); diff -Nru /Users/io/Downloads/binutils-2.45/bfd/archures.c dist/bfd/archures.c --- /Users/io/Downloads/binutils-2.45/bfd/archures.c 2025-07-27 01:00:00 +++ dist/bfd/archures.c 2025-11-14 01:50:18 @@ -678,6 +678,7 @@ extern const bfd_arch_info_type bfd_nds32_arch; extern const bfd_arch_info_type bfd_nfp_arch; extern const bfd_arch_info_type bfd_ns32k_arch; +extern const bfd_arch_info_type bfd_openrisc_arch; extern const bfd_arch_info_type bfd_or1k_arch; extern const bfd_arch_info_type bfd_pdp11_arch; extern const bfd_arch_info_type bfd_pj_arch; @@ -766,6 +767,7 @@ &bfd_nds32_arch, &bfd_nfp_arch, &bfd_ns32k_arch, + &bfd_openrisc_arch, &bfd_or1k_arch, &bfd_pdp11_arch, &bfd_powerpc_arch, diff -Nru /Users/io/Downloads/binutils-2.45/bfd/coff-alpha.c dist/bfd/coff-alpha.c --- /Users/io/Downloads/binutils-2.45/bfd/coff-alpha.c 2025-07-27 01:00:00 +++ dist/bfd/coff-alpha.c 2025-11-14 01:50:18 @@ -643,7 +643,9 @@ case ALPHA_R_OP_STORE: /* The STORE reloc needs the size and offset fields. We store them in the addend. */ +#if 0 BFD_ASSERT (intern->r_offset <= 256); +#endif rptr->addend = (intern->r_offset << 8) + intern->r_size; break; diff -Nru /Users/io/Downloads/binutils-2.45/bfd/config.bfd dist/bfd/config.bfd --- /Users/io/Downloads/binutils-2.45/bfd/config.bfd 2025-07-27 01:00:00 +++ dist/bfd/config.bfd 2025-11-14 01:50:18 @@ -384,7 +384,7 @@ targ_defvec=arm_elf32_nacl_be_vec targ_selvecs="arm_elf32_nacl_le_vec" ;; - armeb-*-netbsd*) + arm*eb-*-netbsd*) targ_defvec=arm_elf32_be_vec targ_selvecs="arm_elf32_le_vec" ;; @@ -648,8 +648,8 @@ ;; i[3-7]86-*-netbsd* | i[3-7]86-*-knetbsd*-gnu) targ_defvec=i386_elf32_vec - targ_selvecs="iamcu_elf32_vec" - targ64_selvecs="x86_64_elf64_vec" + targ_selvecs="iamcu_elf32_vec i386_coff_vec i386_pei_vec" + targ64_selvecs="x86_64_elf64_vec x86_64_pe_vec x86_64_pei_vec" ;; i[3-7]86-*-openbsd*) targ_defvec=i386_elf32_vec @@ -892,13 +892,29 @@ ;; #ifdef BFD64 + mipsn64*el-*-netbsd*) + targ_defvec=mips_elf64_trad_le_vec + targ_selvecs="mips_elf32_trad_be_vec mips_elf32_trad_le_vec mips_elf32_ntrad_be_vec mips_elf32_ntrad_le_vec mips_elf64_trad_be_vec mips_ecoff_be_vec mips_ecoff_le_vec" + ;; + mipsn64*-*-netbsd*) + targ_defvec=mips_elf64_trad_be_vec + targ_selvecs="mips_elf32_trad_be_vec mips_elf32_trad_le_vec mips_elf32_ntrad_be_vec mips_elf32_ntrad_le_vec mips_elf64_trad_le_vec mips_ecoff_be_vec mips_ecoff_le_vec" + ;; + mips64*el-*-netbsd*) + targ_defvec=mips_elf32_ntrad_le_vec + targ_selvecs="mips_elf32_trad_be_vec mips_elf32_trad_le_vec mips_elf32_ntrad_be_vec mips_elf64_trad_be_vec mips_elf64_trad_le_vec mips_ecoff_be_vec mips_ecoff_le_vec" + ;; + mips64*-*-netbsd*) + targ_defvec=mips_elf32_ntrad_be_vec + targ_selvecs="mips_elf32_trad_be_vec mips_elf32_trad_le_vec mips_elf32_ntrad_le_vec mips_elf64_trad_be_vec mips_elf64_trad_le_vec mips_ecoff_be_vec mips_ecoff_le_vec" + ;; mips*el-*-netbsd*) targ_defvec=mips_elf32_trad_le_vec - targ_selvecs="mips_elf32_trad_be_vec mips_elf64_trad_be_vec mips_elf64_trad_le_vec mips_ecoff_le_vec mips_ecoff_be_vec" + targ_selvecs="mips_elf32_trad_be_vec mips_elf32_ntrad_be_vec mips_elf32_ntrad_le_vec mips_elf64_trad_be_vec mips_elf64_trad_le_vec mips_ecoff_be_vec mips_ecoff_le_vec" ;; mips*-*-netbsd*) targ_defvec=mips_elf32_trad_be_vec - targ_selvecs="mips_elf32_trad_le_vec mips_elf64_trad_be_vec mips_elf64_trad_le_vec mips_ecoff_be_vec mips_ecoff_le_vec" + targ_selvecs="mips_elf32_trad_le_vec mips_elf32_ntrad_be_vec mips_elf32_ntrad_le_vec mips_elf64_trad_be_vec mips_elf64_trad_le_vec mips_ecoff_be_vec mips_ecoff_le_vec" ;; mips*el-*-haiku*) targ_defvec=mips_elf32_le_vec @@ -1068,7 +1084,7 @@ targ_underscore=yes ;; - or1k-*-elf | or1k-*-linux* | or1k-*-rtems*) + or1k-*-elf | or1k-*-linux* | or1k-*-rtems* | or1k*-*-netbsd*) targ_defvec=or1k_elf32_vec ;; @@ -1335,6 +1351,10 @@ targ_underscore=yes ;; + sparc-*-netbsd*) + targ_defvec=sparc_elf32_vec + want64=true + ;; sparc-*-solaris2.[0-6] | sparc-*-solaris2.[0-6].*) # PR 27666: Do not include sparc_elf32_vec here. targ_defvec=sparc_elf32_sol2_vec @@ -1502,6 +1522,13 @@ # All MIPS ELF targets need a 64-bit bfd_vma. case "${targ_defvec} ${targ_selvecs}" in *mips_elf*) + want64=true + ;; +esac + +# vax natively supports 64-bit integers. +case "${targ_defvec} ${targ_selvecs}" in + *vax*) want64=true ;; esac diff -Nru /Users/io/Downloads/binutils-2.45/bfd/configure dist/bfd/configure --- /Users/io/Downloads/binutils-2.45/bfd/configure 2025-07-27 01:00:00 +++ dist/bfd/configure 2025-11-14 01:50:18 @@ -11993,9 +11993,9 @@ esac fi -# Enable -z separate-code by default for Linux/x86. +# Enable -z separate-code by default for Linux/x86 and NetBSD/x86 case "${target}" in -i[3-7]86-*-linux-* | x86_64-*-linux-*) +i[3-7]86-*-linux-* | x86_64-*-linux-* | i[3-7]86-*-netbsd* | x86_64-*-netbsd*) if test ${ac_default_ld_z_separate_code} = unset; then ac_default_ld_z_separate_code=1 fi @@ -15554,6 +15547,7 @@ i386_aout_vec) tb="$tb i386aout.lo aout32.lo" ;; i386_aout_bsd_vec) tb="$tb i386bsd.lo aout32.lo" ;; i386_aout_lynx_vec) tb="$tb i386lynx.lo lynx-core.lo aout32.lo" ;; + i386_aout_nbsd_vec) tb="$tb i386netbsd.lo aout32.lo" ;; i386_coff_vec) tb="$tb coff-i386.lo $coff" ;; i386_coff_go32_vec) tb="$tb coff-go32.lo $coff" ;; i386_coff_go32stubbed_vec) tb="$tb coff-stgo32.lo $coff" ;; @@ -15614,8 +15608,8 @@ mips_elf32_le_vec) tb="$tb elf32-mips.lo elfxx-mips.lo elf-vxworks.lo elf32.lo $elf $ecoff" ;; mips_elf32_n_be_vec) tb="$tb elfn32-mips.lo elfxx-mips.lo elf-vxworks.lo elf32.lo $elf $ecoff"; target_size=64 ;; mips_elf32_n_le_vec) tb="$tb elfn32-mips.lo elfxx-mips.lo elf-vxworks.lo elf32.lo $elf $ecoff"; target_size=64 ;; - mips_elf32_ntrad_be_vec) tb="$tb elfn32-mips.lo elfxx-mips.lo elf-vxworks.lo elf32.lo $elf $ecoff"; target_size=64 ;; - mips_elf32_ntrad_le_vec) tb="$tb elfn32-mips.lo elfxx-mips.lo elf-vxworks.lo elf32.lo $elf $ecoff"; target_size=64 ;; + mips_elf32_ntrad_be_vec) tb="$tb elfn32-mips.lo elfxx-mips.lo elf-vxworks.lo elf32.lo $elf $ecoff"; ;; + mips_elf32_ntrad_le_vec) tb="$tb elfn32-mips.lo elfxx-mips.lo elf-vxworks.lo elf32.lo $elf $ecoff"; ;; mips_elf32_ntradfbsd_be_vec) tb="$tb elfn32-mips.lo elfxx-mips.lo elf-vxworks.lo elf32.lo $elf $ecoff"; target_size=64 ;; mips_elf32_ntradfbsd_le_vec) tb="$tb elfn32-mips.lo elfxx-mips.lo elf-vxworks.lo elf32.lo $elf $ecoff"; target_size=64 ;; mips_elf32_trad_be_vec) tb="$tb elf32-mips.lo elfxx-mips.lo elf-vxworks.lo elf32.lo $elf $ecoff" ;; diff -Nru /Users/io/Downloads/binutils-2.45/bfd/configure.ac dist/bfd/configure.ac --- /Users/io/Downloads/binutils-2.45/bfd/configure.ac 2025-07-27 01:00:00 +++ dist/bfd/configure.ac 2025-11-14 01:50:18 @@ -126,7 +126,7 @@ yes) use_secureplt=true ;; no) use_secureplt=false ;; *) AC_MSG_ERROR(bad value ${enableval} for secureplt option) ;; -esac],[use_secureplt=true])dnl +esac],[use_secureplt=false])dnl if test $use_secureplt = true; then AC_DEFINE(USE_SECUREPLT, 1, [Define if we should default to creating read-only plt entries]) @@ -141,10 +141,10 @@ yes) ac_default_ld_z_separate_code=1 ;; no) ac_default_ld_z_separate_code=0 ;; esac]) -# Enable -z separate-code by default for Linux/x86. +# Enable -z separate-code by default for Linux/x86 and NetBSD/x86 changequote(,)dnl case "${target}" in -i[3-7]86-*-linux-* | x86_64-*-linux-*) +i[3-7]86-*-linux-* | x86_64-*-linux-* | i[3-7]86-*-netbsd | x86_64-*-netbsd* ) changequote([,])dnl if test ${ac_default_ld_z_separate_code} = unset; then ac_default_ld_z_separate_code=1 @@ -479,6 +479,7 @@ i386_aout_vec) tb="$tb i386aout.lo aout32.lo" ;; i386_aout_bsd_vec) tb="$tb i386bsd.lo aout32.lo" ;; i386_aout_lynx_vec) tb="$tb i386lynx.lo lynx-core.lo aout32.lo" ;; + i386_aout_nbsd_vec) tb="$tb i386netbsd.lo aout32.lo" ;; i386_coff_vec) tb="$tb coff-i386.lo $coff" ;; i386_coff_go32_vec) tb="$tb coff-go32.lo $coff" ;; i386_coff_go32stubbed_vec) tb="$tb coff-stgo32.lo $coff" ;; @@ -539,8 +540,8 @@ mips_elf32_le_vec) tb="$tb elf32-mips.lo elfxx-mips.lo elf-vxworks.lo elf32.lo $elf $ecoff" ;; mips_elf32_n_be_vec) tb="$tb elfn32-mips.lo elfxx-mips.lo elf-vxworks.lo elf32.lo $elf $ecoff"; target_size=64 ;; mips_elf32_n_le_vec) tb="$tb elfn32-mips.lo elfxx-mips.lo elf-vxworks.lo elf32.lo $elf $ecoff"; target_size=64 ;; - mips_elf32_ntrad_be_vec) tb="$tb elfn32-mips.lo elfxx-mips.lo elf-vxworks.lo elf32.lo $elf $ecoff"; target_size=64 ;; - mips_elf32_ntrad_le_vec) tb="$tb elfn32-mips.lo elfxx-mips.lo elf-vxworks.lo elf32.lo $elf $ecoff"; target_size=64 ;; + mips_elf32_ntrad_be_vec) tb="$tb elfn32-mips.lo elfxx-mips.lo elf-vxworks.lo elf32.lo $elf $ecoff"; ;; + mips_elf32_ntrad_le_vec) tb="$tb elfn32-mips.lo elfxx-mips.lo elf-vxworks.lo elf32.lo $elf $ecoff"; ;; mips_elf32_ntradfbsd_be_vec) tb="$tb elfn32-mips.lo elfxx-mips.lo elf-vxworks.lo elf32.lo $elf $ecoff"; target_size=64 ;; mips_elf32_ntradfbsd_le_vec) tb="$tb elfn32-mips.lo elfxx-mips.lo elf-vxworks.lo elf32.lo $elf $ecoff"; target_size=64 ;; mips_elf32_trad_be_vec) tb="$tb elf32-mips.lo elfxx-mips.lo elf-vxworks.lo elf32.lo $elf $ecoff" ;; diff -Nru /Users/io/Downloads/binutils-2.45/bfd/configure.host dist/bfd/configure.host --- /Users/io/Downloads/binutils-2.45/bfd/configure.host 2025-07-27 01:00:00 +++ dist/bfd/configure.host 2025-11-14 01:50:18 @@ -72,6 +72,10 @@ mips*-*-sysv*) HDEFINES="-G 4" ;; mips*-*-riscos*) HDEFINES="-G 4" ;; +sparc64*-*-netbsd*) host64=true; HOST_64BIT_TYPE=long ;; + +x86_64*-*-netbsd*) host64=true; HOST_64BIT_TYPE=long ;; + # Some Solaris systems (osol0906 at least) have a libc that doesn't recognise # the "MS-ANSI" code page name, so we define an override for CP_ACP (sets the # default code page used by windres/windmc when not specified by a commandline diff -Nru /Users/io/Downloads/binutils-2.45/bfd/doc/reloc.texi dist/bfd/doc/reloc.texi --- /Users/io/Downloads/binutils-2.45/bfd/doc/reloc.texi 2025-07-27 01:00:00 +++ dist/bfd/doc/reloc.texi 2025-11-14 01:50:18 @@ -489,6 +489,12 @@ @deffnx {} BFD_RELOC_68K_TLS_LE8 Relocations used by 68K ELF. @end deffn +@deffn {} BFD_RELOC_VAX_GLOB_DAT +@deffnx {} BFD_RELOC_VAX_GLOB_REF +@deffnx {} BFD_RELOC_VAX_JMP_SLOT +@deffnx {} BFD_RELOC_VAX_RELATIVE +Relocations used by VAX ELF. +@end deffn @deffn {} BFD_RELOC_32_BASEREL @deffnx {} BFD_RELOC_16_BASEREL @deffnx {} BFD_RELOC_LO16_BASEREL diff -Nru /Users/io/Downloads/binutils-2.45/bfd/elf.c dist/bfd/elf.c --- /Users/io/Downloads/binutils-2.45/bfd/elf.c 2025-07-27 01:00:00 +++ dist/bfd/elf.c 2025-11-14 01:50:18 @@ -4751,7 +4751,7 @@ get_program_header_size (bfd *abfd, struct bfd_link_info *info) { size_t segs; - asection *s; + asection *s, *s2; const struct elf_backend_data *bed; /* Assume we will need exactly two PT_LOAD segments: one for text @@ -4759,21 +4759,28 @@ segs = 2; s = bfd_get_section_by_name (abfd, ".interp"); + s2 = bfd_get_section_by_name (abfd, ".dynamic"); if (s != NULL && (s->flags & SEC_LOAD) != 0 && s->size != 0) { - /* If we have a loadable interpreter section, we need a - PT_INTERP segment. In this case, assume we also need a - PT_PHDR segment, although that may not be true for all - targets. */ - segs += 2; + ++segs; } - if (bfd_get_section_by_name (abfd, ".dynamic") != NULL) + if (s2 != NULL && (s2->flags & SEC_LOAD) != 0) { /* We need a PT_DYNAMIC segment. */ ++segs; } + if ((s != NULL && (s->flags & SEC_LOAD) != 0) || + (s2 != NULL && (s2->flags & SEC_LOAD) != 0)) + { + /* + * If either a PT_INTERP or PT_DYNAMIC segment is created, + * also create a PT_PHDR segment. + */ + ++segs; + } + if (info != NULL && info->relro) { /* We need a PT_GNU_RELRO segment. */ @@ -5132,7 +5139,14 @@ the program headers and a PT_INTERP segment for the .interp section. */ s = bfd_get_section_by_name (abfd, ".interp"); + if (s != NULL && (s->flags & SEC_LOAD) == 0) if (s != NULL && (s->flags & SEC_LOAD) != 0 && s->size != 0) + s = NULL; + dynsec = bfd_get_section_by_name (abfd, ".dynamic"); + if (dynsec != NULL && (dynsec->flags & SEC_LOAD) == 0) + dynsec = NULL; + + if (s != NULL || dynsec != NULL) { amt = sizeof (struct elf_segment_map); m = (struct elf_segment_map *) bfd_zalloc (abfd, amt); @@ -5146,7 +5160,10 @@ phdr_in_segment = true; *pm = m; pm = &m->next; + } + if (s != NULL) + { amt = sizeof (struct elf_segment_map); m = (struct elf_segment_map *) bfd_zalloc (abfd, amt); if (m == NULL) @@ -5168,10 +5185,6 @@ hdr_index = 0; writable = false; executable = false; - dynsec = bfd_get_section_by_name (abfd, ".dynamic"); - if (dynsec != NULL - && (dynsec->flags & SEC_LOAD) == 0) - dynsec = NULL; if ((abfd->flags & D_PAGED) == 0) phdr_in_segment = false; @@ -11772,7 +11785,7 @@ return elfcore_grok_netbsd_procinfo (abfd, note); case NT_NETBSDCORE_AUXV: /* NetBSD-specific Elf Auxiliary Vector data. */ - return elfcore_make_auxv_note_section (abfd, note, 4); + return elfcore_make_auxv_note_section (abfd, note, 0); case NT_NETBSDCORE_LWPSTATUS: return elfcore_make_note_pseudosection (abfd, ".note.netbsdcore.lwpstatus", diff -Nru /Users/io/Downloads/binutils-2.45/bfd/elf32-arm.c dist/bfd/elf32-arm.c --- /Users/io/Downloads/binutils-2.45/bfd/elf32-arm.c 2025-07-27 01:00:00 +++ dist/bfd/elf32-arm.c 2025-11-14 01:50:18 @@ -3477,6 +3477,7 @@ #endif } +#if !defined (__NetBSD__) || (__NetBSD_Version__ < 600000000) static inline int elf32_arm_popcount (unsigned int mask) { @@ -3495,6 +3496,7 @@ return sum; #endif } +#endif static void elf32_arm_add_dynreloc (bfd *output_bfd, struct bfd_link_info *info, asection *sreloc, Elf_Internal_Rela *rel); diff -Nru /Users/io/Downloads/binutils-2.45/bfd/elf32-i386.c dist/bfd/elf32-i386.c --- /Users/io/Downloads/binutils-2.45/bfd/elf32-i386.c 2025-07-27 01:00:00 +++ dist/bfd/elf32-i386.c 2025-11-14 01:50:18 @@ -530,6 +530,12 @@ #define LAZY_PLT_ENTRY_SIZE 16 +/* The name of the dynamic interpreter. This is put in the .interp + section. */ + +#define ELF_DYNAMIC_INTERPRETER "/libexec/ld.elf_so" + + /* The size in bytes of an entry in the non-lazy procedure linkage table. */ diff -Nru /Users/io/Downloads/binutils-2.45/bfd/elf32-m68k.c dist/bfd/elf32-m68k.c --- /Users/io/Downloads/binutils-2.45/bfd/elf32-m68k.c 2025-07-27 01:00:00 +++ dist/bfd/elf32-m68k.c 2025-11-14 01:50:18 @@ -2545,7 +2545,7 @@ if (ind->got_entry_key != 0) { BFD_ASSERT (dir->got_entry_key == 0); - /* Assert that GOTs aren't partioned yet. */ + /* Assert that GOTs aren't partitioned yet. */ BFD_ASSERT (ind->glist == NULL); dir->got_entry_key = ind->got_entry_key; @@ -2802,7 +2802,13 @@ && !(ELF32_R_TYPE (rel->r_info) == R_68K_PC8 || ELF32_R_TYPE (rel->r_info) == R_68K_PC16 || ELF32_R_TYPE (rel->r_info) == R_68K_PC32)) - info->flags |= DF_TEXTREL; + { + if (bfd_link_textrel_check(info)) + (*_bfd_error_handler) + (_("warning: dynamic relocation to `%s' in readonly section `%s'"), + h->root.root.string, sec->name); + info->flags |= DF_TEXTREL; + } sreloc->size += sizeof (Elf32_External_Rela); @@ -2964,6 +2970,7 @@ /* Make sure we know what is going on here. */ BFD_ASSERT (dynobj != NULL && (h->needs_plt + || h->type == STT_GNU_IFUNC || h->is_weakalias || (h->def_dynamic && h->ref_regular @@ -2972,7 +2979,7 @@ /* If this is a function, put it in the procedure linkage table. We will fill in the contents of the procedure linkage table later, when we know the address of the .got section. */ - if (h->type == STT_FUNC + if ((h->type == STT_FUNC || h->type == STT_GNU_IFUNC) || h->needs_plt) { if ((h->plt.refcount <= 0 @@ -3253,6 +3260,10 @@ s = s->next) if ((s->section->flags & SEC_READONLY) != 0) { + if (bfd_link_textrel_check(info)) + (*_bfd_error_handler) + (_("warning: dynamic relocation to `%s' in readonly section `%s'"), + h->root.root.string, s->section->name); info->flags |= DF_TEXTREL; break; } diff -Nru /Users/io/Downloads/binutils-2.45/bfd/elf32-sh.c dist/bfd/elf32-sh.c --- /Users/io/Downloads/binutils-2.45/bfd/elf32-sh.c 2025-07-27 01:00:00 +++ dist/bfd/elf32-sh.c 2025-11-14 01:50:18 @@ -2490,6 +2490,7 @@ /* Make sure we know what is going on here. */ BFD_ASSERT (htab->root.dynobj != NULL && (h->needs_plt + || h->type == STT_GNU_IFUNC || h->is_weakalias || (h->def_dynamic && h->ref_regular @@ -2498,7 +2499,7 @@ /* If this is a function, put it in the procedure linkage table. We will fill in the contents of the procedure linkage table later, when we know the address of the .got section. */ - if (h->type == STT_FUNC + if ((h->type == STT_FUNC || h->type == STT_GNU_IFUNC) || h->needs_plt) { if (h->plt.refcount <= 0 diff -Nru /Users/io/Downloads/binutils-2.45/bfd/elf32-vax.c dist/bfd/elf32-vax.c --- /Users/io/Downloads/binutils-2.45/bfd/elf32-vax.c 2025-07-27 01:00:00 +++ dist/bfd/elf32-vax.c 2025-11-14 01:50:18 @@ -494,6 +494,24 @@ return true; } +/* Copy vax-specific data from one module to another */ +static bool +elf32_vax_copy_private_bfd_data (bfd *ibfd, bfd *obfd) +{ + flagword in_flags; + + if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour + || bfd_get_flavour (obfd) != bfd_target_elf_flavour) + return true; + + in_flags = elf_elfheader (ibfd)->e_flags; + + elf_elfheader (obfd)->e_flags = in_flags; + elf_flags_init (obfd) = true; + + return true; +} + /* Merge backend specific data from an object file to the output object file when linking. */ static bool @@ -731,7 +749,13 @@ return false; if (sec->flags & SEC_READONLY) - info->flags |= DF_TEXTREL; + { + if (bfd_link_textrel_check(info)) + (*_bfd_error_handler) + (_("warning: dynamic relocation to `%s' in readonly section `%s'"), + h ? h->root.root.string : "?", sec->name); + info->flags |= DF_TEXTREL; + } } sreloc->size += sizeof (Elf32_External_Rela); @@ -836,6 +860,7 @@ /* Make sure we know what is going on here. */ BFD_ASSERT (dynobj != NULL && (h->needs_plt + || h->type == STT_GNU_IFUNC || h->is_weakalias || (h->def_dynamic && h->ref_regular @@ -844,7 +869,7 @@ /* If this is a function, put it in the procedure linkage table. We will fill in the contents of the procedure linkage table later, when we know the address of the .got section. */ - if (h->type == STT_FUNC + if ((h->type == STT_FUNC || h->type == STT_GNU_IFUNC) || h->needs_plt) { if (h->plt.refcount <= 0 @@ -1190,8 +1215,12 @@ } /* Allocate space in the .got and .rela.got sections. */ - sgot->size += 4; - srelgot->size += sizeof (Elf32_External_Rela); + if (bfd_link_pic (info) || WILL_CALL_FINISH_DYNAMIC_SYMBOL ( + elf_hash_table (info)->dynamic_sections_created, 0, h)) + { + sgot->size += 4; + srelgot->size += sizeof (Elf32_External_Rela); + } } return true; @@ -1461,9 +1490,9 @@ { relocate = true; outrel.r_info = ELF32_R_INFO (0, R_VAX_RELATIVE); - BFD_ASSERT (bfd_get_signed_32 (input_bfd, - &contents[rel->r_offset]) == 0); - outrel.r_addend = relocation + rel->r_addend; + outrel.r_addend = bfd_get_signed_32(input_bfd, + &contents[rel->r_offset]) + + relocation + rel->r_addend; } else { @@ -1502,6 +1531,9 @@ } } + if (input_section->flags & SEC_CODE) + info->flags |= DF_TEXTREL; + if ((input_section->flags & SEC_CODE) != 0 || (ELF32_R_TYPE (outrel.r_info) != R_VAX_32 && ELF32_R_TYPE (outrel.r_info) != R_VAX_RELATIVE @@ -1852,12 +1884,15 @@ #define TARGET_LITTLE_NAME "elf32-vax" #define ELF_TARGET_ID VAX_ELF_DATA #define ELF_MACHINE_CODE EM_VAX -#define ELF_MAXPAGESIZE 0x1000 +#define ELF_MAXPAGESIZE 0x10000 #define elf_backend_create_dynamic_sections \ _bfd_elf_create_dynamic_sections #define bfd_elf32_bfd_link_hash_table_create \ elf_vax_link_hash_table_create +#define bfd_elf32_bfd_copy_private_bfd_data \ + elf32_vax_copy_private_bfd_data + #define bfd_elf32_bfd_final_link bfd_elf_gc_common_final_link #define elf_backend_check_relocs elf_vax_check_relocs diff -Nru /Users/io/Downloads/binutils-2.45/bfd/elf64-alpha.c dist/bfd/elf64-alpha.c --- /Users/io/Downloads/binutils-2.45/bfd/elf64-alpha.c 2025-07-27 01:00:00 +++ dist/bfd/elf64-alpha.c 2025-11-14 01:50:18 @@ -99,6 +99,11 @@ #define PLT_ENTRY_SIZE \ (elf64_alpha_use_secureplt ? NEW_PLT_ENTRY_SIZE : OLD_PLT_ENTRY_SIZE) +/* ld --traditional-format uses this older format instead. */ +#define OLD_PLT_ENTRY_WORD1 0x279f0000 /* ldah $28, 0($31) */ +#define OLD_PLT_ENTRY_WORD2 0x239c0000 /* lda $28, 0($28) */ +#define OLD_PLT_ENTRY_WORD3 0xc3e00000 /* br $31, plt0 */ + #define MAX_GOT_SIZE (64*1024) #define ELF_DYNAMIC_INTERPRETER "/usr/lib/ld.so" @@ -4812,6 +4817,32 @@ plt_index = ((gotent->plt_offset - NEW_PLT_HEADER_SIZE) / NEW_PLT_ENTRY_SIZE); + } + else if ((output_bfd->flags & BFD_TRADITIONAL_FORMAT) != 0) + { + long hi, lo; + + /* decompose the reloc offset for the plt for ldah+lda */ + hi = plt_index * sizeof(Elf64_External_Rela); + lo = ((hi & 0xffff) ^ 0x8000) - 0x8000; + hi = (hi - lo) >> 16; + + insn = INSN_ABO (INSN_LDAH, 28, 31, hi); + bfd_put_32 (output_bfd, insn, + splt->contents + gotent->plt_offset); + + insn = INSN_ABO (INSN_LDA, 28, 28, lo); + bfd_put_32 (output_bfd, insn, + splt->contents + gotent->plt_offset + 4); + + disp = -(gotent->plt_offset + 12); + insn = INSN_AD (INSN_BR, 31, disp); + + bfd_put_32 (output_bfd, insn, + splt->contents + gotent->plt_offset + 8); + + plt_index = ((gotent->plt_offset - OLD_PLT_HEADER_SIZE) + / OLD_PLT_ENTRY_SIZE); } else { diff -Nru /Users/io/Downloads/binutils-2.45/bfd/elf64-mips.c dist/bfd/elf64-mips.c --- /Users/io/Downloads/binutils-2.45/bfd/elf64-mips.c 2025-07-27 01:00:00 +++ dist/bfd/elf64-mips.c 2025-11-14 01:50:18 @@ -111,6 +111,8 @@ (bfd *, asymbol *, bool, char **, bfd_vma *); static bool mips_elf64_object_p (bfd *); +static bool mips_elf64_is_local_label_name + (bfd *, const char *); static irix_compat_t elf64_mips_irix_compat (bfd *); static bool elf64_mips_grok_prstatus @@ -3368,7 +3370,7 @@ (Elf64_Mips_External_Rela *) dst); } -/* Set the GP value for OUTPUT_BFD. Returns FALSE if this is a +/* Set the GP value for OUTPUT_BFD. Returns false if this is a dangerous relocation. */ static bool @@ -4525,7 +4527,18 @@ bfd_default_set_arch_mach (abfd, bfd_arch_mips, mach); return true; } + +/* MIPS ELF local labels start with "$L". */ +static bool +mips_elf64_is_local_label_name (bfd *abfd, const char *name) +{ + if (name[0] == '$' && name[1] == 'L') + return true; + /* We accept the generic ELF local label syntax as well. */ + return _bfd_elf_is_local_label_name (abfd, name); +} + /* Depending on the target vector we generate some version of Irix executables or "normal" MIPS ELF ABI executables. */ static irix_compat_t @@ -4792,9 +4805,8 @@ #define elf_backend_write_section _bfd_mips_elf_write_section #define elf_backend_sort_relocs_p _bfd_mips_elf_sort_relocs_p -/* We don't set bfd_elf64_bfd_is_local_label_name because the 32-bit - MIPS-specific function only applies to IRIX5, which had no 64-bit - ABI. */ +#define bfd_elf64_bfd_is_local_label_name \ + mips_elf64_is_local_label_name #define bfd_elf64_bfd_is_target_special_symbol \ _bfd_mips_elf_is_target_special_symbol #define bfd_elf64_find_nearest_line _bfd_mips_elf_find_nearest_line diff -Nru /Users/io/Downloads/binutils-2.45/bfd/elf64-ppc.c dist/bfd/elf64-ppc.c --- /Users/io/Downloads/binutils-2.45/bfd/elf64-ppc.c 2025-07-27 01:00:00 +++ dist/bfd/elf64-ppc.c 2025-11-14 01:50:18 @@ -10314,7 +10314,13 @@ srel = htab->elf.irelplt; srel->size += count * sizeof (Elf64_External_Rela); if ((p->sec->output_section->flags & SEC_READONLY) != 0) - info->flags |= DF_TEXTREL; + { + if (bfd_link_textrel_check(info)) + (*_bfd_error_handler) + (_("warning: dynamic relocation in readonly section `%s'"), + p->sec->output_section->name); + info->flags |= DF_TEXTREL; + } } } } @@ -16503,6 +16509,11 @@ contents + rel->r_offset + 4); can_plt_call = true; } + } + else + { + /* Tail calls don't need to worry about restoring TOC. */ + can_plt_call = true; } } diff -Nru /Users/io/Downloads/binutils-2.45/bfd/elflink.c dist/bfd/elflink.c --- /Users/io/Downloads/binutils-2.45/bfd/elflink.c 2025-07-27 01:00:00 +++ dist/bfd/elflink.c 2025-11-14 01:50:18 @@ -3192,6 +3192,8 @@ if (h->is_weakalias) { struct elf_link_hash_entry *def = weakdef (h); + while (def->root.type == bfd_link_hash_indirect) + def = (struct elf_link_hash_entry *) def->root.u.i.link; /* If the real definition is defined by a regular object file, don't do anything special. See the longer description in @@ -12452,7 +12454,11 @@ if (bed->s->arch_size == 32) irel[0].r_info = ELF32_R_INFO (indx, howto->type); else +#ifdef BFD64 irel[0].r_info = ELF64_R_INFO (indx, howto->type); +#else + BFD_FAIL(); +#endif rel_hdr = reldata->hdr; erel = rel_hdr->contents; diff -Nru /Users/io/Downloads/binutils-2.45/bfd/elfn32-mips.c dist/bfd/elfn32-mips.c --- /Users/io/Downloads/binutils-2.45/bfd/elfn32-mips.c 2025-07-27 01:00:00 +++ dist/bfd/elfn32-mips.c 2025-11-14 01:50:18 @@ -80,6 +80,8 @@ (bfd *, Elf_Internal_Note *); static bool elf32_mips_grok_psinfo (bfd *, Elf_Internal_Note *); +static bool mips_elf_n32_is_local_label_name + (bfd *, const char *); static bool elf_n32_mips_grok_freebsd_prstatus (bfd *, Elf_Internal_Note *); static irix_compat_t elf_n32_mips_irix_compat @@ -3195,7 +3197,7 @@ false); /* pcrel_offset */ -/* Set the GP value for OUTPUT_BFD. Returns FALSE if this is a +/* Set the GP value for OUTPUT_BFD. Returns false if this is a dangerous relocation. */ static bool @@ -3858,7 +3860,7 @@ || bfd_is_com_section (bfd_asymbol_section (sym))); } -/* Likewise, return TRUE if the symbol table split overall must be +/* Likewise, return true if the symbol table split overall must be between section symbols and all other symbols. */ static bool mips_elf_n32_elfsym_local_is_section (bfd *abfd) @@ -4039,6 +4041,17 @@ } } +/* MIPS ELF local labels start with "$L". */ +static bool +mips_elf_n32_is_local_label_name (bfd *abfd, const char *name) +{ + if (name[0] == '$' && name[1] == 'L') + return true; + + /* We accept the generic ELF local label syntax as well. */ + return _bfd_elf_is_local_label_name (abfd, name); +} + /* Depending on the target vector we generate some version of Irix executables or "normal" MIPS ELF ABI executables. */ static irix_compat_t @@ -4182,6 +4195,9 @@ mips_elf_n32_elfsym_local_is_section #define elf_backend_mips_irix_compat elf_n32_mips_irix_compat #define elf_backend_mips_rtype_to_howto mips_elf_n32_rtype_to_howto + +#define bfd_elf32_bfd_is_local_label_name \ + mips_elf_n32_is_local_label_name #define bfd_elf32_bfd_is_target_special_symbol \ _bfd_mips_elf_is_target_special_symbol #define bfd_elf32_find_nearest_line _bfd_mips_elf_find_nearest_line diff -Nru /Users/io/Downloads/binutils-2.45/bfd/elfxx-mips.c dist/bfd/elfxx-mips.c --- /Users/io/Downloads/binutils-2.45/bfd/elfxx-mips.c 2025-07-27 01:00:00 +++ dist/bfd/elfxx-mips.c 2025-11-14 01:50:18 @@ -9170,10 +9170,30 @@ reloc types into the output file as R_MIPS_REL32 relocs. Make room for this reloc in .rel(a).dyn. */ mips_elf_allocate_dynamic_relocations (dynobj, info, 1); - if (MIPS_ELF_READONLY_SECTION (sec)) - /* We tell the dynamic linker that there are - relocations against the text segment. */ - info->flags |= DF_TEXTREL; + /* In the N32 and 64-bit ABIs there may be multiple + consecutive relocations for the same offset. If we have + a R_MIPS_GPREL32 followed by a R_MIPS_64 then that + relocation is complete and needs no futher adjustment. + + Silently ignore absolute relocations in the .eh_frame + section, they will be dropped latter. + */ + if ((rel == relocs + || rel[-1].r_offset != rel->r_offset + || r_type != R_MIPS_64 + || ELF_R_TYPE(abfd, rel[-1].r_info) != R_MIPS_GPREL32) + && MIPS_ELF_READONLY_SECTION (sec) + && !((r_type == R_MIPS_32 || r_type == R_MIPS_64) + && strcmp(sec->name, ".eh_frame") == 0)) + { + /* We tell the dynamic linker that there are + relocations against the text segment. */ + info->flags |= DF_TEXTREL; + info->callbacks->warning + (info, + _("relocation emitted against readonly section"), + NULL, abfd, sec, rel->r_offset); + } } else { diff -Nru /Users/io/Downloads/binutils-2.45/bfd/elfxx-sparc.c dist/bfd/elfxx-sparc.c --- /Users/io/Downloads/binutils-2.45/bfd/elfxx-sparc.c 2025-07-27 01:00:00 +++ dist/bfd/elfxx-sparc.c 2025-11-14 01:50:18 @@ -3482,6 +3482,23 @@ tls_type = _bfd_sparc_elf_hash_entry (h)->tls_type; else if (local_got_offsets) tls_type = _bfd_sparc_elf_local_got_tls_type (input_bfd) [r_symndx]; + else if (h != NULL) + { + tls_type = _bfd_sparc_elf_hash_entry(h)->tls_type; + if (!bfd_link_dll (info) + && h->dynindx == -1 + && tls_type == GOT_TLS_IE) + switch (SPARC_ELF_R_TYPE (rel->r_info)) + { + case R_SPARC_TLS_GD_HI22: + case R_SPARC_TLS_IE_HI22: + r_type = R_SPARC_TLS_LE_HIX22; + break; + default: + r_type = R_SPARC_TLS_LE_LOX10; + break; + } + } else tls_type = GOT_UNKNOWN; if (tls_type == GOT_TLS_IE) @@ -3663,6 +3680,8 @@ tls_type = _bfd_sparc_elf_hash_entry (h)->tls_type; else if (local_got_offsets) tls_type = _bfd_sparc_elf_local_got_tls_type (input_bfd) [r_symndx]; + else if (h != NULL) + tls_type = _bfd_sparc_elf_hash_entry(h)->tls_type; else tls_type = GOT_UNKNOWN; /* GD -> IE or LE */ diff -Nru /Users/io/Downloads/binutils-2.45/bfd/libbfd.h dist/bfd/libbfd.h --- /Users/io/Downloads/binutils-2.45/bfd/libbfd.h 2025-07-27 01:00:00 +++ dist/bfd/libbfd.h 2025-11-14 01:50:18 @@ -2854,6 +2854,7 @@ "BFD_RELOC_XSTORMY16_FPTR16", "BFD_RELOC_RELC", "BFD_RELOC_VAX_GLOB_DAT", + "BFD_RELOC_VAX_GLOB_REF", "BFD_RELOC_VAX_JMP_SLOT", "BFD_RELOC_VAX_RELATIVE", "BFD_RELOC_MT_PC16", diff -Nru /Users/io/Downloads/binutils-2.45/bfd/reloc.c dist/bfd/reloc.c --- /Users/io/Downloads/binutils-2.45/bfd/reloc.c 2025-07-27 01:00:00 +++ dist/bfd/reloc.c 2025-11-14 01:50:18 @@ -1520,6 +1520,17 @@ Relocations used by 68K ELF. ENUM + BFD_RELOC_VAX_GLOB_DAT +ENUMX + BFD_RELOC_VAX_GLOB_REF +ENUMX + BFD_RELOC_VAX_JMP_SLOT +ENUMX + BFD_RELOC_VAX_RELATIVE +ENUMDOC + Relocations used by VAX ELF. + +ENUM BFD_RELOC_32_BASEREL ENUMX BFD_RELOC_16_BASEREL diff -Nru /Users/io/Downloads/binutils-2.45/bfd/targets.c dist/bfd/targets.c --- /Users/io/Downloads/binutils-2.45/bfd/targets.c 2025-07-27 01:00:00 +++ dist/bfd/targets.c 2025-11-14 01:50:18 @@ -743,6 +743,7 @@ extern const bfd_target i386_aout_vec; extern const bfd_target i386_aout_bsd_vec; extern const bfd_target i386_aout_lynx_vec; +extern const bfd_target i386_aout_nbsd_vec; extern const bfd_target i386_coff_vec; extern const bfd_target i386_coff_go32_vec; extern const bfd_target i386_coff_go32stubbed_vec; diff -Nru /Users/io/Downloads/binutils-2.45/binutils/readelf.c dist/binutils/readelf.c --- /Users/io/Downloads/binutils-2.45/binutils/readelf.c 2025-07-27 01:00:00 +++ dist/binutils/readelf.c 2025-11-14 01:50:18 @@ -251,6 +251,7 @@ static bool do_demangle = false; /* Pretty print C++ symbol names. */ static bool process_links = false; static bool dump_any_debugging = false; +static bool do_special_files = false; static bool extra_sym_info = false; static int demangle_flags = DMGL_ANSI | DMGL_PARAMS; static int sym_base = 0; @@ -6112,6 +6113,7 @@ {"use-dynamic", no_argument, 0, 'D'}, {"dynamic", no_argument, 0, 'd'}, {"headers", no_argument, 0, 'e'}, + {"special-files", no_argument, 0, 'f'}, {"section-groups", no_argument, 0, 'g'}, {"help", no_argument, 0, 'H'}, {"file-header", no_argument, 0, 'h'}, @@ -6322,6 +6324,8 @@ fprintf (stream, _("\ -T --silent-truncation If a symbol name is truncated, do not add [...] suffix\n")); fprintf (stream, _("\ + -f --special-files Process non-plain files too\n")); + fprintf (stream, _("\ @ Read options from \n")); fprintf (stream, _("\ -H --help Display this information\n")); @@ -6418,7 +6422,7 @@ usage (stderr); while ((c = getopt_long - (argc, argv, "ACDHILNPR:STU:VWXacdeghi:j:lnp:rstuvw::x:z", options, NULL)) != EOF) + (argc, argv, "ACDHILNPR:STU:VWXacdefghi:j:lnp:rstuvw::x:z", options, NULL)) != EOF) { switch (c) { @@ -6469,6 +6473,9 @@ case 'u': do_unwind = true; break; + case 'f': + do_special_files = true; + break; case 'h': do_header = true; break; @@ -7128,7 +7135,7 @@ if (filedata->file_header.e_phnum > 1) printf (_("\nProgram Headers:\n")); else - printf (_("\nProgram Headers:\n")); + printf (_("\nProgram Header:\n")); if (is_32bit_elf) printf @@ -21825,6 +21832,20 @@ ((version & NT_NETBSD_PAX_ASLR) ? "+ASLR" : ""), ((version & NT_NETBSD_PAX_NOASLR) ? "-ASLR" : "")); return true; + + case NT_NETBSD_MCMODEL: + if (pnote->descsz < 1) + break; + printf (" NetBSD\t\t0x%08lx\tMCModel ", pnote->descsz); + for (size_t i = 0; i < pnote->descsz; i++) + { + unsigned char c = pnote->descdata[i] & 0xff; + if (c == '\0') + break; + putchar (ISPRINT (c) ? c : '?'); + } + putchar ('\n'); + return true; } printf (" NetBSD\t0x%08lx\tUnknown note type: (0x%08lx)\n", @@ -24199,7 +24220,7 @@ return false; } - if (! S_ISREG (statbuf.st_mode)) + if (!do_special_files && ! S_ISREG (statbuf.st_mode)) { error (_("'%s' is not an ordinary file\n"), file_name); return false; diff -Nru /Users/io/Downloads/binutils-2.45/gas/config/atof-vax.c dist/gas/config/atof-vax.c --- /Users/io/Downloads/binutils-2.45/gas/config/atof-vax.c 2025-07-27 01:00:00 +++ dist/gas/config/atof-vax.c 2025-11-14 01:50:18 @@ -267,10 +267,27 @@ int exponent_skippage; LITTLENUM_TYPE word1; - /* JF: Deal with new Nan, +Inf and -Inf codes. */ if (f->sign != '-' && f->sign != '+') { - make_invalid_floating_point_number (words); + if (f->sign == 0) + { + /* All NaNs are 0. */ + memset (words, 0x00, sizeof (LITTLENUM_TYPE) * precision); + } + else if (f->sign == 'P') + { + /* Positive Infinity. */ + memset (words, 0xff, sizeof (LITTLENUM_TYPE) * precision); + words[0] &= 0x7fff; + } + else if (f->sign == 'N') + { + /* Negative Infinity. */ + memset (words, 0x00, sizeof (LITTLENUM_TYPE) * precision); + words[0] = 0x0080; + } + else + make_invalid_floating_point_number (words); return return_value; } diff -Nru /Users/io/Downloads/binutils-2.45/gas/config/obj-elf.c dist/gas/config/obj-elf.c --- /Users/io/Downloads/binutils-2.45/gas/config/obj-elf.c 2025-07-27 01:00:00 +++ dist/gas/config/obj-elf.c 2025-11-14 01:50:18 @@ -2522,10 +2522,12 @@ && bed->elf_osabi != ELFOSABI_FREEBSD) as_bad (_("symbol type \"%s\" is supported only by GNU " "and FreeBSD targets"), type_name); +#if 0 /* MIPS targets do not support IFUNCS. */ else if (bed->target_id == MIPS_ELF_DATA) as_bad (_("symbol type \"%s\" is not supported by " "MIPS targets"), type_name); +#endif elf_tdata (stdoutput)->has_gnu_osabi |= elf_gnu_osabi_ifunc; type = BSF_FUNCTION | BSF_GNU_INDIRECT_FUNCTION; } diff -Nru /Users/io/Downloads/binutils-2.45/gas/config/tc-arm.c dist/gas/config/tc-arm.c --- /Users/io/Downloads/binutils-2.45/gas/config/tc-arm.c 2025-07-27 01:00:00 +++ dist/gas/config/tc-arm.c 2025-11-14 01:50:18 @@ -23496,16 +23496,20 @@ asection *sect; for (sect = stdoutput->sections; sect != NULL; sect = sect->next) - if (seg_info (sect)->tc_segment_info_data.current_pred.state - == MANUAL_PRED_BLOCK) - { - if (now_pred.type == SCALAR_PRED) - as_warn (_("section '%s' finished with an open IT block."), + { + segment_info_type *seginfo = seg_info (sect); + + if (seginfo && seginfo->tc_segment_info_data.current_pred.state + == MANUAL_PRED_BLOCK) + { + if (now_pred.type == SCALAR_PRED) + as_warn (_("section '%s' finished with an open IT block."), + sect->name); + else + as_warn (_("section '%s' finished with an open VPT/VPST block."), sect->name); - else - as_warn (_("section '%s' finished with an open VPT/VPST block."), - sect->name); - } + } + } #else if (now_pred.state == MANUAL_PRED_BLOCK) { diff -Nru /Users/io/Downloads/binutils-2.45/gas/config/tc-m68k.c dist/gas/config/tc-m68k.c --- /Users/io/Downloads/binutils-2.45/gas/config/tc-m68k.c 2025-07-27 01:00:00 +++ dist/gas/config/tc-m68k.c 2025-11-14 01:50:18 @@ -74,6 +74,7 @@ static int flag_short_refs; /* -l option. */ static int flag_long_jumps; /* -S option. */ static int flag_keep_pcrel; /* --pcrel option. */ +static bool lcfix = false; #ifdef REGISTER_PREFIX_OPTIONAL int flag_reg_prefix_optional = REGISTER_PREFIX_OPTIONAL; @@ -4272,8 +4273,24 @@ } } + bool hasnop = false; + char nop[4] = "nop"; + toP = NULL; +next: memset (&the_ins, '\0', sizeof (the_ins)); + m68k_ip (str); + + if (lcfix == true && hasnop == false && + (the_ins.opcode[0] & 0xf000) == 0xf000) + { + memset (&the_ins, '\0', sizeof (the_ins)); + m68k_ip (nop); + hasnop = true; + } + else + hasnop = false; + er = the_ins.error; if (!er) { @@ -4349,6 +4366,8 @@ if (the_ins.reloc[m].wid == 'B') fixP->fx_signed = 1; } + if (hasnop == true) + goto next; return; } @@ -4447,6 +4466,8 @@ the_ins.reloc[m].pic_reloc)); fixP->fx_pcrel_adjust = the_ins.reloc[m].pcrel_fix; } + if (hasnop == true) + goto next; } /* Comparison function used by qsort to rank the opcode entries by name. */ @@ -7255,7 +7276,7 @@ { if (arg[0] == 'm') { - if (arg[1] == '6') + if (arg[1] == '6' || arg[1] == '5') arg += 1; else if (arg[1] == 'c' && arg[2] == '6') arg += 2; @@ -7457,6 +7478,8 @@ ; else if (m68k_set_cpu (arg, 0, 1)) ; + else if (startswith (arg, "lcfix")) + lcfix = true; else return 0; break; @@ -7558,6 +7581,7 @@ fprintf (stream, _("\ -march= set architecture\n\ -mcpu= set cpu [default %s]\n\ +-mlcfix compatability with lc040 nop before f-line\n\ "), default_cpu); for (i = 0; m68k_extensions[i].name; i++) fprintf (stream, _("\ diff -Nru /Users/io/Downloads/binutils-2.45/gas/config/tc-mips.c dist/gas/config/tc-mips.c --- /Users/io/Downloads/binutils-2.45/gas/config/tc-mips.c 2025-07-27 01:00:00 +++ dist/gas/config/tc-mips.c 2025-11-14 01:50:18 @@ -942,6 +942,9 @@ NUM_FIX_VR4120_CLASSES }; +/* ...likewise -mtrap-zero-jump. */ +static bfd_boolean mips_trap_zero_jump; + /* ...likewise -mfix-loongson2f-jump. */ static bool mips_fix_loongson2f_jump; @@ -985,6 +988,8 @@ static int mips_relax_branch; +static int mips_fix_loongson2f_btb; + /* TRUE if checks are suppressed for invalid branches between ISA modes. Needed for broken assembly produced by some GCC versions and some sloppy code out there, where branches to data labels are present. */ @@ -1377,6 +1382,7 @@ static void mips16_macro_build (expressionS *, const char *, const char *, va_list *); static void load_register (int, expressionS *, int); +static void macro_build (expressionS *, const char *, const char *, ...); static void macro_start (void); static void macro_end (void); static void macro (struct mips_cl_insn *ip, char *str); @@ -1581,6 +1587,8 @@ OPTION_NO_LOONGSON_EXT, OPTION_LOONGSON_EXT2, OPTION_NO_LOONGSON_EXT2, + OPTION_FIX_LOONGSON2F_BTB, + OPTION_NO_FIX_LOONGSON2F_BTB, OPTION_END_OF_ENUM }; @@ -1670,6 +1678,8 @@ {"mno-fix-loongson2f-jump", no_argument, NULL, OPTION_NO_FIX_LOONGSON2F_JUMP}, {"mfix-loongson2f-nop", no_argument, NULL, OPTION_FIX_LOONGSON2F_NOP}, {"mno-fix-loongson2f-nop", no_argument, NULL, OPTION_NO_FIX_LOONGSON2F_NOP}, + {"mfix-loongson2f-btb", no_argument, NULL, OPTION_FIX_LOONGSON2F_BTB}, + {"mno-fix-loongson2f-btb", no_argument, NULL, OPTION_NO_FIX_LOONGSON2F_BTB}, {"mfix-vr4120", no_argument, NULL, OPTION_FIX_VR4120}, {"mno-fix-vr4120", no_argument, NULL, OPTION_NO_FIX_VR4120}, {"mfix-vr4130", no_argument, NULL, OPTION_FIX_VR4130}, @@ -5619,6 +5629,8 @@ if ((reglist & 0x3f00ffff) != 0) return false; + +/* Fix NOP issue: Replace nops by "or at,at,zero". */ ra = (reglist >> 27) & 0x10; sregs = ((reglist >> 22) & 0x100) | ((reglist >> 16) & 0xff); } @@ -5630,6 +5642,35 @@ return true; } +static void +trap_zero_jump (struct mips_cl_insn * ip) +{ + if (strcmp (ip->insn_mo->name, "j") == 0 + || strcmp (ip->insn_mo->name, "jr") == 0 + || strcmp (ip->insn_mo->name, "jalr") == 0) + { + int sreg; + + if (mips_opts.warn_about_macros) + return; + + sreg = EXTRACT_OPERAND (0, RS, *ip); + if (mips_opts.isa == ISA_MIPS32 + || mips_opts.isa == ISA_MIPS32R2 + || mips_opts.isa == ISA_MIPS64 + || mips_opts.isa == ISA_MIPS64R2) + { + expressionS ep; + ep.X_op = O_constant; + ep.X_add_number = 4096; + macro_build (&ep, "tltiu", "s,j", sreg, BFD_RELOC_LO16); + } + else if (mips_opts.isa != ISA_UNKNOWN + && mips_opts.isa != ISA_MIPS1) + macro_build (NULL, "teq", "s,t", sreg, 0); + } +} + /* OP_ENTRY_EXIT_LIST matcher. */ static unsigned int @@ -6481,8 +6522,8 @@ /* Itbl support may require additional care here. FIXME! Need to modify this to include knowledge about user specified delays! */ - else if ((!cop_interlocks && (pinfo1 & INSN_COPROC_MOVE)) - || (!cop_mem_interlocks && (pinfo1 & INSN_COPROC_MEMORY_DELAY))) + if ((!cop_interlocks && (pinfo1 & INSN_COPROC_MOVE)) + || (!cop_mem_interlocks && (pinfo1 & INSN_COPROC_MEMORY_DELAY))) { /* Handle cases where INSN1 writes to a known general coprocessor register. There must be a one instruction delay before INSN2 @@ -7076,6 +7117,11 @@ if (mips_opts.mips16 && history[0].fixp[0]) return false; + if (mips_fix_loongson2f) + fix_loongson2f (ip); + if (mips_trap_zero_jump) + trap_zero_jump (ip); + /* If the branch is itself the target of a branch, we can not swap. We cheat on this; all we check for is whether there is a label on this instruction. If there are any branches to anything other than @@ -7224,6 +7270,45 @@ return true; } +/* Fix jump through register issue on loongson2f processor for kernel code: + force a BTB clear before the jump to prevent it from being incorrectly + prefetched by the branch prediction engine. */ + +static void +macro_build_jrpatch (expressionS *ep, unsigned int sreg) +{ + if (!mips_fix_loongson2f_btb) + return; + + if (sreg == ZERO || sreg == KT0 || sreg == KT1 || sreg == AT) + return; + + if (!mips_opts.at) + { + as_warn (_("unable to apply loongson2f BTB workaround when .set noat")); + return; + } + + /* li $at, COP_0_BTB_CLEAR | COP_0_RAS_DISABLE */ + ep->X_op = O_constant; + ep->X_add_number = 3; + macro_build (ep, "ori", "t,r,i", AT, ZERO, BFD_RELOC_LO16); + + /* dmtc0 $at, COP_0_DIAG */ + macro_build (NULL, "dmtc0", "t,G", AT, 22); + + /* Hide these two instructions to avoid getting a ``macro expanded into + multiple instructions'' warning. */ + if (mips_relax.sequence != 2) { + mips_macro_warning.sizes[0] -= 2 * 4; + mips_macro_warning.insns[0] -= 2; + } + if (mips_relax.sequence != 1) { + mips_macro_warning.sizes[1] -= 2 * 4; + mips_macro_warning.insns[1] -= 2; + } +} + /* Decide how we should add IP to the instruction stream. ADDRESS_EXPR is an operand of the instruction to be used with RELOC_TYPE. */ @@ -11592,6 +11677,26 @@ macro_build (NULL, ADDRESS_ADD_INSN, "d,v,t", op[0], tempreg, breg); break; + case M_JR_S: + macro_build_jrpatch (&expr1, op[2]); + macro_build (NULL, "jr", "s", op[2]); + return; /* didn't modify $at */ + + case M_J_S: + macro_build_jrpatch (&expr1, op[2]); + macro_build (NULL, "j", "s", op[2]); + return; /* didn't modify $at */ + + case M_JALR_S: + macro_build_jrpatch (&expr1, op[2]); + macro_build (NULL, "jalr", "s", op[2]); + return; /* didn't modify $at */ + + case M_JALR_DS: + macro_build_jrpatch (&expr1, op[2]); + macro_build (NULL, "jalr", "d,s", op[0], op[2]); + return; /* didn't modify $at */ + case M_MSGSND: gas_assert (!mips_opts.micromips); macro_build (NULL, "c2", "C", (op[0] << 16) | 0x01); @@ -15021,6 +15126,14 @@ mips_fix_vr4130 = 0; break; + case OPTION_FIX_LOONGSON2F_BTB: + mips_fix_loongson2f_btb = 1; + break; + + case OPTION_NO_FIX_LOONGSON2F_BTB: + mips_fix_loongson2f_btb = 0; + break; + case OPTION_FIX_CN63XXP1: mips_fix_cn63xxp1 = true; break; @@ -20470,6 +20583,7 @@ fprintf (stream, _("\ -mfix-loongson2f-jump work around Loongson2F JUMP instructions\n\ -mfix-loongson2f-nop work around Loongson2F NOP errata\n\ +-mfix-loongson2f-btb work around Loongson2F BTB errata\n\ -mfix-loongson3-llsc work around Loongson3 LL/SC errata\n\ -mno-fix-loongson3-llsc disable work around Loongson3 LL/SC errata\n\ -mfix-vr4120 work around certain VR4120 errata\n\ diff -Nru /Users/io/Downloads/binutils-2.45/gas/config/tc-mips.h dist/gas/config/tc-mips.h --- /Users/io/Downloads/binutils-2.45/gas/config/tc-mips.h 2025-07-27 01:00:00 +++ dist/gas/config/tc-mips.h 2025-11-14 01:50:18 @@ -187,7 +187,7 @@ #define DWARF2_ADDR_SIZE(bfd) mips_dwarf2_addr_size () #define DWARF2_FDE_RELOC_SIZE (compact_eh ? 4 : mips_dwarf2_addr_size ()) #define DWARF2_FDE_RELOC_ENCODING(enc) \ - (enc | (compact_eh ? DW_EH_PE_pcrel : 0)) + (compact_eh ? (enc)|DW_EH_PE_pcrel : DW_EH_PE_absptr) #define TARGET_USE_CFIPOP 1 diff -Nru /Users/io/Downloads/binutils-2.45/gas/config/tc-vax.c dist/gas/config/tc-vax.c --- /Users/io/Downloads/binutils-2.45/gas/config/tc-vax.c 2025-07-27 01:00:00 +++ dist/gas/config/tc-vax.c 2025-11-14 01:50:18 @@ -22,6 +22,7 @@ #include "vax-inst.h" #include "obstack.h" /* For FRAG_APPEND_1_CHAR macro in "frags.h" */ +#include "dw2gencfi.h" #include "subsegs.h" #include "safe-ctype.h" @@ -281,6 +282,29 @@ if (fixP->fx_subsy != NULL) as_bad_subtract (fixP); + if (fixP->fx_pcrel) + { + switch (fixP->fx_r_type) + { + case BFD_RELOC_32: + /* change the relocation type to 32 bit PC-relative */ + fixP->fx_r_type = BFD_RELOC_32_PCREL; + if (fixP->fx_addsy != NULL) + { + /* Hack around bfd_install_relocation brain damage. */ + value += fixP->fx_frag->fr_address + fixP->fx_where; + } + if (fixP->fx_addsy == abs_section_sym) + fixP->fx_done = 1; + break; + default: + break; + } + } + + /* + * Common code for pc-relative and non-pc-relative cases + */ if (fixP->fx_addsy == NULL) fixP->fx_done = 1; @@ -394,6 +418,9 @@ && (PLT_symbol == NULL || fragP->fr_symbol != PLT_symbol) && fragP->fr_symbol != NULL && flag_want_pic +#ifdef OBJ_ELF + && ELF_ST_VISIBILITY (S_GET_OTHER (fragP->fr_symbol)) != STV_HIDDEN +#endif && (!S_IS_DEFINED (fragP->fr_symbol) || S_IS_WEAK (fragP->fr_symbol) || S_IS_EXTERNAL (fragP->fr_symbol))) @@ -408,7 +435,10 @@ || ((unsigned char *) fragP->fr_opcode)[0] == VAX_CALLG || ((unsigned char *) fragP->fr_opcode)[0] == VAX_JSB || ((unsigned char *) fragP->fr_opcode)[0] == VAX_JMP - || S_IS_FUNCTION (fragP->fr_symbol)) +#if 0 /* port-vax/59326 */ + || S_IS_FUNCTION (fragP->fr_symbol) +#endif + ) reloc_type = BFD_RELOC_32_PLT_PCREL; else reloc_type = BFD_RELOC_32_GOT_PCREL; @@ -1070,6 +1100,81 @@ return retval; } +#ifdef OBJ_AOUT +#ifndef BFD_ASSEMBLER +void +tc_aout_fix_to_chars (where, fixP, segment_address_in_file) + char *where; + fixS *fixP; + relax_addressT segment_address_in_file; +{ + /* + * In: length of relocation (or of address) in chars: 1, 2 or 4. + * Out: GNU LD relocation length code: 0, 1, or 2. + */ + + static const unsigned char nbytes_r_length[] = {42, 0, 1, 42, 2}; + int r_symbolnum; + int r_flags; + + know (fixP->fx_addsy != NULL); + + md_number_to_chars (where, + fixP->fx_frag->fr_address + fixP->fx_where - segment_address_in_file, + 4); + + r_symbolnum = (S_IS_DEFINED (fixP->fx_addsy) + ? S_GET_TYPE (fixP->fx_addsy) + : fixP->fx_addsy->sy_number); + r_flags = (fixP->fx_pcrel ? 1 : 0) + | (!S_IS_DEFINED (fixP->fx_addsy) ? 8 : 0) /* extern */ + | ((nbytes_r_length[fixP->fx_size] & 3) << 1); + + switch (fixP->fx_r_type) { + case NO_RELOC: + break; + case NO_RELOC2: + if (r_flags & 8) + r_flags |= 0x80; /* setting the copy bit */ + /* says we can convert */ + /* to gotslot if needed */ + break; + case RELOC_32: + if (flag_want_pic && S_IS_EXTERNAL(fixP->fx_addsy)) { + r_symbolnum = fixP->fx_addsy->sy_number; + r_flags |= 8; /* set extern bit */ + } + break; + case RELOC_JMP_SLOT: + if (flag_want_pic) { + r_flags |= 0x20; /* set jmptable */ + r_flags &= ~0x08; /* clear extern bit */ + } + break; + case RELOC_JMP_TBL: + if (flag_want_pic) { + r_flags |= 0x20; /* set jmptable */ + r_flags |= 0x08; /* set extern bit */ + } + break; + case RELOC_GLOB_DAT: + if (flag_want_pic) { + r_flags |= 0x10; /* set baserel bit */ + r_symbolnum = fixP->fx_addsy->sy_number; + if (S_IS_EXTERNAL(fixP->fx_addsy)) + r_flags |= 8; /* set extern bit */ + } + break; + } + + where[4] = (r_symbolnum >> 0) & 0xff; + where[5] = (r_symbolnum >> 8) & 0xff; + where[6] = (r_symbolnum >> 16) & 0xff; + where[7] = r_flags; +} +#endif /* !BFD_ASSEMBLER */ +#endif /* OBJ_AOUT */ + /* Parse a vax operand in DEC assembler notation. For speed, expect a string of whitespace to be reduced to a single ' '. This is the case for GNU AS, and is easy for other DEC-compatible @@ -3110,7 +3215,7 @@ if (flag_want_pic && operandP->vop_mode == 8 && this_add_symbol != NULL) { - as_warn (_("Symbol %s used as immediate operand in PIC mode."), + as_warn (_("Symbol '%s' used as immediate operand in PIC mode."), S_GET_NAME (this_add_symbol)); } #endif @@ -3186,7 +3291,15 @@ length = 4; } } +#ifdef OBJ_ELF + if (flag_want_pic && this_add_symbol != NULL) + { + as_warn (_("Symbol '%s' used as displacement in PIC mode."), + S_GET_NAME (this_add_symbol)); + } +#endif p = frag_more (1 + length); + know (operandP->vop_reg != 0xf); know (operandP->vop_reg >= 0); p[0] = operandP->vop_reg | ((at | "?\12\14?\16"[length]) << 4); @@ -3349,16 +3462,81 @@ vax_cons_fix_new (fragS *frag, int where, unsigned int nbytes, expressionS *exp, bfd_reloc_code_real_type r) { - if (r == NO_RELOC) + int pcrel; + // fix PC relative frags too ... + switch (r) + { + case BFD_RELOC_8_PCREL: + case BFD_RELOC_16_PCREL: + case BFD_RELOC_32_PCREL: + pcrel = 1; + /* + * Displacement mode addressing (of which PC relative is one + * type) uses the updated contents of the register as the base + * address. VARM, Leonard 1987, pp34 + */ + switch (exp->X_op) + { + case O_constant: + case O_symbol: + exp->X_add_number += nbytes; + break; + } + break; + case NO_RELOC: r = (nbytes == 1 ? BFD_RELOC_8 : nbytes == 2 ? BFD_RELOC_16 : BFD_RELOC_32); + pcrel = 0; + break; + default: + pcrel = 0; + break; + } - fix_new_exp (frag, where, nbytes, exp, 0, r); + fix_new_exp (frag, where, nbytes, exp, pcrel, r); } const char * md_atof (int type, char * litP, int * sizeP) { return vax_md_atof (type, litP, sizeP); +} + +void +vax_cfi_frame_initial_instructions (void) +{ + cfi_add_CFA_def_cfa (14, 0); +} + +int +tc_vax_regname_to_dw2regnum (char *regname) +{ + unsigned int i; + static const struct { char *name; int dw2regnum; } regnames[] = + { + { "r0", 0 }, { "r1", 1 }, { "r2", 2 }, { "r3", 3 }, + { "r4", 4 }, { "r5", 5 }, { "r6", 6 }, { "r7", 7 }, + { "r8", 8 }, { "r9", 9 }, { "r10", 10 }, { "r11", 11 }, + { "ap", 12 }, { "fp", 13 }, { "sp", 14 }, { "pc", 15 }, + { "psw", 16 }, + }; + + for (i = 0; i < ARRAY_SIZE (regnames); ++i) + if (strcmp (regnames[i].name, regname) == 0) + return regnames[i].dw2regnum; + + return -1; +} + +void +vax_cfi_emit_pcrel_expr (expressionS *expP, unsigned int nbytes) +{ + expressionS tmp = *expP; + + tmp.X_op = O_subtract; + tmp.X_op_symbol = symbol_temp_new_now (); + expP = &tmp; + expP->X_add_number += nbytes; + emit_expr (expP, nbytes); } diff -Nru /Users/io/Downloads/binutils-2.45/gas/config/tc-vax.h dist/gas/config/tc-vax.h --- /Users/io/Downloads/binutils-2.45/gas/config/tc-vax.h 2025-07-27 01:00:00 +++ dist/gas/config/tc-vax.h 2025-11-14 01:50:18 @@ -33,6 +33,8 @@ #ifdef OBJ_ELF #define TARGET_FORMAT "elf32-vax" +#define DIFF_EXPR_OK 1 +#define CFI_DIFF_EXPR_OK 0 #endif #define TARGET_ARCH bfd_arch_vax @@ -67,9 +69,17 @@ == S_GET_SEGMENT ((FIX)->fx_addsy))) \ || S_IS_LOCAL ((FIX)->fx_addsy))) -/* - * Local Variables: - * comment-column: 0 - * fill-column: 131 - * End: - */ +#define TARGET_USE_CFIPOP 1 + +#define tc_cfi_frame_initial_instructions vax_cfi_frame_initial_instructions +extern void vax_cfi_frame_initial_instructions (void); + +#define tc_regname_to_dw2regnum tc_vax_regname_to_dw2regnum +extern int tc_vax_regname_to_dw2regnum (char *); + +#define tc_cfi_emit_pcrel_expr vax_cfi_emit_pcrel_expr +extern void vax_cfi_emit_pcrel_expr (expressionS *, unsigned int); + +#define DWARF2_LINE_MIN_INSN_LENGTH 1 +#define DWARF2_DEFAULT_RETURN_COLUMN 15 +#define DWARF2_CIE_DATA_ALIGNMENT -4 diff -Nru /Users/io/Downloads/binutils-2.45/gas/config/te-armnbsd.h dist/gas/config/te-armnbsd.h --- /Users/io/Downloads/binutils-2.45/gas/config/te-armnbsd.h 1970-01-01 01:00:00 +++ dist/gas/config/te-armnbsd.h 2025-11-14 01:50:18 @@ -0,0 +1,22 @@ +/* Copyright 2004, 2005, 2007, 2009 Free Software Foundation, Inc. + + This file is part of GAS, the GNU Assembler. + + GAS is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 3, + or (at your option) any later version. + + GAS is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See + the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with GAS; see the file COPYING. If not, write to the Free + Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA + 02110-1301, USA. */ + +#include "te-nbsd.h" + +#define CPU_DEFAULT ARM_ARCH_V4 diff -Nru /Users/io/Downloads/binutils-2.45/gas/config/te-armnbsdeabi.h dist/gas/config/te-armnbsdeabi.h --- /Users/io/Downloads/binutils-2.45/gas/config/te-armnbsdeabi.h 1970-01-01 01:00:00 +++ dist/gas/config/te-armnbsdeabi.h 2025-11-14 01:50:18 @@ -0,0 +1,25 @@ +/* Copyright 2004, 2005, 2007, 2009 Free Software Foundation, Inc. + + This file is part of GAS, the GNU Assembler. + + GAS is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 3, + or (at your option) any later version. + + GAS is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See + the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with GAS; see the file COPYING. If not, write to the Free + Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA + 02110-1301, USA. */ + +#include "te-nbsd.h" + +/* The EABI requires the use of VFP. */ +#define CPU_DEFAULT ARM_ARCH_V5TEJ +#define FPU_DEFAULT FPU_ARCH_VFP +#define EABI_DEFAULT EF_ARM_EABI_VER5 diff -Nru /Users/io/Downloads/binutils-2.45/gas/config/te-armnbsdeabihf.h dist/gas/config/te-armnbsdeabihf.h --- /Users/io/Downloads/binutils-2.45/gas/config/te-armnbsdeabihf.h 1970-01-01 01:00:00 +++ dist/gas/config/te-armnbsdeabihf.h 2025-11-14 01:50:18 @@ -0,0 +1,25 @@ +/* Copyright 2004, 2005, 2007, 2009 Free Software Foundation, Inc. + + This file is part of GAS, the GNU Assembler. + + GAS is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 3, + or (at your option) any later version. + + GAS is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See + the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with GAS; see the file COPYING. If not, write to the Free + Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA + 02110-1301, USA. */ + +#include "te-nbsd.h" + +/* The EABI requires the use of VFP. */ +#define CPU_DEFAULT ARM_ARCH_V5TEJ +#define FPU_DEFAULT FPU_ARCH_VFP_V2 +#define EABI_DEFAULT EF_ARM_EABI_VER5 diff -Nru /Users/io/Downloads/binutils-2.45/gas/config/vax-inst.h dist/gas/config/vax-inst.h --- /Users/io/Downloads/binutils-2.45/gas/config/vax-inst.h 2025-07-27 01:00:00 +++ dist/gas/config/vax-inst.h 2025-11-14 01:50:18 @@ -65,6 +65,8 @@ #define VAX_WIDEN_WORD (0x20) /* Add this to byte branch to get word br. */ #define VAX_WIDEN_LONG (0x6) /* Add this to byte branch to get long jmp.*/ /* Needs VAX_PC_RELATIVE_MODE byte after it*/ +#define VAX_CALLS (0xFB) /* Call with arg list on stack */ +#define VAX_CALLG (0xFA) /* Call with arg list in memory */ struct vit /* vax instruction tree */ { diff -Nru /Users/io/Downloads/binutils-2.45/gas/configure dist/gas/configure --- /Users/io/Downloads/binutils-2.45/gas/configure 2025-07-27 01:00:00 +++ dist/gas/configure 2025-11-14 01:50:18 @@ -11675,28 +11675,25 @@ # Add -Wstack-usage if the compiler is a sufficiently recent version of GCC. -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -__GNUC__ -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "(^[0-4]$|^__GNUC__$)" >/dev/null 2>&1; then : +#cat confdefs.h - <<_ACEOF >conftest.$ac_ext +#/* end confdefs.h. */ +#__GNUC__ +#_ACEOF +#if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | +# $EGREP "(^[0-4]$|^__GNUC__$)" >/dev/null 2>&1; then : +# +#else +# cat confdefs.h - <<_ACEOF >conftest.$ac_ext +#/* end confdefs.h. */ +#__clang__ +#_ACEOF +#if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | +# $EGREP "^__clang__$" >/dev/null 2>&1; then : +# GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Wstack-usage=262144" +#fi +#rm -f conftest* -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -__clang__ -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "^__clang__$" >/dev/null 2>&1; then : - GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Wstack-usage=262144" -fi -rm -f conftest* -fi -rm -f conftest* - - # Set WARN_WRITE_STRINGS if the compiler supports -Wwrite-strings. WARN_WRITE_STRINGS="" cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -11729,28 +11726,25 @@ # Add -Wstack-usage if the compiler is a sufficiently recent version of GCC. -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -__GNUC__ -_ACEOF -if (eval "$ac_cpp_for_build conftest.$ac_ext") 2>&5 | - $EGREP "(^[0-4]$|^__GNUC__$)" >/dev/null 2>&1; then : +#cat confdefs.h - <<_ACEOF >conftest.$ac_ext +#/* end confdefs.h. */ +#__GNUC__ +#_ACEOF +#if (eval "$ac_cpp_for_build conftest.$ac_ext") 2>&5 | +# $EGREP "(^[0-4]$|^__GNUC__$)" >/dev/null 2>&1; then : +# +#else +# cat confdefs.h - <<_ACEOF >conftest.$ac_ext +#/* end confdefs.h. */ +#__clang__ +#_ACEOF +#if (eval "$ac_cpp_for_build conftest.$ac_ext") 2>&5 | +# $EGREP "^__clang__$" >/dev/null 2>&1; then : +# GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Wstack-usage=262144" +#fi +#rm -f conftest* -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -__clang__ -_ACEOF -if (eval "$ac_cpp_for_build conftest.$ac_ext") 2>&5 | - $EGREP "^__clang__$" >/dev/null 2>&1; then : - GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Wstack-usage=262144" -fi -rm -f conftest* -fi -rm -f conftest* - - # Check whether --enable-werror was given. if test "${enable_werror+set}" = set; then : enableval=$enable_werror; case "${enableval}" in @@ -12210,7 +12204,7 @@ mips) # Set mips_cpu to the name of the default CPU. case ${target_cpu} in - mips | mipsbe | mipseb | mipsle | mipsel | mips64 | mips64el) + mips | mipsbe | mipseb | mipsle | mipsel | mips64 | mips64el | mips64eb | mipsn64el | mipsn64eb) mips_cpu=from-abi ;; mipsisa32 | mipsisa32el) diff -Nru /Users/io/Downloads/binutils-2.45/gas/configure.ac dist/gas/configure.ac --- /Users/io/Downloads/binutils-2.45/gas/configure.ac 2025-07-27 01:00:00 +++ dist/gas/configure.ac 2025-11-14 01:50:18 @@ -319,7 +319,7 @@ mips) # Set mips_cpu to the name of the default CPU. case ${target_cpu} in - mips | mipsbe | mipseb | mipsle | mipsel | mips64 | mips64el) + mips | mipsbe | mipseb | mipsle | mipsel | mips64 | mips64el | mips64eb | mipsn64el | mipsn64eb ) mips_cpu=from-abi ;; mipsisa32 | mipsisa32el) diff -Nru /Users/io/Downloads/binutils-2.45/gas/configure.tgt dist/gas/configure.tgt --- /Users/io/Downloads/binutils-2.45/gas/configure.tgt 2025-07-27 01:00:00 +++ dist/gas/configure.tgt 2025-11-14 01:50:18 @@ -73,7 +73,7 @@ m32c) cpu_type=m32c endian=little ;; m32r) cpu_type=m32r endian=big ;; m32rle) cpu_type=m32r endian=little ;; - m5200) cpu_type=m68k ;; + m5200|m5407) cpu_type=m68k ;; m68008) cpu_type=m68k ;; m680[012346]0) cpu_type=m68k ;; m6811|m6812|m68hc12) cpu_type=m68hc11 ;; @@ -354,6 +354,7 @@ or1k*-*-elf | or1k*-*-rtems*) fmt=elf endian=big ;; or1k*-*-linux*) fmt=elf em=linux endian=big ;; + or1k-*-netbsd*) fmt=elf em=nbsd ;; pj*) fmt=elf ;; diff -Nru /Users/io/Downloads/binutils-2.45/gas/doc/c-mips.texi dist/gas/doc/c-mips.texi --- /Users/io/Downloads/binutils-2.45/gas/doc/c-mips.texi 2025-07-27 01:00:00 +++ dist/gas/doc/c-mips.texi 2025-11-14 01:50:18 @@ -325,6 +325,14 @@ @itemx -mno-fix-vr4130 Insert nops to work around the VR4130 @samp{mflo}/@samp{mfhi} errata. +@item -mfix-loongson2f-btb +@itemx -mno-fix-loongson2f-btb +Clear the Branch Target Buffer before any jump through a register. This +option is intended to be used on kernel code for the Loongson 2F processor +only; userland code compiled with this option will fault, and kernel code +compiled with this option run on another processor than Loongson 2F will +yield unpredictable results. + @item -mfix-24k @itemx -mno-fix-24k Insert nops to work around the 24K @samp{eret}/@samp{deret} errata. diff -Nru /Users/io/Downloads/binutils-2.45/gprof/corefile.c dist/gprof/corefile.c --- /Users/io/Downloads/binutils-2.45/gprof/corefile.c 2025-07-27 01:00:00 +++ dist/gprof/corefile.c 2025-11-14 01:50:18 @@ -31,6 +31,8 @@ #include "safe-ctype.h" #include /* For UINT_MAX. */ +#include + bfd *core_bfd; static int core_num_syms; static asymbol **core_syms; diff -Nru /Users/io/Downloads/binutils-2.45/gprof/gprof.c dist/gprof/gprof.c --- /Users/io/Downloads/binutils-2.45/gprof/gprof.c 2025-07-27 01:00:00 +++ dist/gprof/gprof.c 2025-11-14 01:50:18 @@ -47,6 +47,8 @@ static void usage (FILE *, int) ATTRIBUTE_NORETURN; +#include + const char * whoami; const char * function_mapping_file; static const char * external_symbol_table; diff -Nru /Users/io/Downloads/binutils-2.45/include/elf/common.h dist/include/elf/common.h --- /Users/io/Downloads/binutils-2.45/include/elf/common.h 2025-07-27 01:00:00 +++ dist/include/elf/common.h 2025-11-14 01:50:19 @@ -1062,7 +1062,7 @@ /* Values for NetBSD .note.netbsd.ident notes. Note name is "NetBSD". */ #define NT_NETBSD_IDENT 1 -#define NT_NETBSD_MARCH 5 +#define NT_NETBSD_EMUL 2 /* obsolete */ /* Values for NetBSD .note.netbsd.ident notes. Note name is "PaX". */ #define NT_NETBSD_PAX 3 @@ -1072,6 +1072,9 @@ #define NT_NETBSD_PAX_NOGUARD 0x08 /* Force disable Segvguard. */ #define NT_NETBSD_PAX_ASLR 0x10 /* Force enable ASLR. */ #define NT_NETBSD_PAX_NOASLR 0x20 /* Force disable ASLR. */ + +#define NT_NETBSD_MARCH 5 +#define NT_NETBSD_MCMODEL 6 /* Values for OpenBSD .note.openbsd.ident notes. Note name is "OpenBSD". */ diff -Nru /Users/io/Downloads/binutils-2.45/include/opcode/mips.h dist/include/opcode/mips.h --- /Users/io/Downloads/binutils-2.45/include/opcode/mips.h 2025-07-27 01:00:00 +++ dist/include/opcode/mips.h 2025-11-14 01:50:19 @@ -1369,7 +1369,11 @@ M_DSUB_I, M_DSUBU_I, M_DSUBU_I_2, + M_JR_S, + M_J_S, M_J_A, + M_JALR_S, + M_JALR_DS, M_JAL_1, M_JAL_2, M_JAL_A, diff -Nru /Users/io/Downloads/binutils-2.45/ld/Makefile.am dist/ld/Makefile.am --- /Users/io/Downloads/binutils-2.45/ld/Makefile.am 2025-07-27 01:00:00 +++ dist/ld/Makefile.am 2025-11-14 01:50:19 @@ -173,6 +173,8 @@ earmelf_linux_fdpiceabi.c \ earmelf_nacl.c \ earmelf_nbsd.c \ + earmelf_nbsd_eabi.c \ + earmelf_nbsd_eabihf.c \ earmelf_phoenix.c \ earmelf_vxworks.c \ earmelfb.c \ @@ -183,6 +185,8 @@ earmelfb_linux_fdpiceabi.c \ earmelfb_nacl.c \ earmelfb_nbsd.c \ + earmelfb_nbsd_eabi.c \ + earmelfb_nbsd_eabihf.c \ earmnto.c \ earmpe.c \ eavr1.c \ @@ -257,8 +261,10 @@ eelf32mt.c \ eelf32or1k.c \ eelf32or1k_linux.c \ + eelf32or1k_nbsd.c \ eelf32ppc.c \ eelf32ppc_fbsd.c \ + eelf32ppc_nbsd.c \ eelf32ppchaiku.c \ eelf32ppclinux.c \ eelf32ppcnto.c \ @@ -385,6 +391,8 @@ eaarch64fbsdb.c \ eaarch64haiku.c \ eaarch64linux.c \ + eaarch64nbsd.c \ + eaarch64nbsdb.c \ eaarch64linux32.c \ eaarch64linux32b.c \ eaarch64linuxb.c \ diff -Nru /Users/io/Downloads/binutils-2.45/ld/Makefile.in dist/ld/Makefile.in --- /Users/io/Downloads/binutils-2.45/ld/Makefile.in 2025-07-27 01:00:00 +++ dist/ld/Makefile.in 2025-11-14 01:50:19 @@ -684,6 +684,8 @@ earmelf_linux_fdpiceabi.c \ earmelf_nacl.c \ earmelf_nbsd.c \ + earmelf_nbsd_eabi.c \ + earmelf_nbsd_eabihf.c \ earmelf_phoenix.c \ earmelf_vxworks.c \ earmelfb.c \ @@ -694,6 +696,8 @@ earmelfb_linux_fdpiceabi.c \ earmelfb_nacl.c \ earmelfb_nbsd.c \ + earmelfb_nbsd_eabi.c \ + earmelfb_nbsd_eabihf.c \ earmnto.c \ earmpe.c \ eavr1.c \ @@ -768,8 +772,10 @@ eelf32mt.c \ eelf32or1k.c \ eelf32or1k_linux.c \ + eelf32or1k_nbsd.c \ eelf32ppc.c \ eelf32ppc_fbsd.c \ + eelf32ppc_nbsd.c \ eelf32ppchaiku.c \ eelf32ppclinux.c \ eelf32ppcnto.c \ @@ -895,6 +901,8 @@ eaarch64fbsdb.c \ eaarch64haiku.c \ eaarch64linux.c \ + eaarch64nbsd.c \ + eaarch64nbsdb.c \ eaarch64linux32.c \ eaarch64linux32b.c \ eaarch64linuxb.c \ @@ -1282,6 +1290,8 @@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eaarch64linux32.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eaarch64linux32b.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eaarch64linuxb.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eaarch64nbsd.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eaarch64nbsdb.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eaarch64nto.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eaarch64pe.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eaix5ppc.Po@am__quote@ @@ -1306,6 +1316,8 @@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/earmelf_linux_fdpiceabi.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/earmelf_nacl.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/earmelf_nbsd.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/earmelf_nbsd_eabi.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/earmelf_nbsd_eabihf.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/earmelf_phoenix.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/earmelf_vxworks.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/earmelfb.Po@am__quote@ @@ -1316,6 +1328,9 @@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/earmelfb_linux_fdpiceabi.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/earmelfb_nacl.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/earmelfb_nbsd.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/earmelfb_nbsd_eabi.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/earmelfb_nbsd_eabihf.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/earmnbsd.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/earmnto.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/earmpe.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eavr1.Po@am__quote@ @@ -1398,6 +1413,7 @@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32lppclinux.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32lppcnto.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32lppcsim.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32lriscv.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32lr5900.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32lr5900n32.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32lriscv.Po@am__quote@ @@ -1421,8 +1437,10 @@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32mt.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32or1k.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32or1k_linux.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32or1k_nbsd.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32ppc.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32ppc_fbsd.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32ppc_nbsd.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32ppchaiku.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32ppclinux.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32ppcnto.Po@am__quote@ diff -Nru /Users/io/Downloads/binutils-2.45/ld/configure.tgt dist/ld/configure.tgt --- /Users/io/Downloads/binutils-2.45/ld/configure.tgt 2025-07-27 01:00:00 +++ dist/ld/configure.tgt 2025-11-14 01:50:19 @@ -82,9 +82,15 @@ # Please try to keep this table more or less in alphabetic order - it # makes it much easier to lookup a specific archictecture. case "${targ}" in +aarch64_be-*-netbsd*) targ_emul=aarch64nbsdb + targ_extra_emuls="aarch64nbsd aarch64elfb aarch64elf armelfb_nbsd_eabihf armelf_nbsd_eabihf armelfb_nbsd_eabi armelf_nbsd_eabi armelfb_nbsd armelf_nbsd armelf armelfb" + ;; aarch64_be-*-elf) targ_emul=aarch64elfb targ_extra_emuls="aarch64elf aarch64elf32 aarch64elf32b armelfb armelf" ;; +aarch64-*-netbsd*) targ_emul=aarch64nbsd + targ_extra_emuls="aarch64nbsdb aarch64elf aarch64elfb armelf_nbsd_eabihf armelfb_nbsd_eabihf armelf_nbsd_eabi armelfb_nbsd_eabi armelf_nbsd armelfb_nbsd armelf armelfb" + ;; aarch64-*-elf | aarch64-*-rtems* | aarch64-*-genode*) targ_emul=aarch64elf targ_extra_emuls="aarch64elf32 aarch64elf32b aarch64elfb armelf armelfb" @@ -190,12 +196,28 @@ targ_emul=armelf_fbsd targ_extra_emuls="armelfb_fbsd armelf" ;; -armeb-*-netbsd*) targ_emul=armelfb_nbsd; - targ_extra_emuls="armelf_nbsd armelf" +arm*eb-*-netbsd*-*eabihf*) + targ_emul=armelfb_nbsd_eabihf + targ_extra_emuls="armelf_nbsd_eabihf armelf_nbsd_eabi armelfb_nbsd_eabi armelf_nbsd armelfb_nbsd armelf" ;; -arm-*-netbsd*) targ_emul=armelf_nbsd; - targ_extra_emuls="armelfb_nbsd armelf" +arm*eb-*-netbsd*-*eabi*) + targ_emul=armelfb_nbsd_eabi + targ_extra_emuls="armelf_nbsd_eabi armelf_nbsd_eabihf armelfb_nbsd_eabihf armelf_nbsd armelfb_nbsd armelf" ;; +arm*-*-netbsd*-*eabihf*) + targ_emul=armelf_nbsd_eabihf + targ_extra_emuls="armelfb_nbsd_eabihf armelf_nbsd_eabi armelfb_nbsd_eabi armelf_nbsd armelfb_nbsd armelf" + ;; +arm*-*-netbsd*-*eabi*) + targ_emul=armelf_nbsd_eabi + targ_extra_emuls="armelfb_nbsd_eabi armelf_nbsd_eabihf armelfb_nbsd_eabihf armelf_nbsd armelfb_nbsd armelf" + ;; +arm*eb-*-netbsd*) targ_emul=armelfb_nbsd + targ_extra_emuls="armelf_nbsd armelf" + ;; +arm*-*-netbsd*) targ_emul=armelf_nbsd + targ_extra_emuls="armelfb_nbsd armelf" + ;; arm-*-nto*) targ_emul=armnto ;; arm-*-phoenix*) targ_emul=armelf @@ -539,6 +561,22 @@ mips*el-*-haiku*) targ_emul=elf_mipsel_haiku targ_extra_emuls="elf32ltsmip elf32btsmip elf32ltsmipn32 elf64ltsmip elf32btsmipn32 elf64btsmip" ;; +mips64*el-*-netbsd*) targ_emul=elf32ltsmipn32 + targ_extra_emuls="elf64btsmip elf64ltsmip elf32ltsmip elf32btsmipn32 elf32btsmip" + targ_extra_libpath=$targ_extra_emuls + ;; +mips64*-*-netbsd*) targ_emul=elf32btsmipn32 + targ_extra_emuls="elf64ltsmip elf64btsmip elf32btsmip elf32ltsmipn32 elf32ltsmip" + targ_extra_libpath=$targ_extra_emuls + ;; +mipsn64*el-*-netbsd*) targ_emul=elf64ltsmip + targ_extra_emuls="elf64btsmip elf32ltsmip elf32btsmip elf32btsmipn32 elf32ltsmipn32" + targ_extra_libpath=$targ_extra_emuls + ;; +mipsn64*-*-netbsd*) targ_emul=elf64btsmip + targ_extra_emuls="elf64ltsmip elf64btsmip elf32ltsmip elf32btsmip elf32ltsmipn32 elf32btsmipn32" + targ_extra_libpath=$targ_extra_emuls + ;; mips*el-*-netbsd*) targ_emul=elf32ltsmip targ_extra_emuls="elf32btsmip elf64ltsmip elf64btsmip" ;; @@ -679,8 +717,25 @@ or1k-*-elf | or1knd-*-elf | or1k-*-rtems* | or1knd-*-rtems*) targ_emul=elf32or1k ;; +or1k-*-netbsd* | or1knd-*-netbsd*) targ_emul=elf32or1k_nbsd + ;; or1k-*-linux* | or1knd-*-linux*) targ_emul=elf32or1k_linux ;; +powerpc-*-netbsd*) + targ_emul=elf32ppc_nbsd + targ_extra_emuls="elf32ppc elf32ppcsim" + targ_extra_libpath=elf32ppc; + tdir_elf32ppcsim=`echo ${targ_alias} | sed -e 's/ppc/ppcsim/'` + targ64_extra_emuls=elf64ppc + targ64_extra_libpath=elf64ppc + ;; +powerpc64-*-netbsd*) + targ_emul=elf64ppc + targ_extra_emuls="elf32ppc elf32ppc_nbsd elf32ppcsim" + targ_extra_libpath="elf32ppc_nbsd elf32ppc" + tdir_elf32ppc=`echo "${targ_alias}" | sed -e 's/64//'` + tdir_elf32ppc_fbsd=$tdir_elf32ppc + ;; pdp11-*-*) targ_emul=pdp11 targ_extra_ofiles= ;; @@ -807,11 +862,13 @@ ;; pru*-*-*) targ_emul=pruelf ;; -riscv32be*-*-linux*) targ_emul=elf32briscv +riscv32be*-*-linux* | riscv32be*-*-netbsd*) + targ_emul=elf32briscv targ_extra_emuls="elf32briscv_ilp32f elf32briscv_ilp32 elf64briscv elf64briscv_lp64f elf64briscv_lp64 elf32lriscv elf32lriscv_ilp32f elf32lriscv_ilp32 elf64lriscv elf64lriscv_lp64f elf64lriscv_lp64" targ_extra_libpath=$targ_extra_emuls ;; -riscv32*-*-linux*) targ_emul=elf32lriscv +riscv32*-*-linux* | riscv-*-netbsd* | riscv32*-*-netbsd*) + targ_emul=elf32lriscv targ_extra_emuls="elf32lriscv_ilp32f elf32lriscv_ilp32 elf64lriscv elf64lriscv_lp64f elf64lriscv_lp64 elf32briscv elf32briscv_ilp32f elf32briscv_ilp32 elf64briscv elf64briscv_lp64f elf64briscv_lp64" targ_extra_libpath=$targ_extra_emuls ;; @@ -825,11 +882,13 @@ targ_extra_emuls="elf64lriscv elf32briscv elf64briscv" targ_extra_libpath=$targ_extra_emuls ;; -riscv64be*-*-linux*) targ_emul=elf64briscv +riscv64be*-*-linux* | riscv64be*-*-netbsd*) + targ_emul=elf64briscv targ_extra_emuls="elf64briscv_lp64f elf64briscv_lp64 elf32briscv elf32briscv_ilp32f elf32briscv_ilp32 elf64lriscv elf64lriscv_lp64f elf64lriscv_lp64 elf32lriscv elf32lriscv_ilp32f elf32lriscv_ilp32" targ_extra_libpath=$targ_extra_emuls ;; -riscv64*-*-linux*) targ_emul=elf64lriscv +riscv64*-*-linux* | riscv64*-*-netbsd*) + targ_emul=elf64lriscv targ_extra_emuls="elf64lriscv_lp64f elf64lriscv_lp64 elf32lriscv elf32lriscv_ilp32f elf32lriscv_ilp32 elf64briscv elf64briscv_lp64f elf64briscv_lp64 elf32briscv elf32briscv_ilp32f elf32briscv_ilp32" targ_extra_libpath=$targ_extra_emuls ;; @@ -942,6 +1001,11 @@ targ_extra_libpath=elf64_sparc tdir_elf64_sparc=`echo ${targ_alias} | sed -e 's/32//'` ;; +sparc64-*-netbsd*) targ_emul=elf64_sparc + targ_extra_emuls="elf32_sparc" + ;; +sparc*-*-netbsd*) targ_emul=elf32_sparc + ;; sparc-*-solaris2.[0-6] | sparc-*-solaris2.[0-6].*) targ_emul=elf32_sparc_sol2 targ_extra_emuls=elf32_sparc @@ -1184,7 +1248,7 @@ # Enable -z separate-code and --warn-textrel by default for Linux/x86. case "${target}" in -i[3-7]86-*-linux-* | x86_64-*-linux-*) +i[3-7]86-*-linux-* | x86_64-*-linux-* | i[3-7]86-*-netbsd* | x86_64-*-netbsd*) if test ${ac_default_ld_z_separate_code} = unset; then ac_default_ld_z_separate_code=1 fi diff -Nru /Users/io/Downloads/binutils-2.45/ld/emulparams/aarch64nbsd.sh dist/ld/emulparams/aarch64nbsd.sh --- /Users/io/Downloads/binutils-2.45/ld/emulparams/aarch64nbsd.sh 1970-01-01 01:00:00 +++ dist/ld/emulparams/aarch64nbsd.sh 2025-11-14 01:50:19 @@ -0,0 +1,37 @@ +ARCH=aarch64 +MACHINE= +NOP=0 + +SCRIPT_NAME=elf +ELFSIZE=64 +OUTPUT_FORMAT="elf64-littleaarch64" +BIG_OUTPUT_FORMAT="elf64-bigaarch64" +LITTLE_OUTPUT_FORMAT="elf64-littleaarch64" +NO_REL_RELOCS=yes + +TEMPLATE_NAME=elf +EXTRA_EM_FILE=aarch64elf + +GENERATE_SHLIB_SCRIPT=yes +GENERATE_PIE_SCRIPT=yes + +MAXPAGESIZE="CONSTANT (MAXPAGESIZE)" +COMMONPAGESIZE="CONSTANT (COMMONPAGESIZE)" +SEPARATE_GOTPLT=24 +IREL_IN_PLT= + +TEXT_START_ADDR=0x200100000 + +DATA_START_SYMBOLS='PROVIDE (__data_start = .);'; + +# AArch64 does not support .s* sections. +NO_SMALL_DATA=yes + +OTHER_BSS_SYMBOLS='__bss_start__ = .;' +OTHER_BSS_END_SYMBOLS='_bss_end__ = . ; __bss_end__ = . ;' +OTHER_END_SYMBOLS='__end__ = . ;' + +OTHER_SECTIONS='.note.gnu.arm.ident 0 : { KEEP (*(.note.gnu.arm.ident)) }' +ATTRS_SECTIONS='.ARM.attributes 0 : { KEEP (*(.ARM.attributes)) KEEP (*(.gnu.attributes)) }' +# Ensure each PLT entry is aligned to a cache line. +PLT=".plt ${RELOCATING-0} : ALIGN(16) { *(.plt)${IREL_IN_PLT+ *(.iplt)} }" diff -Nru /Users/io/Downloads/binutils-2.45/ld/emulparams/aarch64nbsdb.sh dist/ld/emulparams/aarch64nbsdb.sh --- /Users/io/Downloads/binutils-2.45/ld/emulparams/aarch64nbsdb.sh 1970-01-01 01:00:00 +++ dist/ld/emulparams/aarch64nbsdb.sh 2025-11-14 01:50:19 @@ -0,0 +1,2 @@ +. ${srcdir}/emulparams/aarch64nbsd.sh +OUTPUT_FORMAT="elf64-bigaarch64" diff -Nru /Users/io/Downloads/binutils-2.45/ld/emulparams/armelf_nbsd.sh dist/ld/emulparams/armelf_nbsd.sh --- /Users/io/Downloads/binutils-2.45/ld/emulparams/armelf_nbsd.sh 2025-07-27 01:00:00 +++ dist/ld/emulparams/armelf_nbsd.sh 2025-11-14 01:50:19 @@ -1,7 +1,19 @@ source_sh ${srcdir}/emulparams/armelf.sh MAXPAGESIZE="CONSTANT (MAXPAGESIZE)" -TEXT_START_ADDR=0x00008000 +TEXT_START_ADDR=0x00010000 TARGET2_TYPE=got-rel +GENERATE_PIE_SCRIPT=yes +unset DATA_START_SYMBOLS unset STACK_ADDR unset EMBEDDED + +case "$target" in + aarch64*-*-netbsd* | arm*-*-netbsdelf*-*eabi*) + case "$EMULATION_NAME" in + armelf*_nbsd) + LIB_PATH='=/usr/lib/oabi' + ;; + esac + ;; +esac diff -Nru /Users/io/Downloads/binutils-2.45/ld/emulparams/armelf_nbsd_eabi.sh dist/ld/emulparams/armelf_nbsd_eabi.sh --- /Users/io/Downloads/binutils-2.45/ld/emulparams/armelf_nbsd_eabi.sh 1970-01-01 01:00:00 +++ dist/ld/emulparams/armelf_nbsd_eabi.sh 2025-11-14 01:50:19 @@ -0,0 +1,27 @@ +. ${srcdir}/emulparams/armelf_nbsd.sh + +# Use the ARM ABI-compliant exception-handling sections. +OTHER_READONLY_SECTIONS=" + .ARM.extab ${RELOCATING-0} : { *(.ARM.extab${RELOCATING+* .gnu.linkonce.armextab.*}) } + ${RELOCATING+ PROVIDE_HIDDEN (__exidx_start = .); } + .ARM.exidx ${RELOCATING-0} : { *(.ARM.exidx${RELOCATING+* .gnu.linkonce.armexidx.*}) } + ${RELOCATING+ PROVIDE_HIDDEN (__exidx_end = .); }" + +case "$target" in + arm*-*-netbsdelf*-*eabihf*) + case "$EMULATION_NAME" in + *armelf*eabi) + LIB_PATH='=/usr/lib/eabi' + ;; + esac + ;; + arm*-*-netbsdelf*-*eabi*) + ;; + aarch64*-*-netbsd* | arm*-*-netbsdelf*) + case "$EMULATION_NAME" in + *armelf*eabi) + LIB_PATH='=/usr/lib/eabi' + ;; + esac + ;; +esac diff -Nru /Users/io/Downloads/binutils-2.45/ld/emulparams/armelf_nbsd_eabihf.sh dist/ld/emulparams/armelf_nbsd_eabihf.sh --- /Users/io/Downloads/binutils-2.45/ld/emulparams/armelf_nbsd_eabihf.sh 1970-01-01 01:00:00 +++ dist/ld/emulparams/armelf_nbsd_eabihf.sh 2025-11-14 01:50:19 @@ -0,0 +1,20 @@ +. ${srcdir}/emulparams/armelf_nbsd.sh + +# Use the ARM ABI-compliant exception-handling sections. +OTHER_READONLY_SECTIONS=" + .ARM.extab ${RELOCATING-0} : { *(.ARM.extab${RELOCATING+* .gnu.linkonce.armextab.*}) } + ${RELOCATING+ PROVIDE_HIDDEN (__exidx_start = .); } + .ARM.exidx ${RELOCATING-0} : { *(.ARM.exidx${RELOCATING+* .gnu.linkonce.armexidx.*}) } + ${RELOCATING+ PROVIDE_HIDDEN (__exidx_end = .); }" + +case "$target" in + arm*-*-netbsdelf*-*eabihf*) + ;; + aarch64*-*-netbsd* | arm*-*-netbsdelf*) + case "$EMULATION_NAME" in + *armelf*eabihf) + LIB_PATH='=/usr/lib/eabihf' + ;; + esac + ;; +esac diff -Nru /Users/io/Downloads/binutils-2.45/ld/emulparams/armelfb_nbsd_eabi.sh dist/ld/emulparams/armelfb_nbsd_eabi.sh --- /Users/io/Downloads/binutils-2.45/ld/emulparams/armelfb_nbsd_eabi.sh 1970-01-01 01:00:00 +++ dist/ld/emulparams/armelfb_nbsd_eabi.sh 2025-11-14 01:50:19 @@ -0,0 +1,2 @@ +. ${srcdir}/emulparams/armelf_nbsd_eabi.sh +OUTPUT_FORMAT="elf32-bigarm" diff -Nru /Users/io/Downloads/binutils-2.45/ld/emulparams/armelfb_nbsd_eabihf.sh dist/ld/emulparams/armelfb_nbsd_eabihf.sh --- /Users/io/Downloads/binutils-2.45/ld/emulparams/armelfb_nbsd_eabihf.sh 1970-01-01 01:00:00 +++ dist/ld/emulparams/armelfb_nbsd_eabihf.sh 2025-11-14 01:50:19 @@ -0,0 +1,2 @@ +. ${srcdir}/emulparams/armelf_nbsd_eabihf.sh +OUTPUT_FORMAT="elf32-bigarm" diff -Nru /Users/io/Downloads/binutils-2.45/ld/emulparams/elf32_sparc.sh dist/ld/emulparams/elf32_sparc.sh --- /Users/io/Downloads/binutils-2.45/ld/emulparams/elf32_sparc.sh 2025-07-27 01:00:00 +++ dist/ld/emulparams/elf32_sparc.sh 2025-11-14 01:50:19 @@ -13,6 +13,17 @@ TEMPLATE_NAME=elf DATA_PLT= GENERATE_SHLIB_SCRIPT=yes +#ELFSIZE=32 GENERATE_PIE_SCRIPT=yes NOP=0x01000000 NO_SMALL_DATA=yes + +case "$target" in + sparc64-*-netbsd*) + case "$EMULATION_NAME" in + *32*) + LIB_PATH='=/usr/lib/sparc' + ;; + esac + ;; +esac diff -Nru /Users/io/Downloads/binutils-2.45/ld/emulparams/elf32bmip.sh dist/ld/emulparams/elf32bmip.sh --- /Users/io/Downloads/binutils-2.45/ld/emulparams/elf32bmip.sh 2025-07-27 01:00:00 +++ dist/ld/emulparams/elf32bmip.sh 2025-11-14 01:50:19 @@ -56,7 +56,7 @@ .lit8 ${RELOCATING-0} : { *(.lit8) } .lit4 ${RELOCATING-0} : { *(.lit4) } " -TEXT_START_SYMBOLS="${CREATE_SHLIB+PROVIDE (}_ftext = .${CREATE_SHLIB+)};" +TEXT_START_SYMBOLS="PROVIDE_HIDDEN (__eprol = .); ${CREATE_SHLIB+PROVIDE (}_ftext = .${CREATE_SHLIB+)};" DATA_START_SYMBOLS="${CREATE_SHLIB+PROVIDE (}_fdata = .${CREATE_SHLIB+)};" OTHER_BSS_SYMBOLS="${CREATE_SHLIB+PROVIDE (}_fbss = .${CREATE_SHLIB+)};" OTHER_SECTIONS=" diff -Nru /Users/io/Downloads/binutils-2.45/ld/emulparams/elf32bmipn32-defs.sh dist/ld/emulparams/elf32bmipn32-defs.sh --- /Users/io/Downloads/binutils-2.45/ld/emulparams/elf32bmipn32-defs.sh 2025-07-27 01:00:00 +++ dist/ld/emulparams/elf32bmipn32-defs.sh 2025-11-14 01:50:19 @@ -6,6 +6,7 @@ # Handle both big- and little-ended 32-bit MIPS objects. ARCH=mips +MACHINE= OUTPUT_FORMAT="elf32-bigmips" BIG_OUTPUT_FORMAT="elf32-bigmips" LITTLE_OUTPUT_FORMAT="elf32-littlemips" @@ -77,7 +78,7 @@ " # Magic symbols. -TEXT_START_SYMBOLS="${CREATE_SHLIB+PROVIDE (}_ftext = .${CREATE_SHLIB+)};" +TEXT_START_SYMBOLS="PROVIDE_HIDDEN (__eprol = .); ${CREATE_SHLIB+PROVIDE (}_ftext = .${CREATE_SHLIB+)};" DATA_START_SYMBOLS="${CREATE_SHLIB+PROVIDE (}_fdata = .${CREATE_SHLIB+)};" OTHER_BSS_SYMBOLS="${CREATE_SHLIB+PROVIDE (}_fbss = .${CREATE_SHLIB+)};" diff -Nru /Users/io/Downloads/binutils-2.45/ld/emulparams/elf32lriscv.sh dist/ld/emulparams/elf32lriscv.sh --- /Users/io/Downloads/binutils-2.45/ld/emulparams/elf32lriscv.sh 2025-07-27 01:00:00 +++ dist/ld/emulparams/elf32lriscv.sh 2025-11-14 01:50:19 @@ -12,4 +12,13 @@ LIBPATH_SUFFIX="32/ilp32d 32" ;; esac ;; + # NetBSD puts ILP32 libraries in rv32 subdirectory. + # XXX d vs f vs "" + riscv64-*-netbsd*) + case "$EMULATION_NAME" in + *32*) + LIB_PATH='=/usr/lib/rv32' + ;; + esac + ;; esac diff -Nru /Users/io/Downloads/binutils-2.45/ld/emulparams/elf32lriscv_ilp32.sh dist/ld/emulparams/elf32lriscv_ilp32.sh --- /Users/io/Downloads/binutils-2.45/ld/emulparams/elf32lriscv_ilp32.sh 2025-07-27 01:00:00 +++ dist/ld/emulparams/elf32lriscv_ilp32.sh 2025-11-14 01:50:19 @@ -11,4 +11,13 @@ LIBPATH_SUFFIX="32/ilp32 32" ;; esac ;; + # NetBSD puts ILP32 libraries in rv32 subdirectory. + # XXX d vs f vs "" + riscv64-*-netbsd*) + case "$EMULATION_NAME" in + *32*) + LIB_PATH='=/usr/lib/rv32' + ;; + esac + ;; esac diff -Nru /Users/io/Downloads/binutils-2.45/ld/emulparams/elf32lriscv_ilp32f.sh dist/ld/emulparams/elf32lriscv_ilp32f.sh --- /Users/io/Downloads/binutils-2.45/ld/emulparams/elf32lriscv_ilp32f.sh 2025-07-27 01:00:00 +++ dist/ld/emulparams/elf32lriscv_ilp32f.sh 2025-11-14 01:50:19 @@ -11,4 +11,13 @@ LIBPATH_SUFFIX="32/ilp32f 32" ;; esac ;; + # NetBSD puts ILP32 libraries in rv32 subdirectory. + # XXX d vs f vs "" + riscv64-*-netbsd*) + case "$EMULATION_NAME" in + *32*) + LIB_PATH='=/usr/lib/rv32' + ;; + esac + ;; esac diff -Nru /Users/io/Downloads/binutils-2.45/ld/emulparams/elf32or1k_nbsd.sh dist/ld/emulparams/elf32or1k_nbsd.sh --- /Users/io/Downloads/binutils-2.45/ld/emulparams/elf32or1k_nbsd.sh 1970-01-01 01:00:00 +++ dist/ld/emulparams/elf32or1k_nbsd.sh 2025-11-14 01:50:19 @@ -0,0 +1,6 @@ +. ${srcdir}/emulparams/elf32or1k.sh +unset EMBEDDED +GENERATE_SHLIB_SCRIPT=yes +GENERATE_PIE_SCRIPT=yes +GENERATE_COMBRELOC_SCRIPT=yes +TEXT_START_ADDR=0x00002000 diff -Nru /Users/io/Downloads/binutils-2.45/ld/emulparams/elf32ppc_nbsd.sh dist/ld/emulparams/elf32ppc_nbsd.sh --- /Users/io/Downloads/binutils-2.45/ld/emulparams/elf32ppc_nbsd.sh 1970-01-01 01:00:00 +++ dist/ld/emulparams/elf32ppc_nbsd.sh 2025-11-14 01:50:19 @@ -0,0 +1,10 @@ +. ${srcdir}/emulparams/elf32ppc.sh + +case "$target" in + powerpc64*-*-netbsd*) + case "$EMULATION_NAME" in + *32*) + LIB_PATH='=/usr/lib/powerpc' + ;; + esac +esac diff -Nru /Users/io/Downloads/binutils-2.45/ld/emulparams/elf64alpha_nbsd.sh dist/ld/emulparams/elf64alpha_nbsd.sh --- /Users/io/Downloads/binutils-2.45/ld/emulparams/elf64alpha_nbsd.sh 2025-07-27 01:00:00 +++ dist/ld/emulparams/elf64alpha_nbsd.sh 2025-11-14 01:50:19 @@ -1,2 +1,8 @@ source_sh ${srcdir}/emulparams/elf64alpha.sh ENTRY=__start + +NOP=0x47ff041f +# XXX binutils 2.13 +# Note that the number is always big-endian, thus we have to +# reverse the digit string. +#NOP=0x0000fe2f1f04ff47 # unop; nop diff -Nru /Users/io/Downloads/binutils-2.45/ld/emulparams/elf_i386.sh dist/ld/emulparams/elf_i386.sh --- /Users/io/Downloads/binutils-2.45/ld/emulparams/elf_i386.sh 2025-07-27 01:00:00 +++ dist/ld/emulparams/elf_i386.sh 2025-11-14 01:50:19 @@ -19,10 +19,22 @@ TEMPLATE_NAME=elf EXTRA_EM_FILE="elf-x86" GENERATE_SHLIB_SCRIPT=yes +#ELFSIZE=32 GENERATE_PIE_SCRIPT=yes NO_SMALL_DATA=yes SEPARATE_GOTPLT="SIZEOF (.got.plt) >= 12 ? 12 : 0" IREL_IN_PLT= + +case "$target" in + x86_64-*-netbsd*) + case "$EMULATION_NAME" in + *i386*) + LIB_PATH='=/usr/lib/i386' + ;; + esac + ;; +esac + # These sections are placed right after .plt section. OTHER_PLT_SECTIONS=" .plt.got ${RELOCATING-0} : { *(.plt.got) } diff -Nru /Users/io/Downloads/binutils-2.45/ld/emulparams/hppalinux.sh dist/ld/emulparams/hppalinux.sh --- /Users/io/Downloads/binutils-2.45/ld/emulparams/hppalinux.sh 2025-07-27 01:00:00 +++ dist/ld/emulparams/hppalinux.sh 2025-11-14 01:50:19 @@ -1,5 +1,5 @@ # If you change this file, please also look at files which source this one: -# hppanbsd.sh +# hppanbsd.sh hppaobsd.sh SCRIPT_NAME=elf ELFSIZE=32 diff -Nru /Users/io/Downloads/binutils-2.45/ld/emulparams/m68kelf.sh dist/ld/emulparams/m68kelf.sh --- /Users/io/Downloads/binutils-2.45/ld/emulparams/m68kelf.sh 2025-07-27 01:00:00 +++ dist/ld/emulparams/m68kelf.sh 2025-11-14 01:50:19 @@ -10,5 +10,6 @@ TEMPLATE_NAME=elf EXTRA_EM_FILE=m68kelf GENERATE_SHLIB_SCRIPT=yes +ELFSIZE=32 GENERATE_PIE_SCRIPT=yes NO_SMALL_DATA=yes diff -Nru /Users/io/Downloads/binutils-2.45/ld/emulparams/m68kelfnbsd.sh dist/ld/emulparams/m68kelfnbsd.sh --- /Users/io/Downloads/binutils-2.45/ld/emulparams/m68kelfnbsd.sh 2025-07-27 01:00:00 +++ dist/ld/emulparams/m68kelfnbsd.sh 2025-11-14 01:50:19 @@ -1,4 +1,4 @@ source_sh ${srcdir}/emulparams/m68kelf.sh TEXT_START_ADDR=0x2000 TARGET_PAGE_SIZE=0x2000 -MACHINE= +NONPAGED_TEXT_START_ADDR=${TEXT_START_ADDR} diff -Nru /Users/io/Downloads/binutils-2.45/ld/emulparams/sh.sh dist/ld/emulparams/sh.sh --- /Users/io/Downloads/binutils-2.45/ld/emulparams/sh.sh 2025-07-27 01:00:00 +++ dist/ld/emulparams/sh.sh 2025-11-14 01:50:19 @@ -3,6 +3,6 @@ SCRIPT_NAME=sh OUTPUT_FORMAT="coff-sh" -TEXT_START_ADDR=0x8000 -TARGET_PAGE_SIZE=128 +TEXT_START_ADDR=0x1000 +TARGET_PAGE_SIZE=0x1000 ARCH=sh diff -Nru /Users/io/Downloads/binutils-2.45/ld/emulparams/shelf_nbsd.sh dist/ld/emulparams/shelf_nbsd.sh --- /Users/io/Downloads/binutils-2.45/ld/emulparams/shelf_nbsd.sh 2025-07-27 01:00:00 +++ dist/ld/emulparams/shelf_nbsd.sh 2025-11-14 01:50:19 @@ -9,7 +9,12 @@ DATA_START_SYMBOLS='PROVIDE (__data_start = .);'; -ENTRY=_start +ENTRY=__start unset EMBEDDED +unset OTHER_SECTIONS + +OTHER_READWRITE_SECTIONS=' + .note.ABI-tag : { *(.note.ABI-tag) } +' unset STACK_ADDR diff -Nru /Users/io/Downloads/binutils-2.45/ld/emultempl/aarch64elf.em dist/ld/emultempl/aarch64elf.em --- /Users/io/Downloads/binutils-2.45/ld/emultempl/aarch64elf.em 2025-07-27 01:00:00 +++ dist/ld/emultempl/aarch64elf.em 2025-11-14 01:50:19 @@ -57,6 +57,8 @@ ldfile_set_output_arch ("`echo ${ARCH}`", bfd_arch_unknown); #endif /* not TARGET_ */ input_flags.dynamic = ${DYNAMIC_LINK-true}; + /* XXX For NetBSD, ----copy-dt-needed-entries by default. */ + input_flags.add_DT_NEEDED_for_dynamic = true; config.has_shared = `if test -n "$GENERATE_SHLIB_SCRIPT" ; then echo true ; else echo false ; fi`; config.separate_code = `if test "x${SEPARATE_CODE}" = xyes ; then echo true ; else echo false ; fi`; link_info.check_relocs_after_open_input = true; diff -Nru /Users/io/Downloads/binutils-2.45/ld/emultempl/armelf.em dist/ld/emultempl/armelf.em --- /Users/io/Downloads/binutils-2.45/ld/emultempl/armelf.em 2025-07-27 01:00:00 +++ dist/ld/emultempl/armelf.em 2025-11-14 01:50:19 @@ -57,6 +57,8 @@ ldfile_set_output_arch ("`echo ${ARCH}`", bfd_arch_unknown); #endif /* not TARGET_ */ input_flags.dynamic = ${DYNAMIC_LINK-true}; + /* XXX For NetBSD, ----copy-dt-needed-entries by default. */ + input_flags.add_DT_NEEDED_for_dynamic = true; config.has_shared = `if test -n "$GENERATE_SHLIB_SCRIPT" ; then echo true ; else echo false ; fi`; config.separate_code = `if test "x${SEPARATE_CODE}" = xyes ; then echo true ; else echo false ; fi`; link_info.check_relocs_after_open_input = true; diff -Nru /Users/io/Downloads/binutils-2.45/ld/emultempl/elf.em dist/ld/emultempl/elf.em --- /Users/io/Downloads/binutils-2.45/ld/emultempl/elf.em 2025-07-27 01:00:00 +++ dist/ld/emultempl/elf.em 2025-11-14 01:50:19 @@ -82,6 +82,8 @@ { ldfile_set_output_arch ("${OUTPUT_ARCH}", bfd_arch_`echo ${ARCH} | sed -e 's/:.*//'`); input_flags.dynamic = ${DYNAMIC_LINK-true}; + /* XXX For NetBSD, ----copy-dt-needed-entries by default. */ + input_flags.add_DT_NEEDED_for_dynamic = true; config.has_shared = `if test -n "$GENERATE_SHLIB_SCRIPT" ; then echo true ; else echo false ; fi`; config.separate_code = `if test "x${SEPARATE_CODE}" = xyes ; then echo true ; else echo false ; fi`; link_info.check_relocs_after_open_input = true; diff -Nru /Users/io/Downloads/binutils-2.45/ld/genscripts.sh dist/ld/genscripts.sh --- /Users/io/Downloads/binutils-2.45/ld/genscripts.sh 2025-07-27 01:00:00 +++ dist/ld/genscripts.sh 2025-11-14 01:50:19 @@ -266,7 +266,8 @@ done libs="${exec_prefix}/${TOOL_LIB}/lib ${libs}" fi - append_to_lib_path ${libs} + #NetBSD: don't spam linker scripts like this. + #append_to_lib_path ${libs} fi if [ "x${LIB_PATH}" = "x" ] && [ "x${USE_LIBPATH}" = xyes ] ; then diff -Nru /Users/io/Downloads/binutils-2.45/ld/lexsup.c dist/ld/lexsup.c --- /Users/io/Downloads/binutils-2.45/ld/lexsup.c 2025-07-27 01:00:00 +++ dist/ld/lexsup.c 2025-11-14 01:50:19 @@ -470,7 +470,7 @@ ONE_DASH }, { {"shared", no_argument, NULL, OPTION_SHARED}, '\0', NULL, N_("Create a shared library"), ONE_DASH }, - { {"Bshareable", no_argument, NULL, OPTION_SHARED }, /* FreeBSD. */ + { {"Bshareable", no_argument, NULL, OPTION_SHARED }, /* FreeBSD, NetBSD. */ '\0', NULL, NULL, ONE_DASH }, { {"pie", no_argument, NULL, OPTION_PIE}, '\0', NULL, N_("Create a position independent executable"), ONE_DASH }, @@ -611,6 +611,8 @@ { {"whole-archive", no_argument, NULL, OPTION_WHOLE_ARCHIVE}, '\0', NULL, N_("Include all objects from following archives"), TWO_DASHES }, + { {"Bforcearchive", no_argument, NULL, OPTION_WHOLE_ARCHIVE}, + '\0', NULL, NULL, TWO_DASHES }, /* NetBSD. */ { {"wrap", required_argument, NULL, OPTION_WRAP}, '\0', N_("SYMBOL"), N_("Use wrapper functions for SYMBOL"), TWO_DASHES }, { {"ignore-unresolved-symbol", required_argument, NULL, diff -Nru /Users/io/Downloads/binutils-2.45/ld/scripttempl/elf.sc dist/ld/scripttempl/elf.sc --- /Users/io/Downloads/binutils-2.45/ld/scripttempl/elf.sc 2025-07-27 01:00:00 +++ dist/ld/scripttempl/elf.sc 2025-11-14 01:50:19 @@ -157,6 +157,8 @@ # then set foo equal to bar, otherwise set foo equal to baz. # ------------------------------------------------------------------------ +test -z "$TEXT_START_SYMBOLS" && TEXT_START_SYMBOLS="PROVIDE_HIDDEN (__eprol = .);" +test -z "$ENTRY" && ENTRY=_start if test -n "$NOP"; then FILL="=$NOP" else @@ -648,6 +650,7 @@ .text ${RELOCATING-0} : { ${RELOCATING+${TEXT_START_SYMBOLS}} + *(.text) ${RELOCATING+*(.text.unlikely .text.*_unlikely .text.unlikely.*)} ${RELOCATING+*(.text.exit .text.exit.*)} ${RELOCATING+*(.text.startup .text.startup.*)} @@ -727,19 +730,6 @@ .exception_ranges ${RELOCATING-0} : ONLY_IF_RO { *(.exception_ranges${RELOCATING+*}) } ${TEXT_PLT+${PLT_NEXT_DATA+${PLT} ${OTHER_PLT_SECTIONS}}} - - /* Various note sections. Placed here so that they are always included - in the read-only segment and not treated as orphan sections. The - current orphan handling algorithm does place note sections after R/O - data, but this is not guaranteed to always be the case. */ - .note.build-id : { *(.note.build-id) } ${RELOCATING+${REGION}} - .note.GNU-stack : { *(.note.GNU-stack) } ${RELOCATING+${REGION}} - .note.gnu-property : { *(.note.gnu-property) } ${RELOCATING+${REGION}} - .note.ABI-tag : { *(.note.ABI-tag) } ${RELOCATING+${REGION}} - .note.package : { *(.note.package) } ${RELOCATING+${REGION}} - .note.dlopen : { *(.note.dlopen) } ${RELOCATING+${REGION}} - .note.netbsd.ident : { *(.note.netbsd.ident) } ${RELOCATING+${REGION}} - .note.openbsd.ident : { *(.note.openbsd.ident) } ${RELOCATING+${REGION}} ${RELOCATING+${ETEXT_LAST_IN_RODATA_SEGMENT+PROVIDE (__${ETEXT_NAME} = .);}} ${RELOCATING+${ETEXT_LAST_IN_RODATA_SEGMENT+PROVIDE (_${ETEXT_NAME} = .);}} diff -Nru /Users/io/Downloads/binutils-2.45/ld/scripttempl/sh.sc dist/ld/scripttempl/sh.sc --- /Users/io/Downloads/binutils-2.45/ld/scripttempl/sh.sc 2025-07-27 01:00:00 +++ dist/ld/scripttempl/sh.sc 2025-11-14 01:50:19 @@ -23,6 +23,7 @@ OUTPUT_FORMAT("${OUTPUT_FORMAT}") OUTPUT_ARCH(${ARCH}) +${LIB_SEARCH_DIRS} EOF @@ -42,9 +43,9 @@ *(.text) *(.strings) ${RELOCATING+ _etext = . ; } - } ${RELOCATING+ > ram} + } ${CONSTRUCTING+${TORS}} - .data : + .data ${RELOCATING+ ALIGN(${TARGET_PAGE_SIZE})} : { *(.data) ${RELOCATING+*(.gcc_exc*)} @@ -53,19 +54,19 @@ ${RELOCATING+___EH_FRAME_END__ = . ;} ${RELOCATING+LONG(0);} ${RELOCATING+ _edata = . ; } - } ${RELOCATING+ > ram} - .bss : + } + .bss ${RELOCATING+ ALIGN(${TARGET_PAGE_SIZE})} : { ${RELOCATING+ _bss_start = . ; } *(.bss) *(COMMON) ${RELOCATING+ _end = . ; } - } ${RELOCATING+ > ram} - .stack ${RELOCATING+ 0x30000 } : + } + .stack : { ${RELOCATING+ _stack = . ; } *(.stack) - } ${RELOCATING+ > ram} + } .stab 0 ${RELOCATING+(NOLOAD)} : { *(.stab) diff -Nru /Users/io/Downloads/binutils-2.45/libiberty/floatformat.c dist/libiberty/floatformat.c --- /Users/io/Downloads/binutils-2.45/libiberty/floatformat.c 2025-07-27 01:00:00 +++ dist/libiberty/floatformat.c 2025-11-14 01:50:19 @@ -515,7 +515,11 @@ if (nan) dto = NAN; else +#ifdef __vax__ + dto = HUGE_VAL; +#else dto = INFINITY; +#endif if (get_field (ufrom, fmt->byteorder, fmt->totalsize, fmt->sign_start, 1)) dto = -dto; diff -Nru /Users/io/Downloads/binutils-2.45/libiberty/make-temp-file.c dist/libiberty/make-temp-file.c --- /Users/io/Downloads/binutils-2.45/libiberty/make-temp-file.c 2025-07-27 01:00:00 +++ dist/libiberty/make-temp-file.c 2025-11-14 01:50:19 @@ -96,6 +96,8 @@ } static const char tmp[] = { DIR_SEPARATOR, 't', 'm', 'p', 0 }; +static const char usrtmp[] = +{ DIR_SEPARATOR, 'u', 's', 'r', DIR_SEPARATOR, 't', 'm', 'p', 0 }; static const char vartmp[] = { DIR_SEPARATOR, 'v', 'a', 'r', DIR_SEPARATOR, 't', 'm', 'p', 0 }; @@ -142,9 +144,10 @@ base = try_dir (P_tmpdir, base); #endif - /* Try /var/tmp, then /tmp. */ - base = try_dir (vartmp, base); + /* Try /tmp, /var/tmp, then /usr/tmp. */ base = try_dir (tmp, base); + base = try_dir (vartmp, base); + base = try_dir (usrtmp, base); /* If all else fails, use the current directory! */ if (base == 0) diff -Nru /Users/io/Downloads/binutils-2.45/libiberty/strsignal.c dist/libiberty/strsignal.c --- /Users/io/Downloads/binutils-2.45/libiberty/strsignal.c 2025-07-27 01:00:00 +++ dist/libiberty/strsignal.c 2025-11-14 01:50:19 @@ -551,7 +551,7 @@ #ifndef HAVE_PSIGNAL void -psignal (int signo, char *message) +psignal (int signo, const char *message) { if (signal_names == NULL) { diff -Nru /Users/io/Downloads/binutils-2.45/opcodes/Makefile.am dist/opcodes/Makefile.am --- /Users/io/Downloads/binutils-2.45/opcodes/Makefile.am 2025-07-27 01:00:00 +++ dist/opcodes/Makefile.am 2025-11-14 01:50:19 @@ -76,6 +76,7 @@ mep-desc.h mep-opc.h \ microblaze-opc.h \ mt-desc.h mt-opc.h \ + or1k-desc.h or1k-opc.h \ score-opc.h \ sh-opc.h \ sysdep.h \ diff -Nru /Users/io/Downloads/binutils-2.45/opcodes/Makefile.in dist/opcodes/Makefile.in --- /Users/io/Downloads/binutils-2.45/opcodes/Makefile.in 2025-07-27 01:00:00 +++ dist/opcodes/Makefile.in 2025-11-14 01:50:19 @@ -1004,6 +1004,7 @@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/or1k-dis.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/or1k-ibld.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/or1k-opc.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/or1k-opinst.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pdp11-dis.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pdp11-opc.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pj-dis.Plo@am__quote@ diff -Nru /Users/io/Downloads/binutils-2.45/opcodes/cgen.sh dist/opcodes/cgen.sh --- /Users/io/Downloads/binutils-2.45/opcodes/cgen.sh 2025-07-27 01:00:00 +++ dist/opcodes/cgen.sh 2025-11-14 01:50:19 @@ -61,6 +61,7 @@ shift ; extrafiles=$9 rootdir=${srcdir}/.. +move_if_change="${CONFIG_SHELL:-/bin/sh} ${rootdir}/move-if-change" # $arch is $6, as passed on the command line. # $ARCH is the same argument but in all uppercase.