diff options
Diffstat (limited to 'bfd')
-rw-r--r-- | bfd/ChangeLog | 18 | ||||
-rw-r--r-- | bfd/Makefile.am | 14 | ||||
-rw-r--r-- | bfd/Makefile.in | 20 | ||||
-rw-r--r-- | bfd/config.bfd | 98 | ||||
-rwxr-xr-x | bfd/configure | 6 | ||||
-rw-r--r-- | bfd/configure.ac | 6 | ||||
-rw-r--r-- | bfd/doc/bfdint.texi | 10 | ||||
-rw-r--r-- | bfd/freebsd.h | 100 | ||||
-rw-r--r-- | bfd/i386dynix.c | 82 | ||||
-rw-r--r-- | bfd/i386freebsd.c | 38 | ||||
-rw-r--r-- | bfd/i386linux.c | 733 | ||||
-rw-r--r-- | bfd/i386mach3.c | 73 | ||||
-rw-r--r-- | bfd/i386netbsd.c | 38 | ||||
-rw-r--r-- | bfd/i386os9k.c | 242 | ||||
-rw-r--r-- | bfd/po/SRC-POTFILES.in | 7 | ||||
-rw-r--r-- | bfd/targets.c | 21 |
16 files changed, 45 insertions, 1461 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index b53adc1..afa66e0 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,21 @@ +2018-04-18 Alan Modra <amodra@gmail.com> + + * Makefile.am: Remove support for assorted i386 aout and coff targets. + * config.bfd: Likewise. + * configure.ac: Likewise. + * doc/bfdint.texi: Likewise. + * targets.c: Likewise. + * freebsd.h: Delete. + * i386dynix.c: Delete. + * i386freebsd.c: Delete. + * i386linux.c: Delete. + * i386mach3.c: Delete. + * i386netbsd.c: Delete. + * i386os9k.c: Delete. + * Makefile.in: Regenerate. + * configure: Regenerate. + * po/SRC-POTFILES.in: Regenerate. + 2018-04-17 Andrew Sadek <andrew.sadek.se@gmail.com> Microblaze Target: PIC data text relative diff --git a/bfd/Makefile.am b/bfd/Makefile.am index d964055..2008e12 100644 --- a/bfd/Makefile.am +++ b/bfd/Makefile.am @@ -359,14 +359,8 @@ BFD32_BACKENDS = \ elfxx-tilegx.lo \ i386aout.lo \ i386bsd.lo \ - i386dynix.lo \ - i386freebsd.lo \ - i386linux.lo \ i386lynx.lo \ - i386mach3.lo \ i386msdos.lo \ - i386netbsd.lo \ - i386os9k.lo \ mach-o.lo \ mach-o-i386.lo \ mach-o-arm.lo \ @@ -508,14 +502,8 @@ BFD32_BACKENDS_CFILES = \ elfxx-tilegx.c \ i386aout.c \ i386bsd.c \ - i386dynix.c \ - i386freebsd.c \ - i386linux.c \ i386lynx.c \ - i386mach3.c \ i386msdos.c \ - i386netbsd.c \ - i386os9k.c \ mach-o.c \ mach-o-i386.c \ mach-o-arm.c \ @@ -700,7 +688,7 @@ SOURCE_HFILES = \ aout-target.h aoutx.h coffcode.h coffswap.h ecoffswap.h \ elf-bfd.h elf-hppa.h elf-linux-core.h elf32-hppa.h \ elf64-hppa.h elfcode.h elfcore.h \ - freebsd.h genlink.h go32stub.h \ + genlink.h go32stub.h \ libaout.h libbfd.h libcoff.h libecoff.h libhppa.h \ libpei.h libxcoff.h mach-o.h \ netbsd.h ns32k.h \ diff --git a/bfd/Makefile.in b/bfd/Makefile.in index 5176a32..6ac276e 100644 --- a/bfd/Makefile.in +++ b/bfd/Makefile.in @@ -693,14 +693,8 @@ BFD32_BACKENDS = \ elfxx-tilegx.lo \ i386aout.lo \ i386bsd.lo \ - i386dynix.lo \ - i386freebsd.lo \ - i386linux.lo \ i386lynx.lo \ - i386mach3.lo \ i386msdos.lo \ - i386netbsd.lo \ - i386os9k.lo \ mach-o.lo \ mach-o-i386.lo \ mach-o-arm.lo \ @@ -842,14 +836,8 @@ BFD32_BACKENDS_CFILES = \ elfxx-tilegx.c \ i386aout.c \ i386bsd.c \ - i386dynix.c \ - i386freebsd.c \ - i386linux.c \ i386lynx.c \ - i386mach3.c \ i386msdos.c \ - i386netbsd.c \ - i386os9k.c \ mach-o.c \ mach-o-i386.c \ mach-o-arm.c \ @@ -1035,7 +1023,7 @@ SOURCE_HFILES = \ aout-target.h aoutx.h coffcode.h coffswap.h ecoffswap.h \ elf-bfd.h elf-hppa.h elf-linux-core.h elf32-hppa.h \ elf64-hppa.h elfcode.h elfcore.h \ - freebsd.h genlink.h go32stub.h \ + genlink.h go32stub.h \ libaout.h libbfd.h libcoff.h libecoff.h libhppa.h \ libpei.h libxcoff.h mach-o.h \ netbsd.h ns32k.h \ @@ -1432,14 +1420,8 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hpux-core.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/i386aout.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/i386bsd.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/i386dynix.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/i386freebsd.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/i386linux.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/i386lynx.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/i386mach3.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)/i386os9k.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ihex.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/init.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/irix-core.Plo@am__quote@ diff --git a/bfd/config.bfd b/bfd/config.bfd index 6f48ae1..38bfdfd 100644 --- a/bfd/config.bfd +++ b/bfd/config.bfd @@ -53,29 +53,11 @@ case $targ in echo "*** Use or1k-*-elf or or1k-*-linux as the target instead" >&2 exit 1 ;; - i[3-7]86-*-netbsdelf* | i[3-7]86-*-netbsd*-gnu* | i[3-7]86-*-knetbsd*-gnu | \ mips*-*-irix5* | mips*-*-irix6*) # Not obsolete ;; arm*-*-aout | \ arm*-*-coff | \ - i[3-7]86-*-sco3.2v5*coff | \ - i[3-7]86-*-sysv4* | i[3-7]86-*-unixware* | \ - i[3-7]86-*-sco3.2v5* | \ - i[3-7]86-*-dgux* | i[3-7]86-*-sysv5* | \ - i[3-7]86-*-chorus* | \ - i[3-7]86-*-sysv* | i[3-7]86-*-isc* | i[3-7]86-*-sco* | i[3-7]86-*-coff | \ - i[3-7]86-*-aix* | \ - i[3-7]86-sequent-bsd* | \ - i[3-7]86-*-freebsdaout* | i[3-7]86-*-freebsd[12].* | \ - i[3-7]86-*-freebsd[12] | \ - i[3-7]86-*-netbsdaout* | i[3-7]86-*-netbsd* | \ - i[3-7]86-*-openbsd[0-2].* | i[3-7]86-*-openbsd3.[0-3] | \ - i[3-7]86-*-linux*aout* | \ - i[3-7]86-*-mach* | i[3-7]86-*-osf1mk* | \ - i[3-7]86-*-os9k | \ - i[3-7]86-none-* | \ - i[3-7]86-*-aout* | i[3-7]86*-*-vsta* | \ mips*-big-* | \ mips*-dec-* | mips*el-*-ecoff* | \ mips*-*-ecoff* | \ @@ -94,7 +76,7 @@ case $targ in esac case $targ in - m68*-*-netbsdelf*) + *-*-netbsdelf* | i[3-7]86-*-netbsd*-gnu* | i[3-7]86-*-knetbsd*-gnu) # Not obsolete ;; *-adobe-* | \ @@ -111,6 +93,23 @@ case $targ in h8300*-*-coff | \ h8500*-*-coff | \ hppa*-*-rtems* | \ + i[3-7]86-*-unixware* | \ + i[3-7]86-*-dgux* | \ + i[3-7]86-*-chorus* | \ + i[3-7]86-*-sysv* | \ + i[3-7]86-*-isc* | \ + i[3-7]86-*-sco* | \ + i[3-7]86-*-coff | \ + i[3-7]86-*-aix* | \ + i[3-7]86-sequent-bsd* | \ + i[3-7]86-*-freebsdaout* | i[3-7]86-*-freebsd[12].* | i[3-7]86-*-freebsd[12] | \ + i[3-7]86-*-netbsdaout* | i[3-7]86-*-netbsd* | \ + i[3-7]86-*-openbsd[0-2].* | i[3-7]86-*-openbsd3.[0-3] | \ + i[3-7]86-*-linux*aout* | \ + i[3-7]86-*-mach* | i[3-7]86-*-osf1mk* | \ + i[3-7]86-*-os9k | \ + i[3-7]86-none-* | \ + i[3-7]86-*-aout* | i[3-7]86*-*-vsta* | \ i370-* | \ i860-*-* | \ i960-*-* | \ @@ -587,13 +586,7 @@ case "${targ}" in targ_selvecs=hppa_elf32_vec ;; - i[3-7]86-*-sco3.2v5*coff) - targ_defvec=i386_coff_vec - targ_selvecs=i386_elf32_vec - ;; - i[3-7]86-*-sysv4* | i[3-7]86-*-unixware* | \ - i[3-7]86-*-elf* | i[3-7]86-*-sco3.2v5* | \ - i[3-7]86-*-dgux* | i[3-7]86-*-sysv5* | i[3-7]86-*-rtems*) + i[3-7]86-*-elf* | i[3-7]86-*-rtems*) targ_defvec=i386_elf32_vec targ_selvecs="iamcu_elf32_vec i386_coff_vec" ;; @@ -622,10 +615,6 @@ case "${targ}" in targ_defvec=i386_elf32_vec targ_selvecs=iamcu_elf32_vec ;; - i[3-7]86-*-chorus*) - targ_defvec=i386_elf32_vec - targ_selvecs=iamcu_elf32_vec - ;; i[3-7]86-*-dicos*) targ_defvec=i386_elf32_vec targ_selvecs=iamcu_elf32_vec @@ -635,20 +624,12 @@ case "${targ}" in targ_defvec=i386_coff_go32_vec targ_selvecs="i386_coff_go32stubbed_vec i386_aout_vec" ;; - i[3-7]86-*-sysv* | i[3-7]86-*-isc* | i[3-7]86-*-sco* | i[3-7]86-*-coff | \ - i[3-7]86-*-aix*) - targ_defvec=i386_coff_vec - ;; i[3-7]86-*-darwin* | i[3-7]86-*-macos10* | i[3-7]86-*-rhapsody*) targ_defvec=i386_mach_o_vec targ_selvecs="mach_o_le_vec mach_o_be_vec mach_o_fat_vec pef_vec pef_xlib_vec sym_vec" targ64_selvecs=x86_64_mach_o_vec targ_archs="$targ_archs bfd_powerpc_arch bfd_rs6000_arch" ;; - i[3-7]86-sequent-bsd*) - targ_defvec=i386_aout_dynix_vec - targ_underscore=yes - ;; i[3-7]86-*-bsd*) targ_defvec=i386_aout_bsd_vec targ_underscore=yes @@ -658,12 +639,6 @@ case "${targ}" in targ_selvecs=iamcu_elf32_vec targ64_selvecs="x86_64_elf64_vec l1om_elf64_vec k1om_elf64_vec" ;; - i[3-7]86-*-freebsdaout* | i[3-7]86-*-freebsd[12].* | \ - i[3-7]86-*-freebsd[12]) - targ_defvec=i386_aout_fbsd_vec - targ_selvecs=i386_aout_bsd_vec - targ_underscore=yes - ;; i[3-7]86-*-freebsd* | i[3-7]86-*-kfreebsd*-gnu) targ_defvec=i386_elf32_fbsd_vec targ_selvecs="i386_elf32_vec iamcu_elf32_vec i386_pei_vec i386_coff_vec" @@ -676,31 +651,20 @@ case "${targ}" in ;; i[3-7]86-*-netbsdelf* | i[3-7]86-*-netbsd*-gnu* | i[3-7]86-*-knetbsd*-gnu) targ_defvec=i386_elf32_vec - targ_selvecs="i386_aout_nbsd_vec iamcu_elf32_vec" + targ_selvecs="iamcu_elf32_vec" targ64_selvecs="x86_64_elf64_vec l1om_elf64_vec k1om_elf64_vec" ;; i[3-7]86-*-netbsdpe*) targ_defvec=i386_pe_vec targ_selvecs="i386_pe_vec i386_pei_vec i386_elf32_vec iamcu_elf32_vec" ;; - i[3-7]86-*-netbsdaout* | i[3-7]86-*-netbsd* | \ - i[3-7]86-*-openbsd[0-2].* | i[3-7]86-*-openbsd3.[0-3]) - targ_defvec=i386_aout_nbsd_vec - targ_selvecs="i386_elf32_vec iamcu_elf32_vec i386_aout_bsd_vec" - targ_underscore=yes - ;; i[3-7]86-*-openbsd*) targ_defvec=i386_elf32_vec - targ_selvecs="iamcu_elf32_vec i386_aout_nbsd_vec" - ;; - i[3-7]86-*-linux*aout*) - targ_defvec=i386_aout_linux_vec - targ_selvecs="i386_elf32_vec iamcu_elf32_vec" - targ_underscore=yes + targ_selvecs="iamcu_elf32_vec" ;; i[3-7]86-*-linux-*) targ_defvec=i386_elf32_vec - targ_selvecs="iamcu_elf32_vec i386_aout_linux_vec i386_pei_vec" + targ_selvecs="iamcu_elf32_vec i386_pei_vec" targ64_selvecs="x86_64_elf64_vec x86_64_elf32_vec x86_64_pei_vec l1om_elf64_vec k1om_elf64_vec" ;; i[3-7]86-*-nacl*) @@ -747,12 +711,12 @@ case "${targ}" in ;; x86_64-*-netbsd* | x86_64-*-openbsd*) targ_defvec=x86_64_elf64_vec - targ_selvecs="i386_elf32_vec iamcu_elf32_vec i386_aout_nbsd_vec i386_coff_vec i386_pei_vec x86_64_pei_vec l1om_elf64_vec k1om_elf64_vec" + targ_selvecs="i386_elf32_vec iamcu_elf32_vec i386_coff_vec i386_pei_vec x86_64_pei_vec l1om_elf64_vec k1om_elf64_vec" want64=true ;; x86_64-*-linux-*) targ_defvec=x86_64_elf64_vec - targ_selvecs="i386_elf32_vec iamcu_elf32_vec x86_64_elf32_vec i386_aout_linux_vec i386_pei_vec x86_64_pei_vec l1om_elf64_vec k1om_elf64_vec" + targ_selvecs="i386_elf32_vec iamcu_elf32_vec x86_64_elf32_vec i386_pei_vec x86_64_pei_vec l1om_elf64_vec k1om_elf64_vec" want64=true ;; x86_64-*-nacl*) @@ -785,14 +749,6 @@ case "${targ}" in targ_defvec=i386_elf32_vec targ_selvecs=iamcu_elf32_vec ;; - i[3-7]86-*-mach* | i[3-7]86-*-osf1mk*) - targ_defvec=i386_aout_mach3_vec - targ_cflags=-DSTAT_FOR_EXEC - targ_underscore=yes - ;; - i[3-7]86-*-os9k) - targ_defvec=i386_aout_os9k_vec - ;; i[3-7]86-*-msdos*) targ_defvec=i386_aout_vec targ_selvecs=i386_msdos_vec @@ -824,12 +780,6 @@ case "${targ}" in targ_selvecs="i386_pe_vec i386_pei_vec i386_elf32_vec iamcu_elf32_vec" targ_underscore=yes ;; - i[3-7]86-none-*) - targ_defvec=i386_coff_vec - ;; - i[3-7]86-*-aout* | i[3-7]86*-*-vsta*) - targ_defvec=i386_aout_vec - ;; i[3-7]86-*-vxworks*) targ_defvec=i386_elf32_vxworks_vec targ_underscore=yes diff --git a/bfd/configure b/bfd/configure index 1e1c26b..ecfbff1 100755 --- a/bfd/configure +++ b/bfd/configure @@ -14398,13 +14398,7 @@ do hppa_som_vec) tb="$tb som.lo" ;; i386_aout_vec) tb="$tb i386aout.lo aout32.lo" ;; i386_aout_bsd_vec) tb="$tb i386bsd.lo aout32.lo" ;; - i386_aout_dynix_vec) tb="$tb i386dynix.lo aout32.lo" ;; - i386_aout_fbsd_vec) tb="$tb i386freebsd.lo aout32.lo" ;; - i386_aout_linux_vec) tb="$tb i386linux.lo aout32.lo" ;; i386_aout_lynx_vec) tb="$tb i386lynx.lo lynx-core.lo aout32.lo" ;; - i386_aout_mach3_vec) tb="$tb i386mach3.lo aout32.lo" ;; - i386_aout_nbsd_vec) tb="$tb i386netbsd.lo aout32.lo" ;; - i386_aout_os9k_vec) tb="$tb i386os9k.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" ;; diff --git a/bfd/configure.ac b/bfd/configure.ac index 49252c7..38f568e 100644 --- a/bfd/configure.ac +++ b/bfd/configure.ac @@ -475,13 +475,7 @@ do hppa_som_vec) tb="$tb som.lo" ;; i386_aout_vec) tb="$tb i386aout.lo aout32.lo" ;; i386_aout_bsd_vec) tb="$tb i386bsd.lo aout32.lo" ;; - i386_aout_dynix_vec) tb="$tb i386dynix.lo aout32.lo" ;; - i386_aout_fbsd_vec) tb="$tb i386freebsd.lo aout32.lo" ;; - i386_aout_linux_vec) tb="$tb i386linux.lo aout32.lo" ;; i386_aout_lynx_vec) tb="$tb i386lynx.lo lynx-core.lo aout32.lo" ;; - i386_aout_mach3_vec) tb="$tb i386mach3.lo aout32.lo" ;; - i386_aout_nbsd_vec) tb="$tb i386netbsd.lo aout32.lo" ;; - i386_aout_os9k_vec) tb="$tb i386os9k.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" ;; diff --git a/bfd/doc/bfdint.texi b/bfd/doc/bfdint.texi index bcab35e..4d36381 100644 --- a/bfd/doc/bfdint.texi +++ b/bfd/doc/bfdint.texi @@ -1098,17 +1098,9 @@ This file is the source for the generated files @file{elf32-target.h} and @file{elf64-target.h}, one of which is included by every ELF target. It defines the ELF target vector. -@item freebsd.h -@cindex @file{freebsd.h} -Presumably intended to be included by all FreeBSD targets, but in fact -there is only one such target, @samp{i386-freebsd}. This defines a -function used to set the right magic number for FreeBSD, as well as -various macros, and includes @file{aout-target.h}. - @item netbsd.h @cindex @file{netbsd.h} -Like @file{freebsd.h}, except that there are several files which include -it. +Used by all netbsd aout targets. Several other files include it. @item peicode.h @cindex @file{peicode.h} diff --git a/bfd/freebsd.h b/bfd/freebsd.h deleted file mode 100644 index 8bb36fe..0000000 --- a/bfd/freebsd.h +++ /dev/null @@ -1,100 +0,0 @@ -/* BFD back-end definitions used by all FreeBSD targets. - Copyright (C) 1990-2018 Free Software Foundation, Inc. - - This file is part of BFD, the Binary File Descriptor library. - - This program 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 of the License, or - (at your option) any later version. - - This program 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 this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, - MA 02110-1301, USA. */ - - -/* FreeBSD ZMAGIC files never have the header in the text. */ -#define N_HEADER_IN_TEXT(x) 0 - -/* ZMAGIC files start at offset 0. Does not apply to QMAGIC files. */ -#define TEXT_START_ADDR 0 - -#define N_GETMAGIC_NET(execp) \ - ((execp)->a_info & 0xffff) -#define N_GETMID_NET(execp) \ - (((execp)->a_info >> 16) & 0x3ff) -#define N_GETFLAG_NET(exexp) \ - (((execp)->a_info >> 26) & 0x3f) - -#define N_MACHTYPE(execp) \ - ((enum machine_type) \ - ((N_GETMAGIC_NET (execp) == ZMAGIC) ? N_GETMID_NET (execp) : \ - ((execp)->a_info >> 16) & 0x3ff)) -#define N_FLAGS(execp) \ - ((N_GETMAGIC_NET (execp) == ZMAGIC) ? N_GETFLAG_NET (execp) : \ - ((execp)->a_info >> 26) & 0x3f) - -#define N_SET_INFO(execp, magic, type, flags) \ - ((execp)->a_info = ((magic) & 0xffff) \ - | (((int)(type) & 0x3ff) << 16) \ - | (((flags) & 0x3f) << 26)) -#define N_SET_MACHTYPE(execp, machtype) \ - ((execp)->a_info = \ - ((execp)->a_info & 0xfb00ffff) | ((((int) (machtype)) & 0x3ff) << 16)) -#define N_SET_FLAGS(execp, flags) \ - ((execp)->a_info = \ - ((execp)->a_info & 0x03ffffff) | ((flags & 0x03f) << 26)) - -#include "sysdep.h" -#include "bfd.h" -#include "libbfd.h" -#include "libaout.h" - -/* On FreeBSD, the magic number is always in i386 (little-endian) - format. I think. */ -#define SWAP_MAGIC(ext) bfd_getl32 (ext) - -#define MY_write_object_contents MY (write_object_contents) -static bfd_boolean MY (write_object_contents) (bfd *); - -#include "aout-target.h" - -/* Write an object file. - Section contents have already been written. We write the - file header, symbols, and relocation. */ - -static bfd_boolean -MY (write_object_contents) (bfd *abfd) -{ - struct external_exec exec_bytes; - struct internal_exec *execp = exec_hdr (abfd); - - obj_reloc_entry_size (abfd) = RELOC_STD_SIZE; - - /* Magic number, maestro, please! */ - switch (bfd_get_arch(abfd)) - { - case bfd_arch_sparc: - N_SET_MACHTYPE (execp, M_SPARC_NETBSD); - break; - case bfd_arch_i386: - N_SET_MACHTYPE (execp, M_386_NETBSD); - break; - case bfd_arch_ns32k: - N_SET_MACHTYPE (execp, M_532_NETBSD); - break; - default: - N_SET_MACHTYPE (execp, M_UNKNOWN); - break; - } - - WRITE_HEADERS (abfd, execp); - - return TRUE; -} diff --git a/bfd/i386dynix.c b/bfd/i386dynix.c deleted file mode 100644 index fbdcd69..0000000 --- a/bfd/i386dynix.c +++ /dev/null @@ -1,82 +0,0 @@ -/* BFD back-end for i386 a.out binaries under dynix. - Copyright (C) 1994-2018 Free Software Foundation, Inc. - - This file is part of BFD, the Binary File Descriptor library. - - This program 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 of the License, or - (at your option) any later version. - - This program 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 this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, - MA 02110-1301, USA. */ - - -/* This BFD is currently only tested with gdb, writing object files - may not work. */ - -#define TEXT_START_ADDR 4096 -#define TARGET_PAGE_SIZE 4096 -#define SEGMENT_SIZE TARGET_PAGE_SIZE - -#include "aout/dynix3.h" - -#define DEFAULT_ARCH bfd_arch_i386 -#define MACHTYPE_OK(mtype) ((mtype) == M_386 || (mtype) == M_UNKNOWN) - -/* Do not "beautify" the CONCAT* macro args. Traditional C will not - remove whitespace added here, and thus will fail to concatenate - the tokens. */ -#define MY(OP) CONCAT2 (i386_aout_dynix_,OP) -#define TARGETNAME "a.out-i386-dynix" -#define NAME(x,y) CONCAT3 (i386dynix,_32_,y) -#define ARCH_SIZE 32 -#define NAME_swap_exec_header_in NAME(i386dynix_32_,swap_exec_header_in) -#define MY_get_section_contents aout_32_get_section_contents - -/* aoutx.h requires definitions for NMAGIC, BMAGIC and QMAGIC. */ -#define NMAGIC 0 -#define BMAGIC OMAGIC -#define QMAGIC XMAGIC - -#include "aoutx.h" - -/* (Ab)use some fields in the internal exec header to be able to read - executables that contain shared data. */ - -#define a_shdata a_tload -#define a_shdrsize a_dload - -void -i386dynix_32_swap_exec_header_in (bfd *abfd, - struct external_exec *raw_bytes, - struct internal_exec *execp) -{ - struct external_exec *bytes = (struct external_exec *)raw_bytes; - - /* The internal_exec structure has some fields that are unused in this - configuration (IE for i960), so ensure that all such uninitialized - fields are zero'd out. There are places where two of these structs - are memcmp'd, and thus the contents do matter. */ - memset (execp, 0, sizeof (struct internal_exec)); - /* Now fill in fields in the execp, from the bytes in the raw data. */ - execp->a_info = H_GET_32 (abfd, bytes->e_info); - execp->a_text = GET_WORD (abfd, bytes->e_text); - execp->a_data = GET_WORD (abfd, bytes->e_data); - execp->a_bss = GET_WORD (abfd, bytes->e_bss); - execp->a_syms = GET_WORD (abfd, bytes->e_syms); - execp->a_entry = GET_WORD (abfd, bytes->e_entry); - execp->a_trsize = GET_WORD (abfd, bytes->e_trsize); - execp->a_drsize = GET_WORD (abfd, bytes->e_drsize); - execp->a_shdata = GET_WORD (abfd, bytes->e_shdata); - execp->a_shdrsize = GET_WORD (abfd, bytes->e_shdrsize); -} - -#include "aout-target.h" diff --git a/bfd/i386freebsd.c b/bfd/i386freebsd.c deleted file mode 100644 index 0415203..0000000 --- a/bfd/i386freebsd.c +++ /dev/null @@ -1,38 +0,0 @@ -/* BFD back-end for FreeBSD/386 a.out-ish binaries. - Copyright (C) 1990-2018 Free Software Foundation, Inc. - - This file is part of BFD, the Binary File Descriptor library. - - This program 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 of the License, or - (at your option) any later version. - - This program 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 this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, - MA 02110-1301, USA. */ - -#define BYTES_IN_WORD 4 -#undef TARGET_IS_BIG_ENDIAN_P - -#define TARGET_PAGE_SIZE 4096 -#define SEGMENT_SIZE TARGET_PAGE_SIZE - -#define DEFAULT_ARCH bfd_arch_i386 -#define MACHTYPE_OK(mtype) ((mtype) == M_386_NETBSD || (mtype) == M_UNKNOWN) - -/* Do not "beautify" the CONCAT* macro args. Traditional C will not - remove whitespace added here, and thus will fail to concatenate - the tokens. */ -#define MY(OP) CONCAT2 (i386_aout_fbsd_,OP) - -/* This needs to start with a.out so GDB knows it is an a.out variant. */ -#define TARGETNAME "a.out-i386-freebsd" - -#include "freebsd.h" diff --git a/bfd/i386linux.c b/bfd/i386linux.c deleted file mode 100644 index 0887ecb..0000000 --- a/bfd/i386linux.c +++ /dev/null @@ -1,733 +0,0 @@ -/* BFD back-end for linux flavored i386 a.out binaries. - Copyright (C) 1992-2018 Free Software Foundation, Inc. - - This file is part of BFD, the Binary File Descriptor library. - - This program 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 of the License, or - (at your option) any later version. - - This program 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 this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, - MA 02110-1301, USA. */ - -#define TARGET_PAGE_SIZE 4096 -#define ZMAGIC_DISK_BLOCK_SIZE 1024 -#define SEGMENT_SIZE TARGET_PAGE_SIZE -#define TEXT_START_ADDR 0x0 - -#define MACHTYPE_OK(mtype) ((mtype) == M_386 || (mtype) == M_UNKNOWN) - -#include "sysdep.h" -#include "bfd.h" -#include "libbfd.h" -#include "aout/aout64.h" -#include "aout/stab_gnu.h" -#include "aout/ar.h" -#include "libaout.h" /* BFD a.out internal data structures */ - -#define DEFAULT_ARCH bfd_arch_i386 - -/* Do not "beautify" the CONCAT* macro args. Traditional C will not - remove whitespace added here, and thus will fail to concatenate - the tokens. */ -#define MY(OP) CONCAT2 (i386_aout_linux_,OP) -#define TARGETNAME "a.out-i386-linux" - -extern const bfd_target MY(vec); - -/* We always generate QMAGIC files in preference to ZMAGIC files. It - would be possible to make this a linker option, if that ever - becomes important. */ - -static void MY_final_link_callback - (bfd *, file_ptr *, file_ptr *, file_ptr *); -static bfd_boolean i386linux_bfd_final_link - (bfd *, struct bfd_link_info *); -static bfd_boolean i386linux_write_object_contents (bfd *); - -static bfd_boolean -i386linux_bfd_final_link (bfd *abfd, struct bfd_link_info *info) -{ - obj_aout_subformat (abfd) = q_magic_format; - return NAME(aout,final_link) (abfd, info, MY_final_link_callback); -} - -#define MY_bfd_final_link i386linux_bfd_final_link - -/* Set the machine type correctly. */ - -static bfd_boolean -i386linux_write_object_contents (bfd *abfd) -{ - struct external_exec exec_bytes; - struct internal_exec *execp = exec_hdr (abfd); - - N_SET_MACHTYPE (execp, M_386); - - obj_reloc_entry_size (abfd) = RELOC_STD_SIZE; - - WRITE_HEADERS (abfd, execp); - - return TRUE; -} - -#define MY_write_object_contents i386linux_write_object_contents - -/* Code to link against Linux a.out shared libraries. */ - -/* See if a symbol name is a reference to the global offset table. */ - -#ifndef GOT_REF_PREFIX -#define GOT_REF_PREFIX "__GOT_" -#endif - -#define IS_GOT_SYM(name) (CONST_STRNEQ (name, GOT_REF_PREFIX)) - -/* See if a symbol name is a reference to the procedure linkage table. */ - -#ifndef PLT_REF_PREFIX -#define PLT_REF_PREFIX "__PLT_" -#endif - -#define IS_PLT_SYM(name) (CONST_STRNEQ (name, PLT_REF_PREFIX)) - -/* This string is used to generate specialized error messages. */ - -#ifndef NEEDS_SHRLIB -#define NEEDS_SHRLIB "__NEEDS_SHRLIB_" -#endif - -/* This special symbol is a set vector that contains a list of - pointers to fixup tables. It will be present in any dynamically - linked file. The linker generated fixup table should also be added - to the list, and it should always appear in the second slot (the - first one is a dummy with a magic number that is defined in - crt0.o). */ - -#ifndef SHARABLE_CONFLICTS -#define SHARABLE_CONFLICTS "__SHARABLE_CONFLICTS__" -#endif - -/* We keep a list of fixups. The terminology is a bit strange, but - each fixup contains two 32 bit numbers. A regular fixup contains - an address and a pointer, and at runtime we should store the - address at the location pointed to by the pointer. A builtin fixup - contains two pointers, and we should read the address using one - pointer and store it at the location pointed to by the other - pointer. Builtin fixups come into play when we have duplicate - __GOT__ symbols for the same variable. The builtin fixup will copy - the GOT pointer from one over into the other. */ - -struct fixup -{ - struct fixup *next; - struct linux_link_hash_entry *h; - bfd_vma value; - - /* Nonzero if this is a jump instruction that needs to be fixed, - zero if this is just a pointer */ - char jump; - - char builtin; -}; - -/* We don't need a special hash table entry structure, but we do need - to keep some information between linker passes, so we use a special - hash table. */ - -struct linux_link_hash_entry -{ - struct aout_link_hash_entry root; -}; - -struct linux_link_hash_table -{ - struct aout_link_hash_table root; - - /* First dynamic object found in link. */ - bfd *dynobj; - - /* Number of fixups. */ - size_t fixup_count; - - /* Number of builtin fixups. */ - size_t local_builtins; - - /* List of fixups. */ - struct fixup *fixup_list; -}; - -/* Routine to create an entry in an Linux link hash table. */ - -static struct bfd_hash_entry * -linux_link_hash_newfunc (struct bfd_hash_entry *entry, - struct bfd_hash_table *table, - const char *string) -{ - struct linux_link_hash_entry *ret = (struct linux_link_hash_entry *) entry; - - /* Allocate the structure if it has not already been allocated by a - subclass. */ - if (ret == (struct linux_link_hash_entry *) NULL) - ret = ((struct linux_link_hash_entry *) - bfd_hash_allocate (table, sizeof (struct linux_link_hash_entry))); - if (ret == NULL) - return (struct bfd_hash_entry *) ret; - - /* Call the allocation method of the superclass. */ - ret = ((struct linux_link_hash_entry *) - NAME(aout,link_hash_newfunc) ((struct bfd_hash_entry *) ret, - table, string)); - if (ret != NULL) - { - /* Set local fields; there aren't any. */ - } - - return (struct bfd_hash_entry *) ret; -} - -/* Create a Linux link hash table. */ - -static struct bfd_link_hash_table * -linux_link_hash_table_create (bfd *abfd) -{ - struct linux_link_hash_table *ret; - bfd_size_type amt = sizeof (struct linux_link_hash_table); - - ret = (struct linux_link_hash_table *) bfd_zmalloc (amt); - if (ret == (struct linux_link_hash_table *) NULL) - return (struct bfd_link_hash_table *) NULL; - if (!NAME(aout,link_hash_table_init) (&ret->root, abfd, - linux_link_hash_newfunc, - sizeof (struct linux_link_hash_entry))) - { - free (ret); - return (struct bfd_link_hash_table *) NULL; - } - - return &ret->root.root; -} - -/* Look up an entry in a Linux link hash table. */ - -#define linux_link_hash_lookup(table, string, create, copy, follow) \ - ((struct linux_link_hash_entry *) \ - aout_link_hash_lookup (&(table)->root, (string), (create), (copy),\ - (follow))) - -/* Traverse a Linux link hash table. */ - -#define linux_link_hash_traverse(table, func, info) \ - (aout_link_hash_traverse \ - (&(table)->root, \ - (bfd_boolean (*) (struct aout_link_hash_entry *, void *)) (func), \ - (info))) - -/* Get the Linux link hash table from the info structure. This is - just a cast. */ - -#define linux_hash_table(p) ((struct linux_link_hash_table *) ((p)->hash)) - -/* Store the information for a new fixup. */ - -static struct fixup * -new_fixup (struct bfd_link_info *info, - struct linux_link_hash_entry *h, - bfd_vma value, - int builtin) -{ - struct fixup *f; - - f = (struct fixup *) bfd_hash_allocate (&info->hash->table, - sizeof (struct fixup)); - if (f == NULL) - return f; - f->next = linux_hash_table (info)->fixup_list; - linux_hash_table (info)->fixup_list = f; - f->h = h; - f->value = value; - f->builtin = builtin; - f->jump = 0; - ++linux_hash_table (info)->fixup_count; - return f; -} - -/* We come here once we realize that we are going to link to a shared - library. We need to create a special section that contains the - fixup table, and we ultimately need to add a pointer to this into - the set vector for SHARABLE_CONFLICTS. At this point we do not - know the size of the section, but that's OK - we just need to - create it for now. */ - -static bfd_boolean -linux_link_create_dynamic_sections (bfd *abfd, - struct bfd_link_info *info ATTRIBUTE_UNUSED) -{ - flagword flags; - asection *s; - - /* Note that we set the SEC_IN_MEMORY flag. */ - flags = SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY; - - /* We choose to use the name ".linux-dynamic" for the fixup table. - Why not? */ - s = bfd_make_section_with_flags (abfd, ".linux-dynamic", flags); - if (s == NULL - || ! bfd_set_section_alignment (abfd, s, 2)) - return FALSE; - s->size = 0; - s->contents = 0; - - return TRUE; -} - -/* Function to add a single symbol to the linker hash table. This is - a wrapper around _bfd_generic_link_add_one_symbol which handles the - tweaking needed for dynamic linking support. */ - -static bfd_boolean -linux_add_one_symbol (struct bfd_link_info *info, - bfd *abfd, - const char *name, - flagword flags, - asection *section, - bfd_vma value, - const char *string, - bfd_boolean copy, - bfd_boolean collect, - struct bfd_link_hash_entry **hashp) -{ - struct linux_link_hash_entry *h; - bfd_boolean insert; - - /* Look up and see if we already have this symbol in the hash table. - If we do, and the defining entry is from a shared library, we - need to create the dynamic sections. - - FIXME: What if abfd->xvec != info->output_bfd->xvec? We may - want to be able to link Linux a.out and ELF objects together, - but serious confusion is possible. */ - - insert = FALSE; - - if (! bfd_link_relocatable (info) - && linux_hash_table (info)->dynobj == NULL - && strcmp (name, SHARABLE_CONFLICTS) == 0 - && (flags & BSF_CONSTRUCTOR) != 0 - && abfd->xvec == info->output_bfd->xvec) - { - if (! linux_link_create_dynamic_sections (abfd, info)) - return FALSE; - linux_hash_table (info)->dynobj = abfd; - insert = TRUE; - } - - if (bfd_is_abs_section (section) - && abfd->xvec == info->output_bfd->xvec) - { - h = linux_link_hash_lookup (linux_hash_table (info), name, FALSE, - FALSE, FALSE); - if (h != NULL - && (h->root.root.type == bfd_link_hash_defined - || h->root.root.type == bfd_link_hash_defweak)) - { - struct fixup *f; - - if (hashp != NULL) - *hashp = (struct bfd_link_hash_entry *) h; - - f = new_fixup (info, h, value, ! IS_PLT_SYM (name)); - if (f == NULL) - return FALSE; - f->jump = IS_PLT_SYM (name); - - return TRUE; - } - } - - /* Do the usual procedure for adding a symbol. */ - if (! _bfd_generic_link_add_one_symbol (info, abfd, name, flags, section, - value, string, copy, collect, - hashp)) - return FALSE; - - /* Insert a pointer to our table in the set vector. The dynamic - linker requires this information */ - if (insert) - { - asection *s; - - /* Here we do our special thing to add the pointer to the - dynamic section in the SHARABLE_CONFLICTS set vector. */ - s = bfd_get_section_by_name (linux_hash_table (info)->dynobj, - ".linux-dynamic"); - BFD_ASSERT (s != NULL); - - if (! (_bfd_generic_link_add_one_symbol - (info, linux_hash_table (info)->dynobj, SHARABLE_CONFLICTS, - BSF_GLOBAL | BSF_CONSTRUCTOR, s, (bfd_vma) 0, NULL, - FALSE, FALSE, NULL))) - return FALSE; - } - - return TRUE; -} - -/* We will crawl the hash table and come here for every global symbol. - We will examine each entry and see if there are indications that we - need to add a fixup. There are two possible cases - one is where - you have duplicate definitions of PLT or GOT symbols - these will - have already been caught and added as "builtin" fixups. If we find - that the corresponding non PLT/GOT symbol is also present, we - convert it to a regular fixup instead. - - This function is called via linux_link_hash_traverse. */ - -static bfd_boolean -linux_tally_symbols (struct linux_link_hash_entry *h, void * data) -{ - struct bfd_link_info *info = (struct bfd_link_info *) data; - struct fixup *f, *f1; - int is_plt; - struct linux_link_hash_entry *h1, *h2; - bfd_boolean exists; - - if (h->root.root.type == bfd_link_hash_undefined - && CONST_STRNEQ (h->root.root.root.string, NEEDS_SHRLIB)) - { - const char *name; - char *p; - char *alloc = NULL; - - name = h->root.root.root.string + sizeof NEEDS_SHRLIB - 1; - p = strrchr (name, '_'); - if (p != NULL) - alloc = (char *) bfd_malloc ((bfd_size_type) strlen (name) + 1); - - if (p == NULL || alloc == NULL) - _bfd_error_handler (_("output file requires shared library `%s'"), - name); - else - { - strcpy (alloc, name); - p = strrchr (alloc, '_'); - *p++ = '\0'; - _bfd_error_handler - (_("output file requires shared library `%s.so.%s'"), - alloc, p); - free (alloc); - } - - abort (); - } - - /* If this symbol is not a PLT/GOT, we do not even need to look at it */ - is_plt = IS_PLT_SYM (h->root.root.root.string); - - if (is_plt || IS_GOT_SYM (h->root.root.root.string)) - { - /* Look up this symbol twice. Once just as a regular lookup, - and then again following all of the indirect links until we - reach a real symbol. */ - h1 = linux_link_hash_lookup (linux_hash_table (info), - (h->root.root.root.string - + sizeof PLT_REF_PREFIX - 1), - FALSE, FALSE, TRUE); - /* h2 does not follow indirect symbols. */ - h2 = linux_link_hash_lookup (linux_hash_table (info), - (h->root.root.root.string - + sizeof PLT_REF_PREFIX - 1), - FALSE, FALSE, FALSE); - - /* The real symbol must exist but if it is also an ABS symbol, - there is no need to have a fixup. This is because they both - came from the same library. If on the other hand, we had to - use an indirect symbol to get to the real symbol, we add the - fixup anyway, since there are cases where these symbols come - from different shared libraries */ - if (h1 != NULL - && (((h1->root.root.type == bfd_link_hash_defined - || h1->root.root.type == bfd_link_hash_defweak) - && ! bfd_is_abs_section (h1->root.root.u.def.section)) - || h2->root.root.type == bfd_link_hash_indirect)) - { - /* See if there is a "builtin" fixup already present - involving this symbol. If so, convert it to a regular - fixup. In the end, this relaxes some of the requirements - about the order of performing fixups. */ - exists = FALSE; - for (f1 = linux_hash_table (info)->fixup_list; - f1 != NULL; - f1 = f1->next) - { - if ((f1->h != h && f1->h != h1) - || (! f1->builtin && ! f1->jump)) - continue; - if (f1->h == h1) - exists = TRUE; - if (! exists - && bfd_is_abs_section (h->root.root.u.def.section)) - { - f = new_fixup (info, h1, f1->h->root.root.u.def.value, 0); - f->jump = is_plt; - } - f1->h = h1; - f1->jump = is_plt; - f1->builtin = 0; - exists = TRUE; - } - if (! exists - && bfd_is_abs_section (h->root.root.u.def.section)) - { - f = new_fixup (info, h1, h->root.root.u.def.value, 0); - if (f == NULL) - { - /* FIXME: No way to return error. */ - abort (); - } - f->jump = is_plt; - } - } - - /* Quick and dirty way of stripping these symbols from the - symtab. */ - if (bfd_is_abs_section (h->root.root.u.def.section)) - h->root.written = TRUE; - } - - return TRUE; -} - -/* This is called to set the size of the .linux-dynamic section is. - It is called by the Linux linker emulation before_allocation - routine. We have finished reading all of the input files, and now - we just scan the hash tables to find out how many additional fixups - are required. */ - -bfd_boolean -bfd_i386linux_size_dynamic_sections (bfd *output_bfd, - struct bfd_link_info *info) -{ - struct fixup *f; - asection *s; - - if (output_bfd->xvec != &MY(vec)) - return TRUE; - - /* First find the fixups... */ - linux_link_hash_traverse (linux_hash_table (info), - linux_tally_symbols, - info); - - /* If there are builtin fixups, leave room for a marker. This is - used by the dynamic linker so that it knows that all that follow - are builtin fixups instead of regular fixups. */ - for (f = linux_hash_table (info)->fixup_list; f != NULL; f = f->next) - { - if (f->builtin) - { - ++linux_hash_table (info)->fixup_count; - ++linux_hash_table (info)->local_builtins; - break; - } - } - - if (linux_hash_table (info)->dynobj == NULL) - { - if (linux_hash_table (info)->fixup_count > 0) - abort (); - return TRUE; - } - - /* Allocate memory for our fixup table. We will fill it in later. */ - s = bfd_get_section_by_name (linux_hash_table (info)->dynobj, - ".linux-dynamic"); - if (s != NULL) - { - s->size = linux_hash_table (info)->fixup_count + 1; - s->size *= 8; - s->contents = (bfd_byte *) bfd_zalloc (output_bfd, s->size); - if (s->contents == NULL) - return FALSE; - } - - return TRUE; -} - -/* We come here once we are ready to actually write the fixup table to - the output file. Scan the fixup tables and so forth and generate - the stuff we need. */ - -static bfd_boolean -linux_finish_dynamic_link (bfd *output_bfd, - struct bfd_link_info *info) -{ - asection *s, *os, *is; - bfd_byte *fixup_table; - struct linux_link_hash_entry *h; - struct fixup *f; - unsigned int new_addr; - int section_offset; - unsigned int fixups_written; - - if (linux_hash_table (info)->dynobj == NULL) - return TRUE; - - s = bfd_get_section_by_name (linux_hash_table (info)->dynobj, - ".linux-dynamic"); - BFD_ASSERT (s != NULL); - os = s->output_section; - fixups_written = 0; - -#ifdef LINUX_LINK_DEBUG - printf ("Fixup table file offset: %x VMA: %x\n", - os->filepos + s->output_offset, - os->vma + s->output_offset); -#endif - - fixup_table = s->contents; - bfd_put_32 (output_bfd, - (bfd_vma) linux_hash_table (info)->fixup_count, fixup_table); - fixup_table += 4; - - /* Fill in fixup table. */ - for (f = linux_hash_table (info)->fixup_list; f != NULL; f = f->next) - { - if (f->builtin) - continue; - - if (f->h->root.root.type != bfd_link_hash_defined - && f->h->root.root.type != bfd_link_hash_defweak) - { - _bfd_error_handler - (_("symbol %s not defined for fixups"), - f->h->root.root.root.string); - continue; - } - - is = f->h->root.root.u.def.section; - section_offset = is->output_section->vma + is->output_offset; - new_addr = f->h->root.root.u.def.value + section_offset; - -#ifdef LINUX_LINK_DEBUG - printf ("Fixup(%d) %s: %x %x\n",f->jump, f->h->root.root.string, - new_addr, f->value); -#endif - - if (f->jump) - { - /* Relative address */ - new_addr = new_addr - (f->value + 5); - bfd_put_32 (output_bfd, (bfd_vma) new_addr, fixup_table); - fixup_table += 4; - bfd_put_32 (output_bfd, f->value + 1, fixup_table); - fixup_table += 4; - } - else - { - bfd_put_32 (output_bfd, (bfd_vma) new_addr, fixup_table); - fixup_table += 4; - bfd_put_32 (output_bfd, f->value, fixup_table); - fixup_table += 4; - } - ++fixups_written; - } - - if (linux_hash_table (info)->local_builtins != 0) - { - /* Special marker so we know to switch to the other type of fixup */ - bfd_put_32 (output_bfd, (bfd_vma) 0, fixup_table); - fixup_table += 4; - bfd_put_32 (output_bfd, (bfd_vma) 0, fixup_table); - fixup_table += 4; - ++fixups_written; - for (f = linux_hash_table (info)->fixup_list; f != NULL; f = f->next) - { - if (! f->builtin) - continue; - - if (f->h->root.root.type != bfd_link_hash_defined - && f->h->root.root.type != bfd_link_hash_defweak) - { - _bfd_error_handler - (_("symbol %s not defined for fixups"), - f->h->root.root.root.string); - continue; - } - - is = f->h->root.root.u.def.section; - section_offset = is->output_section->vma + is->output_offset; - new_addr = f->h->root.root.u.def.value + section_offset; - -#ifdef LINUX_LINK_DEBUG - printf ("Fixup(B) %s: %x %x\n", f->h->root.root.string, - new_addr, f->value); -#endif - - bfd_put_32 (output_bfd, (bfd_vma) new_addr, fixup_table); - fixup_table += 4; - bfd_put_32 (output_bfd, f->value, fixup_table); - fixup_table += 4; - ++fixups_written; - } - } - - if (linux_hash_table (info)->fixup_count != fixups_written) - { - _bfd_error_handler (_("warning: fixup count mismatch")); - while (linux_hash_table (info)->fixup_count > fixups_written) - { - bfd_put_32 (output_bfd, (bfd_vma) 0, fixup_table); - fixup_table += 4; - bfd_put_32 (output_bfd, (bfd_vma) 0, fixup_table); - fixup_table += 4; - ++fixups_written; - } - } - - h = linux_link_hash_lookup (linux_hash_table (info), - "__BUILTIN_FIXUPS__", - FALSE, FALSE, FALSE); - - if (h != NULL - && (h->root.root.type == bfd_link_hash_defined - || h->root.root.type == bfd_link_hash_defweak)) - { - is = h->root.root.u.def.section; - section_offset = is->output_section->vma + is->output_offset; - new_addr = h->root.root.u.def.value + section_offset; - -#ifdef LINUX_LINK_DEBUG - printf ("Builtin fixup table at %x\n", new_addr); -#endif - - bfd_put_32 (output_bfd, (bfd_vma) new_addr, fixup_table); - } - else - bfd_put_32 (output_bfd, (bfd_vma) 0, fixup_table); - - if (bfd_seek (output_bfd, (file_ptr) (os->filepos + s->output_offset), - SEEK_SET) != 0) - return FALSE; - - if (bfd_bwrite (s->contents, s->size, output_bfd) != s->size) - return FALSE; - - return TRUE; -} - -#define MY_bfd_link_hash_table_create linux_link_hash_table_create -#define MY_add_one_symbol linux_add_one_symbol -#define MY_finish_dynamic_link linux_finish_dynamic_link - -#define MY_zmagic_contiguous 1 - -#include "aout-target.h" diff --git a/bfd/i386mach3.c b/bfd/i386mach3.c deleted file mode 100644 index bffbf0c..0000000 --- a/bfd/i386mach3.c +++ /dev/null @@ -1,73 +0,0 @@ -/* BFD back-end for i386 a.out binaries. - Copyright (C) 1990-2018 Free Software Foundation, Inc. - - This file is part of BFD, the Binary File Descriptor library. - - This program 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 of the License, or - (at your option) any later version. - - This program 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 this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, - MA 02110-1301, USA. */ - - -/* This is for Mach 3, which uses a.out, not Mach-O. */ - -/* There is no magic number or anything which lets us distinguish this target - from i386aout or i386bsd. So this target is only useful if it is the - default target. */ - -#define TARGET_PAGE_SIZE 1 -#define SEGMENT_SIZE 0x1000 -#define TEXT_START_ADDR 0x10000 -#define ARCH 32 -/* This macro is only relevant when N_MAGIC(x) == ZMAGIC. */ -#define N_HEADER_IN_TEXT(x) 1 - -#define N_TXTSIZE(x) ((x)->a_text) - -#include "sysdep.h" -#include "bfd.h" -#include "libbfd.h" -#include "aout/aout64.h" -#include "aout/stab_gnu.h" -#include "aout/ar.h" -#include "libaout.h" /* BFD a.out internal data structures */ - -#define DEFAULT_ARCH bfd_arch_i386 - -/* Do not "beautify" the CONCAT* macro args. Traditional C will not - remove whitespace added here, and thus will fail to concatenate - the tokens. */ -#define MY(OP) CONCAT2 (i386_aout_mach3_,OP) -#define TARGETNAME "a.out-mach3" - -static bfd_boolean MY (set_sizes) (bfd *); -#define MY_backend_data &MY(backend_data) - -static const struct aout_backend_data MY(backend_data) = -{ - 0, /* zmagic contiguous */ - 1, /* text incl header */ - 0, /* entry is text address */ - 0, /* exec_hdr_flags */ - 0, /* text vma? */ - MY(set_sizes), - 1, /* exec header not counted */ - 0, /* add_dynamic_symbols */ - 0, /* add_one_symbol */ - 0, /* link_dynamic_object */ - 0, /* write_dynamic_symbol */ - 0, /* check_dynamic_reloc */ - 0 /* finish_dynamic_link */ -}; - -#include "aout-target.h" diff --git a/bfd/i386netbsd.c b/bfd/i386netbsd.c deleted file mode 100644 index 989fb30..0000000 --- a/bfd/i386netbsd.c +++ /dev/null @@ -1,38 +0,0 @@ -/* BFD back-end for NetBSD/386 a.out-ish binaries. - Copyright (C) 1990-2018 Free Software Foundation, Inc. - - This file is part of BFD, the Binary File Descriptor library. - - This program 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 of the License, or - (at your option) any later version. - - This program 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 this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, - MA 02110-1301, USA. */ - -#define BYTES_IN_WORD 4 -#undef TARGET_IS_BIG_ENDIAN_P - -#define TARGET_PAGE_SIZE 4096 -#define SEGMENT_SIZE TARGET_PAGE_SIZE - -#define DEFAULT_ARCH bfd_arch_i386 -#define DEFAULT_MID M_386_NETBSD - -/* Do not "beautify" the CONCAT* macro args. Traditional C will not - remove whitespace added here, and thus will fail to concatenate - the tokens. */ -#define MY(OP) CONCAT2 (i386_aout_nbsd_,OP) - -/* This needs to start with a.out so GDB knows it is an a.out variant. */ -#define TARGETNAME "a.out-i386-netbsd" - -#include "netbsd.h" diff --git a/bfd/i386os9k.c b/bfd/i386os9k.c deleted file mode 100644 index 1c8ef84..0000000 --- a/bfd/i386os9k.c +++ /dev/null @@ -1,242 +0,0 @@ -/* BFD back-end for os9000 i386 binaries. - Copyright (C) 1990-2018 Free Software Foundation, Inc. - Written by Cygnus Support. - - This file is part of BFD, the Binary File Descriptor library. - - This program 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 of the License, or - (at your option) any later version. - - This program 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 this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, - MA 02110-1301, USA. */ - -#include "sysdep.h" -#include "bfd.h" -#include "libbfd.h" -#include "bfdlink.h" -#include "libaout.h" /* BFD a.out internal data structures */ -#include "os9k.h" - -/* Swaps the information in an executable header taken from a raw byte - stream memory image, into the internal exec_header structure. */ -static bfd_boolean -os9k_swap_exec_header_in (bfd *abfd, - mh_com *raw_bytes, - struct internal_exec *execp) -{ - mh_com *bytes = (mh_com *) raw_bytes; - unsigned int dload, dmemsize, dmemstart; - - /* Now fill in fields in the execp, from the bytes in the raw data. */ - execp->a_info = H_GET_16 (abfd, bytes->m_sync); - execp->a_syms = 0; - execp->a_entry = H_GET_32 (abfd, bytes->m_exec); - execp->a_talign = 2; - execp->a_dalign = 2; - execp->a_balign = 2; - - dload = H_GET_32 (abfd, bytes->m_idata); - execp->a_data = dload + 8; - - if (bfd_seek (abfd, (file_ptr) dload, SEEK_SET) != 0 - || (bfd_bread (&dmemstart, (bfd_size_type) sizeof (dmemstart), abfd) - != sizeof (dmemstart)) - || (bfd_bread (&dmemsize, (bfd_size_type) sizeof (dmemsize), abfd) - != sizeof (dmemsize))) - return FALSE; - - execp->a_tload = 0; - execp->a_dload = H_GET_32 (abfd, (unsigned char *) &dmemstart); - execp->a_text = dload - execp->a_tload; - execp->a_data = H_GET_32 (abfd, (unsigned char *) &dmemsize); - execp->a_bss = H_GET_32 (abfd, bytes->m_data) - execp->a_data; - - execp->a_trsize = 0; - execp->a_drsize = 0; - - return TRUE; -} - - -/* Finish up the opening of a b.out file for reading. Fill in all the - fields that are not handled by common code. */ - -static const bfd_target * -os9k_callback (bfd *abfd) -{ - struct internal_exec *execp = exec_hdr (abfd); - unsigned long bss_start; - - /* Architecture and machine type. */ - bfd_set_arch_mach (abfd, bfd_arch_i386, 0); - - /* The positions of the string table and symbol table. */ - obj_str_filepos (abfd) = 0; - obj_sym_filepos (abfd) = 0; - - /* The alignments of the sections. */ - obj_textsec (abfd)->alignment_power = execp->a_talign; - obj_datasec (abfd)->alignment_power = execp->a_dalign; - obj_bsssec (abfd)->alignment_power = execp->a_balign; - - /* The starting addresses of the sections. */ - obj_textsec (abfd)->vma = execp->a_tload; - obj_datasec (abfd)->vma = execp->a_dload; - - /* And reload the sizes, since the aout module zaps them. */ - obj_textsec (abfd)->size = execp->a_text; - - bss_start = execp->a_dload + execp->a_data; /* BSS = end of data section. */ - obj_bsssec (abfd)->vma = align_power (bss_start, execp->a_balign); - - /* The file positions of the sections. */ - obj_textsec (abfd)->filepos = execp->a_entry; - obj_datasec (abfd)->filepos = execp->a_dload; - - /* The file positions of the relocation info *** - obj_textsec (abfd)->rel_filepos = N_TROFF (execp); - obj_datasec (abfd)->rel_filepos = N_DROFF (execp); */ - - adata (abfd).page_size = 1; /* Not applicable. */ - adata (abfd).segment_size = 1;/* Not applicable. */ - adata (abfd).exec_bytes_size = MHCOM_BYTES_SIZE; - - return abfd->xvec; -} - -static const bfd_target * -os9k_object_p (bfd *abfd) -{ - struct internal_exec anexec; - mh_com exec_bytes; - - if (bfd_bread (&exec_bytes, (bfd_size_type) MHCOM_BYTES_SIZE, abfd) - != MHCOM_BYTES_SIZE) - { - if (bfd_get_error () != bfd_error_system_call) - bfd_set_error (bfd_error_wrong_format); - return 0; - } - - anexec.a_info = H_GET_16 (abfd, exec_bytes.m_sync); - if (N_BADMAG (&anexec)) - { - bfd_set_error (bfd_error_wrong_format); - return 0; - } - - if (! os9k_swap_exec_header_in (abfd, &exec_bytes, &anexec)) - { - if (bfd_get_error () != bfd_error_system_call) - bfd_set_error (bfd_error_wrong_format); - return NULL; - } - return aout_32_some_aout_object_p (abfd, &anexec, os9k_callback); -} - -static int -os9k_sizeof_headers (bfd *abfd ATTRIBUTE_UNUSED, - struct bfd_link_info *info ATTRIBUTE_UNUSED) -{ - return sizeof (struct internal_exec); -} - - - -#define aout_32_close_and_cleanup aout_32_bfd_free_cached_info - -#define aout_32_find_line _bfd_nosymbols_find_line -#define aout_32_get_symbol_version_string \ - _bfd_nosymbols_get_symbol_version_string -#define aout_32_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol - -#define aout_32_bfd_reloc_type_lookup _bfd_norelocs_bfd_reloc_type_lookup -#define aout_32_bfd_reloc_name_lookup _bfd_norelocs_bfd_reloc_name_lookup - -#define aout_32_get_section_contents_in_window \ - _bfd_generic_get_section_contents_in_window - -#define aout_32_set_reloc _bfd_generic_set_reloc - -#define os9k_bfd_get_relocated_section_contents \ - bfd_generic_get_relocated_section_contents -#define os9k_bfd_relax_section bfd_generic_relax_section -#define os9k_bfd_gc_sections bfd_generic_gc_sections -#define os9k_bfd_lookup_section_flags bfd_generic_lookup_section_flags -#define os9k_bfd_merge_sections bfd_generic_merge_sections -#define os9k_bfd_is_group_section bfd_generic_is_group_section -#define os9k_bfd_discard_group bfd_generic_discard_group -#define os9k_section_already_linked \ - _bfd_generic_section_already_linked -#define os9k_bfd_define_common_symbol bfd_generic_define_common_symbol -#define os9k_bfd_define_start_stop bfd_generic_define_start_stop -#define os9k_bfd_link_hash_table_create _bfd_generic_link_hash_table_create -#define os9k_bfd_link_add_symbols _bfd_generic_link_add_symbols -#define os9k_bfd_link_just_syms _bfd_generic_link_just_syms -#define os9k_bfd_copy_link_hash_symbol_type \ - _bfd_generic_copy_link_hash_symbol_type -#define os9k_bfd_final_link _bfd_generic_final_link -#define os9k_bfd_link_split_section _bfd_generic_link_split_section -#define os9k_bfd_link_check_relocs _bfd_generic_link_check_relocs - -const bfd_target i386_aout_os9k_vec = - { - "i386os9k", /* name */ - bfd_target_os9k_flavour, - BFD_ENDIAN_LITTLE, /* data byte order is little */ - BFD_ENDIAN_LITTLE, /* hdr byte order is little */ - (HAS_RELOC | EXEC_P | WP_TEXT), /* object flags */ - (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD), /* section flags */ - 0, /* symbol leading char */ - ' ', /* ar_pad_char */ - 16, /* ar_max_namelen */ - 0, /* match priority. */ - - bfd_getl64, bfd_getl_signed_64, bfd_putl64, - bfd_getl32, bfd_getl_signed_32, bfd_putl32, - bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* data */ - bfd_getl64, bfd_getl_signed_64, bfd_putl64, - bfd_getl32, bfd_getl_signed_32, bfd_putl32, - bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* hdrs */ - { /* bfd_check_format */ - _bfd_dummy_target, - os9k_object_p, - bfd_generic_archive_p, - _bfd_dummy_target - }, - { /* bfd_set_format */ - _bfd_bool_bfd_false_error, - _bfd_bool_bfd_false_error, - _bfd_generic_mkarchive, - _bfd_bool_bfd_false_error - }, - { /* bfd_write_contents */ - _bfd_bool_bfd_false_error, - _bfd_bool_bfd_false_error, - _bfd_write_archive_contents, - _bfd_bool_bfd_false_error - }, - - BFD_JUMP_TABLE_GENERIC (aout_32), - BFD_JUMP_TABLE_COPY (_bfd_generic), - BFD_JUMP_TABLE_CORE (_bfd_nocore), - BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_bsd), - BFD_JUMP_TABLE_SYMBOLS (aout_32), - BFD_JUMP_TABLE_RELOCS (aout_32), - BFD_JUMP_TABLE_WRITE (aout_32), - BFD_JUMP_TABLE_LINK (os9k), - BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic), - - NULL, - - NULL, - }; diff --git a/bfd/po/SRC-POTFILES.in b/bfd/po/SRC-POTFILES.in index 62339ec..f7ce387 100644 --- a/bfd/po/SRC-POTFILES.in +++ b/bfd/po/SRC-POTFILES.in @@ -231,21 +231,14 @@ elfxx-tilegx.c elfxx-x86.c elfxx-x86.c format.c -freebsd.h genlink.h go32stub.h hash.c hpux-core.c i386aout.c i386bsd.c -i386dynix.c -i386freebsd.c -i386linux.c i386lynx.c -i386mach3.c i386msdos.c -i386netbsd.c -i386os9k.c ihex.c init.c irix-core.c diff --git a/bfd/targets.c b/bfd/targets.c index cce8b74..c03efe0 100644 --- a/bfd/targets.c +++ b/bfd/targets.c @@ -650,13 +650,7 @@ extern const bfd_target hppa_elf64_linux_vec; extern const bfd_target hppa_som_vec; extern const bfd_target i386_aout_vec; extern const bfd_target i386_aout_bsd_vec; -extern const bfd_target i386_aout_dynix_vec; -extern const bfd_target i386_aout_fbsd_vec; -extern const bfd_target i386_aout_linux_vec; extern const bfd_target i386_aout_lynx_vec; -extern const bfd_target i386_aout_mach3_vec; -extern const bfd_target i386_aout_nbsd_vec; -extern const bfd_target i386_aout_os9k_vec; extern const bfd_target i386_coff_vec; extern const bfd_target i386_coff_go32_vec; extern const bfd_target i386_coff_go32stubbed_vec; @@ -1014,22 +1008,7 @@ static const bfd_target * const _bfd_target_vector[] = &i386_aout_vec, &i386_aout_bsd_vec, -#if 0 - &i386_aout_dynix_vec, -#endif - &i386_aout_fbsd_vec, -#if 0 - /* Since a.out files lack decent magic numbers, no way to recognize - which kind of a.out file it is. */ - &i386_aout_linux_vec, -#endif &i386_aout_lynx_vec, -#if 0 - /* No distinguishing features for Mach 3 executables. */ - &i386_aout_mach3_vec, -#endif - &i386_aout_nbsd_vec, - &i386_aout_os9k_vec, &i386_coff_vec, &i386_coff_go32_vec, &i386_coff_go32stubbed_vec, |