aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2018-04-16 15:11:22 +0930
committerAlan Modra <amodra@gmail.com>2018-04-16 15:11:22 +0930
commitb4b594e304d44458e25e106ddb4824a37aaf556c (patch)
tree56141c32290d4aa4c12ccf1bb1aae631cca7ad39
parentfceadf09517d8b37a0fa77852e26a789fc160d94 (diff)
downloadfsf-binutils-gdb-b4b594e304d44458e25e106ddb4824a37aaf556c.zip
fsf-binutils-gdb-b4b594e304d44458e25e106ddb4824a37aaf556c.tar.gz
fsf-binutils-gdb-b4b594e304d44458e25e106ddb4824a37aaf556c.tar.bz2
Remove netware support
include/ * nlm/ChangeLog-9315: Delete. * nlm/alpha-ext.h: Delete. * nlm/common.h: Delete. * nlm/external.h: Delete. * nlm/i386-ext.h: Delete. * nlm/internal.h: Delete. * nlm/ppc-ext.h: Delete. * nlm/sparc32-ext.h: Delete. bfd/ * Makefile.am: Remove netware support. * bfd-in.h: Likewise. * bfd.c: Likewise. * config.bfd: Likewise. * configure.ac: Likewise. * doc/bfdint.texi: Likewise. * ecoff.c: Likewise. * targets.c: Likewise. * libnlm.h: Delete. * nlm-target.h: Delete. * nlm.c: Delete. * nlm32-alpha.c: Delete. * nlm32-i386.c: Delete. * nlm32-ppc.c: Delete. * nlm32-sparc.c: Delete. * nlm32.c: Delete. * nlm64.c: Delete. * nlmcode.h: Delete. * nlmswap.h: Delete. * Makefile.in: Regenerate. * bfd-in2.h: Regenerate. * configure: Regenerate. * po/SRC-POTFILES.in: Regenerate. binutils/ * .gitignore: Remove netware support. * Makefile.am: Likewise. * configure.ac: Likewise. * doc/Makefile.am: Likewise. * doc/binutils.texi: Likewise. * testsuite/binutils-all/nm.exp: Likewise. * nlmconv.c: Delete. * nlmconv.h: Delete. * nlmheader.y: Delete. * Makefile.in: Regenerate. * configure: Regenerate. * doc/Makefile.in: Regenerate. * po/POTFILES.in: Regenerate. gas/ * Makefile.am: Remove netware support. * config/tc-i386.c: Likewise. * configure.tgt: Likewise. * config/te-netware.h: Delete. * Makefile.in: Regenerate. * po/POTFILES.in: Regenerate. gprof/ * corefile.c: Remove netware support. ld/ * Makefile.am: Remove netware support. * configure.tgt: Likewise. * testsuite/ld-powerpc/powerpc.exp: Likewise. * emulparams/i386nw.sh: Delete. * emulparams/ppcnw.sh: Delete. * scripttempl/nw.sc: Delete. * Makefile.in: Regenerate. * po/BLD-POTFILES.in: Regenerate.
-rw-r--r--bfd/ChangeLog26
-rw-r--r--bfd/Makefile.am18
-rw-r--r--bfd/Makefile.in25
-rw-r--r--bfd/bfd-in.h2
-rw-r--r--bfd/bfd-in2.h4
-rw-r--r--bfd/bfd.c1
-rw-r--r--bfd/config.bfd21
-rwxr-xr-xbfd/configure4
-rw-r--r--bfd/configure.ac4
-rw-r--r--bfd/doc/bfdint.texi24
-rw-r--r--bfd/ecoff.c16
-rw-r--r--bfd/libnlm.h222
-rw-r--r--bfd/nlm-target.h265
-rw-r--r--bfd/nlm.c55
-rw-r--r--bfd/nlm32-alpha.c859
-rw-r--r--bfd/nlm32-i386.c429
-rw-r--r--bfd/nlm32-ppc.c986
-rw-r--r--bfd/nlm32-sparc.c378
-rw-r--r--bfd/nlm32.c22
-rw-r--r--bfd/nlm64.c22
-rw-r--r--bfd/nlmcode.h1982
-rw-r--r--bfd/nlmswap.h153
-rw-r--r--bfd/po/SRC-POTFILES.in11
-rw-r--r--bfd/targets.c10
-rw-r--r--binutils/.gitignore4
-rw-r--r--binutils/ChangeLog16
-rw-r--r--binutils/Makefile.am45
-rw-r--r--binutils/Makefile.in121
-rwxr-xr-xbinutils/configure31
-rw-r--r--binutils/configure.ac27
-rw-r--r--binutils/doc/Makefile.am8
-rw-r--r--binutils/doc/Makefile.in10
-rw-r--r--binutils/doc/binutils.texi110
-rw-r--r--binutils/nlmconv.c2166
-rw-r--r--binutils/nlmconv.h86
-rw-r--r--binutils/nlmheader.y959
-rw-r--r--binutils/po/POTFILES.in2
-rw-r--r--binutils/testsuite/binutils-all/nm.exp7
-rw-r--r--gas/ChangeLog9
-rw-r--r--gas/Makefile.am1
-rw-r--r--gas/Makefile.in1
-rw-r--r--gas/config/tc-i386.c1
-rw-r--r--gas/config/te-netware.h28
-rw-r--r--gas/configure.tgt1
-rw-r--r--gas/po/POTFILES.in1
-rw-r--r--gprof/ChangeLog4
-rw-r--r--gprof/corefile.c1
-rw-r--r--include/ChangeLog11
-rw-r--r--include/nlm/ChangeLog-9315127
-rw-r--r--include/nlm/alpha-ext.h167
-rw-r--r--include/nlm/common.h123
-rw-r--r--include/nlm/external.h172
-rw-r--r--include/nlm/i386-ext.h117
-rw-r--r--include/nlm/internal.h309
-rw-r--r--include/nlm/ppc-ext.h164
-rw-r--r--include/nlm/sparc32-ext.h121
-rw-r--r--ld/ChangeLog11
-rw-r--r--ld/Makefile.am8
-rw-r--r--ld/Makefile.in10
-rw-r--r--ld/configure.tgt3
-rw-r--r--ld/emulparams/i386nw.sh8
-rw-r--r--ld/emulparams/ppcnw.sh6
-rw-r--r--ld/po/BLD-POTFILES.in2
-rw-r--r--ld/scripttempl/nw.sc143
-rw-r--r--ld/testsuite/ld-powerpc/powerpc.exp2
65 files changed, 135 insertions, 10547 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index fe34344..9e26d90 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,5 +1,31 @@
2018-04-16 Alan Modra <amodra@gmail.com>
+ * Makefile.am: Remove netware support.
+ * bfd-in.h: Likewise.
+ * bfd.c: Likewise.
+ * config.bfd: Likewise.
+ * configure.ac: Likewise.
+ * doc/bfdint.texi: Likewise.
+ * ecoff.c: Likewise.
+ * targets.c: Likewise.
+ * libnlm.h: Delete.
+ * nlm-target.h: Delete.
+ * nlm.c: Delete.
+ * nlm32-alpha.c: Delete.
+ * nlm32-i386.c: Delete.
+ * nlm32-ppc.c: Delete.
+ * nlm32-sparc.c: Delete.
+ * nlm32.c: Delete.
+ * nlm64.c: Delete.
+ * nlmcode.h: Delete.
+ * nlmswap.h: Delete.
+ * Makefile.in: Regenerate.
+ * bfd-in2.h: Regenerate.
+ * configure: Regenerate.
+ * po/SRC-POTFILES.in: Regenerate.
+
+2018-04-16 Alan Modra <amodra@gmail.com>
+
* archures.c: Remove tahoe support.
* config.bfd: Likewise.
* configure.ac: Likewise.
diff --git a/bfd/Makefile.am b/bfd/Makefile.am
index a03e2b2..0ed96c9 100644
--- a/bfd/Makefile.am
+++ b/bfd/Makefile.am
@@ -411,11 +411,6 @@ BFD32_BACKENDS = \
mach-o-arm.lo \
mipsbsd.lo \
newsos3.lo \
- nlm.lo \
- nlm32-i386.lo \
- nlm32-ppc.lo \
- nlm32-sparc.lo \
- nlm32.lo \
ns32knetbsd.lo \
oasys.lo \
pc532-mach.lo \
@@ -602,11 +597,6 @@ BFD32_BACKENDS_CFILES = \
mach-o-arm.c \
mipsbsd.c \
newsos3.c \
- nlm.c \
- nlm32-i386.c \
- nlm32-ppc.c \
- nlm32-sparc.c \
- nlm32.c \
ns32knetbsd.c \
oasys.c \
pc532-mach.c \
@@ -690,8 +680,6 @@ BFD64_BACKENDS = \
mach-o-aarch64.lo \
mach-o-x86-64.lo \
mmo.lo \
- nlm32-alpha.lo \
- nlm64.lo \
pe-x86_64.lo \
pei-ia64.lo \
pei-x86_64.lo \
@@ -731,8 +719,6 @@ BFD64_BACKENDS_CFILES = \
mach-o-aarch64.c \
mach-o-x86-64.c \
mmo.c \
- nlm32-alpha.c \
- nlm64.c \
pe-x86_64.c \
pei-ia64.c \
pei-x86_64.c \
@@ -804,8 +790,8 @@ SOURCE_HFILES = \
elf64-hppa.h elfcode.h elfcore.h \
freebsd.h genlink.h go32stub.h \
libaout.h libbfd.h libcoff.h libecoff.h libhppa.h libieee.h \
- libnlm.h liboasys.h libpei.h libxcoff.h mach-o.h \
- netbsd.h nlm-target.h nlmcode.h nlmswap.h ns32k.h \
+ liboasys.h libpei.h libxcoff.h mach-o.h \
+ netbsd.h ns32k.h \
pef.h pef-traceback.h peicode.h som.h version.h \
vms.h xsym.h
diff --git a/bfd/Makefile.in b/bfd/Makefile.in
index d63aef9..91614ce 100644
--- a/bfd/Makefile.in
+++ b/bfd/Makefile.in
@@ -745,11 +745,6 @@ BFD32_BACKENDS = \
mach-o-arm.lo \
mipsbsd.lo \
newsos3.lo \
- nlm.lo \
- nlm32-i386.lo \
- nlm32-ppc.lo \
- nlm32-sparc.lo \
- nlm32.lo \
ns32knetbsd.lo \
oasys.lo \
pc532-mach.lo \
@@ -936,11 +931,6 @@ BFD32_BACKENDS_CFILES = \
mach-o-arm.c \
mipsbsd.c \
newsos3.c \
- nlm.c \
- nlm32-i386.c \
- nlm32-ppc.c \
- nlm32-sparc.c \
- nlm32.c \
ns32knetbsd.c \
oasys.c \
pc532-mach.c \
@@ -1025,8 +1015,6 @@ BFD64_BACKENDS = \
mach-o-aarch64.lo \
mach-o-x86-64.lo \
mmo.lo \
- nlm32-alpha.lo \
- nlm64.lo \
pe-x86_64.lo \
pei-ia64.lo \
pei-x86_64.lo \
@@ -1066,8 +1054,6 @@ BFD64_BACKENDS_CFILES = \
mach-o-aarch64.c \
mach-o-x86-64.c \
mmo.c \
- nlm32-alpha.c \
- nlm64.c \
pe-x86_64.c \
pei-ia64.c \
pei-x86_64.c \
@@ -1139,8 +1125,8 @@ SOURCE_HFILES = \
elf64-hppa.h elfcode.h elfcore.h \
freebsd.h genlink.h go32stub.h \
libaout.h libbfd.h libcoff.h libecoff.h libhppa.h libieee.h \
- libnlm.h liboasys.h libpei.h libxcoff.h mach-o.h \
- netbsd.h nlm-target.h nlmcode.h nlmswap.h ns32k.h \
+ liboasys.h libpei.h libxcoff.h mach-o.h \
+ netbsd.h ns32k.h \
pef.h pef-traceback.h peicode.h som.h version.h \
vms.h xsym.h
@@ -1594,13 +1580,6 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mmo.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/netbsd-core.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/newsos3.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nlm.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nlm32-alpha.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nlm32-i386.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nlm32-ppc.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nlm32-sparc.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nlm32.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nlm64.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ns32knetbsd.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/oasys.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/opncls.Plo@am__quote@
diff --git a/bfd/bfd-in.h b/bfd/bfd-in.h
index a06cd74..cc59ed6 100644
--- a/bfd/bfd-in.h
+++ b/bfd/bfd-in.h
@@ -608,8 +608,6 @@ extern bfd_boolean _bfd_handle_already_linked
/* Externally visible ECOFF routines. */
-extern bfd_vma bfd_ecoff_get_gp_value
- (bfd * abfd);
extern bfd_boolean bfd_ecoff_set_gp_value
(bfd *abfd, bfd_vma gp_value);
extern bfd_boolean bfd_ecoff_set_regmasks
diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h
index 6a3d3d5..d04f028 100644
--- a/bfd/bfd-in2.h
+++ b/bfd/bfd-in2.h
@@ -615,8 +615,6 @@ extern bfd_boolean _bfd_handle_already_linked
/* Externally visible ECOFF routines. */
-extern bfd_vma bfd_ecoff_get_gp_value
- (bfd * abfd);
extern bfd_boolean bfd_ecoff_set_gp_value
(bfd *abfd, bfd_vma gp_value);
extern bfd_boolean bfd_ecoff_set_regmasks
@@ -7015,7 +7013,6 @@ struct bfd
struct ihex_data_struct *ihex_data;
struct tekhex_data_struct *tekhex_data;
struct elf_obj_tdata *elf_obj_data;
- struct nlm_obj_tdata *nlm_obj_data;
struct mmo_data_struct *mmo_data;
struct sun_core_struct *sun_core_data;
struct sco5_core_struct *sco5_core_data;
@@ -7325,7 +7322,6 @@ enum bfd_flavour
bfd_target_xcoff_flavour,
bfd_target_elf_flavour,
bfd_target_ieee_flavour,
- bfd_target_nlm_flavour,
bfd_target_oasys_flavour,
bfd_target_tekhex_flavour,
bfd_target_srec_flavour,
diff --git a/bfd/bfd.c b/bfd/bfd.c
index 31bcc34..31df6cd 100644
--- a/bfd/bfd.c
+++ b/bfd/bfd.c
@@ -317,7 +317,6 @@ CODE_FRAGMENT
. struct ihex_data_struct *ihex_data;
. struct tekhex_data_struct *tekhex_data;
. struct elf_obj_tdata *elf_obj_data;
-. struct nlm_obj_tdata *nlm_obj_data;
. struct mmo_data_struct *mmo_data;
. struct sun_core_struct *sun_core_data;
. struct sco5_core_struct *sco5_core_data;
diff --git a/bfd/config.bfd b/bfd/config.bfd
index 77ce4eb..4f6fb94 100644
--- a/bfd/config.bfd
+++ b/bfd/config.bfd
@@ -57,7 +57,6 @@ case $targ in
mips*-*-irix5* | mips*-*-irix6*)
# Not obsolete
;;
- *-*-netware* | \
arm-epoc-pe* | \
arm*-*-aout | \
arm*-*-coff | \
@@ -75,7 +74,6 @@ case $targ in
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-*-netware* | \
i[3-7]86-*-linux*aout* | \
i[3-7]86-*-mach* | i[3-7]86-*-osf1mk* | \
i[3-7]86-*-os9k | \
@@ -106,7 +104,6 @@ case $targ in
sparc-*-linux*aout* | \
sparc-*-netbsdaout* | \
sparc-*-openbsd[0-2].* | sparc-*-openbsd3.[0-1] | \
- sparc-*-netware* | \
sparc64-*-aout* | \
sparc*-*-coff* | \
vax-*-bsd* | vax-*-ultrix* | \
@@ -130,6 +127,7 @@ esac
case $targ in
*-adobe-* | \
*-go32-rtems* | \
+ *-*-netware* | \
*-*-rtemsaout* | \
*-*-rtemscoff* | \
a29k-* | \
@@ -294,11 +292,6 @@ case "${targ}" in
targ_selvecs=alpha_ecoff_le_vec
want64=true
;;
- alpha*-*-netware*)
- targ_defvec=alpha_ecoff_le_vec
- targ_selvecs=alpha_nlm32_vec
- want64=true
- ;;
alpha*-*-linux*ecoff*)
targ_defvec=alpha_ecoff_le_vec
targ_selvecs=alpha_elf64_vec
@@ -732,10 +725,6 @@ case "${targ}" in
targ_defvec=i386_elf32_vec
targ_selvecs="iamcu_elf32_vec i386_aout_nbsd_vec"
;;
- i[3-7]86-*-netware*)
- targ_defvec=i386_elf32_vec
- targ_selvecs="iamcu_elf32_vec i386_nlm32_vec i386_coff_vec i386_aout_vec"
- ;;
i[3-7]86-*-linux*aout*)
targ_defvec=i386_aout_linux_vec
targ_selvecs="i386_elf32_vec iamcu_elf32_vec"
@@ -1384,10 +1373,6 @@ case "${targ}" in
targ_selvecs="rs6000_xcoff_vec"
targ_cflags=-DSMALL_ARCHIVE
;;
- powerpc-*-netware*)
- targ_defvec=powerpc_elf32_vec
- targ_selvecs="powerpc_nlm32_vec rs6000_xcoff_vec"
- ;;
powerpc-*-nto*)
targ_defvec=powerpc_elf32_vec
targ_selvecs="rs6000_xcoff_vec powerpc_elf32_le_vec powerpc_boot_vec"
@@ -1665,10 +1650,6 @@ case "${targ}" in
targ_defvec=sparc_elf32_vxworks_vec
targ_selvecs="sparc_elf32_vec sparc_aout_sunos_be_vec"
;;
- sparc-*-netware*)
- targ_defvec=sparc_elf32_vec
- targ_selvecs="sparc_nlm32_vec sparc_aout_sunos_be_vec"
- ;;
#ifdef BFD64
sparc64-*-aout*)
targ_defvec=sparc_aout_sunos_be_vec
diff --git a/bfd/configure b/bfd/configure
index 5a06c7a..81befe3 100755
--- a/bfd/configure
+++ b/bfd/configure
@@ -14337,7 +14337,6 @@ do
alpha_ecoff_le_vec) tb="$tb coff-alpha.lo ecoff.lo $ecoff"; target_size=64 ;;
alpha_elf64_vec) tb="$tb elf64-alpha.lo elf64.lo $elf"; target_size=64 ;;
alpha_elf64_fbsd_vec) tb="$tb elf64-alpha.lo elf64.lo $elf"; target_size=64 ;;
- alpha_nlm32_vec) tb="$tb nlm32-alpha.lo nlm32.lo nlm.lo"; target_size=64 ;;
alpha_vms_vec) tb="$tb vms-alpha.lo vms-misc.lo vms-lib.lo"; target_size=64 ;;
alpha_vms_lib_txt_vec) tb="$tb vms-lib.lo vms-misc.lo" ;;
am33_elf32_linux_vec) tb="$tb elf32-am33lin.lo elf32.lo $elf" ;;
@@ -14424,7 +14423,6 @@ do
i386_elf32_vxworks_vec) tb="$tb elf32-i386.lo elfxx-x86.lo elf-ifunc.lo elf-nacl.lo elf-vxworks.lo elf32.lo $elf" ;;
i386_mach_o_vec) tb="$tb mach-o-i386.lo" ;;
i386_msdos_vec) tb="$tb i386msdos.lo" ;;
- i386_nlm32_vec) tb="$tb nlm32-i386.lo nlm32.lo nlm.lo" ;;
i386_pe_vec) tb="$tb pe-i386.lo peigen.lo $coff" ;;
i386_pei_vec) tb="$tb pei-i386.lo peigen.lo $coff" ;;
iamcu_elf32_vec) tb="$tb elf32-i386.lo elfxx-x86.lo elf-ifunc.lo elf-nacl.lo elf-vxworks.lo elf32.lo $elf" ;;
@@ -14539,7 +14537,6 @@ do
powerpc_elf64_vec) tb="$tb elf64-ppc.lo elf64-gen.lo elf64.lo $elf"; target_size=64 ;;
powerpc_elf64_le_vec) tb="$tb elf64-ppc.lo elf64-gen.lo elf64.lo $elf" target_size=64 ;;
powerpc_elf64_fbsd_vec) tb="$tb elf64-ppc.lo elf64-gen.lo elf64.lo $elf" target_size=64 ;;
- powerpc_nlm32_vec) tb="$tb nlm32-ppc.lo nlm32.lo nlm.lo" ;;
powerpc_pe_vec) tb="$tb pe-ppc.lo peigen.lo $coff" ;;
powerpc_pe_le_vec) tb="$tb pe-ppc.lo peigen.lo $coff" ;;
powerpc_pei_vec) tb="$tb pei-ppc.lo peigen.lo $coff" ;;
@@ -14601,7 +14598,6 @@ do
sparc_elf64_vec) tb="$tb elf64-sparc.lo elfxx-sparc.lo elf-vxworks.lo elf64.lo $elf"; target_size=64 ;;
sparc_elf64_fbsd_vec) tb="$tb elf64-sparc.lo elfxx-sparc.lo elf-vxworks.lo elf64.lo $elf"; target_size=64 ;;
sparc_elf64_sol2_vec) tb="$tb elf64-sparc.lo elfxx-sparc.lo elf-vxworks.lo elf64.lo $elf"; target_size=64 ;;
- sparc_nlm32_vec) tb="$tb nlm32-sparc.lo nlm32.lo nlm.lo" ;;
spu_elf32_vec) tb="$tb elf32-spu.lo elf32.lo $elf" ;;
sym_vec) tb="$tb xsym.lo" ;;
tic30_aout_vec) tb="$tb aout-tic30.lo" ;;
diff --git a/bfd/configure.ac b/bfd/configure.ac
index afaa635..e8250ad 100644
--- a/bfd/configure.ac
+++ b/bfd/configure.ac
@@ -414,7 +414,6 @@ do
alpha_ecoff_le_vec) tb="$tb coff-alpha.lo ecoff.lo $ecoff"; target_size=64 ;;
alpha_elf64_vec) tb="$tb elf64-alpha.lo elf64.lo $elf"; target_size=64 ;;
alpha_elf64_fbsd_vec) tb="$tb elf64-alpha.lo elf64.lo $elf"; target_size=64 ;;
- alpha_nlm32_vec) tb="$tb nlm32-alpha.lo nlm32.lo nlm.lo"; target_size=64 ;;
alpha_vms_vec) tb="$tb vms-alpha.lo vms-misc.lo vms-lib.lo"; target_size=64 ;;
alpha_vms_lib_txt_vec) tb="$tb vms-lib.lo vms-misc.lo" ;;
am33_elf32_linux_vec) tb="$tb elf32-am33lin.lo elf32.lo $elf" ;;
@@ -501,7 +500,6 @@ do
i386_elf32_vxworks_vec) tb="$tb elf32-i386.lo elfxx-x86.lo elf-ifunc.lo elf-nacl.lo elf-vxworks.lo elf32.lo $elf" ;;
i386_mach_o_vec) tb="$tb mach-o-i386.lo" ;;
i386_msdos_vec) tb="$tb i386msdos.lo" ;;
- i386_nlm32_vec) tb="$tb nlm32-i386.lo nlm32.lo nlm.lo" ;;
i386_pe_vec) tb="$tb pe-i386.lo peigen.lo $coff" ;;
i386_pei_vec) tb="$tb pei-i386.lo peigen.lo $coff" ;;
iamcu_elf32_vec) tb="$tb elf32-i386.lo elfxx-x86.lo elf-ifunc.lo elf-nacl.lo elf-vxworks.lo elf32.lo $elf" ;;
@@ -616,7 +614,6 @@ do
powerpc_elf64_vec) tb="$tb elf64-ppc.lo elf64-gen.lo elf64.lo $elf"; target_size=64 ;;
powerpc_elf64_le_vec) tb="$tb elf64-ppc.lo elf64-gen.lo elf64.lo $elf" target_size=64 ;;
powerpc_elf64_fbsd_vec) tb="$tb elf64-ppc.lo elf64-gen.lo elf64.lo $elf" target_size=64 ;;
- powerpc_nlm32_vec) tb="$tb nlm32-ppc.lo nlm32.lo nlm.lo" ;;
powerpc_pe_vec) tb="$tb pe-ppc.lo peigen.lo $coff" ;;
powerpc_pe_le_vec) tb="$tb pe-ppc.lo peigen.lo $coff" ;;
powerpc_pei_vec) tb="$tb pei-ppc.lo peigen.lo $coff" ;;
@@ -678,7 +675,6 @@ do
sparc_elf64_vec) tb="$tb elf64-sparc.lo elfxx-sparc.lo elf-vxworks.lo elf64.lo $elf"; target_size=64 ;;
sparc_elf64_fbsd_vec) tb="$tb elf64-sparc.lo elfxx-sparc.lo elf-vxworks.lo elf64.lo $elf"; target_size=64 ;;
sparc_elf64_sol2_vec) tb="$tb elf64-sparc.lo elfxx-sparc.lo elf-vxworks.lo elf64.lo $elf"; target_size=64 ;;
- sparc_nlm32_vec) tb="$tb nlm32-sparc.lo nlm32.lo nlm.lo" ;;
spu_elf32_vec) tb="$tb elf32-spu.lo elf32.lo $elf" ;;
sym_vec) tb="$tb xsym.lo" ;;
tic30_aout_vec) tb="$tb aout-tic30.lo" ;;
diff --git a/bfd/doc/bfdint.texi b/bfd/doc/bfdint.texi
index fa838c4..954a47a 100644
--- a/bfd/doc/bfdint.texi
+++ b/bfd/doc/bfdint.texi
@@ -338,8 +338,6 @@ ECOFF.
ELF.
@item bfd_target_ieee_flavour
IEEE-695.
-@item bfd_target_nlm_flavour
-NLM.
@item bfd_target_oasys_flavour
OASYS.
@item bfd_target_tekhex_flavour
@@ -1116,23 +1114,6 @@ various macros, and includes @file{aout-target.h}.
Like @file{freebsd.h}, except that there are several files which include
it.
-@item nlm-target.h
-@cindex @file{nlm-target.h}
-Defines the target vector for a standard NLM target.
-
-@item nlmcode.h
-@cindex @file{nlmcode.h}
-Like @file{elfcode.h}, but for NLM targets. This is only included by
-@file{nlm32.c} and @file{nlm64.c}, both of which define the macro
-@samp{ARCH_SIZE} to an appropriate value. There are no 64 bit NLM
-targets anyhow, so this is sort of useless.
-
-@item nlmswap.h
-@cindex @file{nlmswap.h}
-Like @file{coffswap.h}, but for NLM targets. This is included by each
-NLM target, but I think it winds up compiling to the exact same code for
-every target, and as such is fairly useless.
-
@item peicode.h
@cindex @file{peicode.h}
Provides swapping routines and other hooks for PE targets.
@@ -1826,11 +1807,6 @@ information. Normally produced by a linker.
Load Memory Address. This is the address at which a section will be
loaded. Compare with VMA, below.
-@item NLM
-NetWare Loadable Module. Used to describe the format of an object which
-be loaded into NetWare, which is some kind of PC based network server
-program.
-
@item object file
A binary file including machine instructions, symbols, and relocation
information. Normally produced by an assembler.
diff --git a/bfd/ecoff.c b/bfd/ecoff.c
index c947e60..b01f572 100644
--- a/bfd/ecoff.c
+++ b/bfd/ecoff.c
@@ -2218,22 +2218,6 @@ _bfd_ecoff_set_section_contents (bfd *abfd,
return TRUE;
}
-/* Get the GP value for an ECOFF file. This is a hook used by
- nlmconv. */
-
-bfd_vma
-bfd_ecoff_get_gp_value (bfd *abfd)
-{
- if (bfd_get_flavour (abfd) != bfd_target_ecoff_flavour
- || bfd_get_format (abfd) != bfd_object)
- {
- bfd_set_error (bfd_error_invalid_operation);
- return 0;
- }
-
- return ecoff_data (abfd)->gp;
-}
-
/* Set the GP value for an ECOFF file. This is a hook used by the
assembler. */
diff --git a/bfd/libnlm.h b/bfd/libnlm.h
deleted file mode 100644
index 042c3a4..0000000
--- a/bfd/libnlm.h
+++ /dev/null
@@ -1,222 +0,0 @@
-/* BFD back-end data structures for NLM (NetWare Loadable Modules) files.
- Copyright (C) 1993-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. */
-
-#ifndef _LIBNLM_H_
-#define _LIBNLM_H_ 1
-
-#ifdef ARCH_SIZE
-# define NLM_ARCH_SIZE ARCH_SIZE
-#endif
-#include "nlm/common.h"
-#include "nlm/internal.h"
-#include "nlm/external.h"
-
-/* A reloc for an imported NLM symbol. Normal relocs are associated
- with sections, and include a symbol. These relocs are associated
- with (undefined) symbols, and include a section. */
-
-struct nlm_relent
-{
- /* Section of reloc. */
- asection *section;
- /* Reloc info (sym_ptr_ptr field set only when canonicalized). */
- arelent reloc;
-};
-
-/* Information we keep for an NLM symbol. */
-
-typedef struct
-{
- /* BFD symbol. */
- asymbol symbol;
- /* Number of reloc entries for imported symbol. */
- bfd_size_type rcnt;
- /* Array of reloc information for imported symbol. */
- struct nlm_relent *relocs;
-} nlmNAME(symbol_type);
-
-extern bfd_boolean nlm_mkobject (bfd *);
-extern bfd_boolean nlm_set_arch_mach (bfd *, enum bfd_architecture, unsigned long);
-extern void nlmNAME (get_symbol_info) (bfd *, asymbol *, symbol_info *);
-extern long nlmNAME (get_symtab_upper_bound)(bfd *);
-extern long nlmNAME (canonicalize_symtab) (bfd *, asymbol **);
-extern asymbol * nlmNAME (make_empty_symbol) (bfd *);
-extern void nlmNAME (print_symbol) (bfd *, void *, asymbol *, bfd_print_symbol_type);
-extern long nlmNAME (get_reloc_upper_bound) (bfd *, asection *);
-extern long nlmNAME (canonicalize_reloc) (bfd *, asection *, arelent **, asymbol **);
-extern const bfd_target * nlmNAME (object_p) (bfd *);
-extern bfd_boolean nlmNAME (set_arch_mach) (bfd *, enum bfd_architecture, unsigned long);
-extern bfd_boolean nlmNAME (set_section_contents) (bfd *, asection *, const void *, file_ptr, bfd_size_type);
-extern bfd_boolean nlmNAME (write_object_contents) (bfd *);
-
-/* Some private data is stashed away for future use using the tdata pointer
- in the bfd structure. */
-
-struct nlm_obj_tdata
-{
- /* Actual data, but ref like ptr */
- Nlm_Internal_Fixed_Header nlm_fixed_hdr[1];
- Nlm_Internal_Variable_Header nlm_variable_hdr[1];
- Nlm_Internal_Version_Header nlm_version_hdr[1];
- Nlm_Internal_Copyright_Header nlm_copyright_hdr[1];
- Nlm_Internal_Extended_Header nlm_extended_hdr[1];
- Nlm_Internal_Custom_Header nlm_custom_hdr[1];
- Nlm_Internal_Cygnus_Ext_Header nlm_cygnus_ext_hdr[1];
- /* BFD NLM symbols. */
- nlmNAME (symbol_type) * nlm_symbols;
- /* Lowest text and data VMA values. */
- bfd_vma nlm_text_low;
- bfd_vma nlm_data_low;
- /* Caches for data read from object file. */
- arelent * nlm_reloc_fixups;
- asection ** nlm_reloc_fixup_secs;
- /* Backend specific information. This should probably be a pointer,
- but that would require yet another entry point to initialize the
- structure. */
- union
- {
- struct /* Alpha backend information. */
- {
- bfd_vma gp; /* GP value. */
- bfd_vma lita_address; /* .lita section address. */
- bfd_size_type lita_size; /* .lita section size. */
- }
- alpha_backend_data;
- }
- backend_data;
-};
-
-#define nlm_tdata(bfd) ((bfd) -> tdata.nlm_obj_data)
-#define nlm_fixed_header(bfd) (nlm_tdata (bfd) -> nlm_fixed_hdr)
-#define nlm_variable_header(bfd) (nlm_tdata (bfd) -> nlm_variable_hdr)
-#define nlm_version_header(bfd) (nlm_tdata (bfd) -> nlm_version_hdr)
-#define nlm_copyright_header(bfd) (nlm_tdata (bfd) -> nlm_copyright_hdr)
-#define nlm_extended_header(bfd) (nlm_tdata (bfd) -> nlm_extended_hdr)
-#define nlm_custom_header(bfd) (nlm_tdata (bfd) -> nlm_custom_hdr)
-#define nlm_cygnus_ext_header(bfd) (nlm_tdata (bfd) -> nlm_cygnus_ext_hdr)
-#define nlm_get_symbols(bfd) (nlm_tdata (bfd) -> nlm_symbols)
-#define nlm_set_symbols(bfd, p) (nlm_tdata (bfd) -> nlm_symbols = (p))
-#define nlm_set_text_low(bfd, i) (nlm_tdata (bfd) -> nlm_text_low = (i))
-#define nlm_get_text_low(bfd) (nlm_tdata (bfd) -> nlm_text_low)
-#define nlm_set_data_low(bfd, i) (nlm_tdata (bfd) -> nlm_data_low = (i))
-#define nlm_get_data_low(bfd) (nlm_tdata (bfd) -> nlm_data_low)
-#define nlm_relocation_fixups(bfd) (nlm_tdata (bfd) -> nlm_reloc_fixups)
-#define nlm_relocation_fixup_secs(bfd) (nlm_tdata (bfd) -> nlm_reloc_fixup_secs)
-#define nlm_alpha_backend_data(bfd) (&nlm_tdata (bfd) -> backend_data.alpha_backend_data)
-
-/* This is used when writing out the external relocs. */
-
-struct reloc_and_sec
-{
- arelent *rel;
- asection *sec;
-};
-
-/* We store some function pointer in the backend structure. This lets
- different NLM targets share most of the same code, while providing
- slightly different code where necessary. */
-
-struct nlm_backend_data
-{
- /* Signature for this backend. */
- char signature[NLM_SIGNATURE_SIZE];
- /* Size of the fixed header. */
- bfd_size_type fixed_header_size;
- /* Size of optional prefix for this backend. Some backend may
- require this to be a function, but so far a constant is OK. This
- is for a prefix which precedes the standard NLM fixed header. */
- bfd_size_type optional_prefix_size;
- /* Architecture. */
- enum bfd_architecture arch;
- /* Machine. */
- unsigned int mach;
- /* Some NLM formats do not use the uninitialized data section, so
- all uninitialized data must be put into the regular data section
- instead. */
- bfd_boolean no_uninitialized_data;
- /* Some NLM formats have a prefix on the file. If this function is
- not NULL, it will be called by nlm_object_p. It should return
- TRUE if this file could match this format, and it should leave
- the BFD such that a bfd_bread will pick up the fixed header. */
- bfd_boolean (*nlm_backend_object_p) (bfd *);
- /* Write out the prefix. This function may be NULL. This must
- write out the same number of bytes as is in the field
- optional_prefix_size. */
- bfd_boolean (*nlm_write_prefix) (bfd *);
- /* Read a relocation fixup from abfd. The reloc information is
- machine specific. The second argument is the symbol if this is
- an import, or NULL if this is a reloc fixup. This function
- should set the third argument to the section which the reloc
- belongs in, and the fourth argument to the reloc itself; it does
- not need to fill in the sym_ptr_ptr field for a reloc against an
- import symbol. */
- bfd_boolean (*nlm_read_reloc) (bfd *, nlmNAME (symbol_type) *, asection **, arelent *);
- /* To make objcopy to an i386 NLM work, the i386 backend needs a
- chance to work over the relocs. This is a bit icky. */
- bfd_boolean (*nlm_mangle_relocs) (bfd *, asection *, const void *, bfd_vma, bfd_size_type);
- /* Read an import record from abfd. It would be nice if this
- were in a machine-dependent format, but it doesn't seem to be. */
- bfd_boolean (*nlm_read_import) (bfd *, nlmNAME (symbol_type) *);
- /* Write an import record to abfd. */
- bfd_boolean (*nlm_write_import) (bfd *, asection *, arelent *);
- /* Set the section for a public symbol. This may be NULL, in which
- case a default method will be used. */
- bfd_boolean (*nlm_set_public_section) (bfd *, nlmNAME (symbol_type) *);
- /* Get the offset to write out for a public symbol. This may be
- NULL, in which case a default method will be used. */
- bfd_vma (*nlm_get_public_offset) (bfd *, asymbol *);
- /* Swap the fixed header in and out */
- void (*nlm_swap_fhdr_in) (bfd *, void *, Nlm_Internal_Fixed_Header *);
- void (*nlm_swap_fhdr_out) (bfd *, struct nlm_internal_fixed_header *, void *);
- /* Write out an external reference. */
- bfd_boolean (*nlm_write_external) (bfd *, bfd_size_type, asymbol *, struct reloc_and_sec *);
- bfd_boolean (*nlm_write_export) (bfd *, asymbol *, bfd_vma);
-};
-
-#define nlm_backend(bfd) ((struct nlm_backend_data *)((bfd) -> xvec -> backend_data))
-#define nlm_signature(bfd) (nlm_backend (bfd) -> signature)
-#define nlm_fixed_header_size(bfd) (nlm_backend (bfd) -> fixed_header_size)
-#define nlm_optional_prefix_size(bfd) (nlm_backend (bfd) -> optional_prefix_size)
-#define nlm_architecture(bfd) (nlm_backend (bfd) -> arch)
-#define nlm_machine(bfd) (nlm_backend (bfd) -> mach)
-#define nlm_no_uninitialized_data(bfd) (nlm_backend (bfd) -> no_uninitialized_data)
-#define nlm_backend_object_p_func(bfd) (nlm_backend (bfd) -> nlm_backend_object_p)
-#define nlm_write_prefix_func(bfd) (nlm_backend (bfd) -> nlm_write_prefix)
-#define nlm_read_reloc_func(bfd) (nlm_backend (bfd) -> nlm_read_reloc)
-#define nlm_mangle_relocs_func(bfd) (nlm_backend (bfd) -> nlm_mangle_relocs)
-#define nlm_read_import_func(bfd) (nlm_backend (bfd) -> nlm_read_import)
-#define nlm_write_import_func(bfd) (nlm_backend (bfd) -> nlm_write_import)
-#define nlm_set_public_section_func(bfd) (nlm_backend (bfd) -> nlm_set_public_section)
-#define nlm_get_public_offset_func(bfd) (nlm_backend (bfd) -> nlm_get_public_offset)
-#define nlm_swap_fixed_header_in_func(bfd) (nlm_backend (bfd) -> nlm_swap_fhdr_in)
-#define nlm_swap_fixed_header_out_func(bfd)(nlm_backend (bfd) -> nlm_swap_fhdr_out)
-#define nlm_write_external_func(bfd) (nlm_backend (bfd) -> nlm_write_external)
-#define nlm_write_export_func(bfd) (nlm_backend (bfd) -> nlm_write_export)
-
-/* The NLM code, data, and uninitialized sections have no names defined
- in the NLM, but bfd wants to give them names, so use the traditional
- UNIX names. */
-
-#define NLM_CODE_NAME ".text"
-#define NLM_INITIALIZED_DATA_NAME ".data"
-#define NLM_UNINITIALIZED_DATA_NAME ".bss"
-
-#endif /* _LIBNLM_H_ */
diff --git a/bfd/nlm-target.h b/bfd/nlm-target.h
deleted file mode 100644
index a299843..0000000
--- a/bfd/nlm-target.h
+++ /dev/null
@@ -1,265 +0,0 @@
-/* Target definitions for 32/64-bit NLM (NetWare Loadable Module)
- Copyright (C) 1993-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 nlm_core_file_p _bfd_dummy_target
-
-#define nlm_get_symtab_upper_bound nlmNAME (get_symtab_upper_bound)
-#define nlm_canonicalize_symtab nlmNAME (canonicalize_symtab)
-#define nlm_make_empty_symbol nlmNAME (make_empty_symbol)
-#define nlm_print_symbol nlmNAME (print_symbol)
-#define nlm_get_symbol_info nlmNAME (get_symbol_info)
-#define nlm_get_symbol_version_string _bfd_nosymbols_get_symbol_version_string
-#define nlm_bfd_is_local_label_name bfd_generic_is_local_label_name
-#define nlm_bfd_is_target_special_symbol _bfd_bool_bfd_asymbol_false
-#define nlm_get_lineno _bfd_nosymbols_get_lineno
-#define nlm_find_nearest_line _bfd_nosymbols_find_nearest_line
-#define nlm_find_line _bfd_nosymbols_find_line
-#define nlm_find_inliner_info _bfd_nosymbols_find_inliner_info
-#define nlm_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol
-#define nlm_read_minisymbols _bfd_generic_read_minisymbols
-#define nlm_minisymbol_to_symbol _bfd_generic_minisymbol_to_symbol
-
-#define nlm_get_reloc_upper_bound nlmNAME (get_reloc_upper_bound)
-#define nlm_canonicalize_reloc nlmNAME (canonicalize_reloc)
-#define nlm_set_reloc _bfd_generic_set_reloc
-#define nlm_bfd_reloc_type_lookup bfd_default_reloc_type_lookup
-#define nlm_bfd_reloc_name_lookup _bfd_norelocs_bfd_reloc_name_lookup
-#define nlm_set_section_contents nlmNAME (set_section_contents)
-
-#define nlm_sizeof_headers _bfd_nolink_sizeof_headers
-#define nlm_bfd_get_relocated_section_contents bfd_generic_get_relocated_section_contents
-#define nlm_bfd_relax_section bfd_generic_relax_section
-#define nlm_bfd_gc_sections bfd_generic_gc_sections
-#define nlm_bfd_lookup_section_flags bfd_generic_lookup_section_flags
-#define nlm_bfd_merge_sections bfd_generic_merge_sections
-#define nlm_bfd_is_group_section bfd_generic_is_group_section
-#define nlm_bfd_discard_group bfd_generic_discard_group
-#define nlm_section_already_linked _bfd_generic_section_already_linked
-#define nlm_bfd_define_common_symbol bfd_generic_define_common_symbol
-#define nlm_bfd_define_start_stop bfd_generic_define_start_stop
-#define nlm_bfd_link_hash_table_create _bfd_generic_link_hash_table_create
-#define nlm_bfd_link_add_symbols _bfd_generic_link_add_symbols
-#define nlm_bfd_link_just_syms _bfd_generic_link_just_syms
-#define nlm_bfd_copy_link_hash_symbol_type \
- _bfd_generic_copy_link_hash_symbol_type
-#define nlm_bfd_final_link _bfd_generic_final_link
-#define nlm_bfd_link_split_section _bfd_generic_link_split_section
-#define nlm_bfd_link_check_relocs _bfd_generic_link_check_relocs
-
-/* This structure contains everything that BFD knows about a target.
- It includes things like its byte order, name, what routines to call
- to do various operations, etc. Every BFD points to a target structure
- with its "xvec" member.
-
- There are two such structures here: one for big-endian machines and
- one for little-endian machines. */
-
-/* Forward declaration for use when initialising alternative_target field. */
-#ifdef TARGET_LITTLE_SYM
-extern const bfd_target TARGET_LITTLE_SYM;
-#endif
-
-#ifdef TARGET_BIG_SYM
-const bfd_target TARGET_BIG_SYM =
-{
- /* Name: identify kind of target. */
- TARGET_BIG_NAME,
-
- /* Flavour: general indication about file. */
- bfd_target_nlm_flavour,
-
- /* Byteorder: data is big endian. */
- BFD_ENDIAN_BIG,
-
- /* Header_byteorder: header is also big endian. */
- BFD_ENDIAN_BIG,
-
- /* Object_flags: mask of all file flags. */
- (HAS_RELOC | EXEC_P | HAS_LINENO | HAS_DEBUG | HAS_SYMS | HAS_LOCALS
- | WP_TEXT),
-
- /* Section_flags: mask of all section flags. */
- (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_READONLY
- | SEC_CODE | SEC_DATA),
-
- /* Leading_symbol_char: is the first char of a user symbol
- predictable, and if so what is it. */
- 0,
-
- /* AR_pad_char: pad character for filenames within an archive header
- FIXME: this really has nothing to do with NLM, this is a characteristic
- of the archiver and/or os and should be independently tunable. */
- '/',
-
- /* AR_max_namelen: maximum number of characters in an archive header
- FIXME: this really has nothing to do with NLM, this is a characteristic
- of the archiver and should be independently tunable. This value is
- a WAG (wild a** guess). */
- 15,
- 0, /* match priority. */
-
- /* Routines to byte-swap various sized integers from the data sections. */
- bfd_getb64, bfd_getb_signed_64, bfd_putb64,
- bfd_getb32, bfd_getb_signed_32, bfd_putb32,
- bfd_getb16, bfd_getb_signed_16, bfd_putb16,
-
- /* Routines to byte-swap various sized integers from the file headers. */
- bfd_getb64, bfd_getb_signed_64, bfd_putb64,
- bfd_getb32, bfd_getb_signed_32, bfd_putb32,
- bfd_getb16, bfd_getb_signed_16, bfd_putb16,
-
- /* bfd_check_format: check the format of a file being read. */
- { _bfd_dummy_target, /* Unknown format. */
- nlmNAME (object_p), /* Assembler/linker output (object file). */
- bfd_generic_archive_p, /* An archive. */
- nlm_core_file_p /* A core file. */
- },
-
- /* bfd_set_format: set the format of a file being written. */
- { _bfd_bool_bfd_false_error,
- nlm_mkobject,
- _bfd_generic_mkarchive,
- _bfd_bool_bfd_false_error
- },
-
- /* bfd_write_contents: write cached information into a file being written. */
- { _bfd_bool_bfd_false_error,
- nlmNAME (write_object_contents),
- _bfd_write_archive_contents,
- _bfd_bool_bfd_false_error
- },
-
- /* Initialize a jump table with the standard macro.
- All names start with "nlm". */
- BFD_JUMP_TABLE_GENERIC (_bfd_generic),
- BFD_JUMP_TABLE_COPY (_bfd_generic),
- BFD_JUMP_TABLE_CORE (_bfd_nocore),
- BFD_JUMP_TABLE_ARCHIVE (_bfd_noarchive),
- BFD_JUMP_TABLE_SYMBOLS (nlm),
- BFD_JUMP_TABLE_RELOCS (nlm),
- BFD_JUMP_TABLE_WRITE (nlm),
- BFD_JUMP_TABLE_LINK (nlm),
- BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
-
- /* Alternative endian target. */
-#ifdef TARGET_LITTLE_SYM
- & TARGET_LITTLE_SYM,
-#else
- NULL,
-#endif
-
- /* Backend_data. */
- (void *) TARGET_BACKEND_DATA
-};
-#endif
-
-#ifdef TARGET_LITTLE_SYM
-const bfd_target TARGET_LITTLE_SYM =
-{
- /* Name: identify kind of target. */
- TARGET_LITTLE_NAME,
-
- /* Flavour: general indication about file. */
- bfd_target_nlm_flavour,
-
- /* Byteorder: data is little endian. */
- BFD_ENDIAN_LITTLE,
-
- /* Header_byteorder: header is also little endian. */
- BFD_ENDIAN_LITTLE,
-
- /* Object_flags: mask of all file flags. */
- (HAS_RELOC | EXEC_P | HAS_LINENO | HAS_DEBUG | HAS_SYMS | HAS_LOCALS
- | WP_TEXT),
-
- /* Section_flags: mask of all section flags. */
- (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_READONLY
- | SEC_DATA),
-
- /* Leading_symbol_char: is the first char of a user symbol
- predictable, and if so what is it. */
- 0,
-
- /* AR_pad_char: pad character for filenames within an archive header
- FIXME: this really has nothing to do with NLM, this is a characteristic
- of the archiver and/or os and should be independently tunable. */
- '/',
-
- /* AR_max_namelen: maximum number of characters in an archive header
- FIXME: this really has nothing to do with NLM, this is a characteristic
- of the archiver and should be independently tunable. This value is
- a WAG (wild a** guess). */
- 15,
- 0, /* match priority. */
-
- /* Routines to byte-swap various sized integers from the data sections. */
- bfd_getl64, bfd_getl_signed_64, bfd_putl64,
- bfd_getl32, bfd_getl_signed_32, bfd_putl32,
- bfd_getl16, bfd_getl_signed_16, bfd_putl16,
-
- /* Routines to byte-swap various sized integers from the file headers. */
- bfd_getl64, bfd_getl_signed_64, bfd_putl64,
- bfd_getl32, bfd_getl_signed_32, bfd_putl32,
- bfd_getl16, bfd_getl_signed_16, bfd_putl16,
-
- /* bfd_check_format: check the format of a file being read. */
- { _bfd_dummy_target, /* Unknown format. */
- nlmNAME(object_p), /* Assembler/linker output (object file). */
- bfd_generic_archive_p, /* An archive. */
- nlm_core_file_p /* A core file. */
- },
-
- /* bfd_set_format: set the format of a file being written. */
- { _bfd_bool_bfd_false_error,
- nlm_mkobject,
- _bfd_generic_mkarchive,
- _bfd_bool_bfd_false_error
- },
-
- /* bfd_write_contents: write cached information into a file being written. */
- { _bfd_bool_bfd_false_error,
- nlmNAME(write_object_contents),
- _bfd_write_archive_contents,
- _bfd_bool_bfd_false_error
- },
-
- /* Initialize a jump table with the standard macro.
- All names start with "nlm". */
- BFD_JUMP_TABLE_GENERIC (_bfd_generic),
- BFD_JUMP_TABLE_COPY (_bfd_generic),
- BFD_JUMP_TABLE_CORE (_bfd_nocore),
- BFD_JUMP_TABLE_ARCHIVE (_bfd_noarchive),
- BFD_JUMP_TABLE_SYMBOLS (nlm),
- BFD_JUMP_TABLE_RELOCS (nlm),
- BFD_JUMP_TABLE_WRITE (nlm),
- BFD_JUMP_TABLE_LINK (nlm),
- BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
-
- /* Alternative endian target. */
-#ifdef TARGET_BIG_SYM
- & TARGET_BIG_SYM,
-#else
- NULL,
-#endif
-
- /* Backend_data. */
- (void *) TARGET_BACKEND_DATA
-};
-#endif
diff --git a/bfd/nlm.c b/bfd/nlm.c
deleted file mode 100644
index 828a474..0000000
--- a/bfd/nlm.c
+++ /dev/null
@@ -1,55 +0,0 @@
-/* NLM (NetWare Loadable Module) executable support for BFD.
- Copyright (C) 1993-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. */
-
-#include "sysdep.h"
-#include "bfd.h"
-#include "libbfd.h"
-#include "libnlm.h"
-
-/* Make an NLM object. We just need to allocate the backend
- information. */
-
-bfd_boolean
-nlm_mkobject (bfd * abfd)
-{
- bfd_size_type amt = sizeof (struct nlm_obj_tdata);
-
- nlm_tdata (abfd) = bfd_zalloc (abfd, amt);
- if (nlm_tdata (abfd) == NULL)
- return FALSE;
-
- if (nlm_architecture (abfd) != bfd_arch_unknown)
- bfd_default_set_arch_mach (abfd, nlm_architecture (abfd),
- nlm_machine (abfd));
-
- /* Since everything is done at close time, do we need any initialization ? */
- return TRUE;
-}
-
-/* Set the architecture and machine for an NLM object. */
-
-bfd_boolean
-nlm_set_arch_mach (bfd * abfd,
- enum bfd_architecture arch,
- unsigned long machine)
-{
- bfd_default_set_arch_mach (abfd, arch, machine);
- return arch == nlm_architecture (abfd);
-}
diff --git a/bfd/nlm32-alpha.c b/bfd/nlm32-alpha.c
deleted file mode 100644
index 05e36b0..0000000
--- a/bfd/nlm32-alpha.c
+++ /dev/null
@@ -1,859 +0,0 @@
-/* Support for 32-bit Alpha NLM (NetWare Loadable Module)
- Copyright (C) 1993-2018 Free Software Foundation, Inc.
- Written by Ian Lance Taylor, 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. */
-
-
-/* This file describes the 32 bit Alpha NLM format. You might think
- that an Alpha chip would use a 64 bit format, but, for some reason,
- it doesn't. */
-
-#include "sysdep.h"
-#include "bfd.h"
-#include "libbfd.h"
-
-#define ARCH_SIZE 32
-
-#include "nlm/alpha-ext.h"
-#define Nlm_External_Fixed_Header Nlm32_alpha_External_Fixed_Header
-
-#include "libnlm.h"
-
-/* Alpha NLM's have a prefix header before the standard NLM. This
- function reads it in, verifies the version, and seeks the bfd to
- the location before the regular NLM header. */
-
-static bfd_boolean
-nlm_alpha_backend_object_p (bfd *abfd)
-{
- struct nlm32_alpha_external_prefix_header s;
- file_ptr size;
-
- if (bfd_bread (&s, (bfd_size_type) sizeof s, abfd) != sizeof s)
- return FALSE;
-
- if (H_GET_32 (abfd, s.magic) != NLM32_ALPHA_MAGIC)
- return FALSE;
-
- /* FIXME: Should we check the format number? */
-
- /* Skip to the end of the header. */
- size = H_GET_32 (abfd, s.size);
- if (bfd_seek (abfd, size, SEEK_SET) != 0)
- return FALSE;
-
- return TRUE;
-}
-
-/* Write out the prefix. */
-
-static bfd_boolean
-nlm_alpha_write_prefix (bfd *abfd)
-{
- struct nlm32_alpha_external_prefix_header s;
-
- memset (&s, 0, sizeof s);
- H_PUT_32 (abfd, NLM32_ALPHA_MAGIC, s.magic);
- H_PUT_32 (abfd, 2, s.format);
- H_PUT_32 (abfd, sizeof s, s.size);
- if (bfd_bwrite (&s, (bfd_size_type) sizeof s, abfd) != sizeof s)
- return FALSE;
- return TRUE;
-}
-
-#define ONES(n) (((bfd_vma) 1 << ((n) - 1) << 1) - 1)
-
-/* How to process the various reloc types. */
-
-static reloc_howto_type nlm32_alpha_howto_table[] =
-{
- /* Reloc type 0 is ignored by itself. However, it appears after a
- GPDISP reloc to identify the location where the low order 16 bits
- of the gp register are loaded. */
- HOWTO (ALPHA_R_IGNORE, /* Type. */
- 0, /* Rightshift. */
- 0, /* Size (0 = byte, 1 = short, 2 = long). */
- 8, /* Bitsize. */
- FALSE, /* PC_relative. */
- 0, /* Bitpos. */
- complain_overflow_dont, /* Complain_on_overflow. */
- 0, /* Special_function. */
- "IGNORE", /* Name. */
- FALSE, /* Partial_inplace. */
- 0, /* Source mask. */
- 0, /* Dest mask. */
- FALSE), /* PCrel_offset. */
-
- /* A 32 bit reference to a symbol. */
- HOWTO (ALPHA_R_REFLONG, /* Type. */
- 0, /* Rightshift. */
- 2, /* Size (0 = byte, 1 = short, 2 = long). */
- 32, /* Bitsize. */
- FALSE, /* PC_relative. */
- 0, /* Bitpos. */
- complain_overflow_bitfield, /* Complain_on_overflow. */
- 0, /* Special_function. */
- "REFLONG", /* Name. */
- TRUE, /* Partial_inplace. */
- 0xffffffff, /* Source mask. */
- 0xffffffff, /* Dest mask. */
- FALSE), /* PCrel_offset. */
-
- /* A 64 bit reference to a symbol. */
- HOWTO (ALPHA_R_REFQUAD, /* Type. */
- 0, /* Rightshift. */
- 4, /* Size (0 = byte, 1 = short, 2 = long). */
- 64, /* Bitsize. */
- FALSE, /* PC_relative. */
- 0, /* Bitpos. */
- complain_overflow_bitfield, /* Complain_on_overflow. */
- 0, /* Special_function. */
- "REFQUAD", /* Name. */
- TRUE, /* Partial_inplace. */
- ONES (64), /* Source mask. */
- ONES (64), /* Dest mask. */
- FALSE), /* PCrel_offset. */
-
- /* A 32 bit GP relative offset. This is just like REFLONG except
- that when the value is used the value of the gp register will be
- added in. */
- HOWTO (ALPHA_R_GPREL32, /* Type. */
- 0, /* Rightshift. */
- 2, /* Size (0 = byte, 1 = short, 2 = long). */
- 32, /* Bitsize. */
- FALSE, /* PC_relative. */
- 0, /* Bitpos. */
- complain_overflow_bitfield, /* Complain_on_overflow. */
- 0, /* Special_function. */
- "GPREL32", /* Name. */
- TRUE, /* Partial_inplace. */
- 0xffffffff, /* Source mask. */
- 0xffffffff, /* Dest mask. */
- FALSE), /* PCrel_offset. */
-
- /* Used for an instruction that refers to memory off the GP
- register. The offset is 16 bits of the 32 bit instruction. This
- reloc always seems to be against the .lita section. */
- HOWTO (ALPHA_R_LITERAL, /* Type. */
- 0, /* Rightshift. */
- 2, /* Size (0 = byte, 1 = short, 2 = long). */
- 16, /* Bitsize. */
- FALSE, /* PC_relative. */
- 0, /* Bitpos. */
- complain_overflow_signed, /* Complain_on_overflow. */
- 0, /* Special_function. */
- "LITERAL", /* Name. */
- TRUE, /* Partial_inplace. */
- 0xffff, /* Source mask. */
- 0xffff, /* Dest mask. */
- FALSE), /* PCrel_offset. */
-
- /* This reloc only appears immediately following a LITERAL reloc.
- It identifies a use of the literal. It seems that the linker can
- use this to eliminate a portion of the .lita section. The symbol
- index is special: 1 means the literal address is in the base
- register of a memory format instruction; 2 means the literal
- address is in the byte offset register of a byte-manipulation
- instruction; 3 means the literal address is in the target
- register of a jsr instruction. This does not actually do any
- relocation. */
- HOWTO (ALPHA_R_LITUSE, /* Type. */
- 0, /* Rightshift. */
- 2, /* Size (0 = byte, 1 = short, 2 = long). */
- 32, /* Bitsize. */
- FALSE, /* PC_relative. */
- 0, /* Bitpos. */
- complain_overflow_dont, /* Complain_on_overflow. */
- 0, /* Special_function. */
- "LITUSE", /* Name. */
- FALSE, /* Partial_inplace. */
- 0, /* Source mask. */
- 0, /* Dest mask. */
- FALSE), /* PCrel_offset. */
-
- /* Load the gp register. This is always used for a ldah instruction
- which loads the upper 16 bits of the gp register. The next reloc
- will be an IGNORE reloc which identifies the location of the lda
- instruction which loads the lower 16 bits. The symbol index of
- the GPDISP instruction appears to actually be the number of bytes
- between the ldah and lda instructions. This gives two different
- ways to determine where the lda instruction is; I don't know why
- both are used. The value to use for the relocation is the
- difference between the GP value and the current location; the
- load will always be done against a register holding the current
- address. */
- HOWTO (ALPHA_R_GPDISP, /* Type. */
- 16, /* Rightshift. */
- 2, /* Size (0 = byte, 1 = short, 2 = long). */
- 16, /* Bitsize. */
- TRUE, /* PC_relative. */
- 0, /* Bitpos. */
- complain_overflow_dont, /* Complain_on_overflow. */
- 0, /* Special_function. */
- "GPDISP", /* Name. */
- TRUE, /* Partial_inplace. */
- 0xffff, /* Source mask. */
- 0xffff, /* Dest mask. */
- TRUE), /* PCrel_offset. */
-
- /* A 21 bit branch. The native assembler generates these for
- branches within the text segment, and also fills in the PC
- relative offset in the instruction. It seems to me that this
- reloc, unlike the others, is not partial_inplace. */
- HOWTO (ALPHA_R_BRADDR, /* Type. */
- 2, /* Rightshift. */
- 2, /* Size (0 = byte, 1 = short, 2 = long). */
- 21, /* Bitsize. */
- TRUE, /* PC_relative. */
- 0, /* Bitpos. */
- complain_overflow_signed, /* Complain_on_overflow. */
- 0, /* Special_function. */
- "BRADDR", /* Name. */
- FALSE, /* Partial_inplace. */
- 0, /* Source mask. */
- 0x1fffff, /* Dest mask. */
- FALSE), /* PCrel_offset. */
-
- /* A hint for a jump to a register. */
- HOWTO (ALPHA_R_HINT, /* Type. */
- 2, /* Rightshift. */
- 2, /* Size (0 = byte, 1 = short, 2 = long). */
- 14, /* Bitsize. */
- FALSE, /* PC_relative. */
- 0, /* Bitpos. */
- complain_overflow_dont, /* Complain_on_overflow. */
- 0, /* Special_function. */
- "HINT", /* Name. */
- TRUE, /* Partial_inplace. */
- 0x3fff, /* Source mask. */
- 0x3fff, /* Dest mask. */
- FALSE), /* PCrel_offset. */
-
- /* 16 bit PC relative offset. */
- HOWTO (ALPHA_R_SREL16, /* Type. */
- 0, /* Rightshift. */
- 1, /* Size (0 = byte, 1 = short, 2 = long). */
- 16, /* Bitsize. */
- TRUE, /* PC_relative. */
- 0, /* Bitpos. */
- complain_overflow_signed, /* Complain_on_overflow. */
- 0, /* Special_function. */
- "SREL16", /* Name. */
- TRUE, /* Partial_inplace. */
- 0xffff, /* Source mask. */
- 0xffff, /* Dest mask. */
- FALSE), /* PCrel_offset. */
-
- /* 32 bit PC relative offset. */
- HOWTO (ALPHA_R_SREL32, /* Type. */
- 0, /* Rightshift. */
- 2, /* Size (0 = byte, 1 = short, 2 = long). */
- 32, /* Bitsize. */
- TRUE, /* PC_relative. */
- 0, /* Bitpos. */
- complain_overflow_signed, /* Complain_on_overflow. */
- 0, /* Special_function. */
- "SREL32", /* Name. */
- TRUE, /* Partial_inplace. */
- 0xffffffff, /* Source mask. */
- 0xffffffff, /* Dest mask. */
- FALSE), /* PCrel_offset. */
-
- /* A 64 bit PC relative offset. */
- HOWTO (ALPHA_R_SREL64, /* Type. */
- 0, /* Rightshift. */
- 4, /* Size (0 = byte, 1 = short, 2 = long). */
- 64, /* Bitsize. */
- TRUE, /* PC_relative. */
- 0, /* Bitpos. */
- complain_overflow_signed, /* Complain_on_overflow. */
- 0, /* Special_function. */
- "SREL64", /* Name. */
- TRUE, /* Partial_inplace. */
- ONES (64), /* Source mask. */
- ONES (64), /* Dest mask. */
- FALSE), /* PCrel_offset. */
-
- /* Push a value on the reloc evaluation stack. */
- HOWTO (ALPHA_R_OP_PUSH, /* Type. */
- 0, /* Rightshift. */
- 0, /* Size (0 = byte, 1 = short, 2 = long). */
- 0, /* Bitsize. */
- FALSE, /* PC_relative. */
- 0, /* Bitpos. */
- complain_overflow_dont, /* Complain_on_overflow. */
- 0, /* Special_function. */
- "OP_PUSH", /* Name. */
- FALSE, /* Partial_inplace. */
- 0, /* Source mask. */
- 0, /* Dest mask. */
- FALSE), /* PCrel_offset. */
-
- /* Store the value from the stack at the given address. Store it in
- a bitfield of size r_size starting at bit position r_offset. */
- HOWTO (ALPHA_R_OP_STORE, /* Type. */
- 0, /* Rightshift. */
- 4, /* Size (0 = byte, 1 = short, 2 = long). */
- 64, /* Bitsize. */
- FALSE, /* PC_relative. */
- 0, /* Bitpos. */
- complain_overflow_dont, /* Complain_on_overflow. */
- 0, /* Special_function. */
- "OP_STORE", /* Name. */
- FALSE, /* Partial_inplace. */
- 0, /* Source mask. */
- ONES (64), /* Dest mask. */
- FALSE), /* PCrel_offset. */
-
- /* Subtract the reloc address from the value on the top of the
- relocation stack. */
- HOWTO (ALPHA_R_OP_PSUB, /* Type. */
- 0, /* Rightshift. */
- 0, /* Size (0 = byte, 1 = short, 2 = long). */
- 0, /* Bitsize. */
- FALSE, /* PC_relative. */
- 0, /* Bitpos. */
- complain_overflow_dont, /* Complain_on_overflow. */
- 0, /* Special_function. */
- "OP_PSUB", /* Name. */
- FALSE, /* Partial_inplace. */
- 0, /* Source mask. */
- 0, /* Dest mask. */
- FALSE), /* PCrel_offset. */
-
- /* Shift the value on the top of the relocation stack right by the
- given value. */
- HOWTO (ALPHA_R_OP_PRSHIFT, /* Type. */
- 0, /* Rightshift. */
- 0, /* Size (0 = byte, 1 = short, 2 = long). */
- 0, /* Bitsize. */
- FALSE, /* PC_relative. */
- 0, /* Bitpos. */
- complain_overflow_dont, /* Complain_on_overflow. */
- 0, /* Special_function. */
- "OP_PRSHIFT", /* Name. */
- FALSE, /* Partial_inplace. */
- 0, /* Source mask. */
- 0, /* Dest mask. */
- FALSE), /* PCrel_offset. */
-
- /* Adjust the GP value for a new range in the object file. */
- HOWTO (ALPHA_R_GPVALUE, /* Type. */
- 0, /* Rightshift. */
- 0, /* Size (0 = byte, 1 = short, 2 = long). */
- 0, /* Bitsize. */
- FALSE, /* PC_relative. */
- 0, /* Bitpos. */
- complain_overflow_dont, /* Complain_on_overflow. */
- 0, /* Special_function. */
- "GPVALUE", /* Name. */
- FALSE, /* Partial_inplace. */
- 0, /* Source mask. */
- 0, /* Dest mask. */
- FALSE) /* PCrel_offset. */
-};
-
-static reloc_howto_type nlm32_alpha_nw_howto =
- HOWTO (ALPHA_R_NW_RELOC, /* Type. */
- 0, /* Rightshift. */
- 0, /* Size (0 = byte, 1 = short, 2 = long). */
- 0, /* Bitsize. */
- FALSE, /* PC_relative. */
- 0, /* Bitpos. */
- complain_overflow_dont, /* Complain_on_overflow. */
- 0, /* Special_function. */
- "NW_RELOC", /* Name. */
- FALSE, /* Partial_inplace. */
- 0, /* Source mask. */
- 0, /* Dest mask. */
- FALSE); /* PCrel_offset. */
-
-/* Read an Alpha NLM reloc. This routine keeps some static data which
- it uses when handling local relocs. This only works correctly
- because all the local relocs are read at once. */
-
-static bfd_boolean
-nlm_alpha_read_reloc (bfd *abfd,
- nlmNAME (symbol_type) *sym,
- asection **secp,
- arelent *rel)
-{
- static bfd_vma gp_value;
- static bfd_vma lita_address;
- struct nlm32_alpha_external_reloc ext;
- bfd_vma r_vaddr;
- long r_symndx;
- int r_type, r_extern, r_offset, r_size;
- asection *code_sec, *data_sec;
-
- /* Read the reloc from the file. */
- if (bfd_bread (&ext, (bfd_size_type) sizeof ext, abfd) != sizeof ext)
- return FALSE;
-
- /* Swap in the reloc information. */
- r_vaddr = H_GET_64 (abfd, ext.r_vaddr);
- r_symndx = H_GET_32 (abfd, ext.r_symndx);
-
- BFD_ASSERT (bfd_little_endian (abfd));
-
- r_type = ((ext.r_bits[0] & RELOC_BITS0_TYPE_LITTLE)
- >> RELOC_BITS0_TYPE_SH_LITTLE);
- r_extern = (ext.r_bits[1] & RELOC_BITS1_EXTERN_LITTLE) != 0;
- r_offset = ((ext.r_bits[1] & RELOC_BITS1_OFFSET_LITTLE)
- >> RELOC_BITS1_OFFSET_SH_LITTLE);
- /* Ignore the reserved bits. */
- r_size = ((ext.r_bits[3] & RELOC_BITS3_SIZE_LITTLE)
- >> RELOC_BITS3_SIZE_SH_LITTLE);
-
- /* Fill in the BFD arelent structure. */
- code_sec = bfd_get_section_by_name (abfd, NLM_CODE_NAME);
- data_sec = bfd_get_section_by_name (abfd, NLM_INITIALIZED_DATA_NAME);
- if (r_extern)
- {
- /* External relocations are only used for imports. */
- BFD_ASSERT (sym != NULL);
- /* We don't need to set sym_ptr_ptr for this case. It is set in
- nlm_canonicalize_reloc. */
- rel->sym_ptr_ptr = NULL;
- rel->addend = 0;
- }
- else
- {
- /* Internal relocations are only used for local relocation
- fixups. If they are not NW_RELOC or GPDISP or IGNORE, they
- must be against .text or .data. */
- BFD_ASSERT (r_type == ALPHA_R_NW_RELOC || sym == NULL);
- if (r_type == ALPHA_R_NW_RELOC
- || r_type == ALPHA_R_GPDISP
- || r_type == ALPHA_R_IGNORE)
- {
- rel->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr;
- rel->addend = 0;
- }
- else if (r_symndx == ALPHA_RELOC_SECTION_TEXT)
- {
- rel->sym_ptr_ptr = code_sec->symbol_ptr_ptr;
- BFD_ASSERT (bfd_get_section_vma (abfd, code_sec) == 0);
- rel->addend = 0;
- }
- else if (r_symndx == ALPHA_RELOC_SECTION_DATA)
- {
- rel->sym_ptr_ptr = data_sec->symbol_ptr_ptr;
- rel->addend = - bfd_get_section_vma (abfd, data_sec);
- }
- else
- {
- BFD_ASSERT (0);
- rel->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr;
- rel->addend = 0;
- }
- }
-
- /* We use the address to determine whether the reloc is in the .text
- or .data section. R_NW_RELOC relocs don't really have a section,
- so we put them in .text. */
- if (r_type == ALPHA_R_NW_RELOC
- || r_vaddr < code_sec->size)
- {
- *secp = code_sec;
- rel->address = r_vaddr;
- }
- else
- {
- *secp = data_sec;
- rel->address = r_vaddr - code_sec->size;
- }
-
- /* We must adjust the addend based on the type. */
- BFD_ASSERT ((r_type >= 0 && r_type <= ALPHA_R_GPVALUE)
- || r_type == ALPHA_R_NW_RELOC);
-
- switch (r_type)
- {
- case ALPHA_R_BRADDR:
- case ALPHA_R_SREL16:
- case ALPHA_R_SREL32:
- case ALPHA_R_SREL64:
- /* The PC relative relocs do not seem to use the section VMA as
- a negative addend. */
- rel->addend = 0;
- break;
-
- case ALPHA_R_GPREL32:
- /* Copy the gp value for this object file into the addend, to
- ensure that we are not confused by the linker. */
- if (! r_extern)
- rel->addend += gp_value;
- break;
-
- case ALPHA_R_LITERAL:
- BFD_ASSERT (! r_extern);
- rel->addend += lita_address;
- break;
-
- case ALPHA_R_LITUSE:
- case ALPHA_R_GPDISP:
- /* The LITUSE and GPDISP relocs do not use a symbol, or an
- addend, but they do use a special code. Put this code in the
- addend field. */
- rel->addend = r_symndx;
- rel->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr;
- break;
-
- case ALPHA_R_OP_STORE:
- /* The STORE reloc needs the size and offset fields. We store
- them in the addend. */
- BFD_ASSERT (r_offset < 256 && r_size < 256);
- rel->addend = (r_offset << 8) + r_size;
- break;
-
- case ALPHA_R_OP_PUSH:
- case ALPHA_R_OP_PSUB:
- case ALPHA_R_OP_PRSHIFT:
- /* The PUSH, PSUB and PRSHIFT relocs do not actually use an
- address. I believe that the address supplied is really an
- addend. */
- rel->addend = r_vaddr;
- break;
-
- case ALPHA_R_GPVALUE:
- /* Record the new gp value. */
- gp_value += r_symndx;
- rel->addend = gp_value;
- break;
-
- case ALPHA_R_IGNORE:
- /* If the type is ALPHA_R_IGNORE, make sure this is a reference
- to the absolute section so that the reloc is ignored. For
- some reason the address of this reloc type is not adjusted by
- the section vma. We record the gp value for this object file
- here, for convenience when doing the GPDISP relocation. */
- rel->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr;
- rel->address = r_vaddr;
- rel->addend = gp_value;
- break;
-
- case ALPHA_R_NW_RELOC:
- /* If this is SETGP, we set the addend to 0. Otherwise we set
- the addend to the size of the .lita section (this is
- r_symndx) plus 1. We have already set the address of the
- reloc to r_vaddr. */
- if (r_size == ALPHA_R_NW_RELOC_SETGP)
- {
- gp_value = r_vaddr;
- rel->addend = 0;
- }
- else if (r_size == ALPHA_R_NW_RELOC_LITA)
- {
- lita_address = r_vaddr;
- rel->addend = r_symndx + 1;
- }
- else
- BFD_ASSERT (0);
- rel->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr;
- break;
-
- default:
- break;
- }
-
- if (r_type == ALPHA_R_NW_RELOC)
- rel->howto = &nlm32_alpha_nw_howto;
- else
- rel->howto = &nlm32_alpha_howto_table[r_type];
-
- return TRUE;
-}
-
-/* Mangle Alpha NLM relocs for output. */
-
-static bfd_boolean
-nlm_alpha_mangle_relocs (bfd *abfd ATTRIBUTE_UNUSED,
- asection *sec ATTRIBUTE_UNUSED,
- const void * data ATTRIBUTE_UNUSED,
- bfd_vma offset ATTRIBUTE_UNUSED,
- bfd_size_type count ATTRIBUTE_UNUSED)
-{
- return TRUE;
-}
-
-/* Read an ALPHA NLM import record. */
-
-static bfd_boolean
-nlm_alpha_read_import (bfd *abfd, nlmNAME (symbol_type) * sym)
-{
- struct nlm_relent *nlm_relocs; /* Relocation records for symbol. */
- bfd_size_type rcount; /* Number of relocs. */
- bfd_byte temp[NLM_TARGET_LONG_SIZE]; /* Temporary 32-bit value. */
- unsigned char symlength; /* Length of symbol name. */
- char *name;
- bfd_size_type amt;
-
- if (bfd_bread (& symlength, (bfd_size_type) sizeof (symlength), abfd)
- != sizeof (symlength))
- return FALSE;
- sym -> symbol.the_bfd = abfd;
- name = bfd_alloc (abfd, (bfd_size_type) symlength + 1);
- if (name == NULL)
- return FALSE;
- if (bfd_bread (name, (bfd_size_type) symlength, abfd) != symlength)
- return FALSE;
- name[symlength] = '\0';
- sym -> symbol.name = name;
- sym -> symbol.flags = 0;
- sym -> symbol.value = 0;
- sym -> symbol.section = bfd_und_section_ptr;
- if (bfd_bread (temp, (bfd_size_type) sizeof (temp), abfd)
- != sizeof (temp))
- return FALSE;
- rcount = H_GET_32 (abfd, temp);
- amt = rcount * sizeof (struct nlm_relent);
- nlm_relocs = bfd_alloc (abfd, amt);
- if (!nlm_relocs)
- return FALSE;
- sym -> relocs = nlm_relocs;
- sym -> rcnt = 0;
- while (sym -> rcnt < rcount)
- {
- asection *section;
-
- if (! nlm_alpha_read_reloc (abfd, sym, &section, &nlm_relocs -> reloc))
- return FALSE;
- nlm_relocs -> section = section;
- nlm_relocs++;
- sym -> rcnt++;
- }
-
- return TRUE;
-}
-
-/* Write an Alpha NLM reloc. */
-
-static bfd_boolean
-nlm_alpha_write_import (bfd * abfd, asection * sec, arelent * rel)
-{
- asymbol *sym;
- bfd_vma r_vaddr;
- long r_symndx;
- int r_type, r_extern, r_offset, r_size;
- struct nlm32_alpha_external_reloc ext;
-
- sym = *rel->sym_ptr_ptr;
-
- /* Get values for the relocation fields. */
- r_type = rel->howto->type;
- if (r_type != ALPHA_R_NW_RELOC)
- {
- r_vaddr = bfd_get_section_vma (abfd, sec) + rel->address;
- if ((sec->flags & SEC_CODE) == 0)
- r_vaddr += bfd_get_section_by_name (abfd, NLM_CODE_NAME) -> size;
- if (bfd_is_und_section (bfd_get_section (sym)))
- {
- r_extern = 1;
- r_symndx = 0;
- }
- else
- {
- r_extern = 0;
- if (bfd_get_section_flags (abfd, bfd_get_section (sym)) & SEC_CODE)
- r_symndx = ALPHA_RELOC_SECTION_TEXT;
- else
- r_symndx = ALPHA_RELOC_SECTION_DATA;
- }
- r_offset = 0;
- r_size = 0;
-
- switch (r_type)
- {
- case ALPHA_R_LITUSE:
- case ALPHA_R_GPDISP:
- r_symndx = rel->addend;
- break;
-
- case ALPHA_R_OP_STORE:
- r_size = rel->addend & 0xff;
- r_offset = (rel->addend >> 8) & 0xff;
- break;
-
- case ALPHA_R_OP_PUSH:
- case ALPHA_R_OP_PSUB:
- case ALPHA_R_OP_PRSHIFT:
- r_vaddr = rel->addend;
- break;
-
- case ALPHA_R_IGNORE:
- r_vaddr = rel->address;
- break;
-
- default:
- break;
- }
- }
- else
- {
- /* r_type == ALPHA_R_NW_RELOC. */
- r_vaddr = rel->address;
- if (rel->addend == 0)
- {
- r_symndx = 0;
- r_size = ALPHA_R_NW_RELOC_SETGP;
- }
- else
- {
- r_symndx = rel->addend - 1;
- r_size = ALPHA_R_NW_RELOC_LITA;
- }
- r_extern = 0;
- r_offset = 0;
- }
-
- /* Swap out the relocation fields. */
- H_PUT_64 (abfd, r_vaddr, ext.r_vaddr);
- H_PUT_32 (abfd, r_symndx, ext.r_symndx);
-
- BFD_ASSERT (bfd_little_endian (abfd));
-
- ext.r_bits[0] = ((r_type << RELOC_BITS0_TYPE_SH_LITTLE)
- & RELOC_BITS0_TYPE_LITTLE);
- ext.r_bits[1] = ((r_extern ? RELOC_BITS1_EXTERN_LITTLE : 0)
- | ((r_offset << RELOC_BITS1_OFFSET_SH_LITTLE)
- & RELOC_BITS1_OFFSET_LITTLE));
- ext.r_bits[2] = 0;
- ext.r_bits[3] = ((r_size << RELOC_BITS3_SIZE_SH_LITTLE)
- & RELOC_BITS3_SIZE_LITTLE);
-
- /* Write out the relocation. */
- if (bfd_bwrite (&ext, (bfd_size_type) sizeof ext, abfd) != sizeof ext)
- return FALSE;
-
- return TRUE;
-}
-
-/* Alpha NetWare does not use the high bit to determine whether a
- public symbol is in the code segment or the data segment. Instead,
- it just uses the address. The set_public_section and
- get_public_offset routines override the default code which uses the
- high bit. */
-
-/* Set the section for a public symbol. */
-
-static bfd_boolean
-nlm_alpha_set_public_section (bfd * abfd, nlmNAME (symbol_type) * sym)
-{
- asection *code_sec, *data_sec;
-
- code_sec = bfd_get_section_by_name (abfd, NLM_CODE_NAME);
- data_sec = bfd_get_section_by_name (abfd, NLM_INITIALIZED_DATA_NAME);
- if (sym->symbol.value < code_sec->size)
- {
- sym->symbol.section = code_sec;
- sym->symbol.flags |= BSF_FUNCTION;
- }
- else
- {
- sym->symbol.section = data_sec;
- sym->symbol.value -= code_sec->size;
- /* The data segment had better be aligned. */
- BFD_ASSERT ((code_sec->size & 0xf) == 0);
- }
- return TRUE;
-}
-
-/* Get the offset to write out for a public symbol. */
-
-static bfd_vma
-nlm_alpha_get_public_offset (bfd * abfd ATTRIBUTE_UNUSED, asymbol * sym)
-{
- return bfd_asymbol_value (sym);
-}
-
-/* Write an Alpha NLM external symbol. */
-
-static bfd_boolean
-nlm_alpha_write_external (bfd *abfd,
- bfd_size_type count,
- asymbol *sym,
- struct reloc_and_sec *relocs)
-{
- bfd_size_type i;
- bfd_byte len;
- unsigned char temp[NLM_TARGET_LONG_SIZE];
- arelent r;
-
- len = strlen (sym->name);
- if ((bfd_bwrite (&len, (bfd_size_type) sizeof (bfd_byte), abfd)
- != sizeof (bfd_byte))
- || bfd_bwrite (sym->name, (bfd_size_type) len, abfd) != len)
- return FALSE;
-
- bfd_put_32 (abfd, count + 2, temp);
- if (bfd_bwrite (temp, (bfd_size_type) sizeof (temp), abfd) != sizeof (temp))
- return FALSE;
-
- /* The first two relocs for each external symbol are the .lita
- address and the GP value. */
- r.sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr;
- r.howto = &nlm32_alpha_nw_howto;
-
- r.address = nlm_alpha_backend_data (abfd)->lita_address;
- r.addend = nlm_alpha_backend_data (abfd)->lita_size + 1;
- if (! nlm_alpha_write_import (abfd, NULL, &r))
- return FALSE;
-
- r.address = nlm_alpha_backend_data (abfd)->gp;
- r.addend = 0;
- if (! nlm_alpha_write_import (abfd, NULL, &r))
- return FALSE;
-
- for (i = 0; i < count; i++)
- if (! nlm_alpha_write_import (abfd, relocs[i].sec, relocs[i].rel))
- return FALSE;
-
- return TRUE;
-}
-
-#include "nlmswap.h"
-
-static const struct nlm_backend_data nlm32_alpha_backend =
-{
- "NetWare Alpha Module \032",
- sizeof (Nlm32_alpha_External_Fixed_Header),
- sizeof (struct nlm32_alpha_external_prefix_header),
- bfd_arch_alpha,
- 0,
- TRUE, /* No uninitialized data permitted by Alpha NetWare. */
- nlm_alpha_backend_object_p,
- nlm_alpha_write_prefix,
- nlm_alpha_read_reloc,
- nlm_alpha_mangle_relocs,
- nlm_alpha_read_import,
- nlm_alpha_write_import,
- nlm_alpha_set_public_section,
- nlm_alpha_get_public_offset,
- nlm_swap_fixed_header_in,
- nlm_swap_fixed_header_out,
- nlm_alpha_write_external,
- 0, /* Write_export. */
-};
-
-#define TARGET_LITTLE_NAME "nlm32-alpha"
-#define TARGET_LITTLE_SYM alpha_nlm32_vec
-#define TARGET_BACKEND_DATA & nlm32_alpha_backend
-
-#include "nlm-target.h"
diff --git a/bfd/nlm32-i386.c b/bfd/nlm32-i386.c
deleted file mode 100644
index b8de2b8..0000000
--- a/bfd/nlm32-i386.c
+++ /dev/null
@@ -1,429 +0,0 @@
-/* Support for 32-bit i386 NLM (NetWare Loadable Module)
- Copyright (C) 1993-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. */
-
-#include "sysdep.h"
-#include "bfd.h"
-#include "libbfd.h"
-
-#define ARCH_SIZE 32
-
-#include "nlm/i386-ext.h"
-#define Nlm_External_Fixed_Header Nlm32_i386_External_Fixed_Header
-
-#include "libnlm.h"
-
-/* Adjust the reloc location by an absolute value. */
-
-static reloc_howto_type nlm_i386_abs_howto =
- HOWTO (0, /* Type. */
- 0, /* Rightshift. */
- 2, /* Size (0 = byte, 1 = short, 2 = long). */
- 32, /* Bitsize. */
- FALSE, /* PC relative. */
- 0, /* Bitpos. */
- complain_overflow_bitfield, /* Complain_on_overflow. */
- 0, /* Special_function. */
- "32", /* Name. */
- TRUE, /* Partial_inplace. */
- 0xffffffff, /* Source mask. */
- 0xffffffff, /* Dest mask. */
- FALSE); /* PR rel_offset. */
-
-/* Adjust the reloc location by a PC relative displacement. */
-
-static reloc_howto_type nlm_i386_pcrel_howto =
- HOWTO (1, /* Type. */
- 0, /* Rightshift. */
- 2, /* Size (0 = byte, 1 = short, 2 = long). */
- 32, /* Bitsize. */
- TRUE, /* PC relative. */
- 0, /* Bitpos. */
- complain_overflow_signed, /* Complain_on_overflow. */
- 0, /* Special_function. */
- "DISP32", /* Name. */
- TRUE, /* Partial_inplace. */
- 0xffffffff, /* Source mask. */
- 0xffffffff, /* Dest mask. */
- TRUE); /* PR rel_offset. */
-
-/* Read a NetWare i386 reloc. */
-
-static bfd_boolean
-nlm_i386_read_reloc (bfd *abfd,
- nlmNAME (symbol_type) *sym,
- asection **secp,
- arelent *rel)
-{
- bfd_byte temp[4];
- bfd_vma val;
- const char *name;
-
- if (bfd_bread (temp, (bfd_size_type) sizeof (temp), abfd) != sizeof (temp))
- return FALSE;
-
- val = bfd_get_32 (abfd, temp);
-
- /* The value is an offset into either the code or data segment.
- This is the location which needs to be adjusted.
-
- If this is a relocation fixup rather than an imported symbol (the
- sym argument is NULL) then the high bit is 0 if the location
- needs to be adjusted by the address of the data segment, or 1 if
- the location needs to be adjusted by the address of the code
- segment. If this is an imported symbol, then the high bit is 0
- if the location is 0 if the location should be adjusted by the
- offset to the symbol, or 1 if the location should adjusted by the
- absolute value of the symbol.
-
- The second most significant bit is 0 if the value is an offset
- into the data segment, or 1 if the value is an offset into the
- code segment.
-
- All this translates fairly easily into a BFD reloc. */
-
- if (sym == NULL)
- {
- if ((val & NLM_HIBIT) == 0)
- name = NLM_INITIALIZED_DATA_NAME;
- else
- {
- name = NLM_CODE_NAME;
- val &=~ NLM_HIBIT;
- }
- rel->sym_ptr_ptr = bfd_get_section_by_name (abfd, name)->symbol_ptr_ptr;
- rel->howto = &nlm_i386_abs_howto;
- }
- else
- {
- /* In this case we do not need to set the sym_ptr_ptr field. */
- rel->sym_ptr_ptr = NULL;
- if ((val & NLM_HIBIT) == 0)
- rel->howto = &nlm_i386_pcrel_howto;
- else
- {
- rel->howto = &nlm_i386_abs_howto;
- val &=~ NLM_HIBIT;
- }
- }
-
- if ((val & (NLM_HIBIT >> 1)) == 0)
- *secp = bfd_get_section_by_name (abfd, NLM_INITIALIZED_DATA_NAME);
- else
- {
- *secp = bfd_get_section_by_name (abfd, NLM_CODE_NAME);
- val &=~ (NLM_HIBIT >> 1);
- }
-
- rel->address = val;
- rel->addend = 0;
-
- return TRUE;
-}
-
-/* Write a NetWare i386 reloc. */
-
-static bfd_boolean
-nlm_i386_write_import (bfd * abfd, asection * sec, arelent * rel)
-{
- asymbol *sym;
- bfd_vma val;
- bfd_byte temp[4];
-
- /* NetWare only supports two kinds of relocs. We should check
- special_function here, as well, but at the moment coff-i386
- relocs uses a special_function which does not affect what we do
- here. */
- if (rel->addend != 0
- || rel->howto == NULL
- || rel->howto->rightshift != 0
- || rel->howto->size != 2
- || rel->howto->bitsize != 32
- || rel->howto->bitpos != 0
- || rel->howto->src_mask != 0xffffffff
- || rel->howto->dst_mask != 0xffffffff)
- {
- bfd_set_error (bfd_error_invalid_operation);
- return FALSE;
- }
-
- sym = *rel->sym_ptr_ptr;
-
- /* The value we write out is the offset into the appropriate
- segment. This offset is the section vma, adjusted by the vma of
- the lowest section in that segment, plus the address of the
- relocation. */
- val = bfd_get_section_vma (abfd, sec) + rel->address;
-
- /* The second most significant bit is 0 if the value is an offset
- into the data segment, or 1 if the value is an offset into the
- code segment. */
- if (bfd_get_section_flags (abfd, sec) & SEC_CODE)
- {
- val -= nlm_get_text_low (abfd);
- val |= NLM_HIBIT >> 1;
- }
- else
- val -= nlm_get_data_low (abfd);
-
- if (! bfd_is_und_section (bfd_get_section (sym)))
- {
- /* NetWare only supports absolute internal relocs. */
- if (rel->howto->pc_relative)
- {
- bfd_set_error (bfd_error_invalid_operation);
- return FALSE;
- }
-
- /* The high bit is 1 if the reloc is against the code section, 0
- if against the data section. */
- if (bfd_get_section_flags (abfd, bfd_get_section (sym)) & SEC_CODE)
- val |= NLM_HIBIT;
- }
- else
- {
- /* The high bit is 1 if this is an absolute reloc, 0 if it is PC
- relative. */
- if (! rel->howto->pc_relative)
- val |= NLM_HIBIT;
- else
- {
- /* PC relative relocs on NetWare must be pcrel_offset. */
- if (! rel->howto->pcrel_offset)
- {
- bfd_set_error (bfd_error_invalid_operation);
- return FALSE;
- }
- }
- }
-
- bfd_put_32 (abfd, val, temp);
- if (bfd_bwrite (temp, (bfd_size_type) sizeof (temp), abfd) != sizeof (temp))
- return FALSE;
-
- return TRUE;
-}
-
-/* I want to be able to use objcopy to turn an i386 a.out or COFF file
- into a NetWare i386 module. That means that the relocs from the
- source file have to be mapped into relocs that apply to the target
- file. This function is called by nlm_set_section_contents to give
- it a chance to rework the relocs.
-
- This is actually a fairly general concept. However, this is not a
- general implementation. */
-
-static bfd_boolean
-nlm_i386_mangle_relocs (bfd *abfd,
- asection *sec,
- const void * data,
- bfd_vma offset,
- bfd_size_type count)
-{
- arelent **rel_ptr_ptr, **rel_end;
-
- rel_ptr_ptr = sec->orelocation;
- rel_end = rel_ptr_ptr + sec->reloc_count;
- for (; rel_ptr_ptr < rel_end; rel_ptr_ptr++)
- {
- arelent *rel;
- asymbol *sym;
- bfd_vma addend;
-
- rel = *rel_ptr_ptr;
- sym = *rel->sym_ptr_ptr;
-
- /* Note that no serious harm will ensue if we fail to change a
- reloc. We will wind up failing in nlm_i386_write_import. */
-
- /* Make sure this reloc is within the data we have. We only 4
- byte relocs here, so we insist on having 4 bytes. */
- if (rel->address < offset
- || rel->address + 4 > offset + count)
- continue;
-
- /* NetWare doesn't support reloc addends, so we get rid of them
- here by simply adding them into the object data. We handle
- the symbol value, if any, the same way. */
- addend = rel->addend + sym->value;
-
- /* The value of a symbol is the offset into the section. If the
- symbol is in the .bss segment, we need to include the size of
- the data segment in the offset as well. Fortunately, we know
- that at this point the size of the data section is in the NLM
- header. */
- if (((bfd_get_section_flags (abfd, bfd_get_section (sym))
- & SEC_LOAD) == 0)
- && ((bfd_get_section_flags (abfd, bfd_get_section (sym))
- & SEC_ALLOC) != 0))
- addend += nlm_fixed_header (abfd)->dataImageSize;
-
- if (addend != 0
- && rel->howto != NULL
- && rel->howto->rightshift == 0
- && rel->howto->size == 2
- && rel->howto->bitsize == 32
- && rel->howto->bitpos == 0
- && rel->howto->src_mask == 0xffffffff
- && rel->howto->dst_mask == 0xffffffff)
- {
- bfd_vma val;
-
- val = bfd_get_32 (abfd, (bfd_byte *) data + rel->address - offset);
- val += addend;
- bfd_put_32 (abfd, val, (bfd_byte *) data + rel->address - offset);
- rel->addend = 0;
- }
-
- /* NetWare uses a reloc with pcrel_offset set. We adjust
- pc_relative relocs accordingly. We are going to change the
- howto field, so we can only do this if the current one is
- compatible. We should check special_function here, but at
- the moment coff-i386 uses a special_function which does not
- affect what we are doing here. */
- if (rel->howto != NULL
- && rel->howto->pc_relative
- && ! rel->howto->pcrel_offset
- && rel->howto->rightshift == 0
- && rel->howto->size == 2
- && rel->howto->bitsize == 32
- && rel->howto->bitpos == 0
- && rel->howto->src_mask == 0xffffffff
- && rel->howto->dst_mask == 0xffffffff)
- {
- bfd_vma val;
-
- /* When pcrel_offset is not set, it means that the negative
- of the address of the memory location is stored in the
- memory location. We must add it back in. */
- val = bfd_get_32 (abfd, (bfd_byte *) data + rel->address - offset);
- val += rel->address;
- bfd_put_32 (abfd, val, (bfd_byte *) data + rel->address - offset);
-
- rel->howto = &nlm_i386_pcrel_howto;
- }
- }
-
- return TRUE;
-}
-
-/* Read a NetWare i386 import record. */
-
-static bfd_boolean
-nlm_i386_read_import (bfd * abfd, nlmNAME (symbol_type) * sym)
-{
- struct nlm_relent *nlm_relocs; /* Relocation records for symbol. */
- bfd_size_type rcount; /* Number of relocs. */
- bfd_byte temp[NLM_TARGET_LONG_SIZE]; /* Temporary 32-bit value. */
- unsigned char symlength; /* Length of symbol name. */
- char *name;
-
- if (bfd_bread (& symlength, (bfd_size_type) sizeof (symlength), abfd)
- != sizeof (symlength))
- return FALSE;
- sym -> symbol.the_bfd = abfd;
- name = bfd_alloc (abfd, (bfd_size_type) symlength + 1);
- if (name == NULL)
- return FALSE;
- if (bfd_bread (name, (bfd_size_type) symlength, abfd) != symlength)
- return FALSE;
- name[symlength] = '\0';
- sym -> symbol.name = name;
- sym -> symbol.flags = 0;
- sym -> symbol.value = 0;
- sym -> symbol.section = bfd_und_section_ptr;
- if (bfd_bread (temp, (bfd_size_type) sizeof (temp), abfd) != sizeof (temp))
- return FALSE;
- rcount = H_GET_32 (abfd, temp);
- nlm_relocs = bfd_alloc (abfd, rcount * sizeof (struct nlm_relent));
- if (!nlm_relocs)
- return FALSE;
- sym -> relocs = nlm_relocs;
- sym -> rcnt = 0;
- while (sym -> rcnt < rcount)
- {
- asection *section;
-
- if (! nlm_i386_read_reloc (abfd, sym, &section, &nlm_relocs -> reloc))
- return FALSE;
- nlm_relocs -> section = section;
- nlm_relocs++;
- sym -> rcnt++;
- }
- return TRUE;
-}
-
-/* Write out an external reference. */
-
-static bfd_boolean
-nlm_i386_write_external (bfd *abfd,
- bfd_size_type count,
- asymbol *sym,
- struct reloc_and_sec *relocs)
-{
- unsigned int i;
- bfd_byte len;
- unsigned char temp[NLM_TARGET_LONG_SIZE];
-
- len = strlen (sym->name);
- if ((bfd_bwrite (&len, (bfd_size_type) sizeof (bfd_byte), abfd)
- != sizeof (bfd_byte))
- || bfd_bwrite (sym->name, (bfd_size_type) len, abfd) != len)
- return FALSE;
-
- bfd_put_32 (abfd, count, temp);
- if (bfd_bwrite (temp, (bfd_size_type) sizeof (temp), abfd) != sizeof (temp))
- return FALSE;
-
- for (i = 0; i < count; i++)
- if (! nlm_i386_write_import (abfd, relocs[i].sec, relocs[i].rel))
- return FALSE;
-
- return TRUE;
-}
-
-#include "nlmswap.h"
-
-static const struct nlm_backend_data nlm32_i386_backend =
-{
- "NetWare Loadable Module\032",
- sizeof (Nlm32_i386_External_Fixed_Header),
- 0, /* Optional_prefix_size. */
- bfd_arch_i386,
- 0,
- FALSE,
- 0, /* Backend_object_p. */
- 0, /* Write_prefix_func. */
- nlm_i386_read_reloc,
- nlm_i386_mangle_relocs,
- nlm_i386_read_import,
- nlm_i386_write_import,
- 0, /* Set_public_section. */
- 0, /* Set_public_offset. */
- nlm_swap_fixed_header_in,
- nlm_swap_fixed_header_out,
- nlm_i386_write_external,
- 0, /* Write_export. */
-};
-
-#define TARGET_LITTLE_NAME "nlm32-i386"
-#define TARGET_LITTLE_SYM i386_nlm32_vec
-#define TARGET_BACKEND_DATA & nlm32_i386_backend
-
-#include "nlm-target.h"
diff --git a/bfd/nlm32-ppc.c b/bfd/nlm32-ppc.c
deleted file mode 100644
index 3e3fdef..0000000
--- a/bfd/nlm32-ppc.c
+++ /dev/null
@@ -1,986 +0,0 @@
-/* Support for 32-bit PowerPC NLM (NetWare Loadable Module)
- 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. */
-
-#include "sysdep.h"
-#include "bfd.h"
-#include "libbfd.h"
-
-/* The format of a PowerPC NLM changed. Define OLDFORMAT to get the
- old format. */
-
-#define ARCH_SIZE 32
-
-#include "nlm/ppc-ext.h"
-#define Nlm_External_Fixed_Header Nlm32_powerpc_External_Fixed_Header
-
-#include "libnlm.h"
-
-#ifdef OLDFORMAT
-
-/* The prefix header is only used in the old format. */
-
-/* PowerPC NLM's have a prefix header before the standard NLM. This
- function reads it in, verifies the version, and seeks the bfd to
- the location before the regular NLM header. */
-
-static bfd_boolean
-nlm_powerpc_backend_object_p (bfd *abfd)
-{
- struct nlm32_powerpc_external_prefix_header s;
-
- if (bfd_bread (& s, (bfd_size_type) sizeof s, abfd) != sizeof s)
- return FALSE;
-
- if (memcmp (s.signature, NLM32_POWERPC_SIGNATURE, sizeof s.signature) != 0
- || H_GET_32 (abfd, s.headerVersion) != NLM32_POWERPC_HEADER_VERSION)
- return FALSE;
-
- return TRUE;
-}
-
-/* Write out the prefix. */
-
-static bfd_boolean
-nlm_powerpc_write_prefix (bfd *abfd)
-{
- struct nlm32_powerpc_external_prefix_header s;
-
- memset (&s, 0, sizeof s);
- memcpy (s.signature, NLM32_POWERPC_SIGNATURE, sizeof s.signature);
- H_PUT_32 (abfd, NLM32_POWERPC_HEADER_VERSION, s.headerVersion);
- H_PUT_32 (abfd, 0, s.origins);
-
- /* FIXME: What should we do about the date? */
-
- if (bfd_bwrite (& s, (bfd_size_type) sizeof s, abfd) != sizeof s)
- return FALSE;
-
- return TRUE;
-}
-
-/* This reloc handling is only applicable to the old format. */
-
-/* How to process the various reloc types. PowerPC NLMs use XCOFF
- reloc types, and I have just copied the XCOFF reloc table here. */
-
-static reloc_howto_type nlm_powerpc_howto_table[] =
-{
- /* Standard 32 bit relocation. */
- HOWTO (0, /* Type. */
- 0, /* Rightshift. */
- 2, /* Size (0 = byte, 1 = short, 2 = long). */
- 32, /* Bitsize. */
- FALSE, /* PC relative. */
- 0, /* Bitpos. */
- complain_overflow_bitfield, /* Complain_on_overflow. */
- 0, /* Special_function. */
- "R_POS", /* Name. */
- TRUE, /* Partial_inplace. */
- 0xffffffff, /* Source mask. */
- 0xffffffff, /* Dest mask. */
- FALSE), /* PC rel offset. */
-
- /* 32 bit relocation, but store negative value. */
- HOWTO (1, /* Type. */
- 0, /* Rightshift. */
- -2, /* Size (0 = byte, 1 = short, 2 = long). */
- 32, /* Bitsize. */
- FALSE, /* PC relative. */
- 0, /* Bitpos. */
- complain_overflow_bitfield, /* Complain_on_overflow. */
- 0, /* Special_function. */
- "R_NEG", /* Name. */
- TRUE, /* Partial_inplace. */
- 0xffffffff, /* Source mask. */
- 0xffffffff, /* Dest mask. */
- FALSE), /* PC rel offset. */
-
- /* 32 bit PC relative relocation. */
- HOWTO (2, /* Type. */
- 0, /* Rightshift. */
- 2, /* Size (0 = byte, 1 = short, 2 = long). */
- 32, /* Bitsize. */
- TRUE, /* PC relative. */
- 0, /* Bitpos. */
- complain_overflow_signed, /* Complain_on_overflow. */
- 0, /* Special_function. */
- "R_REL", /* Name. */
- TRUE, /* Partial_inplace. */
- 0xffffffff, /* Source mask. */
- 0xffffffff, /* Dest mask. */
- FALSE), /* PC rel offset. */
-
- /* 16 bit TOC relative relocation. */
- HOWTO (3, /* Type. */
- 0, /* Rightshift. */
- 1, /* Size (0 = byte, 1 = short, 2 = long). */
- 16, /* Bitsize. */
- FALSE, /* PC relative. */
- 0, /* Bitpos. */
- complain_overflow_signed, /* Complain_on_overflow. */
- 0, /* Special_function. */
- "R_TOC", /* Name. */
- TRUE, /* Partial_inplace. */
- 0xffff, /* Source mask. */
- 0xffff, /* Dest mask. */
- FALSE), /* PC rel offset. */
-
- /* I don't really know what this is. */
- HOWTO (4, /* Type. */
- 1, /* Rightshift. */
- 2, /* Size (0 = byte, 1 = short, 2 = long). */
- 32, /* Bitsize. */
- FALSE, /* PC relative. */
- 0, /* Bitpos. */
- complain_overflow_bitfield, /* Complain_on_overflow. */
- 0, /* Special_function. */
- "R_RTB", /* Name. */
- TRUE, /* Partial_inplace. */
- 0xffffffff, /* Source mask. */
- 0xffffffff, /* Dest mask. */
- FALSE), /* PC rel offset. */
-
- /* External TOC relative symbol. */
- HOWTO (5, /* Type. */
- 0, /* Rightshift. */
- 2, /* Size (0 = byte, 1 = short, 2 = long). */
- 16, /* Bitsize. */
- FALSE, /* PC relative. */
- 0, /* Bitpos. */
- complain_overflow_bitfield, /* Complain_on_overflow. */
- 0, /* Special_function. */
- "R_GL", /* Name. */
- TRUE, /* Partial_inplace. */
- 0xffff, /* Source mask. */
- 0xffff, /* Dest mask. */
- FALSE), /* PC rel offset. */
-
- /* Local TOC relative symbol. */
- HOWTO (6, /* Type. */
- 0, /* Rightshift. */
- 2, /* Size (0 = byte, 1 = short, 2 = long). */
- 16, /* Bitsize. */
- FALSE, /* PC relative. */
- 0, /* Bitpos. */
- complain_overflow_bitfield, /* Complain_on_overflow. */
- 0, /* Special_function. */
- "R_TCL", /* Name. */
- TRUE, /* Partial_inplace. */
- 0xffff, /* Source mask. */
- 0xffff, /* Dest mask. */
- FALSE), /* PC rel offset. */
-
- { 7 },
-
- /* Non modifiable absolute branch. */
- HOWTO (8, /* Type. */
- 0, /* Rightshift. */
- 2, /* Size (0 = byte, 1 = short, 2 = long). */
- 26, /* Bitsize. */
- FALSE, /* PC relative. */
- 0, /* Bitpos. */
- complain_overflow_bitfield, /* Complain_on_overflow. */
- 0, /* Special_function. */
- "R_BA", /* Name. */
- TRUE, /* Partial_inplace. */
- 0x3fffffc, /* Source mask. */
- 0x3fffffc, /* Dest mask. */
- FALSE), /* PC rel offset. */
-
- { 9 },
-
- /* Non modifiable relative branch. */
- HOWTO (0xa, /* Type. */
- 0, /* Rightshift. */
- 2, /* Size (0 = byte, 1 = short, 2 = long). */
- 26, /* Bitsize. */
- TRUE, /* PC relative. */
- 0, /* Bitpos. */
- complain_overflow_signed, /* Complain_on_overflow. */
- 0, /* Special_function. */
- "R_BR", /* Name. */
- TRUE, /* Partial_inplace. */
- 0x3fffffc, /* Source mask. */
- 0x3fffffc, /* Dest mask. */
- FALSE), /* PC rel offset. */
-
- { 0xb },
-
- /* Indirect load. */
- HOWTO (0xc, /* Type. */
- 0, /* Rightshift. */
- 2, /* Size (0 = byte, 1 = short, 2 = long). */
- 16, /* Bitsize. */
- FALSE, /* PC relative. */
- 0, /* Bitpos. */
- complain_overflow_bitfield, /* Complain_on_overflow. */
- 0, /* Special_function. */
- "R_RL", /* Name. */
- TRUE, /* Partial_inplace. */
- 0xffff, /* Source mask. */
- 0xffff, /* Dest mask. */
- FALSE), /* PC rel offset. */
-
- /* Load address. */
- HOWTO (0xd, /* Type. */
- 0, /* Rightshift. */
- 2, /* Size (0 = byte, 1 = short, 2 = long). */
- 16, /* Bitsize. */
- FALSE, /* PC relative. */
- 0, /* Bitpos. */
- complain_overflow_bitfield, /* Complain_on_overflow. */
- 0, /* Special_function. */
- "R_RLA", /* Name. */
- TRUE, /* Partial_inplace. */
- 0xffff, /* Source mask. */
- 0xffff, /* Dest mask. */
- FALSE), /* PC rel offset. */
-
- { 0xe },
-
- /* Non-relocating reference. */
- HOWTO (0xf, /* Type. */
- 0, /* Rightshift. */
- 2, /* Size (0 = byte, 1 = short, 2 = long). */
- 32, /* Bitsize. */
- FALSE, /* PC relative. */
- 0, /* Bitpos. */
- complain_overflow_bitfield, /* Complain_on_overflow. */
- 0, /* Special_function. */
- "R_REF", /* Name. */
- FALSE, /* Partial_inplace. */
- 0, /* Source mask. */
- 0, /* Dest mask. */
- FALSE), /* PC rel offset. */
-
- { 0x10 },
- { 0x11 },
-
- /* TOC relative indirect load. */
- HOWTO (0x12, /* Type. */
- 0, /* Rightshift. */
- 2, /* Size (0 = byte, 1 = short, 2 = long). */
- 16, /* Bitsize. */
- FALSE, /* PC relative. */
- 0, /* Bitpos. */
- complain_overflow_bitfield, /* Complain_on_overflow. */
- 0, /* Special_function. */
- "R_TRL", /* Name. */
- TRUE, /* Partial_inplace. */
- 0xffff, /* Source mask. */
- 0xffff, /* Dest mask. */
- FALSE), /* PC rel offset. */
-
- /* TOC relative load address. */
- HOWTO (0x13, /* Type. */
- 0, /* Rightshift. */
- 2, /* Size (0 = byte, 1 = short, 2 = long). */
- 16, /* Bitsize. */
- FALSE, /* PC relative. */
- 0, /* Bitpos. */
- complain_overflow_bitfield, /* Complain_on_overflow. */
- 0, /* Special_function. */
- "R_TRLA", /* Name. */
- TRUE, /* Partial_inplace. */
- 0xffff, /* Source mask. */
- 0xffff, /* Dest mask. */
- FALSE), /* PC rel offset. */
-
- /* Modifiable relative branch. */
- HOWTO (0x14, /* Type. */
- 1, /* Rightshift. */
- 2, /* Size (0 = byte, 1 = short, 2 = long). */
- 32, /* Bitsize. */
- FALSE, /* PC relative. */
- 0, /* Bitpos. */
- complain_overflow_bitfield, /* Complain_on_overflow. */
- 0, /* Special_function. */
- "R_RRTBI", /* Name. */
- TRUE, /* Partial_inplace. */
- 0xffffffff, /* Source mask. */
- 0xffffffff, /* Dest mask. */
- FALSE), /* PC rel offset. */
-
- /* Modifiable absolute branch. */
- HOWTO (0x15, /* Type. */
- 1, /* Rightshift. */
- 2, /* Size (0 = byte, 1 = short, 2 = long). */
- 32, /* Bitsize. */
- FALSE, /* PC relative. */
- 0, /* Bitpos. */
- complain_overflow_bitfield, /* Complain_on_overflow. */
- 0, /* Special_function. */
- "R_RRTBA", /* Name. */
- TRUE, /* Partial_inplace. */
- 0xffffffff, /* Source mask. */
- 0xffffffff, /* Dest mask. */
- FALSE), /* PC rel offset. */
-
- /* Modifiable call absolute indirect. */
- HOWTO (0x16, /* Type. */
- 0, /* Rightshift. */
- 2, /* Size (0 = byte, 1 = short, 2 = long). */
- 16, /* Bitsize. */
- FALSE, /* PC relative. */
- 0, /* Bitpos. */
- complain_overflow_bitfield, /* Complain_on_overflow. */
- 0, /* Special_function. */
- "R_CAI", /* Name. */
- TRUE, /* Partial_inplace. */
- 0xffff, /* Source mask. */
- 0xffff, /* Dest mask. */
- FALSE), /* PC rel offset. */
-
- /* Modifiable call relative. */
- HOWTO (0x17, /* Type. */
- 0, /* Rightshift. */
- 2, /* Size (0 = byte, 1 = short, 2 = long). */
- 16, /* Bitsize. */
- FALSE, /* PC relative. */
- 0, /* Bitpos. */
- complain_overflow_bitfield, /* Complain_on_overflow. */
- 0, /* Special_function. */
- "R_REL", /* Name. */
- TRUE, /* Partial_inplace. */
- 0xffff, /* Source mask. */
- 0xffff, /* Dest mask. */
- FALSE), /* PC rel offset. */
-
- /* Modifiable branch absolute. */
- HOWTO (0x18, /* Type. */
- 0, /* Rightshift. */
- 2, /* Size (0 = byte, 1 = short, 2 = long). */
- 16, /* Bitsize. */
- FALSE, /* PC relative. */
- 0, /* Bitpos. */
- complain_overflow_bitfield, /* Complain_on_overflow. */
- 0, /* Special_function. */
- "R_RBA", /* Name. */
- TRUE, /* Partial_inplace. */
- 0xffff, /* Source mask. */
- 0xffff, /* Dest mask. */
- FALSE), /* PC rel offset. */
-
- /* Modifiable branch absolute. */
- HOWTO (0x19, /* Type. */
- 0, /* Rightshift. */
- 2, /* Size (0 = byte, 1 = short, 2 = long). */
- 16, /* Bitsize. */
- FALSE, /* PC relative. */
- 0, /* Bitpos. */
- complain_overflow_bitfield, /* Complain_on_overflow. */
- 0, /* Special_function. */
- "R_RBAC", /* Name. */
- TRUE, /* Partial_inplace. */
- 0xffff, /* Source mask. */
- 0xffff, /* Dest mask. */
- FALSE), /* PC rel offset. */
-
- /* Modifiable branch relative. */
- HOWTO (0x1a, /* Type. */
- 0, /* Rightshift. */
- 2, /* Size (0 = byte, 1 = short, 2 = long). */
- 26, /* Bitsize. */
- FALSE, /* PC relative. */
- 0, /* Bitpos. */
- complain_overflow_signed, /* Complain_on_overflow. */
- 0, /* Special_function. */
- "R_REL", /* Name. */
- TRUE, /* Partial_inplace. */
- 0xffff, /* Source mask. */
- 0xffff, /* Dest mask. */
- FALSE), /* PC rel offset. */
-
- /* Modifiable branch absolute. */
- HOWTO (0x1b, /* Type. */
- 0, /* Rightshift. */
- 2, /* Size (0 = byte, 1 = short, 2 = long). */
- 16, /* Bitsize. */
- FALSE, /* PC relative. */
- 0, /* Bitpos. */
- complain_overflow_bitfield, /* Complain_on_overflow. */
- 0, /* Special_function. */
- "R_REL", /* Name. */
- TRUE, /* Partial_inplace. */
- 0xffff, /* Source mask. */
- 0xffff, /* Dest mask. */
- FALSE) /* PC rel offset. */
-};
-
-#define HOWTO_COUNT (sizeof nlm_powerpc_howto_table \
- / sizeof nlm_powerpc_howto_table[0])
-
-/* Read a PowerPC NLM reloc. */
-
-static bfd_boolean
-nlm_powerpc_read_reloc (bfd *abfd,
- nlmNAME (symbol_type) *sym,
- asection **secp,
- arelent *rel)
-{
- struct nlm32_powerpc_external_reloc ext;
- bfd_vma l_vaddr;
- unsigned long l_symndx;
- int l_rtype;
- int l_rsecnm;
- asection *code_sec, *data_sec, *bss_sec;
-
- /* Read the reloc from the file. */
- if (bfd_bread (&ext, (bfd_size_type) sizeof ext, abfd) != sizeof ext)
- return FALSE;
-
- /* Swap in the fields. */
- l_vaddr = H_GET_32 (abfd, ext.l_vaddr);
- l_symndx = H_GET_32 (abfd, ext.l_symndx);
- l_rtype = H_GET_16 (abfd, ext.l_rtype);
- l_rsecnm = H_GET_16 (abfd, ext.l_rsecnm);
-
- /* Get the sections now, for convenience. */
- code_sec = bfd_get_section_by_name (abfd, NLM_CODE_NAME);
- data_sec = bfd_get_section_by_name (abfd, NLM_INITIALIZED_DATA_NAME);
- bss_sec = bfd_get_section_by_name (abfd, NLM_UNINITIALIZED_DATA_NAME);
-
- /* Work out the arelent fields. */
- if (sym != NULL)
- /* This is an import. sym_ptr_ptr is filled in by
- nlm_canonicalize_reloc. */
- rel->sym_ptr_ptr = NULL;
- else
- {
- asection *sec;
-
- if (l_symndx == 0)
- sec = code_sec;
- else if (l_symndx == 1)
- sec = data_sec;
- else if (l_symndx == 2)
- sec = bss_sec;
- else
- {
- bfd_set_error (bfd_error_bad_value);
- return FALSE;
- }
-
- rel->sym_ptr_ptr = sec->symbol_ptr_ptr;
- }
-
- rel->addend = 0;
-
- BFD_ASSERT ((l_rtype & 0xff) < HOWTO_COUNT);
-
- rel->howto = nlm_powerpc_howto_table + (l_rtype & 0xff);
-
- BFD_ASSERT (rel->howto->name != NULL
- && ((l_rtype & 0x8000) != 0
- ? (rel->howto->complain_on_overflow
- == complain_overflow_signed)
- : (rel->howto->complain_on_overflow
- == complain_overflow_bitfield))
- && ((l_rtype >> 8) & 0x1f) == rel->howto->bitsize - 1);
-
- if (l_rsecnm == 0)
- *secp = code_sec;
- else if (l_rsecnm == 1)
- {
- *secp = data_sec;
- l_vaddr -= code_sec->size;
- }
- else
- {
- bfd_set_error (bfd_error_bad_value);
- return FALSE;
- }
-
- rel->address = l_vaddr;
-
- return TRUE;
-}
-
-#else /* not OLDFORMAT */
-
-/* There is only one type of reloc in a PowerPC NLM. */
-
-static reloc_howto_type nlm_powerpc_howto =
- HOWTO (0, /* Type. */
- 0, /* Rightshift. */
- 2, /* Size (0 = byte, 1 = short, 2 = long). */
- 32, /* Bitsize. */
- FALSE, /* PC relative. */
- 0, /* Bitpos. */
- complain_overflow_bitfield, /* Complain_on_overflow. */
- 0, /* Special_function. */
- "32", /* Name. */
- TRUE, /* Partial_inplace. */
- 0xffffffff, /* Source mask. */
- 0xffffffff, /* Dest mask. */
- FALSE); /* PC rel_offset. */
-
-/* Read a PowerPC NLM reloc. */
-
-static bfd_boolean
-nlm_powerpc_read_reloc (bfd *abfd,
- nlmNAME (symbol_type) *sym,
- asection **secp,
- arelent *rel)
-{
- bfd_byte temp[4];
- bfd_vma val;
- const char *name;
-
- if (bfd_bread (temp, (bfd_size_type) sizeof (temp), abfd) != sizeof (temp))
- return FALSE;
-
- val = bfd_get_32 (abfd, temp);
-
- /* The value is a word offset into either the code or data segment.
- This is the location which needs to be adjusted.
-
- The high bit is 0 if the value is an offset into the data
- segment, or 1 if the value is an offset into the text segment.
-
- If this is a relocation fixup rather than an imported symbol (the
- sym argument is NULL), then the second most significant bit is 0
- if the address of the data segment should be added to the
- location addressed by the value, or 1 if the address of the text
- segment should be added.
-
- If this is an imported symbol, the second most significant bit is
- not used and must be 0. */
-
- if ((val & NLM_HIBIT) == 0)
- name = NLM_INITIALIZED_DATA_NAME;
- else
- {
- name = NLM_CODE_NAME;
- val &=~ NLM_HIBIT;
- }
- *secp = bfd_get_section_by_name (abfd, name);
-
- if (sym == NULL)
- {
- if ((val & (NLM_HIBIT >> 1)) == 0)
- name = NLM_INITIALIZED_DATA_NAME;
- else
- {
- name = NLM_CODE_NAME;
- val &=~ (NLM_HIBIT >> 1);
- }
- rel->sym_ptr_ptr = bfd_get_section_by_name (abfd, name)->symbol_ptr_ptr;
- }
-
- rel->howto = & nlm_powerpc_howto;
- rel->address = val << 2;
- rel->addend = 0;
-
- return TRUE;
-}
-
-#endif /* not OLDFORMAT */
-
-/* Mangle PowerPC NLM relocs for output. */
-
-static bfd_boolean
-nlm_powerpc_mangle_relocs (bfd *abfd ATTRIBUTE_UNUSED,
- asection *sec ATTRIBUTE_UNUSED,
- const void * data ATTRIBUTE_UNUSED,
- bfd_vma offset ATTRIBUTE_UNUSED,
- bfd_size_type count ATTRIBUTE_UNUSED)
-{
- return TRUE;
-}
-
-/* Read a PowerPC NLM import record */
-
-static bfd_boolean
-nlm_powerpc_read_import (bfd * abfd, nlmNAME (symbol_type) * sym)
-{
- struct nlm_relent *nlm_relocs; /* Relocation records for symbol. */
- bfd_size_type rcount; /* Number of relocs. */
- bfd_byte temp[NLM_TARGET_LONG_SIZE]; /* Temporary 32-bit value. */
- unsigned char symlength; /* Length of symbol name. */
- char *name;
-
- if (bfd_bread (& symlength, (bfd_size_type) sizeof (symlength), abfd)
- != sizeof (symlength))
- return FALSE;
- sym -> symbol.the_bfd = abfd;
- name = bfd_alloc (abfd, (bfd_size_type) symlength + 1);
- if (name == NULL)
- return FALSE;
- if (bfd_bread (name, (bfd_size_type) symlength, abfd) != symlength)
- return FALSE;
- name[symlength] = '\0';
- sym -> symbol.name = name;
- sym -> symbol.flags = 0;
- sym -> symbol.value = 0;
- sym -> symbol.section = bfd_und_section_ptr;
- if (bfd_bread (temp, (bfd_size_type) sizeof (temp), abfd)
- != sizeof (temp))
- return FALSE;
- rcount = H_GET_32 (abfd, temp);
- nlm_relocs = bfd_alloc (abfd, rcount * sizeof (struct nlm_relent));
- if (nlm_relocs == NULL)
- return FALSE;
- sym -> relocs = nlm_relocs;
- sym -> rcnt = 0;
- while (sym -> rcnt < rcount)
- {
- asection *section;
-
- if (! nlm_powerpc_read_reloc (abfd, sym, &section, &nlm_relocs -> reloc))
- return FALSE;
- nlm_relocs -> section = section;
- nlm_relocs++;
- sym -> rcnt++;
- }
- return TRUE;
-}
-
-#ifndef OLDFORMAT
-
-/* Write a PowerPC NLM reloc. */
-
-static bfd_boolean
-nlm_powerpc_write_import (bfd * abfd, asection * sec, arelent * rel)
-{
- asymbol *sym;
- bfd_vma val;
- bfd_byte temp[4];
-
- /* PowerPC NetWare only supports one kind of reloc. */
- if (rel->addend != 0
- || rel->howto == NULL
- || rel->howto->rightshift != 0
- || rel->howto->size != 2
- || rel->howto->bitsize != 32
- || rel->howto->bitpos != 0
- || rel->howto->pc_relative
- || (rel->howto->src_mask != 0xffffffff && rel->addend != 0)
- || rel->howto->dst_mask != 0xffffffff)
- {
- bfd_set_error (bfd_error_invalid_operation);
- return FALSE;
- }
-
- sym = *rel->sym_ptr_ptr;
-
- /* The value we write out is the offset into the appropriate
- segment, rightshifted by two. This offset is the section vma,
- adjusted by the vma of the lowest section in that segment, plus
- the address of the relocation. */
- val = bfd_get_section_vma (abfd, sec) + rel->address;
- if ((val & 3) != 0)
- {
- bfd_set_error (bfd_error_bad_value);
- return FALSE;
- }
- val >>= 2;
-
- /* The high bit is 0 if the reloc is in the data section, or 1 if
- the reloc is in the code section. */
- if (bfd_get_section_flags (abfd, sec) & SEC_DATA)
- val -= nlm_get_data_low (abfd);
- else
- {
- val -= nlm_get_text_low (abfd);
- val |= NLM_HIBIT;
- }
-
- if (! bfd_is_und_section (bfd_get_section (sym)))
- {
- /* This is an internal relocation fixup. The second most
- significant bit is 0 if this is a reloc against the data
- segment, or 1 if it is a reloc against the text segment. */
- if (bfd_get_section_flags (abfd, bfd_get_section (sym)) & SEC_CODE)
- val |= NLM_HIBIT >> 1;
- }
-
- bfd_put_32 (abfd, val, temp);
- if (bfd_bwrite (temp, (bfd_size_type) sizeof (temp), abfd) != sizeof (temp))
- return FALSE;
-
- return TRUE;
-}
-
-#else /* OLDFORMAT */
-
-/* This is used for the reloc handling in the old format. */
-
-/* Write a PowerPC NLM reloc. */
-
-static bfd_boolean
-nlm_powerpc_write_reloc (bfd *abfd,
- asection *sec,
- arelent *rel,
- int indx)
-{
- struct nlm32_powerpc_external_reloc ext;
- asection *code_sec, *data_sec, *bss_sec;
- asymbol *sym;
- asection *symsec;
- unsigned long l_symndx;
- int l_rtype;
- int l_rsecnm;
- reloc_howto_type *howto;
- bfd_size_type address;
-
- /* Get the sections now, for convenience. */
- code_sec = bfd_get_section_by_name (abfd, NLM_CODE_NAME);
- data_sec = bfd_get_section_by_name (abfd, NLM_INITIALIZED_DATA_NAME);
- bss_sec = bfd_get_section_by_name (abfd, NLM_UNINITIALIZED_DATA_NAME);
-
- sym = *rel->sym_ptr_ptr;
- symsec = bfd_get_section (sym);
- if (indx != -1)
- {
- BFD_ASSERT (bfd_is_und_section (symsec));
- l_symndx = indx + 3;
- }
- else
- {
- if (symsec == code_sec)
- l_symndx = 0;
- else if (symsec == data_sec)
- l_symndx = 1;
- else if (symsec == bss_sec)
- l_symndx = 2;
- else
- {
- bfd_set_error (bfd_error_bad_value);
- return FALSE;
- }
- }
-
- H_PUT_32 (abfd, l_symndx, ext.l_symndx);
-
- for (howto = nlm_powerpc_howto_table;
- howto < nlm_powerpc_howto_table + HOWTO_COUNT;
- howto++)
- {
- if (howto->rightshift == rel->howto->rightshift
- && howto->size == rel->howto->size
- && howto->bitsize == rel->howto->bitsize
- && howto->pc_relative == rel->howto->pc_relative
- && howto->bitpos == rel->howto->bitpos
- && (howto->partial_inplace == rel->howto->partial_inplace
- || (! rel->howto->partial_inplace
- && rel->addend == 0))
- && (howto->src_mask == rel->howto->src_mask
- || (rel->howto->src_mask == 0
- && rel->addend == 0))
- && howto->dst_mask == rel->howto->dst_mask
- && howto->pcrel_offset == rel->howto->pcrel_offset)
- break;
- }
- if (howto >= nlm_powerpc_howto_table + HOWTO_COUNT)
- {
- bfd_set_error (bfd_error_bad_value);
- return FALSE;
- }
-
- l_rtype = howto->type;
- if (howto->complain_on_overflow == complain_overflow_signed)
- l_rtype |= 0x8000;
- l_rtype |= (howto->bitsize - 1) << 8;
- H_PUT_16 (abfd, l_rtype, ext.l_rtype);
-
- address = rel->address;
-
- if (sec == code_sec)
- l_rsecnm = 0;
- else if (sec == data_sec)
- {
- l_rsecnm = 1;
- address += code_sec->size;
- }
- else
- {
- bfd_set_error (bfd_error_bad_value);
- return FALSE;
- }
-
- H_PUT_16 (abfd, l_rsecnm, ext.l_rsecnm);
- H_PUT_32 (abfd, address, ext.l_vaddr);
-
- if (bfd_bwrite (&ext, (bfd_size_type) sizeof ext, abfd) != sizeof ext)
- return FALSE;
-
- return TRUE;
-}
-
-/* Write a PowerPC NLM import. */
-
-static bfd_boolean
-nlm_powerpc_write_import (bfd * abfd, asection * sec, arelent * rel)
-{
- return nlm_powerpc_write_reloc (abfd, sec, rel, -1);
-}
-
-#endif /* OLDFORMAT */
-
-/* Write a PowerPC NLM external symbol. This routine keeps a static
- count of the symbol index. FIXME: I don't know if this is
- necessary, and the index never gets reset. */
-
-static bfd_boolean
-nlm_powerpc_write_external (bfd *abfd,
- bfd_size_type count,
- asymbol *sym,
- struct reloc_and_sec *relocs)
-{
- unsigned int i;
- bfd_byte len;
- unsigned char temp[NLM_TARGET_LONG_SIZE];
-#ifdef OLDFORMAT
- static int indx;
-#endif
-
- len = strlen (sym->name);
- if ((bfd_bwrite (&len, (bfd_size_type) sizeof (bfd_byte), abfd)
- != sizeof (bfd_byte))
- || bfd_bwrite (sym->name, (bfd_size_type) len, abfd) != len)
- return FALSE;
-
- bfd_put_32 (abfd, count, temp);
- if (bfd_bwrite (temp, (bfd_size_type) sizeof (temp), abfd) != sizeof (temp))
- return FALSE;
-
- for (i = 0; i < count; i++)
- {
-#ifndef OLDFORMAT
- if (! nlm_powerpc_write_import (abfd, relocs[i].sec, relocs[i].rel))
- return FALSE;
-#else
- if (! nlm_powerpc_write_reloc (abfd, relocs[i].sec,
- relocs[i].rel, indx))
- return FALSE;
-#endif
- }
-
-#ifdef OLDFORMAT
- ++indx;
-#endif
-
- return TRUE;
-}
-
-#ifndef OLDFORMAT
-
-/* PowerPC Netware uses a word offset, not a byte offset, for public
- symbols. */
-
-/* Set the section for a public symbol. */
-
-static bfd_boolean
-nlm_powerpc_set_public_section (bfd *abfd, nlmNAME (symbol_type) *sym)
-{
- if (sym->symbol.value & NLM_HIBIT)
- {
- sym->symbol.value &= ~NLM_HIBIT;
- sym->symbol.flags |= BSF_FUNCTION;
- sym->symbol.section =
- bfd_get_section_by_name (abfd, NLM_CODE_NAME);
- }
- else
- sym->symbol.section =
- bfd_get_section_by_name (abfd, NLM_INITIALIZED_DATA_NAME);
-
- sym->symbol.value <<= 2;
-
- return TRUE;
-}
-
-/* Get the offset to write out for a public symbol. */
-
-static bfd_vma
-nlm_powerpc_get_public_offset (bfd *abfd, asymbol *sym)
-{
- bfd_vma offset;
- asection *sec;
-
- offset = bfd_asymbol_value (sym);
- sec = bfd_get_section (sym);
- if (sec->flags & SEC_CODE)
- {
- offset -= nlm_get_text_low (abfd);
- offset |= NLM_HIBIT;
- }
- else if (sec->flags & (SEC_DATA | SEC_ALLOC))
- {
- /* SEC_ALLOC is for the .bss section. */
- offset -= nlm_get_data_low (abfd);
- }
- else
- {
- /* We can't handle an exported symbol that is not in the code or
- data segment. */
- bfd_set_error (bfd_error_invalid_operation);
- /* FIXME: No way to return error. */
- abort ();
- }
-
- return offset;
-}
-
-#endif /* ! defined (OLDFORMAT) */
-
-#include "nlmswap.h"
-
-static const struct nlm_backend_data nlm32_powerpc_backend =
-{
- "NetWare PowerPC Module \032",
- sizeof (Nlm32_powerpc_External_Fixed_Header),
-#ifndef OLDFORMAT
- 0, /* Optional_prefix_size. */
-#else
- sizeof (struct nlm32_powerpc_external_prefix_header),
-#endif
- bfd_arch_powerpc,
- 0,
- FALSE,
-#ifndef OLDFORMAT
- 0, /* Backend_object_p. */
- 0, /* Write_prefix. */
-#else
- nlm_powerpc_backend_object_p,
- nlm_powerpc_write_prefix,
-#endif
- nlm_powerpc_read_reloc,
- nlm_powerpc_mangle_relocs,
- nlm_powerpc_read_import,
- nlm_powerpc_write_import,
-#ifndef OLDFORMAT
- nlm_powerpc_set_public_section,
- nlm_powerpc_get_public_offset,
-#else
- 0, /* Set_public_section. */
- 0, /* Get_public_offset. */
-#endif
- nlm_swap_fixed_header_in,
- nlm_swap_fixed_header_out,
- nlm_powerpc_write_external,
- 0, /* Write_export. */
-};
-
-#define TARGET_BIG_NAME "nlm32-powerpc"
-#define TARGET_BIG_SYM powerpc_nlm32_vec
-#define TARGET_BACKEND_DATA & nlm32_powerpc_backend
-
-#include "nlm-target.h"
diff --git a/bfd/nlm32-sparc.c b/bfd/nlm32-sparc.c
deleted file mode 100644
index 32ec5c4..0000000
--- a/bfd/nlm32-sparc.c
+++ /dev/null
@@ -1,378 +0,0 @@
-/* Support for 32-bit SPARC NLM (NetWare Loadable Module)
- Copyright (C) 1993-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. */
-
-#include "sysdep.h"
-#include "bfd.h"
-#include "libbfd.h"
-
-#define ARCH_SIZE 32
-
-#include "nlm/sparc32-ext.h"
-#define Nlm_External_Fixed_Header Nlm32_sparc_External_Fixed_Header
-
-#include "libnlm.h"
-
-enum reloc_type
-{
- R_SPARC_NONE = 0,
- R_SPARC_8, R_SPARC_16, R_SPARC_32,
- R_SPARC_DISP8, R_SPARC_DISP16, R_SPARC_DISP32,
- R_SPARC_WDISP30, R_SPARC_WDISP22,
- R_SPARC_HI22, R_SPARC_22,
- R_SPARC_13, R_SPARC_LO10,
- R_SPARC_GOT10, R_SPARC_GOT13, R_SPARC_GOT22,
- R_SPARC_PC10, R_SPARC_PC22,
- R_SPARC_WPLT30,
- R_SPARC_COPY,
- R_SPARC_GLOB_DAT, R_SPARC_JMP_SLOT,
- R_SPARC_RELATIVE,
- R_SPARC_UA32,
- R_SPARC_max
-};
-
-static reloc_howto_type nlm32_sparc_howto_table[] =
-{
- HOWTO (R_SPARC_NONE, 0,3, 0,FALSE,0,complain_overflow_dont, 0,"R_SPARC_NONE", FALSE,0,0x00000000,TRUE),
- HOWTO (R_SPARC_8, 0,0, 8,FALSE,0,complain_overflow_bitfield,0,"R_SPARC_8", FALSE,0,0x000000ff,TRUE),
- HOWTO (R_SPARC_16, 0,1,16,FALSE,0,complain_overflow_bitfield,0,"R_SPARC_16", FALSE,0,0x0000ffff,TRUE),
- HOWTO (R_SPARC_32, 0,2,32,FALSE,0,complain_overflow_bitfield,0,"R_SPARC_32", FALSE,0,0xffffffff,TRUE),
- HOWTO (R_SPARC_DISP8, 0,0, 8,TRUE, 0,complain_overflow_signed, 0,"R_SPARC_DISP8", FALSE,0,0x000000ff,TRUE),
- HOWTO (R_SPARC_DISP16, 0,1,16,TRUE, 0,complain_overflow_signed, 0,"R_SPARC_DISP16", FALSE,0,0x0000ffff,TRUE),
- HOWTO (R_SPARC_DISP32, 0,2,32,TRUE, 0,complain_overflow_signed, 0,"R_SPARC_DISP32", FALSE,0,0x00ffffff,TRUE),
- HOWTO (R_SPARC_WDISP30, 2,2,30,TRUE, 0,complain_overflow_signed, 0,"R_SPARC_WDISP30", FALSE,0,0x3fffffff,TRUE),
- HOWTO (R_SPARC_WDISP22, 2,2,22,TRUE, 0,complain_overflow_signed, 0,"R_SPARC_WDISP22", FALSE,0,0x003fffff,TRUE),
- HOWTO (R_SPARC_HI22, 10,2,22,FALSE,0,complain_overflow_dont, 0,"R_SPARC_HI22", FALSE,0,0x003fffff,TRUE),
- HOWTO (R_SPARC_22, 0,2,22,FALSE,0,complain_overflow_bitfield,0,"R_SPARC_22", FALSE,0,0x003fffff,TRUE),
- HOWTO (R_SPARC_13, 0,2,13,FALSE,0,complain_overflow_bitfield,0,"R_SPARC_13", FALSE,0,0x00001fff,TRUE),
- HOWTO (R_SPARC_LO10, 0,2,10,FALSE,0,complain_overflow_dont, 0,"R_SPARC_LO10", FALSE,0,0x000003ff,TRUE),
- HOWTO (R_SPARC_GOT10, 0,2,10,FALSE,0,complain_overflow_bitfield,0,"R_SPARC_GOT10", FALSE,0,0x000003ff,TRUE),
- HOWTO (R_SPARC_GOT13, 0,2,13,FALSE,0,complain_overflow_bitfield,0,"R_SPARC_GOT13", FALSE,0,0x00001fff,TRUE),
- HOWTO (R_SPARC_GOT22, 10,2,22,FALSE,0,complain_overflow_bitfield,0,"R_SPARC_GOT22", FALSE,0,0x003fffff,TRUE),
- HOWTO (R_SPARC_PC10, 0,2,10,FALSE,0,complain_overflow_bitfield,0,"R_SPARC_PC10", FALSE,0,0x000003ff,TRUE),
- HOWTO (R_SPARC_PC22, 0,2,22,FALSE,0,complain_overflow_bitfield,0,"R_SPARC_PC22", FALSE,0,0x003fffff,TRUE),
- HOWTO (R_SPARC_WPLT30, 0,0,00,FALSE,0,complain_overflow_dont, 0,"R_SPARC_WPLT30", FALSE,0,0x00000000,TRUE),
- HOWTO (R_SPARC_COPY, 0,0,00,FALSE,0,complain_overflow_dont, 0,"R_SPARC_COPY", FALSE,0,0x00000000,TRUE),
- HOWTO (R_SPARC_GLOB_DAT,0,0,00,FALSE,0,complain_overflow_dont, 0,"R_SPARC_GLOB_DAT",FALSE,0,0x00000000,TRUE),
- HOWTO (R_SPARC_JMP_SLOT,0,0,00,FALSE,0,complain_overflow_dont, 0,"R_SPARC_JMP_SLOT",FALSE,0,0x00000000,TRUE),
- HOWTO (R_SPARC_RELATIVE,0,0,00,FALSE,0,complain_overflow_dont, 0,"R_SPARC_RELATIVE",FALSE,0,0x00000000,TRUE),
- HOWTO (R_SPARC_UA32, 0,0,00,FALSE,0,complain_overflow_dont, 0,"R_SPARC_UA32", FALSE,0,0x00000000,TRUE),
-};
-
-/* Read a NetWare sparc reloc. */
-
-struct nlm32_sparc_reloc_ext
-{
- unsigned char offset[4];
- unsigned char addend[4];
- unsigned char type[1];
- unsigned char pad1[3];
-};
-
-static bfd_boolean
-nlm_sparc_read_reloc (bfd *abfd,
- nlmNAME (symbol_type) *sym ATTRIBUTE_UNUSED,
- asection **secp,
- arelent *rel)
-{
- bfd_vma val, addend;
- unsigned int howto_index;
- unsigned int type;
- struct nlm32_sparc_reloc_ext tmp_reloc;
- asection *code_sec;
-
- if (bfd_bread (&tmp_reloc, (bfd_size_type) 12, abfd) != 12)
- return FALSE;
-
- code_sec = bfd_get_section_by_name (abfd, NLM_CODE_NAME);
- *secp = code_sec;
-
- val = bfd_get_32 (abfd, tmp_reloc.offset);
- addend = bfd_get_32 (abfd, tmp_reloc.addend);
- type = bfd_get_8 (abfd, tmp_reloc.type);
-
- rel->address = val;
- rel->addend = addend;
- rel->howto = NULL;
-
- for (howto_index = 0;
- howto_index < sizeof (nlm32_sparc_howto_table) / sizeof (reloc_howto_type);
- howto_index++)
- if (nlm32_sparc_howto_table[howto_index].type == type)
- {
- rel->howto = &nlm32_sparc_howto_table[howto_index];
- break;
- }
-
-#ifdef DEBUG
- fprintf (stderr, "%s: address = %08lx, addend = %08lx, type = %u, howto = %p\n",
- __FUNCTION__, (unsigned long) rel->address,
- (unsigned long) rel->addend, type, rel->howto);
-#endif
- return TRUE;
-
-}
-
-/* Write a NetWare sparc reloc. */
-
-static bfd_boolean
-nlm_sparc_write_reloc (bfd * abfd, asection * sec, arelent * rel)
-{
- bfd_vma val;
- struct nlm32_sparc_reloc_ext tmp_reloc;
- unsigned int howto_index;
- int type = -1;
- reloc_howto_type *tmp;
-
- for (howto_index = 0;
- howto_index < sizeof (nlm32_sparc_howto_table) / sizeof (reloc_howto_type);
- howto_index++)
- {
- tmp = &nlm32_sparc_howto_table[howto_index];
-
- if (tmp->rightshift == rel->howto->rightshift
- && tmp->size == rel->howto->size
- && tmp->bitsize == rel->howto->bitsize
- && tmp->pc_relative == rel->howto->pc_relative
- && tmp->bitpos == rel->howto->bitpos
- && tmp->src_mask == rel->howto->src_mask
- && tmp->dst_mask == rel->howto->dst_mask)
- {
- type = tmp->type;
- break;
- }
- }
- if (type == -1)
- abort ();
-
- /* Netware wants a list of relocs for each address.
- Format is:
- long offset
- long addend
- char type
- That should be it. */
-
- /* The value we write out is the offset into the appropriate
- segment. This offset is the section vma, adjusted by the vma of
- the lowest section in that segment, plus the address of the
- relocation. */
- val = bfd_get_section_vma (abfd, sec) + rel->address;
-
-#ifdef DEBUG
- fprintf (stderr, "%s: val = %08lx, addend = %08lx, type = %u\n",
- __FUNCTION__, (unsigned long) val, (unsigned long) rel->addend,
- rel->howto->type);
-#endif
- bfd_put_32 (abfd, val, tmp_reloc.offset);
- bfd_put_32 (abfd, rel->addend, tmp_reloc.addend);
- bfd_put_8 (abfd, (short) (rel->howto->type), tmp_reloc.type);
-
- if (bfd_bwrite (&tmp_reloc, (bfd_size_type) 12, abfd) != 12)
- return FALSE;
-
- return TRUE;
-}
-
-/* Mangle relocs for SPARC NetWare. We can just use the standard
- SPARC relocs. */
-
-static bfd_boolean
-nlm_sparc_mangle_relocs (bfd *abfd ATTRIBUTE_UNUSED,
- asection *sec ATTRIBUTE_UNUSED,
- const void * data ATTRIBUTE_UNUSED,
- bfd_vma offset ATTRIBUTE_UNUSED,
- bfd_size_type count ATTRIBUTE_UNUSED)
-{
- return TRUE;
-}
-
-/* Read a NetWare sparc import record. */
-
-static bfd_boolean
-nlm_sparc_read_import (bfd *abfd, nlmNAME (symbol_type) *sym)
-{
- struct nlm_relent *nlm_relocs; /* Relocation records for symbol. */
- bfd_size_type rcount; /* Number of relocs. */
- bfd_byte temp[NLM_TARGET_LONG_SIZE]; /* Temporary 32-bit value. */
- unsigned char symlength; /* Length of symbol name. */
- char *name;
-
- /* First, read in the number of relocation
- entries for this symbol. */
- if (bfd_bread (temp, (bfd_size_type) 4, abfd) != 4)
- return FALSE;
-
- rcount = bfd_get_32 (abfd, temp);
-
- /* Next, read in the length of the symbol. */
- if (bfd_bread (& symlength, (bfd_size_type) sizeof (symlength), abfd)
- != sizeof (symlength))
- return FALSE;
- sym -> symbol.the_bfd = abfd;
- name = bfd_alloc (abfd, (bfd_size_type) symlength + 1);
- if (name == NULL)
- return FALSE;
-
- /* Then read in the symbol. */
- if (bfd_bread (name, (bfd_size_type) symlength, abfd) != symlength)
- return FALSE;
- name[symlength] = '\0';
- sym -> symbol.name = name;
- sym -> symbol.flags = 0;
- sym -> symbol.value = 0;
- sym -> symbol.section = bfd_und_section_ptr;
-
- /* Next, start reading in the relocs. */
- nlm_relocs = bfd_alloc (abfd, rcount * sizeof (struct nlm_relent));
- if (!nlm_relocs)
- return FALSE;
- sym -> relocs = nlm_relocs;
- sym -> rcnt = 0;
- while (sym -> rcnt < rcount)
- {
- asection *section;
-
- if (! nlm_sparc_read_reloc (abfd, sym, &section, &nlm_relocs -> reloc))
- return FALSE;
- nlm_relocs -> section = section;
- nlm_relocs++;
- sym -> rcnt++;
- }
-
- return TRUE;
-}
-
-static bfd_boolean
-nlm_sparc_write_import (bfd * abfd, asection * sec, arelent * rel)
-{
- char temp[4];
- asection *code, *data, *bss, *symsec;
- bfd_vma base;
-
- code = bfd_get_section_by_name (abfd, NLM_CODE_NAME);
- data = bfd_get_section_by_name (abfd, NLM_INITIALIZED_DATA_NAME);
- bss = bfd_get_section_by_name (abfd, NLM_UNINITIALIZED_DATA_NAME);
- symsec = (*rel->sym_ptr_ptr)->section;
-
- if (symsec == code)
- base = 0;
- else if (symsec == data)
- base = code->size;
- else if (symsec == bss)
- base = code->size + data->size;
- else
- base = 0;
-
-#ifdef DEBUG
- fprintf (stderr, "%s: <%lx, 1>\n\t",
- __FUNCTION__, (unsigned long) (base + (*rel->sym_ptr_ptr)->value));
-#endif
- bfd_put_32 (abfd, base + (*rel->sym_ptr_ptr)->value, temp);
- if (bfd_bwrite (temp, (bfd_size_type) 4, abfd) != 4)
- return FALSE;
- bfd_put_32 (abfd, (bfd_vma) 1, temp);
- if (bfd_bwrite (temp, (bfd_size_type) 4, abfd) != 4)
- return FALSE;
- if (! nlm_sparc_write_reloc (abfd, sec, rel))
- return FALSE;
- return TRUE;
-}
-
-/* Write out an external reference. */
-
-static bfd_boolean
-nlm_sparc_write_external (bfd *abfd,
- bfd_size_type count,
- asymbol *sym,
- struct reloc_and_sec *relocs)
-{
- unsigned int i;
- bfd_byte len;
- unsigned char temp[NLM_TARGET_LONG_SIZE];
-
- bfd_put_32 (abfd, count, temp);
- if (bfd_bwrite (temp, (bfd_size_type) sizeof (temp), abfd) != sizeof (temp))
- return FALSE;
-
- len = strlen (sym->name);
- if ((bfd_bwrite (&len, (bfd_size_type) sizeof (bfd_byte), abfd)
- != sizeof (bfd_byte))
- || bfd_bwrite (sym->name, (bfd_size_type) len, abfd) != len)
- return FALSE;
-
- for (i = 0; i < count; i++)
- if (! nlm_sparc_write_reloc (abfd, relocs[i].sec, relocs[i].rel))
- return FALSE;
-
- return TRUE;
-}
-
-static bfd_boolean
-nlm_sparc_write_export (bfd * abfd, asymbol * sym, bfd_vma value)
-{
- bfd_byte len;
- bfd_byte temp[4];
-
-#ifdef DEBUG
- fprintf (stderr, "%s: <%lx, %u, %s>\n",
- __FUNCTION__, (unsigned long) value, strlen (sym->name), sym->name);
-#endif
- bfd_put_32 (abfd, value, temp);
- len = strlen (sym->name);
-
- if (bfd_bwrite (temp, (bfd_size_type) 4, abfd) != 4
- || bfd_bwrite (&len, (bfd_size_type) 1, abfd) != 1
- || bfd_bwrite (sym->name, (bfd_size_type) len, abfd) != len)
- return FALSE;
-
- return TRUE;
-}
-
-#undef nlm_swap_fixed_header_in
-#undef nlm_swap_fixed_header_out
-
-#include "nlmswap.h"
-
-static const struct nlm_backend_data nlm32_sparc_backend =
-{
- "NetWare SPARC Module \032",
- sizeof (Nlm32_sparc_External_Fixed_Header),
- 0, /* Optional_prefix_size. */
- bfd_arch_sparc,
- 0,
- FALSE,
- 0, /* Backend_object_p. */
- 0, /* Write_prefix_func. */
- nlm_sparc_read_reloc,
- nlm_sparc_mangle_relocs,
- nlm_sparc_read_import,
- nlm_sparc_write_import,
- 0, /* Set_public_section. */
- 0, /* Get_public_offset. */
- nlm_swap_fixed_header_in,
- nlm_swap_fixed_header_out,
- nlm_sparc_write_external,
- nlm_sparc_write_export
-};
-
-#define TARGET_BIG_NAME "nlm32-sparc"
-#define TARGET_BIG_SYM sparc_nlm32_vec
-#define TARGET_BACKEND_DATA & nlm32_sparc_backend
-
-#include "nlm-target.h"
diff --git a/bfd/nlm32.c b/bfd/nlm32.c
deleted file mode 100644
index 7cc1592..0000000
--- a/bfd/nlm32.c
+++ /dev/null
@@ -1,22 +0,0 @@
-/* NLM (NetWare Loadable Module) 32-bit executable support for BFD.
- Copyright (C) 1993-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 ARCH_SIZE 32
-#include "nlmcode.h"
diff --git a/bfd/nlm64.c b/bfd/nlm64.c
deleted file mode 100644
index d8f1800..0000000
--- a/bfd/nlm64.c
+++ /dev/null
@@ -1,22 +0,0 @@
-/* NLM (NetWare Loadable Module) 64-bit executable support for BFD.
- Copyright (C) 1993-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 ARCH_SIZE 64
-#include "nlmcode.h"
diff --git a/bfd/nlmcode.h b/bfd/nlmcode.h
deleted file mode 100644
index ac7abaf..0000000
--- a/bfd/nlmcode.h
+++ /dev/null
@@ -1,1982 +0,0 @@
-/* NLM (NetWare Loadable Module) executable support for BFD.
- Copyright (C) 1993-2018 Free Software Foundation, Inc.
-
- Written by Fred Fish @ Cygnus Support, using ELF support as the
- template.
-
- 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 "libnlm.h"
-
-/* The functions in this file do not use the names they appear to use.
- This file is actually compiled multiple times, once for each size
- of NLM target we are using. At each size we use a different name,
- constructed by the macro nlmNAME. For example, the function which
- is named nlm_symbol_type below is actually named nlm32_symbol_type
- in the final executable. */
-
-#define Nlm_External_Fixed_Header NlmNAME (External_Fixed_Header)
-#define Nlm_External_Version_Header NlmNAME (External_Version_Header)
-#define Nlm_External_Copyright_Header NlmNAME (External_Copyright_Header)
-#define Nlm_External_Extended_Header NlmNAME (External_Extended_Header)
-#define Nlm_External_Custom_Header NlmNAME (External_Custom_Header)
-#define Nlm_External_Cygnus_Ext_Header NlmNAME (External_Cygnus_Ext_Header)
-
-#define nlm_symbol_type nlmNAME (symbol_type)
-#define nlm_get_symtab_upper_bound nlmNAME (get_symtab_upper_bound)
-#define nlm_canonicalize_symtab nlmNAME (canonicalize_symtab)
-#define nlm_make_empty_symbol nlmNAME (make_empty_symbol)
-#define nlm_print_symbol nlmNAME (print_symbol)
-#define nlm_get_symbol_info nlmNAME (get_symbol_info)
-#define nlm_get_reloc_upper_bound nlmNAME (get_reloc_upper_bound)
-#define nlm_canonicalize_reloc nlmNAME (canonicalize_reloc)
-#define nlm_object_p nlmNAME (object_p)
-#define nlm_set_section_contents nlmNAME (set_section_contents)
-#define nlm_write_object_contents nlmNAME (write_object_contents)
-
-#define nlm_swap_fixed_header_in(abfd,src,dst) \
- (nlm_swap_fixed_header_in_func (abfd)) (abfd, src, dst)
-#define nlm_swap_fixed_header_out(abfd,src,dst) \
- (nlm_swap_fixed_header_out_func (abfd)) (abfd, src, dst)
-
-/* Should perhaps use put_offset, put_word, etc. For now, the two versions
- can be handled by explicitly specifying 32 bits or "the long type". */
-#if ARCH_SIZE == 64
-#define put_word H_PUT_64
-#define get_word H_GET_64
-#endif
-#if ARCH_SIZE == 32
-#define put_word H_PUT_32
-#define get_word H_GET_32
-#endif
-
-/* Read and swap in the variable length header. All the fields must
- exist in the NLM, and must exist in the order they are read here. */
-
-static bfd_boolean
-nlm_swap_variable_header_in (bfd *abfd)
-{
- unsigned char temp[NLM_TARGET_LONG_SIZE];
- bfd_size_type amt;
-
- /* Read the description length and text members. */
- amt = sizeof (nlm_variable_header (abfd)->descriptionLength);
- if (bfd_bread ((void *) &nlm_variable_header (abfd)->descriptionLength,
- amt, abfd) != amt)
- return FALSE;
- amt = nlm_variable_header (abfd)->descriptionLength + 1;
- if (bfd_bread ((void *) nlm_variable_header (abfd)->descriptionText,
- amt, abfd) != amt)
- return FALSE;
-
- /* Read and convert the stackSize field. */
- amt = sizeof (temp);
- if (bfd_bread ((void *) temp, amt, abfd) != amt)
- return FALSE;
- nlm_variable_header (abfd)->stackSize = get_word (abfd, (bfd_byte *) temp);
-
- /* Read and convert the reserved field. */
- amt = sizeof (temp);
- if (bfd_bread ((void *) temp, amt, abfd) != amt)
- return FALSE;
- nlm_variable_header (abfd)->reserved = get_word (abfd, (bfd_byte *) temp);
-
- /* Read the oldThreadName field. This field is a fixed length string. */
- amt = sizeof (nlm_variable_header (abfd)->oldThreadName);
- if (bfd_bread ((void *) nlm_variable_header (abfd)->oldThreadName,
- amt, abfd) != amt)
- return FALSE;
-
- /* Read the screen name length and text members. */
- amt = sizeof (nlm_variable_header (abfd)->screenNameLength);
- if (bfd_bread ((void *) & nlm_variable_header (abfd)->screenNameLength,
- amt, abfd) != amt)
- return FALSE;
- amt = nlm_variable_header (abfd)->screenNameLength + 1;
- if (bfd_bread ((void *) nlm_variable_header (abfd)->screenName,
- amt, abfd) != amt)
- return FALSE;
-
- /* Read the thread name length and text members. */
- amt = sizeof (nlm_variable_header (abfd)->threadNameLength);
- if (bfd_bread ((void *) & nlm_variable_header (abfd)->threadNameLength,
- amt, abfd) != amt)
- return FALSE;
- amt = nlm_variable_header (abfd)->threadNameLength + 1;
- if (bfd_bread ((void *) nlm_variable_header (abfd)->threadName,
- amt, abfd) != amt)
- return FALSE;
- return TRUE;
-}
-
-/* Add a section to the bfd. */
-
-static bfd_boolean
-add_bfd_section (bfd *abfd,
- char *name,
- file_ptr offset,
- bfd_size_type size,
- flagword flags)
-{
- asection *newsect;
-
- newsect = bfd_make_section_with_flags (abfd, name, flags);
- if (newsect == NULL)
- return FALSE;
-
- newsect->vma = 0; /* NLM's are relocatable. */
- newsect->size = size;
- newsect->filepos = offset;
- newsect->alignment_power = bfd_log2 ((bfd_vma) 0); /* FIXME */
-
- return TRUE;
-}
-
-/* Read and swap in the contents of all the auxiliary headers. Because of
- the braindead design, we have to do strcmps on strings of indeterminate
- length to figure out what each auxiliary header is. Even worse, we have
- no way of knowing how many auxiliary headers there are or where the end
- of the auxiliary headers are, except by finding something that doesn't
- look like a known auxiliary header. This means that the first new type
- of auxiliary header added will break all existing tools that don't
- recognize it. */
-
-static bfd_boolean
-nlm_swap_auxiliary_headers_in (bfd *abfd)
-{
- char tempstr[16];
- file_ptr position;
- bfd_size_type amt;
-
- for (;;)
- {
- position = bfd_tell (abfd);
- amt = sizeof (tempstr);
- if (bfd_bread ((void *) tempstr, amt, abfd) != amt)
- return FALSE;
- if (bfd_seek (abfd, position, SEEK_SET) != 0)
- return FALSE;
- if (CONST_STRNEQ (tempstr, "VeRsIoN#"))
- {
- Nlm_External_Version_Header thdr;
-
- amt = sizeof (thdr);
- if (bfd_bread ((void *) &thdr, amt, abfd) != amt)
- return FALSE;
- memcpy (nlm_version_header (abfd)->stamp, thdr.stamp,
- sizeof (thdr.stamp));
- nlm_version_header (abfd)->majorVersion =
- get_word (abfd, (bfd_byte *) thdr.majorVersion);
- nlm_version_header (abfd)->minorVersion =
- get_word (abfd, (bfd_byte *) thdr.minorVersion);
- nlm_version_header (abfd)->revision =
- get_word (abfd, (bfd_byte *) thdr.revision);
- nlm_version_header (abfd)->year =
- get_word (abfd, (bfd_byte *) thdr.year);
- nlm_version_header (abfd)->month =
- get_word (abfd, (bfd_byte *) thdr.month);
- nlm_version_header (abfd)->day =
- get_word (abfd, (bfd_byte *) thdr.day);
- }
- else if (CONST_STRNEQ (tempstr, "MeSsAgEs"))
- {
- Nlm_External_Extended_Header thdr;
-
- amt = sizeof (thdr);
- if (bfd_bread ((void *) &thdr, amt, abfd) != amt)
- return FALSE;
- memcpy (nlm_extended_header (abfd)->stamp, thdr.stamp,
- sizeof (thdr.stamp));
- nlm_extended_header (abfd)->languageID =
- get_word (abfd, (bfd_byte *) thdr.languageID);
- nlm_extended_header (abfd)->messageFileOffset =
- get_word (abfd, (bfd_byte *) thdr.messageFileOffset);
- nlm_extended_header (abfd)->messageFileLength =
- get_word (abfd, (bfd_byte *) thdr.messageFileLength);
- nlm_extended_header (abfd)->messageCount =
- get_word (abfd, (bfd_byte *) thdr.messageCount);
- nlm_extended_header (abfd)->helpFileOffset =
- get_word (abfd, (bfd_byte *) thdr.helpFileOffset);
- nlm_extended_header (abfd)->helpFileLength =
- get_word (abfd, (bfd_byte *) thdr.helpFileLength);
- nlm_extended_header (abfd)->RPCDataOffset =
- get_word (abfd, (bfd_byte *) thdr.RPCDataOffset);
- nlm_extended_header (abfd)->RPCDataLength =
- get_word (abfd, (bfd_byte *) thdr.RPCDataLength);
- nlm_extended_header (abfd)->sharedCodeOffset =
- get_word (abfd, (bfd_byte *) thdr.sharedCodeOffset);
- nlm_extended_header (abfd)->sharedCodeLength =
- get_word (abfd, (bfd_byte *) thdr.sharedCodeLength);
- nlm_extended_header (abfd)->sharedDataOffset =
- get_word (abfd, (bfd_byte *) thdr.sharedDataOffset);
- nlm_extended_header (abfd)->sharedDataLength =
- get_word (abfd, (bfd_byte *) thdr.sharedDataLength);
- nlm_extended_header (abfd)->sharedRelocationFixupOffset =
- get_word (abfd, (bfd_byte *) thdr.sharedRelocationFixupOffset);
- nlm_extended_header (abfd)->sharedRelocationFixupCount =
- get_word (abfd, (bfd_byte *) thdr.sharedRelocationFixupCount);
- nlm_extended_header (abfd)->sharedExternalReferenceOffset =
- get_word (abfd, (bfd_byte *) thdr.sharedExternalReferenceOffset);
- nlm_extended_header (abfd)->sharedExternalReferenceCount =
- get_word (abfd, (bfd_byte *) thdr.sharedExternalReferenceCount);
- nlm_extended_header (abfd)->sharedPublicsOffset =
- get_word (abfd, (bfd_byte *) thdr.sharedPublicsOffset);
- nlm_extended_header (abfd)->sharedPublicsCount =
- get_word (abfd, (bfd_byte *) thdr.sharedPublicsCount);
- nlm_extended_header (abfd)->sharedDebugRecordOffset =
- get_word (abfd, (bfd_byte *) thdr.sharedDebugRecordOffset);
- nlm_extended_header (abfd)->sharedDebugRecordCount =
- get_word (abfd, (bfd_byte *) thdr.sharedDebugRecordCount);
- nlm_extended_header (abfd)->SharedInitializationOffset =
- get_word (abfd, (bfd_byte *) thdr.sharedInitializationOffset);
- nlm_extended_header (abfd)->SharedExitProcedureOffset =
- get_word (abfd, (bfd_byte *) thdr.SharedExitProcedureOffset);
- nlm_extended_header (abfd)->productID =
- get_word (abfd, (bfd_byte *) thdr.productID);
- nlm_extended_header (abfd)->reserved0 =
- get_word (abfd, (bfd_byte *) thdr.reserved0);
- nlm_extended_header (abfd)->reserved1 =
- get_word (abfd, (bfd_byte *) thdr.reserved1);
- nlm_extended_header (abfd)->reserved2 =
- get_word (abfd, (bfd_byte *) thdr.reserved2);
- nlm_extended_header (abfd)->reserved3 =
- get_word (abfd, (bfd_byte *) thdr.reserved3);
- nlm_extended_header (abfd)->reserved4 =
- get_word (abfd, (bfd_byte *) thdr.reserved4);
- nlm_extended_header (abfd)->reserved5 =
- get_word (abfd, (bfd_byte *) thdr.reserved5);
- }
- else if (CONST_STRNEQ (tempstr, "CoPyRiGhT="))
- {
- amt = sizeof (nlm_copyright_header (abfd)->stamp);
- if (bfd_bread ((void *) nlm_copyright_header (abfd)->stamp,
- amt, abfd) != amt)
- return FALSE;
- if (bfd_bread ((void *) &(nlm_copyright_header (abfd)
- ->copyrightMessageLength),
- (bfd_size_type) 1, abfd) != 1)
- return FALSE;
- /* The copyright message is a variable length string. */
- amt = nlm_copyright_header (abfd)->copyrightMessageLength + 1;
- if (bfd_bread ((void *) nlm_copyright_header (abfd)->copyrightMessage,
- amt, abfd) != amt)
- return FALSE;
- }
- else if (CONST_STRNEQ (tempstr, "CuStHeAd"))
- {
- Nlm_External_Custom_Header thdr;
- bfd_size_type hdrLength;
- file_ptr dataOffset;
- bfd_size_type dataLength;
- char dataStamp[8];
- void * hdr;
-
- /* Read the stamp ("CuStHeAd"). */
- amt = sizeof (thdr.stamp);
- if (bfd_bread ((void *) thdr.stamp, amt, abfd) != amt)
- return FALSE;
- /* Read the length of this custom header. */
- amt = sizeof (thdr.length);
- if (bfd_bread ((void *) thdr.length, amt, abfd) != amt)
- return FALSE;
- hdrLength = get_word (abfd, (bfd_byte *) thdr.length);
- /* Read further fields if we have them. */
- if (hdrLength < NLM_TARGET_LONG_SIZE)
- dataOffset = 0;
- else
- {
- amt = sizeof (thdr.dataOffset);
- if (bfd_bread ((void *) thdr.dataOffset, amt, abfd) != amt)
- return FALSE;
- dataOffset = get_word (abfd, (bfd_byte *) thdr.dataOffset);
- }
- if (hdrLength < 2 * NLM_TARGET_LONG_SIZE)
- dataLength = 0;
- else
- {
- amt = sizeof (thdr.dataLength);
- if (bfd_bread ((void *) thdr.dataLength, amt, abfd) != amt)
- return FALSE;
- dataLength = get_word (abfd, (bfd_byte *) thdr.dataLength);
- }
- if (hdrLength < 2 * NLM_TARGET_LONG_SIZE + 8)
- memset (dataStamp, 0, sizeof (dataStamp));
- else
- {
- amt = sizeof (dataStamp);
- if (bfd_bread ((void *) dataStamp, amt, abfd) != amt)
- return FALSE;
- }
-
- /* Read the rest of the header, if any. */
- if (hdrLength <= 2 * NLM_TARGET_LONG_SIZE + 8)
- {
- hdr = NULL;
- hdrLength = 0;
- }
- else
- {
- hdrLength -= 2 * NLM_TARGET_LONG_SIZE + 8;
- hdr = bfd_alloc (abfd, hdrLength);
- if (hdr == NULL)
- return FALSE;
- if (bfd_bread (hdr, hdrLength, abfd) != hdrLength)
- return FALSE;
- }
-
- /* If we have found a Cygnus header, process it. Otherwise,
- just save the associated data without trying to interpret
- it. */
- if (CONST_STRNEQ (dataStamp, "CyGnUsEx"))
- {
- file_ptr pos;
- bfd_byte *contents;
- bfd_byte *p, *pend;
-
- /* See PR 21840 for a reproducer. */
- if (hdrLength != 0 || hdr != NULL)
- return FALSE;
-
- pos = bfd_tell (abfd);
- if (bfd_seek (abfd, dataOffset, SEEK_SET) != 0)
- return FALSE;
- contents = bfd_alloc (abfd, dataLength);
- if (contents == NULL)
- return FALSE;
- if (bfd_bread (contents, dataLength, abfd) != dataLength)
- return FALSE;
- if (bfd_seek (abfd, pos, SEEK_SET) != 0)
- return FALSE;
-
- LITMEMCPY (nlm_cygnus_ext_header (abfd), "CyGnUsEx");
- nlm_cygnus_ext_header (abfd)->offset = dataOffset;
- nlm_cygnus_ext_header (abfd)->length = dataLength;
-
- /* This data this header points to provides a list of
- the sections which were in the original object file
- which was converted to become an NLM. We locate
- those sections and add them to the BFD. Note that
- this is likely to create a second .text, .data and
- .bss section; retrieving the sections by name will
- get the actual NLM sections, which is what we want to
- happen. The sections from the original file, which
- may be subsets of the NLM section, can only be found
- using bfd_map_over_sections. */
- p = contents;
- pend = p + dataLength;
- while (p < pend)
- {
- char *name;
- size_t l;
- file_ptr filepos;
- bfd_size_type size;
- asection *newsec;
-
- /* The format of this information is
- null terminated section name
- zeroes to adjust to 4 byte boundary
- 4 byte section data file pointer
- 4 byte section size. */
-
- name = (char *) p;
- l = strlen (name) + 1;
- l = (l + 3) &~ (size_t) 3;
- p += l;
- filepos = H_GET_32 (abfd, p);
- p += 4;
- size = H_GET_32 (abfd, p);
- p += 4;
-
- newsec = bfd_make_section_anyway (abfd, name);
- if (newsec == NULL)
- return FALSE;
- newsec->size = size;
- if (filepos != 0)
- {
- newsec->filepos = filepos;
- newsec->flags |= SEC_HAS_CONTENTS;
- }
- }
- }
- else
- {
- memcpy (nlm_custom_header (abfd)->stamp, thdr.stamp,
- sizeof (thdr.stamp));
- nlm_custom_header (abfd)->hdrLength = hdrLength;
- nlm_custom_header (abfd)->dataOffset = dataOffset;
- nlm_custom_header (abfd)->dataLength = dataLength;
- memcpy (nlm_custom_header (abfd)->dataStamp, dataStamp,
- sizeof (dataStamp));
- nlm_custom_header (abfd)->hdr = hdr;
- }
- }
- else
- break;
- }
- return TRUE;
-}
-
-const bfd_target *
-nlm_object_p (bfd *abfd)
-{
- struct nlm_obj_tdata *preserved_tdata = nlm_tdata (abfd);
- bfd_boolean (*backend_object_p) (bfd *);
- void * x_fxdhdr = NULL;
- Nlm_Internal_Fixed_Header *i_fxdhdrp;
- struct nlm_obj_tdata *new_tdata = NULL;
- const char *signature;
- enum bfd_architecture arch;
- bfd_size_type amt;
-
- /* Some NLM formats have a prefix before the standard NLM fixed
- header. */
- backend_object_p = nlm_backend_object_p_func (abfd);
- if (backend_object_p)
- {
- if (!(*backend_object_p) (abfd))
- goto got_wrong_format_error;
- }
-
- /* Read in the fixed length portion of the NLM header in external format. */
- amt = nlm_fixed_header_size (abfd);
- x_fxdhdr = bfd_malloc (amt);
- if (x_fxdhdr == NULL)
- goto got_no_match;
-
- if (bfd_bread ((void *) x_fxdhdr, amt, abfd) != amt)
- {
- if (bfd_get_error () != bfd_error_system_call)
- goto got_wrong_format_error;
- else
- goto got_no_match;
- }
-
- /* Allocate an instance of the nlm_obj_tdata structure and hook it up to
- the tdata pointer in the bfd. */
- amt = sizeof (struct nlm_obj_tdata);
- new_tdata = bfd_zalloc (abfd, amt);
- if (new_tdata == NULL)
- goto got_no_match;
-
- nlm_tdata (abfd) = new_tdata;
-
- i_fxdhdrp = nlm_fixed_header (abfd);
- nlm_swap_fixed_header_in (abfd, x_fxdhdr, i_fxdhdrp);
- free (x_fxdhdr);
- x_fxdhdr = NULL;
-
- /* Check to see if we have an NLM file for this backend by matching
- the NLM signature. */
- signature = nlm_signature (abfd);
- if (signature != NULL
- && *signature != '\0'
- && strncmp ((char *) i_fxdhdrp->signature, signature,
- NLM_SIGNATURE_SIZE) != 0)
- goto got_wrong_format_error;
-
- /* There's no supported way to discover the endianness of an NLM, so test for
- a sane version number after doing byte swapping appropriate for this
- XVEC. (Hack alert!) */
- if (i_fxdhdrp->version > 0xFFFF)
- goto got_wrong_format_error;
-
- /* There's no supported way to check for 32 bit versus 64 bit addresses,
- so ignore this distinction for now. (FIXME) */
- /* Swap in the rest of the required header. */
- if (!nlm_swap_variable_header_in (abfd))
- {
- if (bfd_get_error () != bfd_error_system_call)
- goto got_wrong_format_error;
- else
- goto got_no_match;
- }
-
- /* Add the sections supplied by all NLM's, and then read in the
- auxiliary headers. Reading the auxiliary headers may create
- additional sections described in the cygnus_ext header.
- From this point on we assume that we have an NLM, and do not
- treat errors as indicating the wrong format. */
- if (!add_bfd_section (abfd, NLM_CODE_NAME,
- i_fxdhdrp->codeImageOffset,
- i_fxdhdrp->codeImageSize,
- (SEC_CODE | SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS
- | SEC_RELOC))
- || !add_bfd_section (abfd, NLM_INITIALIZED_DATA_NAME,
- i_fxdhdrp->dataImageOffset,
- i_fxdhdrp->dataImageSize,
- (SEC_DATA | SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS
- | SEC_RELOC))
- || !add_bfd_section (abfd, NLM_UNINITIALIZED_DATA_NAME,
- (file_ptr) 0,
- i_fxdhdrp->uninitializedDataSize,
- SEC_ALLOC))
- goto got_no_match;
-
- if (!nlm_swap_auxiliary_headers_in (abfd))
- goto got_no_match;
-
- if (nlm_fixed_header (abfd)->numberOfRelocationFixups != 0
- || nlm_fixed_header (abfd)->numberOfExternalReferences != 0)
- abfd->flags |= HAS_RELOC;
- if (nlm_fixed_header (abfd)->numberOfPublics != 0
- || nlm_fixed_header (abfd)->numberOfDebugRecords != 0
- || nlm_fixed_header (abfd)->numberOfExternalReferences != 0)
- abfd->flags |= HAS_SYMS;
-
- arch = nlm_architecture (abfd);
- if (arch != bfd_arch_unknown)
- bfd_default_set_arch_mach (abfd, arch, (unsigned long) 0);
-
- abfd->flags |= EXEC_P;
- bfd_get_start_address (abfd) = nlm_fixed_header (abfd)->codeStartOffset;
-
- return abfd->xvec;
-
-got_wrong_format_error:
- bfd_set_error (bfd_error_wrong_format);
-got_no_match:
- nlm_tdata (abfd) = preserved_tdata;
- if (new_tdata != NULL)
- bfd_release (abfd, new_tdata);
- if (x_fxdhdr != NULL)
- free (x_fxdhdr);
-
- return NULL;
-}
-
-/* Swap and write out the variable length header. All the fields must
- exist in the NLM, and must exist in this order. */
-
-static bfd_boolean
-nlm_swap_variable_header_out (bfd *abfd)
-{
- bfd_byte temp[NLM_TARGET_LONG_SIZE];
- bfd_size_type amt;
-
- /* Write the description length and text members. */
- amt = sizeof (nlm_variable_header (abfd)->descriptionLength);
- if (bfd_bwrite (& nlm_variable_header (abfd)->descriptionLength, amt,
- abfd) != amt)
- return FALSE;
- amt = nlm_variable_header (abfd)->descriptionLength + 1;
- if (bfd_bwrite ((void *) nlm_variable_header (abfd)->descriptionText, amt,
- abfd) != amt)
- return FALSE;
-
- /* Convert and write the stackSize field. */
- put_word (abfd, (bfd_vma) nlm_variable_header (abfd)->stackSize, temp);
- amt = sizeof (temp);
- if (bfd_bwrite (temp, amt, abfd) != amt)
- return FALSE;
-
- /* Convert and write the reserved field. */
- put_word (abfd, (bfd_vma) nlm_variable_header (abfd)->reserved, temp);
- amt = sizeof (temp);
- if (bfd_bwrite (temp, amt, abfd) != amt)
- return FALSE;
-
- /* Write the oldThreadName field. This field is a fixed length string. */
- amt = sizeof (nlm_variable_header (abfd)->oldThreadName);
- if (bfd_bwrite (nlm_variable_header (abfd)->oldThreadName, amt,
- abfd) != amt)
- return FALSE;
-
- /* Write the screen name length and text members. */
- amt = sizeof (nlm_variable_header (abfd)->screenNameLength);
- if (bfd_bwrite (& nlm_variable_header (abfd)->screenNameLength, amt,
- abfd) != amt)
- return FALSE;
- amt = nlm_variable_header (abfd)->screenNameLength + 1;
- if (bfd_bwrite (nlm_variable_header (abfd)->screenName, amt, abfd) != amt)
- return FALSE;
-
- /* Write the thread name length and text members. */
- amt = sizeof (nlm_variable_header (abfd)->threadNameLength);
- if (bfd_bwrite (& nlm_variable_header (abfd)->threadNameLength, amt,
- abfd) != amt)
- return FALSE;
- amt = nlm_variable_header (abfd)->threadNameLength + 1;
- if (bfd_bwrite (nlm_variable_header (abfd)->threadName, amt, abfd) != amt)
- return FALSE;
- return TRUE;
-}
-
-/* Return whether there is a non-zero byte in a memory block. */
-
-static bfd_boolean
-find_nonzero (void * buf, size_t size)
-{
- char *p = (char *) buf;
-
- while (size-- != 0)
- if (*p++ != 0)
- return TRUE;
- return FALSE;
-}
-
-/* Swap out the contents of the auxiliary headers. We create those
- auxiliary headers which have been set non-zero. We do not require
- the caller to set up the stamp fields. */
-
-static bfd_boolean
-nlm_swap_auxiliary_headers_out (bfd *abfd)
-{
- bfd_size_type amt;
-
- /* Write out the version header if there is one. */
- if (find_nonzero (nlm_version_header (abfd),
- sizeof (Nlm_Internal_Version_Header)))
- {
- Nlm_External_Version_Header thdr;
-
- LITMEMCPY (thdr.stamp, "VeRsIoN#");
- put_word (abfd, (bfd_vma) nlm_version_header (abfd)->majorVersion,
- (bfd_byte *) thdr.majorVersion);
- put_word (abfd, (bfd_vma) nlm_version_header (abfd)->minorVersion,
- (bfd_byte *) thdr.minorVersion);
- put_word (abfd, (bfd_vma) nlm_version_header (abfd)->revision,
- (bfd_byte *) thdr.revision);
- put_word (abfd, (bfd_vma) nlm_version_header (abfd)->year,
- (bfd_byte *) thdr.year);
- put_word (abfd, (bfd_vma) nlm_version_header (abfd)->month,
- (bfd_byte *) thdr.month);
- put_word (abfd, (bfd_vma) nlm_version_header (abfd)->day,
- (bfd_byte *) thdr.day);
- if (bfd_bwrite ((void *) &thdr, (bfd_size_type) sizeof (thdr), abfd)
- != sizeof (thdr))
- return FALSE;
- }
-
- /* Note - the CoPyRiGhT tag is emitted before the MeSsAgEs
- tag in order to make the NW4.x and NW5.x loaders happy. */
-
- /* Write out the copyright header if there is one. */
- if (find_nonzero (nlm_copyright_header (abfd),
- sizeof (Nlm_Internal_Copyright_Header)))
- {
- Nlm_External_Copyright_Header thdr;
-
- LITMEMCPY (thdr.stamp, "CoPyRiGhT=");
- amt = sizeof (thdr.stamp);
- if (bfd_bwrite ((void *) thdr.stamp, amt, abfd) != amt)
- return FALSE;
- thdr.copyrightMessageLength[0] =
- nlm_copyright_header (abfd)->copyrightMessageLength;
- amt = 1;
- if (bfd_bwrite ((void *) thdr.copyrightMessageLength, amt, abfd) != amt)
- return FALSE;
- /* The copyright message is a variable length string. */
- amt = nlm_copyright_header (abfd)->copyrightMessageLength + 1;
- if (bfd_bwrite ((void *) nlm_copyright_header (abfd)->copyrightMessage,
- amt, abfd) != amt)
- return FALSE;
- }
-
- /* Write out the extended header if there is one. */
- if (find_nonzero (nlm_extended_header (abfd),
- sizeof (Nlm_Internal_Extended_Header)))
- {
- Nlm_External_Extended_Header thdr;
-
- LITMEMCPY (thdr.stamp, "MeSsAgEs");
- put_word (abfd,
- (bfd_vma) nlm_extended_header (abfd)->languageID,
- (bfd_byte *) thdr.languageID);
- put_word (abfd,
- (bfd_vma) nlm_extended_header (abfd)->messageFileOffset,
- (bfd_byte *) thdr.messageFileOffset);
- put_word (abfd,
- (bfd_vma) nlm_extended_header (abfd)->messageFileLength,
- (bfd_byte *) thdr.messageFileLength);
- put_word (abfd,
- (bfd_vma) nlm_extended_header (abfd)->messageCount,
- (bfd_byte *) thdr.messageCount);
- put_word (abfd,
- (bfd_vma) nlm_extended_header (abfd)->helpFileOffset,
- (bfd_byte *) thdr.helpFileOffset);
- put_word (abfd,
- (bfd_vma) nlm_extended_header (abfd)->helpFileLength,
- (bfd_byte *) thdr.helpFileLength);
- put_word (abfd,
- (bfd_vma) nlm_extended_header (abfd)->RPCDataOffset,
- (bfd_byte *) thdr.RPCDataOffset);
- put_word (abfd,
- (bfd_vma) nlm_extended_header (abfd)->RPCDataLength,
- (bfd_byte *) thdr.RPCDataLength);
- put_word (abfd,
- (bfd_vma) nlm_extended_header (abfd)->sharedCodeOffset,
- (bfd_byte *) thdr.sharedCodeOffset);
- put_word (abfd,
- (bfd_vma) nlm_extended_header (abfd)->sharedCodeLength,
- (bfd_byte *) thdr.sharedCodeLength);
- put_word (abfd,
- (bfd_vma) nlm_extended_header (abfd)->sharedDataOffset,
- (bfd_byte *) thdr.sharedDataOffset);
- put_word (abfd,
- (bfd_vma) nlm_extended_header (abfd)->sharedDataLength,
- (bfd_byte *) thdr.sharedDataLength);
- put_word (abfd,
- (bfd_vma) nlm_extended_header (abfd)->sharedRelocationFixupOffset,
- (bfd_byte *) thdr.sharedRelocationFixupOffset);
- put_word (abfd,
- (bfd_vma) nlm_extended_header (abfd)->sharedRelocationFixupCount,
- (bfd_byte *) thdr.sharedRelocationFixupCount);
- put_word (abfd,
- (bfd_vma) nlm_extended_header (abfd)->sharedExternalReferenceOffset,
- (bfd_byte *) thdr.sharedExternalReferenceOffset);
- put_word (abfd,
- (bfd_vma) nlm_extended_header (abfd)->sharedExternalReferenceCount,
- (bfd_byte *) thdr.sharedExternalReferenceCount);
- put_word (abfd,
- (bfd_vma) nlm_extended_header (abfd)->sharedPublicsOffset,
- (bfd_byte *) thdr.sharedPublicsOffset);
- put_word (abfd,
- (bfd_vma) nlm_extended_header (abfd)->sharedPublicsCount,
- (bfd_byte *) thdr.sharedPublicsCount);
- put_word (abfd,
- (bfd_vma) nlm_extended_header (abfd)->sharedDebugRecordOffset,
- (bfd_byte *) thdr.sharedDebugRecordOffset);
- put_word (abfd,
- (bfd_vma) nlm_extended_header (abfd)->sharedDebugRecordCount,
- (bfd_byte *) thdr.sharedDebugRecordCount);
- put_word (abfd,
- (bfd_vma) nlm_extended_header (abfd)->SharedInitializationOffset,
- (bfd_byte *) thdr.sharedInitializationOffset);
- put_word (abfd,
- (bfd_vma) nlm_extended_header (abfd)->SharedExitProcedureOffset,
- (bfd_byte *) thdr.SharedExitProcedureOffset);
- put_word (abfd,
- (bfd_vma) nlm_extended_header (abfd)->productID,
- (bfd_byte *) thdr.productID);
- put_word (abfd,
- (bfd_vma) nlm_extended_header (abfd)->reserved0,
- (bfd_byte *) thdr.reserved0);
- put_word (abfd,
- (bfd_vma) nlm_extended_header (abfd)->reserved1,
- (bfd_byte *) thdr.reserved1);
- put_word (abfd,
- (bfd_vma) nlm_extended_header (abfd)->reserved2,
- (bfd_byte *) thdr.reserved2);
- put_word (abfd,
- (bfd_vma) nlm_extended_header (abfd)->reserved3,
- (bfd_byte *) thdr.reserved3);
- put_word (abfd,
- (bfd_vma) nlm_extended_header (abfd)->reserved4,
- (bfd_byte *) thdr.reserved4);
- put_word (abfd,
- (bfd_vma) nlm_extended_header (abfd)->reserved5,
- (bfd_byte *) thdr.reserved5);
- if (bfd_bwrite ((void *) &thdr, (bfd_size_type) sizeof (thdr), abfd)
- != sizeof (thdr))
- return FALSE;
- }
-
- /* Write out the custom header if there is one. */
- if (find_nonzero (nlm_custom_header (abfd),
- sizeof (Nlm_Internal_Custom_Header)))
- {
- Nlm_External_Custom_Header thdr;
- bfd_boolean ds;
- bfd_size_type hdrLength;
-
- ds = find_nonzero (nlm_custom_header (abfd)->dataStamp,
- sizeof (nlm_custom_header (abfd)->dataStamp));
- LITMEMCPY (thdr.stamp, "CuStHeAd");
- hdrLength = (2 * NLM_TARGET_LONG_SIZE + (ds ? 8 : 0)
- + nlm_custom_header (abfd)->hdrLength);
- put_word (abfd, hdrLength, thdr.length);
- put_word (abfd, (bfd_vma) nlm_custom_header (abfd)->dataOffset,
- thdr.dataOffset);
- put_word (abfd, (bfd_vma) nlm_custom_header (abfd)->dataLength,
- thdr.dataLength);
- if (! ds)
- {
- BFD_ASSERT (nlm_custom_header (abfd)->hdrLength == 0);
- amt = sizeof (thdr) - sizeof (thdr.dataStamp);
- if (bfd_bwrite ((void *) &thdr, amt, abfd) != amt)
- return FALSE;
- }
- else
- {
- memcpy (thdr.dataStamp, nlm_custom_header (abfd)->dataStamp,
- sizeof (thdr.dataStamp));
- amt = sizeof (thdr);
- if (bfd_bwrite ((void *) &thdr, amt, abfd) != amt)
- return FALSE;
- amt = nlm_custom_header (abfd)->hdrLength;
- if (bfd_bwrite (nlm_custom_header (abfd)->hdr, amt, abfd) != amt)
- return FALSE;
- }
- }
-
- /* Write out the Cygnus debugging header if there is one. */
- if (find_nonzero (nlm_cygnus_ext_header (abfd),
- sizeof (Nlm_Internal_Cygnus_Ext_Header)))
- {
- Nlm_External_Custom_Header thdr;
-
- LITMEMCPY (thdr.stamp, "CuStHeAd");
- put_word (abfd, (bfd_vma) 2 * NLM_TARGET_LONG_SIZE + 8,
- (bfd_byte *) thdr.length);
- put_word (abfd, (bfd_vma) nlm_cygnus_ext_header (abfd)->offset,
- (bfd_byte *) thdr.dataOffset);
- put_word (abfd, (bfd_vma) nlm_cygnus_ext_header (abfd)->length,
- (bfd_byte *) thdr.dataLength);
- LITMEMCPY (thdr.dataStamp, "CyGnUsEx");
- amt = sizeof (thdr);
- if (bfd_bwrite ((void *) &thdr, amt, abfd) != amt)
- return FALSE;
- }
-
- return TRUE;
-}
-
-/* We read the NLM's public symbols and use it to generate a bfd symbol
- table (hey, it's better than nothing) on a one-for-one basis. Thus
- use the number of public symbols as the number of bfd symbols we will
- have once we actually get around to reading them in.
-
- Return the number of bytes required to hold the symtab vector, based on
- the count plus 1, since we will NULL terminate the vector allocated based
- on this size. */
-
-long
-nlm_get_symtab_upper_bound (bfd *abfd)
-{
- Nlm_Internal_Fixed_Header *i_fxdhdrp; /* Nlm file header, internal form. */
- long symcount;
- long symtab_size = 0;
-
- i_fxdhdrp = nlm_fixed_header (abfd);
- symcount = (i_fxdhdrp->numberOfPublics
- + i_fxdhdrp->numberOfDebugRecords
- + i_fxdhdrp->numberOfExternalReferences);
- symtab_size = (symcount + 1) * (sizeof (asymbol));
- return symtab_size;
-}
-
-/* Slurp in nlm symbol table.
-
- In the external (in-file) form, NLM export records are variable length,
- with the following form:
-
- 1 byte length of the symbol name (N)
- N bytes the symbol name
- 4 bytes the symbol offset from start of it's section
-
- We also read in the debugging symbols and import records. Import
- records are treated as undefined symbols. As we read the import
- records we also read in the associated reloc information, which is
- attached to the symbol.
-
- The bfd symbols are copied to SYMvoid *S.
-
- When we return, the bfd symcount is either zero or contains the correct
- number of symbols. */
-
-static bfd_boolean
-nlm_slurp_symbol_table (bfd *abfd)
-{
- Nlm_Internal_Fixed_Header *i_fxdhdrp; /* Nlm file header, internal form. */
- bfd_size_type totsymcount; /* Number of NLM symbols. */
- bfd_size_type symcount; /* Counter of NLM symbols. */
- nlm_symbol_type *sym; /* Pointer to current bfd symbol. */
- unsigned char symlength; /* Symbol length read into here. */
- unsigned char symtype; /* Type of debugging symbol. */
- bfd_byte temp[NLM_TARGET_LONG_SIZE]; /* Symbol offsets read into here. */
- bfd_boolean (*read_import_func) (bfd *, nlm_symbol_type *);
- bfd_boolean (*set_public_section_func) (bfd *, nlm_symbol_type *);
- bfd_size_type amt;
-
- if (nlm_get_symbols (abfd) != NULL)
- return TRUE;
-
- /* Read each raw NLM symbol, using the information to create a canonical bfd
- symbol table entry.
-
- Note that we allocate the initial bfd canonical symbol buffer based on a
- one-to-one mapping of the NLM symbols to canonical symbols. We actually
- use all the NLM symbols, so there will be no space left over at the end.
- When we have all the symbols, we build the caller's pointer vector. */
-
- abfd->symcount = 0;
- i_fxdhdrp = nlm_fixed_header (abfd);
- totsymcount = (i_fxdhdrp->numberOfPublics
- + i_fxdhdrp->numberOfDebugRecords
- + i_fxdhdrp->numberOfExternalReferences);
- if (totsymcount == 0)
- return TRUE;
-
- if (bfd_seek (abfd, i_fxdhdrp->publicsOffset, SEEK_SET) != 0)
- return FALSE;
-
- amt = totsymcount * sizeof (nlm_symbol_type);
- sym = bfd_zalloc (abfd, amt);
- if (!sym)
- return FALSE;
- nlm_set_symbols (abfd, sym);
-
- /* We use the bfd's symcount directly as the control count, so that early
- termination of the loop leaves the symcount correct for the symbols that
- were read. */
-
- set_public_section_func = nlm_set_public_section_func (abfd);
- symcount = i_fxdhdrp->numberOfPublics;
- while (abfd->symcount < symcount)
- {
- amt = sizeof (symlength);
- if (bfd_bread ((void *) &symlength, amt, abfd) != amt)
- return FALSE;
- amt = symlength;
- sym->symbol.the_bfd = abfd;
- sym->symbol.name = bfd_alloc (abfd, amt + 1);
- if (!sym->symbol.name)
- return FALSE;
- if (bfd_bread ((void *) sym->symbol.name, amt, abfd) != amt)
- return FALSE;
- /* Cast away const. */
- ((char *) (sym->symbol.name))[symlength] = '\0';
- amt = sizeof (temp);
- if (bfd_bread ((void *) temp, amt, abfd) != amt)
- return FALSE;
- sym->symbol.flags = BSF_GLOBAL | BSF_EXPORT;
- sym->symbol.value = get_word (abfd, temp);
- if (set_public_section_func)
- {
- /* Most backends can use the code below, but unfortunately
- some use a different scheme. */
- if (! (*set_public_section_func) (abfd, sym))
- return FALSE;
- }
- else
- {
- if (sym->symbol.value & NLM_HIBIT)
- {
- sym->symbol.value &= ~NLM_HIBIT;
- sym->symbol.flags |= BSF_FUNCTION;
- sym->symbol.section =
- bfd_get_section_by_name (abfd, NLM_CODE_NAME);
- }
- else
- sym->symbol.section =
- bfd_get_section_by_name (abfd, NLM_INITIALIZED_DATA_NAME);
- }
- sym->rcnt = 0;
- abfd->symcount++;
- sym++;
- }
-
- /* Read the debugging records. */
-
- if (i_fxdhdrp->numberOfDebugRecords > 0)
- {
- if (bfd_seek (abfd, i_fxdhdrp->debugInfoOffset, SEEK_SET) != 0)
- return FALSE;
-
- symcount += i_fxdhdrp->numberOfDebugRecords;
- while (abfd->symcount < symcount)
- {
- amt = sizeof (symtype);
- if (bfd_bread ((void *) &symtype, amt, abfd) != amt)
- return FALSE;
- amt = sizeof (temp);
- if (bfd_bread ((void *) temp, amt, abfd) != amt)
- return FALSE;
- amt = sizeof (symlength);
- if (bfd_bread ((void *) &symlength, amt, abfd) != amt)
- return FALSE;
- amt = symlength;
- sym->symbol.the_bfd = abfd;
- sym->symbol.name = bfd_alloc (abfd, amt + 1);
- if (!sym->symbol.name)
- return FALSE;
- if (bfd_bread ((void *) sym->symbol.name, amt, abfd) != amt)
- return FALSE;
- /* Cast away const. */
- ((char *) (sym->symbol.name))[symlength] = '\0';
- sym->symbol.flags = BSF_LOCAL;
- sym->symbol.value = get_word (abfd, temp);
-
- if (symtype == 0)
- sym->symbol.section =
- bfd_get_section_by_name (abfd, NLM_INITIALIZED_DATA_NAME);
- else if (symtype == 1)
- {
- sym->symbol.flags |= BSF_FUNCTION;
- sym->symbol.section =
- bfd_get_section_by_name (abfd, NLM_CODE_NAME);
- }
- else
- sym->symbol.section = bfd_abs_section_ptr;
-
- sym->rcnt = 0;
- abfd->symcount++;
- sym++;
- }
- }
-
- /* Read in the import records. We can only do this if we know how
- to read relocs for this target. */
- read_import_func = nlm_read_import_func (abfd);
- if (read_import_func != NULL)
- {
- if (bfd_seek (abfd, i_fxdhdrp->externalReferencesOffset, SEEK_SET) != 0)
- return FALSE;
-
- symcount += i_fxdhdrp->numberOfExternalReferences;
- while (abfd->symcount < symcount)
- {
- if (! (*read_import_func) (abfd, sym))
- return FALSE;
- sym++;
- abfd->symcount++;
- }
- }
-
- return TRUE;
-}
-
-/* Note that bfd_get_symcount is guaranteed to be zero if slurping the
- symbol table fails. */
-
-long
-nlm_canonicalize_symtab (bfd *abfd, asymbol **alocation)
-{
- nlm_symbol_type *symbase;
- bfd_size_type counter = 0;
-
- if (! nlm_slurp_symbol_table (abfd))
- return -1;
- symbase = nlm_get_symbols (abfd);
- while (counter < bfd_get_symcount (abfd))
- {
- *alocation++ = &symbase->symbol;
- symbase++;
- counter++;
- }
- *alocation = NULL;
- return bfd_get_symcount (abfd);
-}
-
-/* Make an NLM symbol. There is nothing special to do here. */
-
-asymbol *
-nlm_make_empty_symbol (bfd *abfd)
-{
- bfd_size_type amt = sizeof (nlm_symbol_type);
- nlm_symbol_type *new = bfd_zalloc (abfd, amt);
-
- if (new == NULL)
- return NULL;
- new->symbol.the_bfd = abfd;
- return & new->symbol;
-}
-
-/* Get symbol information. */
-
-void
-nlm_get_symbol_info (bfd *ignore_abfd ATTRIBUTE_UNUSED,
- asymbol *symbol,
- symbol_info *ret)
-{
- bfd_symbol_info (symbol, ret);
-}
-
-/* Print symbol information. */
-
-void
-nlm_print_symbol (bfd *abfd,
- void * afile,
- asymbol *symbol,
- bfd_print_symbol_type how)
-{
- FILE *file = (FILE *) afile;
-
- switch (how)
- {
- case bfd_print_symbol_name:
- case bfd_print_symbol_more:
- if (symbol->name)
- fprintf (file, "%s", symbol->name);
- break;
- case bfd_print_symbol_all:
- bfd_print_symbol_vandf (abfd, (void *) file, symbol);
- fprintf (file, " %-5s", symbol->section->name);
- if (symbol->name)
- fprintf (file, " %s", symbol->name);
- break;
- }
-}
-
-/* Get the relocs for an NLM file. There are two types of relocs.
- Imports are relocs against symbols defined in other NLM files. We
- treat these as relocs against global symbols. Relocation fixups
- are internal relocs.
-
- The actual format used to store the relocs is machine specific. */
-
-/* Read in the relocation fixup information. This is stored in
- nlm_relocation_fixups, an array of arelent structures, and
- nlm_relocation_fixup_secs, an array of section pointers. The
- section pointers are needed because the relocs are not sorted by
- section. */
-
-static bfd_boolean
-nlm_slurp_reloc_fixups (bfd *abfd)
-{
- bfd_boolean (*read_func) (bfd *, nlm_symbol_type *, asection **, arelent *);
- bfd_size_type count, amt;
- arelent *rels;
- asection **secs;
-
- if (nlm_relocation_fixups (abfd) != NULL)
- return TRUE;
- read_func = nlm_read_reloc_func (abfd);
- if (read_func == NULL)
- return TRUE;
-
- if (bfd_seek (abfd, nlm_fixed_header (abfd)->relocationFixupOffset,
- SEEK_SET) != 0)
- return FALSE;
-
- count = nlm_fixed_header (abfd)->numberOfRelocationFixups;
- amt = count * sizeof (arelent);
- rels = bfd_alloc (abfd, amt);
- amt = count * sizeof (asection *);
- secs = bfd_alloc (abfd, amt);
- if ((rels == NULL || secs == NULL) && count != 0)
- return FALSE;
- nlm_relocation_fixups (abfd) = rels;
- nlm_relocation_fixup_secs (abfd) = secs;
-
- /* We have to read piece by piece, because we don't know how large
- the machine specific reloc information is. */
- while (count-- != 0)
- {
- if (! (*read_func) (abfd, NULL, secs, rels))
- {
- nlm_relocation_fixups (abfd) = NULL;
- nlm_relocation_fixup_secs (abfd) = NULL;
- return FALSE;
- }
- ++secs;
- ++rels;
- }
-
- return TRUE;
-}
-
-/* Get the number of relocs. This really just returns an upper bound,
- since it does not attempt to distinguish them based on the section.
- That will be handled when they are actually read. */
-
-long
-nlm_get_reloc_upper_bound (bfd *abfd, asection *sec)
-{
- nlm_symbol_type *syms;
- bfd_size_type count;
- unsigned int ret;
-
- /* If we don't know how to read relocs, just return 0. */
- if (nlm_read_reloc_func (abfd) == NULL)
- return -1;
- /* Make sure we have either the code or the data section. */
- if ((bfd_get_section_flags (abfd, sec) & (SEC_CODE | SEC_DATA)) == 0)
- return 0;
-
- syms = nlm_get_symbols (abfd);
- if (syms == NULL)
- {
- if (! nlm_slurp_symbol_table (abfd))
- return -1;
- syms = nlm_get_symbols (abfd);
- }
-
- ret = nlm_fixed_header (abfd)->numberOfRelocationFixups;
-
- count = bfd_get_symcount (abfd);
- while (count-- != 0)
- {
- ret += syms->rcnt;
- ++syms;
- }
-
- return (ret + 1) * sizeof (arelent *);
-}
-
-/* Get the relocs themselves. */
-
-long
-nlm_canonicalize_reloc (bfd *abfd,
- asection *sec,
- arelent **relptr,
- asymbol **symbols)
-{
- arelent *rels;
- asection **secs;
- bfd_size_type count, i;
- long ret;
-
- /* Get the relocation fixups. */
- rels = nlm_relocation_fixups (abfd);
- if (rels == NULL)
- {
- if (! nlm_slurp_reloc_fixups (abfd))
- return -1;
- rels = nlm_relocation_fixups (abfd);
- }
- secs = nlm_relocation_fixup_secs (abfd);
-
- ret = 0;
- count = nlm_fixed_header (abfd)->numberOfRelocationFixups;
- for (i = 0; i < count; i++, rels++, secs++)
- {
- if (*secs == sec)
- {
- *relptr++ = rels;
- ++ret;
- }
- }
-
- /* Get the import symbols. */
- count = bfd_get_symcount (abfd);
- for (i = 0; i < count; i++, symbols++)
- {
- asymbol *sym;
-
- sym = *symbols;
- if (bfd_asymbol_flavour (sym) == bfd_target_nlm_flavour)
- {
- nlm_symbol_type *nlm_sym;
- bfd_size_type j;
-
- nlm_sym = (nlm_symbol_type *) sym;
- for (j = 0; j < nlm_sym->rcnt; j++)
- {
- if (nlm_sym->relocs[j].section == sec)
- {
- *relptr = &nlm_sym->relocs[j].reloc;
- (*relptr)->sym_ptr_ptr = symbols;
- ++relptr;
- ++ret;
- }
- }
- }
- }
-
- *relptr = NULL;
-
- return ret;
-}
-
-/* Compute the section file positions for an NLM file. All variable
- length data in the file headers must be set before this function is
- called. If the variable length data is changed later, the
- resulting object file will be incorrect. Unfortunately, there is
- no way to check this.
-
- This routine also sets the Size and Offset fields in the fixed
- header.
-
- It also looks over the symbols and moves any common symbols into
- the .bss section; NLM has no way to represent a common symbol.
- This approach means that either the symbols must already have been
- set at this point, or there must be no common symbols. We need to
- move the symbols at this point so that mangle_relocs can see the
- final values. */
-
-static bfd_boolean
-nlm_compute_section_file_positions (bfd *abfd)
-{
- file_ptr sofar;
- asection *sec;
- bfd_vma text, data, bss;
- bfd_vma text_low, data_low;
- unsigned int text_align, data_align, other_align;
- file_ptr text_ptr, data_ptr, other_ptr;
- asection *bss_sec;
- asymbol **sym_ptr_ptr;
-
- if (abfd->output_has_begun)
- return TRUE;
-
- /* Make sure we have a section to hold uninitialized data. */
- bss_sec = bfd_get_section_by_name (abfd, NLM_UNINITIALIZED_DATA_NAME);
- if (bss_sec == NULL)
- {
- if (!add_bfd_section (abfd, NLM_UNINITIALIZED_DATA_NAME,
- (file_ptr) 0, (bfd_size_type) 0,
- SEC_ALLOC))
- return FALSE;
- bss_sec = bfd_get_section_by_name (abfd, NLM_UNINITIALIZED_DATA_NAME);
- }
-
- abfd->output_has_begun = TRUE;
-
- /* The fixed header. */
- sofar = nlm_optional_prefix_size (abfd) + nlm_fixed_header_size (abfd);
-
- /* The variable header. */
- sofar += (sizeof (nlm_variable_header (abfd)->descriptionLength)
- + nlm_variable_header (abfd)->descriptionLength + 1
- + NLM_TARGET_LONG_SIZE /* stackSize */
- + NLM_TARGET_LONG_SIZE /* reserved */
- + sizeof (nlm_variable_header (abfd)->oldThreadName)
- + sizeof (nlm_variable_header (abfd)->screenNameLength)
- + nlm_variable_header (abfd)->screenNameLength + 1
- + sizeof (nlm_variable_header (abfd)->threadNameLength)
- + nlm_variable_header (abfd)->threadNameLength + 1);
-
- /* The auxiliary headers. */
- if (find_nonzero (nlm_version_header (abfd),
- sizeof (Nlm_Internal_Version_Header)))
- sofar += sizeof (Nlm_External_Version_Header);
- if (find_nonzero (nlm_extended_header (abfd),
- sizeof (Nlm_Internal_Extended_Header)))
- sofar += sizeof (Nlm_External_Extended_Header);
- if (find_nonzero (nlm_copyright_header (abfd),
- sizeof (Nlm_Internal_Copyright_Header)))
- sofar += (sizeof (Nlm_External_Copyright_Header)
- + nlm_copyright_header (abfd)->copyrightMessageLength + 1);
- if (find_nonzero (nlm_custom_header (abfd),
- sizeof (Nlm_Internal_Custom_Header)))
- sofar += (sizeof (Nlm_External_Custom_Header)
- + nlm_custom_header (abfd)->hdrLength);
- if (find_nonzero (nlm_cygnus_ext_header (abfd),
- sizeof (Nlm_Internal_Cygnus_Ext_Header)))
- sofar += sizeof (Nlm_External_Custom_Header);
-
- /* Compute the section file positions in two passes. First get the
- sizes of the text and data sections, and then set the file
- positions. This code aligns the sections in the file using the
- same alignment restrictions that apply to the sections in memory;
- this may not be necessary. */
- text = 0;
- text_low = (bfd_vma) - 1;
- text_align = 0;
- data = 0;
- data_low = (bfd_vma) - 1;
- data_align = 0;
- bss = 0;
- other_align = 0;
- for (sec = abfd->sections; sec != NULL; sec = sec->next)
- {
- flagword f;
-
- sec->size = BFD_ALIGN (sec->size, 1 << sec->alignment_power);
-
- f = bfd_get_section_flags (abfd, sec);
- if (f & SEC_CODE)
- {
- text += sec->size;
- if (bfd_get_section_vma (abfd, sec) < text_low)
- text_low = bfd_get_section_vma (abfd, sec);
- if (sec->alignment_power > text_align)
- text_align = sec->alignment_power;
- }
- else if (f & SEC_DATA)
- {
- data += sec->size;
- if (bfd_get_section_vma (abfd, sec) < data_low)
- data_low = bfd_get_section_vma (abfd, sec);
- if (sec->alignment_power > data_align)
- data_align = sec->alignment_power;
- }
- else if (f & SEC_HAS_CONTENTS)
- {
- if (sec->alignment_power > other_align)
- other_align = sec->alignment_power;
- }
- else if (f & SEC_ALLOC)
- bss += sec->size;
- }
-
- nlm_set_text_low (abfd, text_low);
- nlm_set_data_low (abfd, data_low);
-
- if (nlm_no_uninitialized_data (abfd))
- {
- /* This NetWare format does not use uninitialized data. We must
- increase the size of the data section. We will never wind up
- writing those file locations, so they will remain zero. */
- data += bss;
- bss = 0;
- }
-
- text_ptr = BFD_ALIGN (sofar, 1 << text_align);
- data_ptr = BFD_ALIGN (text_ptr + text, 1 << data_align);
- other_ptr = BFD_ALIGN (data_ptr + data, 1 << other_align);
-
- /* Fill in some fields in the header for which we now have the
- information. */
- nlm_fixed_header (abfd)->codeImageOffset = text_ptr;
- nlm_fixed_header (abfd)->codeImageSize = text;
- nlm_fixed_header (abfd)->dataImageOffset = data_ptr;
- nlm_fixed_header (abfd)->dataImageSize = data;
- nlm_fixed_header (abfd)->uninitializedDataSize = bss;
-
- for (sec = abfd->sections; sec != NULL; sec = sec->next)
- {
- flagword f;
-
- f = bfd_get_section_flags (abfd, sec);
-
- if (f & SEC_CODE)
- {
- sec->filepos = text_ptr;
- text_ptr += sec->size;
- }
- else if (f & SEC_DATA)
- {
- sec->filepos = data_ptr;
- data_ptr += sec->size;
- }
- else if (f & SEC_HAS_CONTENTS)
- {
- sec->filepos = other_ptr;
- other_ptr += sec->size;
- }
- }
-
- nlm_fixed_header (abfd)->relocationFixupOffset = other_ptr;
-
- /* Move all common symbols into the .bss section. */
-
- sym_ptr_ptr = bfd_get_outsymbols (abfd);
- if (sym_ptr_ptr != NULL)
- {
- asymbol **sym_end;
- bfd_vma add;
-
- sym_end = sym_ptr_ptr + bfd_get_symcount (abfd);
- add = 0;
- for (; sym_ptr_ptr < sym_end; sym_ptr_ptr++)
- {
- asymbol *sym;
- bfd_vma size;
-
- sym = *sym_ptr_ptr;
-
- if (!bfd_is_com_section (bfd_get_section (sym)))
- continue;
-
- /* Put the common symbol in the .bss section, and increase
- the size of the .bss section by the size of the common
- symbol (which is the old value of the symbol). */
- sym->section = bss_sec;
- size = sym->value;
- sym->value = bss_sec->size + add;
- add += size;
- add = BFD_ALIGN (add, 1 << bss_sec->alignment_power);
- }
- if (add != 0)
- {
- if (nlm_no_uninitialized_data (abfd))
- {
- /* We could handle this case, but so far it hasn't been
- necessary. */
- abort ();
- }
- nlm_fixed_header (abfd)->uninitializedDataSize += add;
- bss_sec->size += add;
- }
- }
-
- return TRUE;
-}
-
-/* Set the contents of a section. To do this we need to know where
- the section is going to be located in the output file. That means
- that the sizes of all the sections must be set, and all the
- variable size header information must be known. */
-
-bfd_boolean
-nlm_set_section_contents (bfd *abfd,
- asection *section,
- const void * location,
- file_ptr offset,
- bfd_size_type count)
-{
- if (! abfd->output_has_begun
- && ! nlm_compute_section_file_positions (abfd))
- return FALSE;
-
- if (count == 0)
- return TRUE;
-
- /* i386 NetWare has a very restricted set of relocs. In order for
- objcopy to work, the NLM i386 backend needs a chance to rework
- the section contents so that its set of relocs will work. If all
- the relocs are already acceptable, this will not do anything. */
- if (section->reloc_count != 0)
- {
- bfd_boolean (*mangle_relocs_func)
- (bfd *, asection *, const void *, bfd_vma, bfd_size_type);
-
- mangle_relocs_func = nlm_mangle_relocs_func (abfd);
- if (mangle_relocs_func != NULL)
- {
- if (!(*mangle_relocs_func) (abfd, section, location,
- (bfd_vma) offset, count))
- return FALSE;
- }
- }
-
- if (bfd_seek (abfd, section->filepos + offset, SEEK_SET) != 0
- || bfd_bwrite (location, count, abfd) != count)
- return FALSE;
-
- return TRUE;
-}
-
-/* We need to sort a list of relocs associated with sections when we
- write out the external relocs. */
-
-static int
-nlm_external_reloc_compare (const void *p1, const void *p2)
-{
- const struct reloc_and_sec *r1 = (const struct reloc_and_sec *) p1;
- const struct reloc_and_sec *r2 = (const struct reloc_and_sec *) p2;
- int cmp;
-
- cmp = strcmp ((*r1->rel->sym_ptr_ptr)->name,
- (*r2->rel->sym_ptr_ptr)->name);
- if (cmp != 0)
- return cmp;
-
- /* We sort by address within symbol to make the sort more stable and
- increase the chances that different hosts will generate bit for
- bit equivalent results. */
- return (int) (r1->rel->address - r2->rel->address);
-}
-
-/* Write out an NLM file. We write out the information in this order:
- fixed header
- variable header
- auxiliary headers
- code sections
- data sections
- other sections (custom data, messages, help, shared NLM, RPC,
- module dependencies)
- relocation fixups
- external references (imports)
- public symbols (exports)
- debugging records
- This is similar to the order used by the NetWare tools; the
- difference is that NetWare puts the sections other than code, data
- and custom data at the end of the NLM. It is convenient for us to
- know where the sections are going to be before worrying about the
- size of the other information.
-
- By the time this function is called, all the section data should
- have been output using set_section_contents. Note that custom
- data, the message file, the help file, the shared NLM file, the RPC
- data, and the module dependencies are all considered to be
- sections; the caller is responsible for filling in the offset and
- length fields in the NLM headers. The relocation fixups and
- imports are both obtained from the list of relocs attached to each
- section. The exports and debugging records are obtained from the
- list of outsymbols. */
-
-bfd_boolean
-nlm_write_object_contents (bfd *abfd)
-{
- asection *sec;
- bfd_boolean (*write_import_func) (bfd *, asection *, arelent *);
- bfd_size_type external_reloc_count, internal_reloc_count, i, c;
- struct reloc_and_sec *external_relocs;
- asymbol **sym_ptr_ptr;
- file_ptr last;
- bfd_boolean (*write_prefix_func) (bfd *);
- unsigned char *fixed_header = NULL;
- file_ptr pos;
- bfd_size_type amt;
-
- fixed_header = bfd_malloc (nlm_fixed_header_size (abfd));
- if (fixed_header == NULL)
- goto error_return;
-
- if (! abfd->output_has_begun
- && ! nlm_compute_section_file_positions (abfd))
- goto error_return;
-
- /* Write out the variable length headers. */
- pos = nlm_optional_prefix_size (abfd) + nlm_fixed_header_size (abfd);
- if (bfd_seek (abfd, pos, SEEK_SET) != 0)
- goto error_return;
- if (! nlm_swap_variable_header_out (abfd)
- || ! nlm_swap_auxiliary_headers_out (abfd))
- {
- bfd_set_error (bfd_error_system_call);
- goto error_return;
- }
-
- /* A weak check on whether the section file positions were
- reasonable. */
- if (bfd_tell (abfd) > nlm_fixed_header (abfd)->codeImageOffset)
- {
- bfd_set_error (bfd_error_invalid_operation);
- goto error_return;
- }
-
- /* Advance to the relocs. */
- if (bfd_seek (abfd, nlm_fixed_header (abfd)->relocationFixupOffset,
- SEEK_SET) != 0)
- goto error_return;
-
- /* The format of the relocation entries is dependent upon the
- particular target. We use an external routine to write the reloc
- out. */
- write_import_func = nlm_write_import_func (abfd);
-
- /* Write out the internal relocation fixups. While we're looping
- over the relocs, we also count the external relocs, which is
- needed when they are written out below. */
- internal_reloc_count = 0;
- external_reloc_count = 0;
- for (sec = abfd->sections; sec != NULL; sec = sec->next)
- {
- arelent **rel_ptr_ptr, **rel_end;
-
- if (sec->reloc_count == 0)
- continue;
-
- /* We can only represent relocs within a code or data
- section. We ignore them for a debugging section. */
- if ((bfd_get_section_flags (abfd, sec) & (SEC_CODE | SEC_DATA)) == 0)
- continue;
-
- /* We need to know how to write out imports */
- if (write_import_func == NULL)
- {
- bfd_set_error (bfd_error_invalid_operation);
- goto error_return;
- }
-
- rel_ptr_ptr = sec->orelocation;
- rel_end = rel_ptr_ptr + sec->reloc_count;
- for (; rel_ptr_ptr < rel_end; rel_ptr_ptr++)
- {
- arelent *rel;
- asymbol *sym;
-
- rel = *rel_ptr_ptr;
- sym = *rel->sym_ptr_ptr;
-
- if (! bfd_is_und_section (bfd_get_section (sym)))
- {
- ++internal_reloc_count;
- if (! (*write_import_func) (abfd, sec, rel))
- goto error_return;
- }
- else
- ++external_reloc_count;
- }
- }
- nlm_fixed_header (abfd)->numberOfRelocationFixups = internal_reloc_count;
-
- /* Write out the imports (relocs against external symbols). These
- are output as a symbol name followed by all the relocs for that
- symbol, so we must first gather together all the relocs against
- external symbols and sort them. */
- amt = external_reloc_count * sizeof (struct reloc_and_sec);
- external_relocs = bfd_alloc (abfd, amt);
- if (external_relocs == NULL)
- goto error_return;
- i = 0;
- for (sec = abfd->sections; sec != NULL; sec = sec->next)
- {
- arelent **rel_ptr_ptr, **rel_end;
-
- if (sec->reloc_count == 0)
- continue;
-
- rel_ptr_ptr = sec->orelocation;
- rel_end = rel_ptr_ptr + sec->reloc_count;
- for (; rel_ptr_ptr < rel_end; rel_ptr_ptr++)
- {
- arelent *rel;
- asymbol *sym;
-
- rel = *rel_ptr_ptr;
- sym = *rel->sym_ptr_ptr;
-
- if (! bfd_is_und_section (bfd_get_section (sym)))
- continue;
-
- external_relocs[i].rel = rel;
- external_relocs[i].sec = sec;
- ++i;
- }
- }
-
- BFD_ASSERT (i == external_reloc_count);
-
- /* Sort the external relocs by name. */
- qsort (external_relocs, (size_t) external_reloc_count,
- sizeof (struct reloc_and_sec), nlm_external_reloc_compare);
-
- /* Write out the external relocs. */
- nlm_fixed_header (abfd)->externalReferencesOffset = bfd_tell (abfd);
- c = 0;
- i = 0;
- while (i < external_reloc_count)
- {
- arelent *rel;
- asymbol *sym;
- bfd_size_type j, cnt;
-
- ++c;
-
- rel = external_relocs[i].rel;
- sym = *rel->sym_ptr_ptr;
-
- cnt = 0;
- for (j = i;
- (j < external_reloc_count
- && *external_relocs[j].rel->sym_ptr_ptr == sym);
- j++)
- ++cnt;
-
- if (! (*nlm_write_external_func (abfd)) (abfd, cnt, sym,
- &external_relocs[i]))
- goto error_return;
-
- i += cnt;
- }
-
- nlm_fixed_header (abfd)->numberOfExternalReferences = c;
-
- /* Write out the public symbols (exports). */
- sym_ptr_ptr = bfd_get_outsymbols (abfd);
- if (sym_ptr_ptr != NULL)
- {
- bfd_vma (*get_public_offset_func) (bfd *, asymbol *);
- bfd_boolean (*write_export_func) (bfd *, asymbol *, bfd_vma);
-
- asymbol **sym_end;
-
- nlm_fixed_header (abfd)->publicsOffset = bfd_tell (abfd);
- get_public_offset_func = nlm_get_public_offset_func (abfd);
- write_export_func = nlm_write_export_func (abfd);
- c = 0;
- sym_end = sym_ptr_ptr + bfd_get_symcount (abfd);
- for (; sym_ptr_ptr < sym_end; sym_ptr_ptr++)
- {
- asymbol *sym;
- bfd_byte len;
- bfd_vma offset;
- bfd_byte temp[NLM_TARGET_LONG_SIZE];
-
- sym = *sym_ptr_ptr;
-
- if ((sym->flags & (BSF_EXPORT | BSF_GLOBAL)) == 0
- || bfd_is_und_section (bfd_get_section (sym)))
- continue;
-
- ++c;
-
- if (get_public_offset_func)
- {
- /* Most backends can use the code below, but
- unfortunately some use a different scheme. */
- offset = (*get_public_offset_func) (abfd, sym);
- }
- else
- {
- offset = bfd_asymbol_value (sym);
- sec = sym->section;
- if (sec->flags & SEC_CODE)
- {
- offset -= nlm_get_text_low (abfd);
- offset |= NLM_HIBIT;
- }
- else if (sec->flags & (SEC_DATA | SEC_ALLOC))
- {
- /* SEC_ALLOC is for the .bss section. */
- offset -= nlm_get_data_low (abfd);
- }
- else
- {
- /* We can't handle an exported symbol that is not in
- the code or data segment. */
- bfd_set_error (bfd_error_invalid_operation);
- goto error_return;
- }
- }
-
- if (write_export_func)
- {
- if (! (*write_export_func) (abfd, sym, offset))
- goto error_return;
- }
- else
- {
- len = strlen (sym->name);
- if ((bfd_bwrite (&len, (bfd_size_type) sizeof (bfd_byte), abfd)
- != sizeof (bfd_byte))
- || bfd_bwrite (sym->name, (bfd_size_type) len, abfd) != len)
- goto error_return;
-
- put_word (abfd, offset, temp);
- if (bfd_bwrite (temp, (bfd_size_type) sizeof (temp), abfd)
- != sizeof (temp))
- goto error_return;
- }
- }
- nlm_fixed_header (abfd)->numberOfPublics = c;
-
- /* Write out the debugging records. The NLM conversion program
- wants to be able to inhibit this, so as a special hack if
- debugInfoOffset is set to -1 we don't write any debugging
- information. This can not be handled by fiddling with the
- symbol table, because exported symbols appear in both the
- exported symbol list and the debugging information. */
- if (nlm_fixed_header (abfd)->debugInfoOffset == (file_ptr) - 1)
- {
- nlm_fixed_header (abfd)->debugInfoOffset = 0;
- nlm_fixed_header (abfd)->numberOfDebugRecords = 0;
- }
- else
- {
- nlm_fixed_header (abfd)->debugInfoOffset = bfd_tell (abfd);
- c = 0;
- sym_ptr_ptr = bfd_get_outsymbols (abfd);
- sym_end = sym_ptr_ptr + bfd_get_symcount (abfd);
- for (; sym_ptr_ptr < sym_end; sym_ptr_ptr++)
- {
- asymbol *sym;
- bfd_byte type, len;
- bfd_vma offset;
- bfd_byte temp[NLM_TARGET_LONG_SIZE];
-
- sym = *sym_ptr_ptr;
-
- /* The NLM notion of a debugging symbol is actually what
- BFD calls a local or global symbol. What BFD calls a
- debugging symbol NLM does not understand at all. */
- if ((sym->flags & (BSF_LOCAL | BSF_GLOBAL | BSF_EXPORT)) == 0
- || (sym->flags & BSF_DEBUGGING) != 0
- || bfd_is_und_section (bfd_get_section (sym)))
- continue;
-
- ++c;
-
- offset = bfd_asymbol_value (sym);
- sec = sym->section;
- if (sec->flags & SEC_CODE)
- {
- offset -= nlm_get_text_low (abfd);
- type = 1;
- }
- else if (sec->flags & (SEC_DATA | SEC_ALLOC))
- {
- /* SEC_ALLOC is for the .bss section. */
- offset -= nlm_get_data_low (abfd);
- type = 0;
- }
- else
- type = 2;
-
- /* The type is 0 for data, 1 for code, 2 for absolute. */
- if (bfd_bwrite (&type, (bfd_size_type) sizeof (bfd_byte), abfd)
- != sizeof (bfd_byte))
- goto error_return;
-
- put_word (abfd, offset, temp);
- if (bfd_bwrite (temp, (bfd_size_type) sizeof (temp), abfd)
- != sizeof (temp))
- goto error_return;
-
- len = strlen (sym->name);
- if ((bfd_bwrite (&len, (bfd_size_type) sizeof (bfd_byte), abfd)
- != sizeof (bfd_byte))
- || bfd_bwrite (sym->name, (bfd_size_type) len, abfd) != len)
- goto error_return;
- }
- nlm_fixed_header (abfd)->numberOfDebugRecords = c;
- }
- }
-
- /* NLMLINK fills in offset values even if there is no data, so we do
- the same. */
- last = bfd_tell (abfd);
- if (nlm_fixed_header (abfd)->codeImageOffset == 0)
- nlm_fixed_header (abfd)->codeImageOffset = last;
- if (nlm_fixed_header (abfd)->dataImageOffset == 0)
- nlm_fixed_header (abfd)->dataImageOffset = last;
- if (nlm_fixed_header (abfd)->customDataOffset == 0)
- nlm_fixed_header (abfd)->customDataOffset = last;
- if (nlm_fixed_header (abfd)->moduleDependencyOffset == 0)
- nlm_fixed_header (abfd)->moduleDependencyOffset = last;
- if (nlm_fixed_header (abfd)->relocationFixupOffset == 0)
- nlm_fixed_header (abfd)->relocationFixupOffset = last;
- if (nlm_fixed_header (abfd)->externalReferencesOffset == 0)
- nlm_fixed_header (abfd)->externalReferencesOffset = last;
- if (nlm_fixed_header (abfd)->publicsOffset == 0)
- nlm_fixed_header (abfd)->publicsOffset = last;
- if (nlm_fixed_header (abfd)->debugInfoOffset == 0)
- nlm_fixed_header (abfd)->debugInfoOffset = last;
-
- /* At this point everything has been written out except the fixed
- header. */
- memcpy (nlm_fixed_header (abfd)->signature, nlm_signature (abfd),
- NLM_SIGNATURE_SIZE);
- nlm_fixed_header (abfd)->version = NLM_HEADER_VERSION;
- nlm_fixed_header (abfd)->codeStartOffset =
- (bfd_get_start_address (abfd)
- - nlm_get_text_low (abfd));
-
- /* We have no convenient way for the caller to pass in the exit
- procedure or the check unload procedure, so the caller must set
- the values in the header to the values of the symbols. */
- nlm_fixed_header (abfd)->exitProcedureOffset -= nlm_get_text_low (abfd);
- if (nlm_fixed_header (abfd)->checkUnloadProcedureOffset != 0)
- nlm_fixed_header (abfd)->checkUnloadProcedureOffset -=
- nlm_get_text_low (abfd);
-
- if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0)
- goto error_return;
-
- write_prefix_func = nlm_write_prefix_func (abfd);
- if (write_prefix_func)
- {
- if (! (*write_prefix_func) (abfd))
- goto error_return;
- }
-
- BFD_ASSERT ((bfd_size_type) bfd_tell (abfd)
- == nlm_optional_prefix_size (abfd));
-
- nlm_swap_fixed_header_out (abfd, nlm_fixed_header (abfd), fixed_header);
- if (bfd_bwrite (fixed_header, nlm_fixed_header_size (abfd), abfd)
- != nlm_fixed_header_size (abfd))
- goto error_return;
-
- if (fixed_header != NULL)
- free (fixed_header);
- return TRUE;
-
-error_return:
- if (fixed_header != NULL)
- free (fixed_header);
- return FALSE;
-}
diff --git a/bfd/nlmswap.h b/bfd/nlmswap.h
deleted file mode 100644
index 3884d77..0000000
--- a/bfd/nlmswap.h
+++ /dev/null
@@ -1,153 +0,0 @@
-/* NLM (NetWare Loadable Module) swapping routines for BFD.
- Copyright (C) 1993-2018 Free Software Foundation, Inc.
-
- Written by Fred Fish @ Cygnus Support, using ELF support as the
- template.
-
- 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. */
-
-
-/* Although this is a header file, it defines functions. It is
- included by NLM backends to define swapping functions that vary
- from one NLM to another. The backend code must arrange for
- Nlm_External_xxxx to be defined appropriately, and can then include
- this file to get the swapping routines.
-
- At the moment this is only needed for one structure, the fixed NLM
- file header. */
-
-/* Translate an NLM fixed length file header in external format into an NLM
- file header in internal format. */
-
-static void
-nlm_swap_fixed_header_in (bfd *abfd,
- void * realsrc,
- Nlm_Internal_Fixed_Header *dst)
-{
- Nlm_External_Fixed_Header *src = (Nlm_External_Fixed_Header *) realsrc;
-
- memcpy (dst->signature, src->signature, NLM_SIGNATURE_SIZE);
- memcpy (dst->moduleName, src->moduleName, NLM_MODULE_NAME_SIZE);
- dst->version =
- H_GET_32 (abfd, src->version);
- dst->codeImageOffset =
- H_GET_32 (abfd, src->codeImageOffset);
- dst->codeImageSize =
- H_GET_32 (abfd, src->codeImageSize);
- dst->dataImageOffset =
- H_GET_32 (abfd, src->dataImageOffset);
- dst->dataImageSize =
- H_GET_32 (abfd, src->dataImageSize);
- dst->uninitializedDataSize =
- H_GET_32 (abfd, src->uninitializedDataSize);
- dst->customDataOffset =
- H_GET_32 (abfd, src->customDataOffset);
- dst->customDataSize =
- H_GET_32 (abfd, src->customDataSize);
- dst->moduleDependencyOffset =
- H_GET_32 (abfd, src->moduleDependencyOffset);
- dst->numberOfModuleDependencies =
- H_GET_32 (abfd, src->numberOfModuleDependencies);
- dst->relocationFixupOffset =
- H_GET_32 (abfd, src->relocationFixupOffset);
- dst->numberOfRelocationFixups =
- H_GET_32 (abfd, src->numberOfRelocationFixups);
- dst->externalReferencesOffset =
- H_GET_32 (abfd, src->externalReferencesOffset);
- dst->numberOfExternalReferences =
- H_GET_32 (abfd, src->numberOfExternalReferences);
- dst->publicsOffset =
- H_GET_32 (abfd, src->publicsOffset);
- dst->numberOfPublics =
- H_GET_32 (abfd, src->numberOfPublics);
- dst->debugInfoOffset =
- H_GET_32 (abfd, src->debugInfoOffset);
- dst->numberOfDebugRecords =
- H_GET_32 (abfd, src->numberOfDebugRecords);
- dst->codeStartOffset =
- H_GET_32 (abfd, src->codeStartOffset);
- dst->exitProcedureOffset =
- H_GET_32 (abfd, src->exitProcedureOffset);
- dst->checkUnloadProcedureOffset =
- H_GET_32 (abfd, src->checkUnloadProcedureOffset);
- dst->moduleType =
- H_GET_32 (abfd, src->moduleType);
- dst->flags =
- H_GET_32 (abfd, src->flags);
-}
-
-/* Translate an NLM fixed length file header in internal format into
- an NLM file header in external format. */
-
-static void
-nlm_swap_fixed_header_out (bfd *abfd,
- Nlm_Internal_Fixed_Header *src,
- void * realdst)
-{
- Nlm_External_Fixed_Header *dst = (Nlm_External_Fixed_Header *) realdst;
-
- memset (dst, 0, sizeof *dst);
- memcpy (dst->signature, src->signature, NLM_SIGNATURE_SIZE);
- memcpy (dst->moduleName, src->moduleName, NLM_MODULE_NAME_SIZE);
- H_PUT_32 (abfd, src->version,
- dst->version);
- H_PUT_32 (abfd, src->codeImageOffset,
- dst->codeImageOffset);
- H_PUT_32 (abfd, src->codeImageSize,
- dst->codeImageSize);
- H_PUT_32 (abfd, src->dataImageOffset,
- dst->dataImageOffset);
- H_PUT_32 (abfd, src->dataImageSize,
- dst->dataImageSize);
- H_PUT_32 (abfd, src->uninitializedDataSize,
- dst->uninitializedDataSize);
- H_PUT_32 (abfd, src->customDataOffset,
- dst->customDataOffset);
- H_PUT_32 (abfd, src->customDataSize,
- dst->customDataSize);
- H_PUT_32 (abfd, src->moduleDependencyOffset,
- dst->moduleDependencyOffset);
- H_PUT_32 (abfd, src->numberOfModuleDependencies,
- dst->numberOfModuleDependencies);
- H_PUT_32 (abfd, src->relocationFixupOffset,
- dst->relocationFixupOffset);
- H_PUT_32 (abfd, src->numberOfRelocationFixups,
- dst->numberOfRelocationFixups);
- H_PUT_32 (abfd, src->externalReferencesOffset,
- dst->externalReferencesOffset);
- H_PUT_32 (abfd, src->numberOfExternalReferences,
- dst->numberOfExternalReferences);
- H_PUT_32 (abfd, src->publicsOffset,
- dst->publicsOffset);
- H_PUT_32 (abfd, src->numberOfPublics,
- dst->numberOfPublics);
- H_PUT_32 (abfd, src->debugInfoOffset,
- dst->debugInfoOffset);
- H_PUT_32 (abfd, src->numberOfDebugRecords,
- dst->numberOfDebugRecords);
- H_PUT_32 (abfd, src->codeStartOffset,
- dst->codeStartOffset);
- H_PUT_32 (abfd, src->exitProcedureOffset,
- dst->exitProcedureOffset);
- H_PUT_32 (abfd, src->checkUnloadProcedureOffset,
- dst->checkUnloadProcedureOffset);
- H_PUT_32 (abfd, src->moduleType,
- dst->moduleType);
- H_PUT_32 (abfd, src->flags,
- dst->flags);
-}
diff --git a/bfd/po/SRC-POTFILES.in b/bfd/po/SRC-POTFILES.in
index afa459e..7604f72 100644
--- a/bfd/po/SRC-POTFILES.in
+++ b/bfd/po/SRC-POTFILES.in
@@ -288,7 +288,6 @@ libcoff.h
libecoff.h
libhppa.h
libieee.h
-libnlm.h
liboasys.h
libpei.h
libxcoff.h
@@ -311,16 +310,6 @@ mmo.c
netbsd-core.c
netbsd.h
newsos3.c
-nlm-target.h
-nlm.c
-nlm32-alpha.c
-nlm32-i386.c
-nlm32-ppc.c
-nlm32-sparc.c
-nlm32.c
-nlm64.c
-nlmcode.h
-nlmswap.h
ns32k.h
ns32knetbsd.c
oasys.c
diff --git a/bfd/targets.c b/bfd/targets.c
index 34169c5..c5ebcd6 100644
--- a/bfd/targets.c
+++ b/bfd/targets.c
@@ -152,7 +152,6 @@ DESCRIPTION
. bfd_target_xcoff_flavour,
. bfd_target_elf_flavour,
. bfd_target_ieee_flavour,
-. bfd_target_nlm_flavour,
. bfd_target_oasys_flavour,
. bfd_target_tekhex_flavour,
. bfd_target_srec_flavour,
@@ -594,7 +593,6 @@ extern const bfd_target aarch64_mach_o_vec;
extern const bfd_target alpha_ecoff_le_vec;
extern const bfd_target alpha_elf64_vec;
extern const bfd_target alpha_elf64_fbsd_vec;
-extern const bfd_target alpha_nlm32_vec;
extern const bfd_target alpha_vms_vec;
extern const bfd_target alpha_vms_lib_txt_vec;
extern const bfd_target am33_elf32_linux_vec;
@@ -681,7 +679,6 @@ extern const bfd_target i386_elf32_sol2_vec;
extern const bfd_target i386_elf32_vxworks_vec;
extern const bfd_target i386_mach_o_vec;
extern const bfd_target i386_msdos_vec;
-extern const bfd_target i386_nlm32_vec;
extern const bfd_target i386_pe_vec;
extern const bfd_target i386_pei_vec;
extern const bfd_target iamcu_elf32_vec;
@@ -799,7 +796,6 @@ extern const bfd_target powerpc_elf32_vxworks_vec;
extern const bfd_target powerpc_elf64_vec;
extern const bfd_target powerpc_elf64_le_vec;
extern const bfd_target powerpc_elf64_fbsd_vec;
-extern const bfd_target powerpc_nlm32_vec;
extern const bfd_target powerpc_pe_vec;
extern const bfd_target powerpc_pe_le_vec;
extern const bfd_target powerpc_pei_vec;
@@ -861,7 +857,6 @@ extern const bfd_target sparc_elf32_vxworks_vec;
extern const bfd_target sparc_elf64_vec;
extern const bfd_target sparc_elf64_fbsd_vec;
extern const bfd_target sparc_elf64_sol2_vec;
-extern const bfd_target sparc_nlm32_vec;
extern const bfd_target spu_elf32_vec;
extern const bfd_target sym_vec;
extern const bfd_target tic30_aout_vec;
@@ -977,7 +972,6 @@ static const bfd_target * const _bfd_target_vector[] =
&alpha_ecoff_le_vec,
&alpha_elf64_vec,
&alpha_elf64_fbsd_vec,
- &alpha_nlm32_vec,
&alpha_vms_vec,
#endif
&alpha_vms_lib_txt_vec,
@@ -1111,7 +1105,6 @@ static const bfd_target * const _bfd_target_vector[] =
&i386_elf32_vxworks_vec,
&i386_mach_o_vec,
&i386_msdos_vec,
- &i386_nlm32_vec,
&i386_pe_vec,
&i386_pei_vec,
@@ -1291,7 +1284,6 @@ static const bfd_target * const _bfd_target_vector[] =
&powerpc_elf64_le_vec,
&powerpc_elf64_fbsd_vec,
#endif
- &powerpc_nlm32_vec,
&powerpc_pe_vec,
&powerpc_pe_le_vec,
&powerpc_pei_vec,
@@ -1376,7 +1368,6 @@ static const bfd_target * const _bfd_target_vector[] =
&sparc_elf64_fbsd_vec,
&sparc_elf64_sol2_vec,
#endif
- &sparc_nlm32_vec,
&spu_elf32_vec,
@@ -1872,7 +1863,6 @@ bfd_flavour_name (enum bfd_flavour flavour)
case bfd_target_xcoff_flavour: return "XCOFF";
case bfd_target_elf_flavour: return "ELF";
case bfd_target_ieee_flavour: return "IEEE";
- case bfd_target_nlm_flavour: return "NLM";
case bfd_target_oasys_flavour: return "Oasys";
case bfd_target_tekhex_flavour: return "Tekhex";
case bfd_target_srec_flavour: return "Srec";
diff --git a/binutils/.gitignore b/binutils/.gitignore
index 1934ea0..321aa29 100644
--- a/binutils/.gitignore
+++ b/binutils/.gitignore
@@ -6,7 +6,6 @@
/dlltool
/dllwrap
/elfedit
-/nlmconv
/nm-new
/objcopy
/objdump
@@ -29,8 +28,6 @@
/defparse.h
/mcparse.c
/mcparse.h
-/nlmheader.c
-/nlmheader.h
/rcparse.c
/rcparse.h
/sysinfo.c
@@ -45,7 +42,6 @@
/doc/cxxfilt.man
/doc/dlltool.1
/doc/elfedit.1
-/doc/nlmconv.1
/doc/nm.1
/doc/objcopy.1
/doc/objdump.1
diff --git a/binutils/ChangeLog b/binutils/ChangeLog
index ba26a67..92db71b 100644
--- a/binutils/ChangeLog
+++ b/binutils/ChangeLog
@@ -1,5 +1,21 @@
2018-04-16 Alan Modra <amodra@gmail.com>
+ * .gitignore: Remove netware support.
+ * Makefile.am: Likewise.
+ * configure.ac: Likewise.
+ * doc/Makefile.am: Likewise.
+ * doc/binutils.texi: Likewise.
+ * testsuite/binutils-all/nm.exp: Likewise.
+ * nlmconv.c: Delete.
+ * nlmconv.h: Delete.
+ * nlmheader.y: Delete.
+ * Makefile.in: Regenerate.
+ * configure: Regenerate.
+ * doc/Makefile.in: Regenerate.
+ * po/POTFILES.in: Regenerate.
+
+2018-04-16 Alan Modra <amodra@gmail.com>
+
* testsuite/binutils-all/objdump.exp: Remove tahoe support.
2018-04-14 Alan Modra <amodra@gmail.com>
diff --git a/binutils/Makefile.am b/binutils/Makefile.am
index 84cef69..ffcaf82 100644
--- a/binutils/Makefile.am
+++ b/binutils/Makefile.am
@@ -78,7 +78,6 @@ DEMANGLER_PROG=cxxfilt
ADDR2LINE_PROG=addr2line
-NLMCONV_PROG=nlmconv
DLLTOOL_PROG=dlltool
WINDRES_PROG=windres
WINDMC_PROG=windmc
@@ -86,7 +85,7 @@ DLLWRAP_PROG=dllwrap
SRCONV_PROG=srconv$(EXEEXT) sysdump$(EXEEXT) coffdump$(EXEEXT)
-bin_PROGRAMS = $(SIZE_PROG) $(OBJDUMP_PROG) $(AR_PROG) $(STRINGS_PROG) $(RANLIB_PROG) $(OBJCOPY_PROG) @BUILD_NLMCONV@ @BUILD_SRCONV@ @BUILD_DLLTOOL@ @BUILD_WINDRES@ @BUILD_WINDMC@ $(ADDR2LINE_PROG) $(READELF_PROG) $(ELFEDIT_PROG) @BUILD_DLLWRAP@
+bin_PROGRAMS = $(SIZE_PROG) $(OBJDUMP_PROG) $(AR_PROG) $(STRINGS_PROG) $(RANLIB_PROG) $(OBJCOPY_PROG) @BUILD_SRCONV@ @BUILD_DLLTOOL@ @BUILD_WINDRES@ @BUILD_WINDMC@ $(ADDR2LINE_PROG) $(READELF_PROG) $(ELFEDIT_PROG) @BUILD_DLLWRAP@
bin_SCRIPTS = @BUILD_INSTALL_MISC@
EXTRA_SCRIPTS = embedspu
@@ -102,7 +101,7 @@ TEST_PROGS = $(BFDTEST1_PROG) $(BFDTEST2_PROG)
RENAMED_PROGS = $(NM_PROG) $(STRIP_PROG) $(DEMANGLER_PROG)
noinst_PROGRAMS = $(RENAMED_PROGS) $(TEST_PROGS) @BUILD_MISC@
-EXTRA_PROGRAMS = $(NLMCONV_PROG) srconv sysdump coffdump $(DLLTOOL_PROG) $(WINDRES_PROG) $(WINDMC_PROG) $(DLLWRAP_PROG)
+EXTRA_PROGRAMS = srconv sysdump coffdump $(DLLTOOL_PROG) $(WINDRES_PROG) $(WINDMC_PROG) $(DLLWRAP_PROG)
# Stuff that goes in tooldir/ if appropriate.
TOOL_PROGS = nm-new strip-new ar ranlib dlltool objdump objcopy readelf
@@ -119,7 +118,7 @@ AM_CPPFLAGS = -I. -I$(srcdir) -I../bfd -I$(BFDDIR) -I$(INCDIR) \
HFILES = \
arsup.h binemul.h bucomm.h budbg.h \
- coffgrok.h debug.h dlltool.h dwarf.h elfcomm.h nlmconv.h \
+ coffgrok.h debug.h dlltool.h dwarf.h elfcomm.h \
objdump.h sysdep.h unwind-ia64.h windres.h winduni.h windint.h \
windmc.h
@@ -132,7 +131,7 @@ CFILES = \
dwarf.c debug.c dlltool.c dllwrap.c \
elfcomm.c emul_aix.c emul_vanilla.c filemode.c \
ieee.c is-ranlib.c is-strip.c maybe-ranlib.c maybe-strip.c \
- nlmconv.c nm.c not-ranlib.c not-strip.c \
+ nm.c not-ranlib.c not-strip.c \
objcopy.c objdump.c prdbg.c \
od-xcoff.c od-macho.c \
rclex.c rdcoff.c rddbg.c readelf.c rename.c \
@@ -144,7 +143,7 @@ CFILES = \
GENERATED_CFILES = \
arparse.c arlex.c sysroff.c sysinfo.c syslex.c \
- defparse.c deflex.c nlmheader.c rcparse.c mcparse.c
+ defparse.c deflex.c rcparse.c mcparse.c
DEBUG_SRCS = rddbg.c debug.c stabs.c ieee.c rdcoff.c
WRITE_DEBUG_SRCS = $(DEBUG_SRCS) wrstabs.c
@@ -216,7 +215,6 @@ strip_new_DEPENDENCIES = $(LIBINTL_DEP) $(LIBIBERTY) $(BFDLIB)
ranlib_DEPENDENCIES = $(LIBINTL_DEP) $(LIBIBERTY) $(BFDLIB)
cxxfilt_DEPENDENCIES = $(LIBINTL_DEP) $(LIBIBERTY) $(BFDLIB)
objcopy_DEPENDENCIES = $(LIBINTL_DEP) $(LIBIBERTY) $(BFDLIB)
-nlmconv_DEPENDENCIES = $(LIBINTL_DEP) $(LIBIBERTY) $(BFDLIB)
srconv_DEPENDENCIES = $(LIBINTL_DEP) $(LIBIBERTY) $(BFDLIB)
sysdump_DEPENDENCIES = $(LIBINTL_DEP) $(LIBIBERTY) $(BFDLIB)
coffdump_DEPENDENCIES = $(LIBINTL_DEP) $(LIBIBERTY) $(BFDLIB)
@@ -388,18 +386,6 @@ endif
$(COMPILE) -c `test -f deflex.c || echo $(srcdir)/`deflex.c $(NO_WERROR)
endif
-nlmheader.@OBJEXT@: nlmheader.c
-if am__fastdepCC
- $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `test -f nlmheader.c || echo $(srcdir)/`nlmheader.c $(NO_WERROR)
- mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
-else
-if AMDEP
- source='nlmheader.c' object='$@' libtool=no @AMDEPBACKSLASH@
- DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-endif
- $(COMPILE) -c `test -f nlmheader.c || echo $(srcdir)/`nlmheader.c $(NO_WERROR)
-endif
-
rcparse.@OBJEXT@: rcparse.c
if am__fastdepCC
$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `test -f rcparse.c || echo $(srcdir)/`rcparse.c $(NO_WERROR)
@@ -483,25 +469,6 @@ coffdump_SOURCES = coffdump.c coffgrok.c $(BULIBS)
sysdump_SOURCES = sysdump.c $(BULIBS)
sysdump.@OBJEXT@: sysroff.c
-# coff/sym.h and coff/ecoff.h won't be found by the automatic dependency
-# scripts, since they are only included conditionally.
-nlmconv.@OBJEXT@: nlmconv.c
-if am__fastdepCC
- ldname=`echo ld | sed '$(transform)'`; \
- $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ \
- -DLD_NAME="\"$${ldname}\"" @NLMCONV_DEFS@ $(srcdir)/nlmconv.c
- mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
-else
-if AMDEP
- source='nlmconv.c' object='$@' libtool=no @AMDEPBACKSLASH@
- DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-endif
- ldname=`echo ld | sed '$(transform)'`; \
- $(COMPILE) -c -DLD_NAME="\"$${ldname}\"" @NLMCONV_DEFS@ $(srcdir)/nlmconv.c
-endif
-
-nlmconv_SOURCES = nlmconv.c nlmheader.y $(BULIBS)
-
windres_SOURCES = windres.c resrc.c rescoff.c resbin.c rcparse.y rclex.c \
winduni.c resres.c $(BULIBS)
windres_LDADD = $(BFDLIB) $(LIBIBERTY) $(LEXLIB) $(LIBINTL) $(LIBICONV)
@@ -514,7 +481,7 @@ dllwrap_SOURCES = dllwrap.c version.c
dllwrap_LDADD = $(LIBIBERTY) $(LIBINTL)
-EXTRA_DIST = arparse.c arparse.h arlex.c nlmheader.c sysinfo.c sysinfo.h \
+EXTRA_DIST = arparse.c arparse.h arlex.c sysinfo.c sysinfo.h \
syslex.c deflex.c defparse.h defparse.c rcparse.h rcparse.c \
mcparse.h mcparse.c embedspu.sh
diff --git a/binutils/Makefile.in b/binutils/Makefile.in
index 648592c..ccecdf7 100644
--- a/binutils/Makefile.in
+++ b/binutils/Makefile.in
@@ -71,23 +71,23 @@ POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
target_triplet = @target@
-bin_PROGRAMS = $(am__EXEEXT_6) $(am__EXEEXT_7) $(am__EXEEXT_8) \
- $(am__EXEEXT_9) $(am__EXEEXT_10) $(am__EXEEXT_11) \
- @BUILD_NLMCONV@ @BUILD_SRCONV@ @BUILD_DLLTOOL@ @BUILD_WINDRES@ \
- @BUILD_WINDMC@ $(am__EXEEXT_12) $(am__EXEEXT_13) \
- $(am__EXEEXT_14) @BUILD_DLLWRAP@
-noinst_PROGRAMS = $(am__EXEEXT_18) $(am__EXEEXT_21) @BUILD_MISC@
-EXTRA_PROGRAMS = $(am__EXEEXT_1) srconv$(EXEEXT) sysdump$(EXEEXT) \
- coffdump$(EXEEXT) $(am__EXEEXT_2) $(am__EXEEXT_3) \
- $(am__EXEEXT_4) $(am__EXEEXT_5)
+bin_PROGRAMS = $(am__EXEEXT_5) $(am__EXEEXT_6) $(am__EXEEXT_7) \
+ $(am__EXEEXT_8) $(am__EXEEXT_9) $(am__EXEEXT_10) \
+ @BUILD_SRCONV@ @BUILD_DLLTOOL@ @BUILD_WINDRES@ @BUILD_WINDMC@ \
+ $(am__EXEEXT_11) $(am__EXEEXT_12) $(am__EXEEXT_13) \
+ @BUILD_DLLWRAP@ $(am__empty)
+noinst_PROGRAMS = $(am__EXEEXT_17) $(am__EXEEXT_20) @BUILD_MISC@
+EXTRA_PROGRAMS = srconv$(EXEEXT) sysdump$(EXEEXT) coffdump$(EXEEXT) \
+ $(am__EXEEXT_1) $(am__EXEEXT_2) $(am__EXEEXT_3) \
+ $(am__EXEEXT_4)
subdir = .
DIST_COMMON = NEWS README ChangeLog $(srcdir)/Makefile.in \
$(srcdir)/Makefile.am $(top_srcdir)/configure \
$(am__configure_deps) $(srcdir)/config.in \
$(srcdir)/../mkinstalldirs $(top_srcdir)/po/Make-in arparse.h \
- arparse.c arlex.c defparse.h defparse.c deflex.c nlmheader.h \
- nlmheader.c arparse.h arparse.c arlex.c mcparse.h mcparse.c \
- rcparse.h rcparse.c $(srcdir)/../depcomp $(srcdir)/../ylwrap
+ arparse.c arlex.c defparse.h defparse.c deflex.c arparse.h \
+ arparse.c arlex.c mcparse.h mcparse.c rcparse.h rcparse.c \
+ $(srcdir)/../depcomp $(srcdir)/../ylwrap
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/../bfd/acinclude.m4 \
$(top_srcdir)/../bfd/warning.m4 $(top_srcdir)/../config/acx.m4 \
@@ -117,28 +117,27 @@ mkinstalldirs = $(SHELL) $(top_srcdir)/../mkinstalldirs
CONFIG_HEADER = config.h
CONFIG_CLEAN_FILES = po/Makefile.in
CONFIG_CLEAN_VPATH_FILES =
-am__EXEEXT_1 = nlmconv$(EXEEXT)
-am__EXEEXT_2 = dlltool$(EXEEXT)
-am__EXEEXT_3 = windres$(EXEEXT)
-am__EXEEXT_4 = windmc$(EXEEXT)
-am__EXEEXT_5 = dllwrap$(EXEEXT)
-am__EXEEXT_6 = size$(EXEEXT)
-am__EXEEXT_7 = objdump$(EXEEXT)
-am__EXEEXT_8 = ar$(EXEEXT)
-am__EXEEXT_9 = strings$(EXEEXT)
-am__EXEEXT_10 = ranlib$(EXEEXT)
-am__EXEEXT_11 = objcopy$(EXEEXT)
-am__EXEEXT_12 = addr2line$(EXEEXT)
-am__EXEEXT_13 = readelf$(EXEEXT)
-am__EXEEXT_14 = elfedit$(EXEEXT)
+am__EXEEXT_1 = dlltool$(EXEEXT)
+am__EXEEXT_2 = windres$(EXEEXT)
+am__EXEEXT_3 = windmc$(EXEEXT)
+am__EXEEXT_4 = dllwrap$(EXEEXT)
+am__EXEEXT_5 = size$(EXEEXT)
+am__EXEEXT_6 = objdump$(EXEEXT)
+am__EXEEXT_7 = ar$(EXEEXT)
+am__EXEEXT_8 = strings$(EXEEXT)
+am__EXEEXT_9 = ranlib$(EXEEXT)
+am__EXEEXT_10 = objcopy$(EXEEXT)
+am__EXEEXT_11 = addr2line$(EXEEXT)
+am__EXEEXT_12 = readelf$(EXEEXT)
+am__EXEEXT_13 = elfedit$(EXEEXT)
am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(bindir)"
-am__EXEEXT_15 = nm-new$(EXEEXT)
-am__EXEEXT_16 = strip-new$(EXEEXT)
-am__EXEEXT_17 = cxxfilt$(EXEEXT)
-am__EXEEXT_18 = $(am__EXEEXT_15) $(am__EXEEXT_16) $(am__EXEEXT_17)
-am__EXEEXT_19 = bfdtest1$(EXEEXT)
-am__EXEEXT_20 = bfdtest2$(EXEEXT)
-am__EXEEXT_21 = $(am__EXEEXT_19) $(am__EXEEXT_20)
+am__EXEEXT_14 = nm-new$(EXEEXT)
+am__EXEEXT_15 = strip-new$(EXEEXT)
+am__EXEEXT_16 = cxxfilt$(EXEEXT)
+am__EXEEXT_17 = $(am__EXEEXT_14) $(am__EXEEXT_15) $(am__EXEEXT_16)
+am__EXEEXT_18 = bfdtest1$(EXEEXT)
+am__EXEEXT_19 = bfdtest2$(EXEEXT)
+am__EXEEXT_20 = $(am__EXEEXT_18) $(am__EXEEXT_19)
PROGRAMS = $(bin_PROGRAMS) $(noinst_PROGRAMS)
am__objects_1 = bucomm.$(OBJEXT) version.$(OBJEXT) filemode.$(OBJEXT)
am_addr2line_OBJECTS = addr2line.$(OBJEXT) $(am__objects_1)
@@ -171,10 +170,6 @@ am__objects_2 = elfcomm.$(OBJEXT)
am_elfedit_OBJECTS = elfedit.$(OBJEXT) version.$(OBJEXT) \
$(am__objects_2)
elfedit_OBJECTS = $(am_elfedit_OBJECTS)
-am_nlmconv_OBJECTS = nlmconv.$(OBJEXT) nlmheader.$(OBJEXT) \
- $(am__objects_1)
-nlmconv_OBJECTS = $(am_nlmconv_OBJECTS)
-nlmconv_LDADD = $(LDADD)
am_nm_new_OBJECTS = nm.$(OBJEXT) $(am__objects_1)
nm_new_OBJECTS = $(am_nm_new_OBJECTS)
nm_new_LDADD = $(LDADD)
@@ -273,11 +268,11 @@ LTYACCCOMPILE = $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
SOURCES = $(addr2line_SOURCES) $(ar_SOURCES) $(EXTRA_ar_SOURCES) \
bfdtest1.c bfdtest2.c $(coffdump_SOURCES) $(cxxfilt_SOURCES) \
$(dlltool_SOURCES) $(dllwrap_SOURCES) $(elfedit_SOURCES) \
- $(nlmconv_SOURCES) $(nm_new_SOURCES) $(objcopy_SOURCES) \
- $(objdump_SOURCES) $(EXTRA_objdump_SOURCES) $(ranlib_SOURCES) \
- $(readelf_SOURCES) $(size_SOURCES) $(srconv_SOURCES) \
- $(strings_SOURCES) $(strip_new_SOURCES) $(sysdump_SOURCES) \
- $(windmc_SOURCES) $(windres_SOURCES)
+ $(nm_new_SOURCES) $(objcopy_SOURCES) $(objdump_SOURCES) \
+ $(EXTRA_objdump_SOURCES) $(ranlib_SOURCES) $(readelf_SOURCES) \
+ $(size_SOURCES) $(srconv_SOURCES) $(strings_SOURCES) \
+ $(strip_new_SOURCES) $(sysdump_SOURCES) $(windmc_SOURCES) \
+ $(windres_SOURCES)
RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
html-recursive info-recursive install-data-recursive \
install-dvi-recursive install-exec-recursive \
@@ -311,7 +306,6 @@ BUILD_DLLTOOL = @BUILD_DLLTOOL@
BUILD_DLLWRAP = @BUILD_DLLWRAP@
BUILD_INSTALL_MISC = @BUILD_INSTALL_MISC@
BUILD_MISC = @BUILD_MISC@
-BUILD_NLMCONV = @BUILD_NLMCONV@
BUILD_SRCONV = @BUILD_SRCONV@
BUILD_WINDMC = @BUILD_WINDMC@
BUILD_WINDRES = @BUILD_WINDRES@
@@ -372,7 +366,6 @@ MKDIR_P = @MKDIR_P@
MKINSTALLDIRS = @MKINSTALLDIRS@
MSGFMT = @MSGFMT@
MSGMERGE = @MSGMERGE@
-NLMCONV_DEFS = @NLMCONV_DEFS@
NM = @NM@
NMEDIT = @NMEDIT@
NO_WERROR = @NO_WERROR@
@@ -501,7 +494,6 @@ OBJDUMP_PROG = objdump
# Note: This one is used as the installed name too, unlike the above.
DEMANGLER_PROG = cxxfilt
ADDR2LINE_PROG = addr2line
-NLMCONV_PROG = nlmconv
DLLTOOL_PROG = dlltool
WINDRES_PROG = windres
WINDMC_PROG = windmc
@@ -527,7 +519,7 @@ AM_CPPFLAGS = -I. -I$(srcdir) -I../bfd -I$(BFDDIR) -I$(INCDIR) \
HFILES = \
arsup.h binemul.h bucomm.h budbg.h \
- coffgrok.h debug.h dlltool.h dwarf.h elfcomm.h nlmconv.h \
+ coffgrok.h debug.h dlltool.h dwarf.h elfcomm.h \
objdump.h sysdep.h unwind-ia64.h windres.h winduni.h windint.h \
windmc.h
@@ -539,7 +531,7 @@ CFILES = \
dwarf.c debug.c dlltool.c dllwrap.c \
elfcomm.c emul_aix.c emul_vanilla.c filemode.c \
ieee.c is-ranlib.c is-strip.c maybe-ranlib.c maybe-strip.c \
- nlmconv.c nm.c not-ranlib.c not-strip.c \
+ nm.c not-ranlib.c not-strip.c \
objcopy.c objdump.c prdbg.c \
od-xcoff.c od-macho.c \
rclex.c rdcoff.c rddbg.c readelf.c rename.c \
@@ -551,7 +543,7 @@ CFILES = \
GENERATED_CFILES = \
arparse.c arlex.c sysroff.c sysinfo.c syslex.c \
- defparse.c deflex.c nlmheader.c rcparse.c mcparse.c
+ defparse.c deflex.c rcparse.c mcparse.c
DEBUG_SRCS = rddbg.c debug.c stabs.c ieee.c rdcoff.c
WRITE_DEBUG_SRCS = $(DEBUG_SRCS) wrstabs.c
@@ -595,7 +587,6 @@ strip_new_DEPENDENCIES = $(LIBINTL_DEP) $(LIBIBERTY) $(BFDLIB)
ranlib_DEPENDENCIES = $(LIBINTL_DEP) $(LIBIBERTY) $(BFDLIB)
cxxfilt_DEPENDENCIES = $(LIBINTL_DEP) $(LIBIBERTY) $(BFDLIB)
objcopy_DEPENDENCIES = $(LIBINTL_DEP) $(LIBIBERTY) $(BFDLIB)
-nlmconv_DEPENDENCIES = $(LIBINTL_DEP) $(LIBIBERTY) $(BFDLIB)
srconv_DEPENDENCIES = $(LIBINTL_DEP) $(LIBIBERTY) $(BFDLIB)
sysdump_DEPENDENCIES = $(LIBINTL_DEP) $(LIBIBERTY) $(BFDLIB)
coffdump_DEPENDENCIES = $(LIBINTL_DEP) $(LIBIBERTY) $(BFDLIB)
@@ -637,7 +628,6 @@ dlltool_SOURCES = dlltool.c defparse.y deflex.l $(BULIBS)
dlltool_LDADD = $(BFDLIB) $(LIBIBERTY) $(LEXLIB) $(LIBINTL)
coffdump_SOURCES = coffdump.c coffgrok.c $(BULIBS)
sysdump_SOURCES = sysdump.c $(BULIBS)
-nlmconv_SOURCES = nlmconv.c nlmheader.y $(BULIBS)
windres_SOURCES = windres.c resrc.c rescoff.c resbin.c rcparse.y rclex.c \
winduni.c resres.c $(BULIBS)
@@ -648,7 +638,7 @@ windmc_SOURCES = windmc.c mcparse.y mclex.c \
windmc_LDADD = $(BFDLIB) $(LIBIBERTY) $(LEXLIB) $(LIBINTL) $(LIBICONV)
dllwrap_SOURCES = dllwrap.c version.c
dllwrap_LDADD = $(LIBIBERTY) $(LIBINTL)
-EXTRA_DIST = arparse.c arparse.h arlex.c nlmheader.c sysinfo.c sysinfo.h \
+EXTRA_DIST = arparse.c arparse.h arlex.c sysinfo.c sysinfo.h \
syslex.c deflex.c defparse.h defparse.c rcparse.h rcparse.c \
mcparse.h mcparse.c embedspu.sh
@@ -803,12 +793,6 @@ dllwrap$(EXEEXT): $(dllwrap_OBJECTS) $(dllwrap_DEPENDENCIES) $(EXTRA_dllwrap_DEP
elfedit$(EXEEXT): $(elfedit_OBJECTS) $(elfedit_DEPENDENCIES) $(EXTRA_elfedit_DEPENDENCIES)
@rm -f elfedit$(EXEEXT)
$(LINK) $(elfedit_OBJECTS) $(elfedit_LDADD) $(LIBS)
-nlmheader.h: nlmheader.c
- @if test ! -f $@; then rm -f nlmheader.c; else :; fi
- @if test ! -f $@; then $(MAKE) $(AM_MAKEFLAGS) nlmheader.c; else :; fi
-nlmconv$(EXEEXT): $(nlmconv_OBJECTS) $(nlmconv_DEPENDENCIES) $(EXTRA_nlmconv_DEPENDENCIES)
- @rm -f nlmconv$(EXEEXT)
- $(LINK) $(nlmconv_OBJECTS) $(nlmconv_LDADD) $(LIBS)
nm-new$(EXEEXT): $(nm_new_OBJECTS) $(nm_new_DEPENDENCIES) $(EXTRA_nm_new_DEPENDENCIES)
@rm -f nm-new$(EXEEXT)
$(LINK) $(nm_new_OBJECTS) $(nm_new_LDADD) $(LIBS)
@@ -925,8 +909,6 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/maybe-strip.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mclex.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mcparse.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nlmconv.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nlmheader.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nm.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/not-ranlib.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/not-strip.Po@am__quote@
@@ -1211,8 +1193,6 @@ maintainer-clean-generic:
-rm -f defparse.h
-rm -f mcparse.c
-rm -f mcparse.h
- -rm -f nlmheader.c
- -rm -f nlmheader.h
-rm -f rcparse.c
-rm -f rcparse.h
-test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
@@ -1428,13 +1408,6 @@ deflex.@OBJEXT@: deflex.c
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c `test -f deflex.c || echo $(srcdir)/`deflex.c $(NO_WERROR)
-nlmheader.@OBJEXT@: nlmheader.c
-@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `test -f nlmheader.c || echo $(srcdir)/`nlmheader.c $(NO_WERROR)
-@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='nlmheader.c' object='$@' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(COMPILE) -c `test -f nlmheader.c || echo $(srcdir)/`nlmheader.c $(NO_WERROR)
-
rcparse.@OBJEXT@: rcparse.c
@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `test -f rcparse.c || echo $(srcdir)/`rcparse.c $(NO_WERROR)
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@@ -1479,18 +1452,6 @@ rescoff.@OBJEXT@:
@am__fastdepCC_FALSE@ $(COMPILE) -c $(DLLTOOL_DEFS) $(srcdir)/rescoff.c
sysdump.@OBJEXT@: sysroff.c
-# coff/sym.h and coff/ecoff.h won't be found by the automatic dependency
-# scripts, since they are only included conditionally.
-nlmconv.@OBJEXT@: nlmconv.c
-@am__fastdepCC_TRUE@ ldname=`echo ld | sed '$(transform)'`; \
-@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ \
-@am__fastdepCC_TRUE@ -DLD_NAME="\"$${ldname}\"" @NLMCONV_DEFS@ $(srcdir)/nlmconv.c
-@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='nlmconv.c' object='$@' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ ldname=`echo ld | sed '$(transform)'`; \
-@am__fastdepCC_FALSE@ $(COMPILE) -c -DLD_NAME="\"$${ldname}\"" @NLMCONV_DEFS@ $(srcdir)/nlmconv.c
-
diststuff: $(EXTRA_DIST) info
all: info
mostlyclean-local:
diff --git a/binutils/configure b/binutils/configure
index 374605d..2e90d60 100755
--- a/binutils/configure
+++ b/binutils/configure
@@ -614,8 +614,6 @@ BUILD_WINDRES
DLLTOOL_DEFS
BUILD_DLLTOOL
BUILD_SRCONV
-BUILD_NLMCONV
-NLMCONV_DEFS
LTLIBICONV
LIBICONV
zlibinc
@@ -11226,7 +11224,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11229 "configure"
+#line 11227 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11332,7 +11330,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11335 "configure"
+#line 11333 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -14420,8 +14418,6 @@ _ACEOF
all_targets=false
-BUILD_NLMCONV=
-NLMCONV_DEFS=
BUILD_SRCONV=
BUILD_DLLTOOL=
DLLTOOL_DEFS=
@@ -14440,9 +14436,7 @@ for targ in $target $canon_targets
do
if test "x$targ" = "xall"; then
all_targets=true
- BUILD_NLMCONV='$(NLMCONV_PROG)$(EXEEXT)'
BUILD_SRCONV='$(SRCONV_PROG)'
- NLMCONV_DEFS="-DNLMCONV_I386 -DNLMCONV_ALPHA -DNLMCONV_POWERPC -DNLMCONV_SPARC"
BUILD_MISC="${BUILD_MISC} "'bin2c$(EXEEXT_FOR_BUILD)'
BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)'
@@ -14455,25 +14449,6 @@ do
od_vectors="$od_vectors objdump_private_desc_xcoff"
else
case $targ in
- i[3-7]86*-*-netware*)
- BUILD_NLMCONV='$(NLMCONV_PROG)$(EXEEXT)'
- NLMCONV_DEFS="$NLMCONV_DEFS -DNLMCONV_I386"
- ;;
- alpha*-*-netware*)
- BUILD_NLMCONV='$(NLMCONV_PROG)$(EXEEXT)'
- NLMCONV_DEFS="$NLMCONV_DEFS -DNLMCONV_ALPHA"
- ;;
- powerpc*-*-netware*)
- BUILD_NLMCONV='$(NLMCONV_PROG)$(EXEEXT)'
- NLMCONV_DEFS="$NLMCONV_DEFS -DNLMCONV_POWERPC"
- ;;
- sparc*-*-netware*)
- BUILD_NLMCONV='$(NLMCONV_PROG)$(EXEEXT)'
- NLMCONV_DEFS="$NLMCONV_DEFS -DNLMCONV_SPARC"
- ;;
- esac
-
- case $targ in
*-*-hms*) BUILD_SRCONV='$(SRCONV_PROG)' ;;
esac
@@ -14667,8 +14642,6 @@ OBJDUMP_DEFS="${OBJDUMP_DEFS} -DOBJDUMP_PRIVATE_VECTORS=\"${OBJDUMP_PRIVATE_VECT
-
-
cat >>confdefs.h <<_ACEOF
#define TARGET "${target}"
_ACEOF
diff --git a/binutils/configure.ac b/binutils/configure.ac
index 430192b..9e4ba6f 100644
--- a/binutils/configure.ac
+++ b/binutils/configure.ac
@@ -228,8 +228,6 @@ AC_CHECK_HEADER(iconv.h)
AM_ICONV
all_targets=false
-BUILD_NLMCONV=
-NLMCONV_DEFS=
BUILD_SRCONV=
BUILD_DLLTOOL=
DLLTOOL_DEFS=
@@ -248,9 +246,7 @@ for targ in $target $canon_targets
do
if test "x$targ" = "xall"; then
all_targets=true
- BUILD_NLMCONV='$(NLMCONV_PROG)$(EXEEXT)'
BUILD_SRCONV='$(SRCONV_PROG)'
- NLMCONV_DEFS="-DNLMCONV_I386 -DNLMCONV_ALPHA -DNLMCONV_POWERPC -DNLMCONV_SPARC"
BUILD_MISC="${BUILD_MISC} "'bin2c$(EXEEXT_FOR_BUILD)'
BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)'
@@ -263,27 +259,6 @@ do
od_vectors="$od_vectors objdump_private_desc_xcoff"
else
case $targ in
-changequote(,)dnl
- i[3-7]86*-*-netware*)
-changequote([,])dnl
- BUILD_NLMCONV='$(NLMCONV_PROG)$(EXEEXT)'
- NLMCONV_DEFS="$NLMCONV_DEFS -DNLMCONV_I386"
- ;;
- alpha*-*-netware*)
- BUILD_NLMCONV='$(NLMCONV_PROG)$(EXEEXT)'
- NLMCONV_DEFS="$NLMCONV_DEFS -DNLMCONV_ALPHA"
- ;;
- powerpc*-*-netware*)
- BUILD_NLMCONV='$(NLMCONV_PROG)$(EXEEXT)'
- NLMCONV_DEFS="$NLMCONV_DEFS -DNLMCONV_POWERPC"
- ;;
- sparc*-*-netware*)
- BUILD_NLMCONV='$(NLMCONV_PROG)$(EXEEXT)'
- NLMCONV_DEFS="$NLMCONV_DEFS -DNLMCONV_SPARC"
- ;;
- esac
-
- case $targ in
*-*-hms*) BUILD_SRCONV='$(SRCONV_PROG)' ;;
esac
@@ -473,8 +448,6 @@ fi
OBJDUMP_DEFS="${OBJDUMP_DEFS} -DOBJDUMP_PRIVATE_VECTORS=\"${OBJDUMP_PRIVATE_VECTORS}\""
-AC_SUBST(NLMCONV_DEFS)
-AC_SUBST(BUILD_NLMCONV)
AC_SUBST(BUILD_SRCONV)
AC_SUBST(BUILD_DLLTOOL)
AC_SUBST(DLLTOOL_DEFS)
diff --git a/binutils/doc/Makefile.am b/binutils/doc/Makefile.am
index 0848ee5..0c108db 100644
--- a/binutils/doc/Makefile.am
+++ b/binutils/doc/Makefile.am
@@ -35,7 +35,6 @@ man_MANS = \
addr2line.1 \
ar.1 \
dlltool.1 \
- nlmconv.1 \
nm.1 \
objcopy.1 \
objdump.1 \
@@ -79,13 +78,6 @@ dlltool.1: $(binutils_TEXI) $(binutils_TEXINFOS)
mv -f $@.T$$$$ $@) || (rm -f $@.T$$$$ && exit 1)
rm -f dlltool.pod
-nlmconv.1: $(binutils_TEXI) $(binutils_TEXINFOS)
- touch $@
- -$(TEXI2POD) $(MANCONF) -Dnlmconv < $(binutils_TEXI) > nlmconv.pod
- -($(POD2MAN) nlmconv.pod | sed -e '/^.if n .na/d' > $@.T$$$$ && \
- mv -f $@.T$$$$ $@) || (rm -f $@.T$$$$ && exit 1)
- rm -f nlmconv.pod
-
nm.1: $(binutils_TEXI) $(binutils_TEXINFOS)
touch $@
-$(TEXI2POD) $(MANCONF) -Dnm < $(binutils_TEXI) > nm.pod
diff --git a/binutils/doc/Makefile.in b/binutils/doc/Makefile.in
index 705dab5..88d01d0 100644
--- a/binutils/doc/Makefile.in
+++ b/binutils/doc/Makefile.in
@@ -161,7 +161,6 @@ BUILD_DLLTOOL = @BUILD_DLLTOOL@
BUILD_DLLWRAP = @BUILD_DLLWRAP@
BUILD_INSTALL_MISC = @BUILD_INSTALL_MISC@
BUILD_MISC = @BUILD_MISC@
-BUILD_NLMCONV = @BUILD_NLMCONV@
BUILD_SRCONV = @BUILD_SRCONV@
BUILD_WINDMC = @BUILD_WINDMC@
BUILD_WINDRES = @BUILD_WINDRES@
@@ -222,7 +221,6 @@ MKDIR_P = @MKDIR_P@
MKINSTALLDIRS = @MKINSTALLDIRS@
MSGFMT = @MSGFMT@
MSGMERGE = @MSGMERGE@
-NLMCONV_DEFS = @NLMCONV_DEFS@
NM = @NM@
NMEDIT = @NMEDIT@
NO_WERROR = @NO_WERROR@
@@ -328,7 +326,6 @@ man_MANS = \
addr2line.1 \
ar.1 \
dlltool.1 \
- nlmconv.1 \
nm.1 \
objcopy.1 \
objdump.1 \
@@ -828,13 +825,6 @@ dlltool.1: $(binutils_TEXI) $(binutils_TEXINFOS)
mv -f $@.T$$$$ $@) || (rm -f $@.T$$$$ && exit 1)
rm -f dlltool.pod
-nlmconv.1: $(binutils_TEXI) $(binutils_TEXINFOS)
- touch $@
- -$(TEXI2POD) $(MANCONF) -Dnlmconv < $(binutils_TEXI) > nlmconv.pod
- -($(POD2MAN) nlmconv.pod | sed -e '/^.if n .na/d' > $@.T$$$$ && \
- mv -f $@.T$$$$ $@) || (rm -f $@.T$$$$ && exit 1)
- rm -f nlmconv.pod
-
nm.1: $(binutils_TEXI) $(binutils_TEXINFOS)
touch $@
-$(TEXI2POD) $(MANCONF) -Dnm < $(binutils_TEXI) > nm.pod
diff --git a/binutils/doc/binutils.texi b/binutils/doc/binutils.texi
index caf7f9d..c965200 100644
--- a/binutils/doc/binutils.texi
+++ b/binutils/doc/binutils.texi
@@ -34,7 +34,6 @@ section entitled ``GNU Free Documentation License''.
* c++filt: (binutils)c++filt. Filter to demangle encoded C++ symbols.
* cxxfilt: (binutils)c++filt. MS-DOS name for c++filt.
* dlltool: (binutils)dlltool. Create files needed to build and use DLLs.
-* nlmconv: (binutils)nlmconv. Converts object code into an NLM.
* nm: (binutils)nm. List symbols from object files.
* objcopy: (binutils)objcopy. Copy and translate object files.
* objdump: (binutils)objdump. Display information from object files.
@@ -121,9 +120,6 @@ Demangle encoded C++ symbols (on MS-DOS, this program is named
@item addr2line
Convert addresses into file names and line numbers
-@item nlmconv
-Convert object code into a Netware Loadable Module
-
@item windres
Manipulate Windows resources
@@ -151,7 +147,6 @@ in the section entitled ``GNU Free Documentation License''.
* c++filt:: Filter to demangle encoded C++ symbols
* cxxfilt: c++filt. MS-DOS name for c++filt
* addr2line:: Convert addresses to file and line
-* nlmconv:: Converts object code into an NLM
* windmc:: Generator for Windows message resources
* windres:: Manipulate Windows resources
* dlltool:: Create files needed to build and use DLLs
@@ -3697,111 +3692,6 @@ Info entries for @file{binutils}.
@c man end
@end ignore
-@node nlmconv
-@chapter nlmconv
-
-@command{nlmconv} converts a relocatable object file into a NetWare
-Loadable Module.
-
-@ignore
-@command{nlmconv} currently works with @samp{i386} object
-files in @code{coff}, @sc{elf}, or @code{a.out} format, and @sc{SPARC}
-object files in @sc{elf}, or @code{a.out} format@footnote{
-@command{nlmconv} should work with any @samp{i386} or @sc{sparc} object
-format in the Binary File Descriptor library. It has only been tested
-with the above formats.}.
-@end ignore
-
-@quotation
-@emph{Warning:} @command{nlmconv} is not always built as part of the binary
-utilities, since it is only useful for NLM targets.
-@end quotation
-
-@c man title nlmconv converts object code into an NLM.
-
-@smallexample
-@c man begin SYNOPSIS nlmconv
-nlmconv [@option{-I} @var{bfdname}|@option{--input-target=}@var{bfdname}]
- [@option{-O} @var{bfdname}|@option{--output-target=}@var{bfdname}]
- [@option{-T} @var{headerfile}|@option{--header-file=}@var{headerfile}]
- [@option{-d}|@option{--debug}] [@option{-l} @var{linker}|@option{--linker=}@var{linker}]
- [@option{-h}|@option{--help}] [@option{-V}|@option{--version}]
- @var{infile} @var{outfile}
-@c man end
-@end smallexample
-
-@c man begin DESCRIPTION nlmconv
-
-@command{nlmconv} converts the relocatable @samp{i386} object file
-@var{infile} into the NetWare Loadable Module @var{outfile}, optionally
-reading @var{headerfile} for NLM header information. For instructions
-on writing the NLM command file language used in header files, see the
-@samp{linkers} section, @samp{NLMLINK} in particular, of the @cite{NLM
-Development and Tools Overview}, which is part of the NLM Software
-Developer's Kit (``NLM SDK''), available from Novell, Inc.
-@command{nlmconv} uses the @sc{gnu} Binary File Descriptor library to read
-@var{infile};
-@ifclear man
-see @ref{BFD,,BFD,ld.info,Using LD}, for more information.
-@end ifclear
-
-@command{nlmconv} can perform a link step. In other words, you can list
-more than one object file for input if you list them in the definitions
-file (rather than simply specifying one input file on the command line).
-In this case, @command{nlmconv} calls the linker for you.
-
-@c man end
-
-@c man begin OPTIONS nlmconv
-
-@table @env
-@item -I @var{bfdname}
-@itemx --input-target=@var{bfdname}
-Object format of the input file. @command{nlmconv} can usually determine
-the format of a given file (so no default is necessary).
-@xref{Target Selection}, for more information.
-
-@item -O @var{bfdname}
-@itemx --output-target=@var{bfdname}
-Object format of the output file. @command{nlmconv} infers the output
-format based on the input format, e.g. for a @samp{i386} input file the
-output format is @samp{nlm32-i386}.
-@xref{Target Selection}, for more information.
-
-@item -T @var{headerfile}
-@itemx --header-file=@var{headerfile}
-Reads @var{headerfile} for NLM header information. For instructions on
-writing the NLM command file language used in header files, see@ see the
-@samp{linkers} section, of the @cite{NLM Development and Tools
-Overview}, which is part of the NLM Software Developer's Kit, available
-from Novell, Inc.
-
-@item -d
-@itemx --debug
-Displays (on standard error) the linker command line used by @command{nlmconv}.
-
-@item -l @var{linker}
-@itemx --linker=@var{linker}
-Use @var{linker} for any linking. @var{linker} can be an absolute or a
-relative pathname.
-
-@item -h
-@itemx --help
-Prints a usage summary.
-
-@item -V
-@itemx --version
-Prints the version number for @command{nlmconv}.
-@end table
-
-@c man end
-
-@ignore
-@c man begin SEEALSO nlmconv
-the Info entries for @file{binutils}.
-@c man end
-@end ignore
-
@node windmc
@chapter windmc
diff --git a/binutils/nlmconv.c b/binutils/nlmconv.c
deleted file mode 100644
index 68941f8..0000000
--- a/binutils/nlmconv.c
+++ /dev/null
@@ -1,2166 +0,0 @@
-/* nlmconv.c -- NLM conversion program
- Copyright (C) 1993-2018 Free Software Foundation, Inc.
-
- This file is part of GNU Binutils.
-
- 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. */
-
-
-/* Written by Ian Lance Taylor <ian@cygnus.com>.
-
- This program can be used to convert any appropriate object file
- into a NetWare Loadable Module (an NLM). It will accept a linker
- specification file which is identical to that accepted by the
- NetWare linker, NLMLINK. */
-
-/* AIX requires this to be the first thing in the file. */
-#ifndef __GNUC__
-# ifdef _AIX
- #pragma alloca
-#endif
-#endif
-
-#include "sysdep.h"
-#include "bfd.h"
-#include "libiberty.h"
-#include "filenames.h"
-#include "safe-ctype.h"
-
-#include "ansidecl.h"
-#include <time.h>
-#include <assert.h>
-#include "getopt.h"
-
-/* Internal BFD NLM header. */
-#include "libnlm.h"
-#include "nlmconv.h"
-
-#ifdef NLMCONV_ALPHA
-#include "coff/sym.h"
-#include "coff/ecoff.h"
-#endif
-
-#include "bucomm.h"
-
-/* If strerror is just a macro, we want to use the one from libiberty
- since it will handle undefined values. */
-#undef strerror
-extern char *strerror (int);
-
-#ifndef SEEK_SET
-#define SEEK_SET 0
-#endif
-
-#ifndef R_OK
-#define R_OK 4
-#define W_OK 2
-#define X_OK 1
-#endif
-
-/* Global variables. */
-
-/* The name used to invoke the program. */
-char *program_name;
-
-/* Local variables. */
-
-/* Whether to print out debugging information (currently just controls
- whether it prints the linker command if there is one). */
-static int debug;
-
-/* The symbol table. */
-static asymbol **symbols;
-
-/* A section we create in the output file to hold pointers to where
- the sections of the input file end up. We will put a pointer to
- this section in the NLM header. These is an entry for each input
- section. The format is
- null terminated section name
- zeroes to adjust to 4 byte boundary
- 4 byte section data file pointer
- 4 byte section size
- We don't need a version number. The way we find this information
- is by finding a stamp in the NLM header information. If we need to
- change the format of this information, we can simply change the
- stamp. */
-static asection *secsec;
-
-/* A temporary file name to be unlinked on exit. Actually, for most
- errors, we leave it around. It's not clear whether that is helpful
- or not. */
-static char *unlink_on_exit;
-
-/* The list of long options. */
-static struct option long_options[] =
-{
- { "debug", no_argument, 0, 'd' },
- { "header-file", required_argument, 0, 'T' },
- { "help", no_argument, 0, 'h' },
- { "input-target", required_argument, 0, 'I' },
- { "input-format", required_argument, 0, 'I' }, /* Obsolete */
- { "linker", required_argument, 0, 'l' },
- { "output-target", required_argument, 0, 'O' },
- { "output-format", required_argument, 0, 'O' }, /* Obsolete */
- { "version", no_argument, 0, 'V' },
- { NULL, no_argument, 0, 0 }
-};
-
-/* Local routines. */
-
-int main (int, char **);
-
-static void show_usage (FILE *, int);
-static const char *select_output_format
- (enum bfd_architecture, unsigned long, bfd_boolean);
-static void setup_sections (bfd *, asection *, void *);
-static void copy_sections (bfd *, asection *, void *);
-static void mangle_relocs
- (bfd *, asection *, arelent ***, long *, char *, bfd_size_type);
-static void default_mangle_relocs
- (bfd *, asection *, arelent ***, long *, char *, bfd_size_type);
-static char *link_inputs (struct string_list *, char *, char *);
-
-#ifdef NLMCONV_I386
-static void i386_mangle_relocs (bfd *, asection *, arelent ***, long *, char *, bfd_size_type);
-#endif
-
-#ifdef NLMCONV_ALPHA
-static void alpha_mangle_relocs (bfd *, asection *, arelent ***, long *, char *, bfd_size_type);
-#endif
-
-#ifdef NLMCONV_POWERPC
-static void powerpc_build_stubs (bfd *, bfd *, asymbol ***, long *);
-static void powerpc_resolve_stubs (bfd *, bfd *);
-static void powerpc_mangle_relocs (bfd *, asection *, arelent ***, long *, char *, bfd_size_type);
-#endif
-
-/* The main routine. */
-
-int
-main (int argc, char **argv)
-{
- int opt;
- char *input_file = NULL;
- const char *input_format = NULL;
- const char *output_format = NULL;
- const char *header_file = NULL;
- char *ld_arg = NULL;
- Nlm_Internal_Fixed_Header fixed_hdr_struct;
- Nlm_Internal_Variable_Header var_hdr_struct;
- Nlm_Internal_Version_Header version_hdr_struct;
- Nlm_Internal_Copyright_Header copyright_hdr_struct;
- Nlm_Internal_Extended_Header extended_hdr_struct;
- bfd *inbfd;
- bfd *outbfd;
- asymbol **newsyms, **outsyms;
- long symcount, newsymalloc, newsymcount;
- long symsize;
- asection *text_sec, *bss_sec, *data_sec;
- bfd_vma vma;
- bfd_size_type align;
- asymbol *endsym;
- long i;
- char inlead, outlead;
- bfd_boolean gotstart, gotexit, gotcheck;
- struct stat st;
- FILE *custom_data = NULL;
- FILE *help_data = NULL;
- FILE *message_data = NULL;
- FILE *rpc_data = NULL;
- FILE *shared_data = NULL;
- size_t custom_size = 0;
- size_t help_size = 0;
- size_t message_size = 0;
- size_t module_size = 0;
- size_t rpc_size = 0;
- asection *custom_section = NULL;
- asection *help_section = NULL;
- asection *message_section = NULL;
- asection *module_section = NULL;
- asection *rpc_section = NULL;
- asection *shared_section = NULL;
- bfd *sharedbfd;
- size_t shared_offset = 0;
- size_t shared_size = 0;
- static Nlm_Internal_Fixed_Header sharedhdr;
- int len;
- char *modname;
- char **matching;
-
-#if defined (HAVE_SETLOCALE) && defined (HAVE_LC_MESSAGES)
- setlocale (LC_MESSAGES, "");
-#endif
-#if defined (HAVE_SETLOCALE)
- setlocale (LC_CTYPE, "");
-#endif
- bindtextdomain (PACKAGE, LOCALEDIR);
- textdomain (PACKAGE);
-
- program_name = argv[0];
- xmalloc_set_program_name (program_name);
- bfd_set_error_program_name (program_name);
-
- expandargv (&argc, &argv);
-
- bfd_init ();
- set_default_bfd_target ();
-
- while ((opt = getopt_long (argc, argv, "dHhI:l:O:T:Vv", long_options,
- (int *) NULL))
- != EOF)
- {
- switch (opt)
- {
- case 'd':
- debug = 1;
- break;
- case 'H':
- case 'h':
- show_usage (stdout, 0);
- break;
- case 'I':
- input_format = optarg;
- break;
- case 'l':
- ld_arg = optarg;
- break;
- case 'O':
- output_format = optarg;
- break;
- case 'T':
- header_file = optarg;
- break;
- case 'v':
- case 'V':
- print_version ("nlmconv");
- break;
- case 0:
- break;
- default:
- show_usage (stderr, 1);
- break;
- }
- }
-
- /* The input and output files may be named on the command line. */
- output_file = NULL;
- if (optind < argc)
- {
- input_file = argv[optind];
- ++optind;
- if (optind < argc)
- {
- output_file = argv[optind];
- ++optind;
- if (optind < argc)
- show_usage (stderr, 1);
- if (filename_cmp (input_file, output_file) == 0)
- {
- fatal (_("input and output files must be different"));
- }
- }
- }
-
- /* Initialize the header information to default values. */
- fixed_hdr = &fixed_hdr_struct;
- memset ((void *) &fixed_hdr_struct, 0, sizeof fixed_hdr_struct);
- var_hdr = &var_hdr_struct;
- memset ((void *) &var_hdr_struct, 0, sizeof var_hdr_struct);
- version_hdr = &version_hdr_struct;
- memset ((void *) &version_hdr_struct, 0, sizeof version_hdr_struct);
- copyright_hdr = &copyright_hdr_struct;
- memset ((void *) &copyright_hdr_struct, 0, sizeof copyright_hdr_struct);
- extended_hdr = &extended_hdr_struct;
- memset ((void *) &extended_hdr_struct, 0, sizeof extended_hdr_struct);
- check_procedure = NULL;
- custom_file = NULL;
- debug_info = FALSE;
- exit_procedure = "_Stop";
- export_symbols = NULL;
- map_file = NULL;
- full_map = FALSE;
- help_file = NULL;
- import_symbols = NULL;
- message_file = NULL;
- modules = NULL;
- sharelib_file = NULL;
- start_procedure = "_Prelude";
- verbose = FALSE;
- rpc_file = NULL;
-
- parse_errors = 0;
-
- /* Parse the header file (if there is one). */
- if (header_file != NULL)
- {
- if (! nlmlex_file (header_file)
- || yyparse () != 0
- || parse_errors != 0)
- exit (1);
- }
-
- if (input_files != NULL)
- {
- if (input_file != NULL)
- {
- fatal (_("input file named both on command line and with INPUT"));
- }
- if (input_files->next == NULL)
- input_file = input_files->string;
- else
- input_file = link_inputs (input_files, ld_arg, map_file);
- }
- else if (input_file == NULL)
- {
- non_fatal (_("no input file"));
- show_usage (stderr, 1);
- }
-
- inbfd = bfd_openr (input_file, input_format);
- if (inbfd == NULL)
- bfd_fatal (input_file);
-
- if (! bfd_check_format_matches (inbfd, bfd_object, &matching))
- {
- bfd_nonfatal (input_file);
- if (bfd_get_error () == bfd_error_file_ambiguously_recognized)
- {
- list_matching_formats (matching);
- free (matching);
- }
- exit (1);
- }
-
- if (output_format == NULL)
- output_format = select_output_format (bfd_get_arch (inbfd),
- bfd_get_mach (inbfd),
- bfd_big_endian (inbfd));
-
- assert (output_format != NULL);
-
- /* Use the output file named on the command line if it exists.
- Otherwise use the file named in the OUTPUT statement. */
- if (output_file == NULL)
- {
- non_fatal (_("no name for output file"));
- show_usage (stderr, 1);
- }
-
- outbfd = bfd_openw (output_file, output_format);
- if (outbfd == NULL)
- bfd_fatal (output_file);
- if (! bfd_set_format (outbfd, bfd_object))
- bfd_fatal (output_file);
-
- assert (bfd_get_flavour (outbfd) == bfd_target_nlm_flavour);
-
- /* XXX: Should we accept the unknown bfd format here ? */
- if (bfd_arch_get_compatible (inbfd, outbfd, TRUE) == NULL)
- non_fatal (_("warning: input and output formats are not compatible"));
-
- /* Move the values read from the command file into outbfd. */
- *nlm_fixed_header (outbfd) = fixed_hdr_struct;
- *nlm_variable_header (outbfd) = var_hdr_struct;
- *nlm_version_header (outbfd) = version_hdr_struct;
- *nlm_copyright_header (outbfd) = copyright_hdr_struct;
- *nlm_extended_header (outbfd) = extended_hdr_struct;
-
- /* Start copying the input BFD to the output BFD. */
- if (! bfd_set_file_flags (outbfd, bfd_get_file_flags (inbfd)))
- bfd_fatal (bfd_get_filename (outbfd));
-
- symsize = bfd_get_symtab_upper_bound (inbfd);
- if (symsize < 0)
- bfd_fatal (input_file);
- symbols = (asymbol **) xmalloc (symsize);
- symcount = bfd_canonicalize_symtab (inbfd, symbols);
- if (symcount < 0)
- bfd_fatal (input_file);
-
- /* Make sure we have a .bss section. */
- bss_sec = bfd_get_section_by_name (outbfd, NLM_UNINITIALIZED_DATA_NAME);
- if (bss_sec == NULL)
- {
- bss_sec = bfd_make_section_with_flags (outbfd,
- NLM_UNINITIALIZED_DATA_NAME,
- SEC_ALLOC);
- if (bss_sec == NULL
- || ! bfd_set_section_alignment (outbfd, bss_sec, 1))
- bfd_fatal (_("make .bss section"));
- }
-
- /* We store the original section names in the .nlmsections section,
- so that programs which understand it can resurrect the original
- sections from the NLM. We will put a pointer to .nlmsections in
- the NLM header area. */
- secsec = bfd_make_section_with_flags (outbfd, ".nlmsections",
- SEC_HAS_CONTENTS);
- if (secsec == NULL)
- bfd_fatal (_("make .nlmsections section"));
-
-#ifdef NLMCONV_POWERPC
- /* For PowerPC NetWare we need to build stubs for calls to undefined
- symbols. Because each stub requires an entry in the TOC section
- which must be at the same location as other entries in the TOC
- section, we must do this before determining where the TOC section
- goes in setup_sections. */
- if (bfd_get_arch (inbfd) == bfd_arch_powerpc)
- powerpc_build_stubs (inbfd, outbfd, &symbols, &symcount);
-#endif
-
- /* Set up the sections. */
- bfd_map_over_sections (inbfd, setup_sections, (void *) outbfd);
-
- text_sec = bfd_get_section_by_name (outbfd, NLM_CODE_NAME);
-
- /* The .bss section immediately follows the .data section. */
- data_sec = bfd_get_section_by_name (outbfd, NLM_INITIALIZED_DATA_NAME);
- if (data_sec != NULL)
- {
- bfd_size_type add;
-
- vma = bfd_get_section_size (data_sec);
- align = 1 << bss_sec->alignment_power;
- add = ((vma + align - 1) &~ (align - 1)) - vma;
- vma += add;
- if (! bfd_set_section_vma (outbfd, bss_sec, vma))
- bfd_fatal (_("set .bss vma"));
- if (add != 0)
- {
- bfd_size_type data_size;
-
- data_size = bfd_get_section_size (data_sec);
- if (! bfd_set_section_size (outbfd, data_sec, data_size + add))
- bfd_fatal (_("set .data size"));
- }
- }
-
- /* Adjust symbol information. */
- inlead = bfd_get_symbol_leading_char (inbfd);
- outlead = bfd_get_symbol_leading_char (outbfd);
- gotstart = FALSE;
- gotexit = FALSE;
- gotcheck = FALSE;
- newsymalloc = 10;
- newsyms = (asymbol **) xmalloc (newsymalloc * sizeof (asymbol *));
- newsymcount = 0;
- endsym = NULL;
- for (i = 0; i < symcount; i++)
- {
- asymbol *sym;
-
- sym = symbols[i];
-
- /* Add or remove a leading underscore. */
- if (inlead != outlead)
- {
- if (inlead != '\0')
- {
- if (bfd_asymbol_name (sym)[0] == inlead)
- {
- if (outlead == '\0')
- ++sym->name;
- else
- {
- char *new_name;
-
- new_name = xmalloc (strlen (bfd_asymbol_name (sym)) + 1);
- new_name[0] = outlead;
- strcpy (new_name + 1, bfd_asymbol_name (sym) + 1);
- sym->name = new_name;
- }
- }
- }
- else
- {
- char *new_name;
-
- new_name = xmalloc (strlen (bfd_asymbol_name (sym)) + 2);
- new_name[0] = outlead;
- strcpy (new_name + 1, bfd_asymbol_name (sym));
- sym->name = new_name;
- }
- }
-
- /* NLM's have an uninitialized data section, but they do not
- have a common section in the Unix sense. Move all common
- symbols into the .bss section, and mark them as exported. */
- if (bfd_is_com_section (bfd_get_section (sym)))
- {
- bfd_vma size = sym->value;
-
- sym->section = bss_sec;
- sym->value = bfd_get_section_size (bss_sec);
- size += sym->value;
- align = 1 << bss_sec->alignment_power;
- size = (size + align - 1) & ~(align - 1);
- bfd_set_section_size (outbfd, bss_sec, size);
- sym->flags |= BSF_EXPORT | BSF_GLOBAL;
- }
- else if (bfd_get_section (sym)->output_section != NULL)
- {
- /* Move the symbol into the output section. */
- sym->value += bfd_get_section (sym)->output_offset;
- sym->section = bfd_get_section (sym)->output_section;
- /* This is no longer a section symbol. */
- sym->flags &=~ BSF_SECTION_SYM;
- }
-
- /* Force _edata and _end to be defined. This would normally be
- done by the linker, but the manipulation of the common
- symbols will confuse it. */
- if ((sym->flags & BSF_DEBUGGING) == 0
- && bfd_asymbol_name (sym)[0] == '_'
- && bfd_is_und_section (bfd_get_section (sym)))
- {
- if (strcmp (bfd_asymbol_name (sym), "_edata") == 0)
- {
- sym->section = bss_sec;
- sym->value = 0;
- }
- if (strcmp (bfd_asymbol_name (sym), "_end") == 0)
- {
- sym->section = bss_sec;
- endsym = sym;
- }
-
-#ifdef NLMCONV_POWERPC
- /* For PowerPC NetWare, we define __GOT0. This is the start
- of the .got section. */
- if (bfd_get_arch (inbfd) == bfd_arch_powerpc
- && strcmp (bfd_asymbol_name (sym), "__GOT0") == 0)
- {
- asection *got_sec;
-
- got_sec = bfd_get_section_by_name (inbfd, ".got");
- assert (got_sec != (asection *) NULL);
- sym->value = got_sec->output_offset;
- sym->section = got_sec->output_section;
- }
-#endif
- }
-
- /* If this is a global symbol, check the export list. */
- if ((sym->flags & (BSF_EXPORT | BSF_GLOBAL)) != 0)
- {
- struct string_list *l;
- int found_simple;
-
- /* Unfortunately, a symbol can appear multiple times on the
- export list, with and without prefixes. */
- found_simple = 0;
- for (l = export_symbols; l != NULL; l = l->next)
- {
- if (strcmp (l->string, bfd_asymbol_name (sym)) == 0)
- found_simple = 1;
- else
- {
- char *zbase;
-
- zbase = strchr (l->string, '@');
- if (zbase != NULL
- && strcmp (zbase + 1, bfd_asymbol_name (sym)) == 0)
- {
- /* We must add a symbol with this prefix. */
- if (newsymcount >= newsymalloc)
- {
- newsymalloc += 10;
- newsyms = ((asymbol **)
- xrealloc ((void *) newsyms,
- (newsymalloc
- * sizeof (asymbol *))));
- }
- newsyms[newsymcount] =
- (asymbol *) xmalloc (sizeof (asymbol));
- *newsyms[newsymcount] = *sym;
- newsyms[newsymcount]->name = l->string;
- ++newsymcount;
- }
- }
- }
- if (! found_simple)
- {
- /* The unmodified symbol is actually not exported at
- all. */
- sym->flags &=~ (BSF_GLOBAL | BSF_EXPORT);
- sym->flags |= BSF_LOCAL;
- }
- }
-
- /* If it's an undefined symbol, see if it's on the import list.
- Change the prefix if necessary. */
- if (bfd_is_und_section (bfd_get_section (sym)))
- {
- struct string_list *l;
-
- for (l = import_symbols; l != NULL; l = l->next)
- {
- if (strcmp (l->string, bfd_asymbol_name (sym)) == 0)
- break;
- else
- {
- char *zbase;
-
- zbase = strchr (l->string, '@');
- if (zbase != NULL
- && strcmp (zbase + 1, bfd_asymbol_name (sym)) == 0)
- {
- sym->name = l->string;
- break;
- }
- }
- }
- if (l == NULL)
- non_fatal (_("warning: symbol %s imported but not in import list"),
- bfd_asymbol_name (sym));
- }
-
- /* See if it's one of the special named symbols. */
- if ((sym->flags & BSF_DEBUGGING) == 0)
- {
- bfd_vma val;
-
- /* FIXME: If these symbols are not in the .text section, we
- add the .text section size to the value. This may not be
- correct for all targets. I'm not sure how this should
- really be handled. */
- if (strcmp (bfd_asymbol_name (sym), start_procedure) == 0)
- {
- val = bfd_asymbol_value (sym);
- if (bfd_get_section (sym) == data_sec
- && text_sec != (asection *) NULL)
- val += bfd_section_size (outbfd, text_sec);
- if (! bfd_set_start_address (outbfd, val))
- bfd_fatal (_("set start address"));
- gotstart = TRUE;
- }
- if (strcmp (bfd_asymbol_name (sym), exit_procedure) == 0)
- {
- val = bfd_asymbol_value (sym);
- if (bfd_get_section (sym) == data_sec
- && text_sec != (asection *) NULL)
- val += bfd_section_size (outbfd, text_sec);
- nlm_fixed_header (outbfd)->exitProcedureOffset = val;
- gotexit = TRUE;
- }
- if (check_procedure != NULL
- && strcmp (bfd_asymbol_name (sym), check_procedure) == 0)
- {
- val = bfd_asymbol_value (sym);
- if (bfd_get_section (sym) == data_sec
- && text_sec != (asection *) NULL)
- val += bfd_section_size (outbfd, text_sec);
- nlm_fixed_header (outbfd)->checkUnloadProcedureOffset = val;
- gotcheck = TRUE;
- }
- }
- }
-
- if (endsym != NULL)
- {
- endsym->value = bfd_get_section_size (bss_sec);
-
- /* FIXME: If any relocs referring to _end use inplace addends,
- then I think they need to be updated. This is handled by
- i386_mangle_relocs. Is it needed for any other object
- formats? */
- }
-
- if (newsymcount == 0)
- outsyms = symbols;
- else
- {
- outsyms = (asymbol **) xmalloc ((symcount + newsymcount + 1)
- * sizeof (asymbol *));
- memcpy (outsyms, symbols, symcount * sizeof (asymbol *));
- memcpy (outsyms + symcount, newsyms, newsymcount * sizeof (asymbol *));
- outsyms[symcount + newsymcount] = NULL;
- }
-
- bfd_set_symtab (outbfd, outsyms, symcount + newsymcount);
-
- if (! gotstart)
- non_fatal (_("warning: START procedure %s not defined"), start_procedure);
- if (! gotexit)
- non_fatal (_("warning: EXIT procedure %s not defined"), exit_procedure);
- if (check_procedure != NULL && ! gotcheck)
- non_fatal (_("warning: CHECK procedure %s not defined"), check_procedure);
-
- /* Add additional sections required for the header information. */
- if (custom_file != NULL)
- {
- custom_data = fopen (custom_file, "r");
- if (custom_data == NULL
- || fstat (fileno (custom_data), &st) < 0)
- {
- fprintf (stderr, "%s:%s: %s\n", program_name, custom_file,
- strerror (errno));
- custom_file = NULL;
- }
- else
- {
- custom_size = st.st_size;
- custom_section = bfd_make_section_with_flags (outbfd, ".nlmcustom",
- SEC_HAS_CONTENTS);
- if (custom_section == NULL
- || ! bfd_set_section_size (outbfd, custom_section, custom_size))
- bfd_fatal (_("custom section"));
- }
- }
- if (help_file != NULL)
- {
- help_data = fopen (help_file, "r");
- if (help_data == NULL
- || fstat (fileno (help_data), &st) < 0)
- {
- fprintf (stderr, "%s:%s: %s\n", program_name, help_file,
- strerror (errno));
- help_file = NULL;
- }
- else
- {
- help_size = st.st_size;
- help_section = bfd_make_section_with_flags (outbfd, ".nlmhelp",
- SEC_HAS_CONTENTS);
- if (help_section == NULL
- || ! bfd_set_section_size (outbfd, help_section, help_size))
- bfd_fatal (_("help section"));
- LITMEMCPY (nlm_extended_header (outbfd)->stamp, "MeSsAgEs");
- }
- }
- if (message_file != NULL)
- {
- message_data = fopen (message_file, "r");
- if (message_data == NULL
- || fstat (fileno (message_data), &st) < 0)
- {
- fprintf (stderr, "%s:%s: %s\n", program_name, message_file,
- strerror (errno));
- message_file = NULL;
- }
- else
- {
- message_size = st.st_size;
- message_section = bfd_make_section_with_flags (outbfd,
- ".nlmmessages",
- SEC_HAS_CONTENTS);
- if (message_section == NULL
- || ! bfd_set_section_size (outbfd, message_section, message_size))
- bfd_fatal (_("message section"));
- LITMEMCPY (nlm_extended_header (outbfd)->stamp, "MeSsAgEs");
- }
- }
- if (modules != NULL)
- {
- struct string_list *l;
-
- module_size = 0;
- for (l = modules; l != NULL; l = l->next)
- module_size += strlen (l->string) + 1;
- module_section = bfd_make_section_with_flags (outbfd, ".nlmmodules",
- SEC_HAS_CONTENTS);
- if (module_section == NULL
- || ! bfd_set_section_size (outbfd, module_section, module_size))
- bfd_fatal (_("module section"));
- }
- if (rpc_file != NULL)
- {
- rpc_data = fopen (rpc_file, "r");
- if (rpc_data == NULL
- || fstat (fileno (rpc_data), &st) < 0)
- {
- fprintf (stderr, "%s:%s: %s\n", program_name, rpc_file,
- strerror (errno));
- rpc_file = NULL;
- }
- else
- {
- rpc_size = st.st_size;
- rpc_section = bfd_make_section_with_flags (outbfd, ".nlmrpc",
- SEC_HAS_CONTENTS);
- if (rpc_section == NULL
- || ! bfd_set_section_size (outbfd, rpc_section, rpc_size))
- bfd_fatal (_("rpc section"));
- LITMEMCPY (nlm_extended_header (outbfd)->stamp, "MeSsAgEs");
- }
- }
- if (sharelib_file != NULL)
- {
- sharedbfd = bfd_openr (sharelib_file, output_format);
- if (sharedbfd == NULL
- || ! bfd_check_format (sharedbfd, bfd_object))
- {
- fprintf (stderr, "%s:%s: %s\n", program_name, sharelib_file,
- bfd_errmsg (bfd_get_error ()));
- sharelib_file = NULL;
- }
- else
- {
- sharedhdr = *nlm_fixed_header (sharedbfd);
- bfd_close (sharedbfd);
- shared_data = fopen (sharelib_file, "r");
- if (shared_data == NULL
- || (fstat (fileno (shared_data), &st) < 0))
- {
- fprintf (stderr, "%s:%s: %s\n", program_name, sharelib_file,
- strerror (errno));
- sharelib_file = NULL;
- }
- else
- {
- /* If we were clever, we could just copy out the
- sections of the shared library which we actually
- need. However, we would have to figure out the sizes
- of the external and public information, and that can
- not be done without reading through them. */
- if (sharedhdr.uninitializedDataSize > 0)
- {
- /* There is no place to record this information. */
- non_fatal (_("%s: warning: shared libraries can not have uninitialized data"),
- sharelib_file);
- }
- shared_offset = st.st_size;
- if (shared_offset > (size_t) sharedhdr.codeImageOffset)
- shared_offset = sharedhdr.codeImageOffset;
- if (shared_offset > (size_t) sharedhdr.dataImageOffset)
- shared_offset = sharedhdr.dataImageOffset;
- if (shared_offset > (size_t) sharedhdr.relocationFixupOffset)
- shared_offset = sharedhdr.relocationFixupOffset;
- if (shared_offset > (size_t) sharedhdr.externalReferencesOffset)
- shared_offset = sharedhdr.externalReferencesOffset;
- if (shared_offset > (size_t) sharedhdr.publicsOffset)
- shared_offset = sharedhdr.publicsOffset;
- shared_size = st.st_size - shared_offset;
- shared_section = bfd_make_section_with_flags (outbfd,
- ".nlmshared",
- SEC_HAS_CONTENTS);
- if (shared_section == NULL
- || ! bfd_set_section_size (outbfd, shared_section,
- shared_size))
- bfd_fatal (_("shared section"));
- LITMEMCPY (nlm_extended_header (outbfd)->stamp, "MeSsAgEs");
- }
- }
- }
-
- /* Check whether a version was given. */
- if (!CONST_STRNEQ (version_hdr->stamp, "VeRsIoN#"))
- non_fatal (_("warning: No version number given"));
-
- /* At least for now, always create an extended header, because that
- is what NLMLINK does. */
- LITMEMCPY (nlm_extended_header (outbfd)->stamp, "MeSsAgEs");
-
- LITMEMCPY (nlm_cygnus_ext_header (outbfd)->stamp, "CyGnUsEx");
-
- /* If the date was not given, force it in. */
- if (nlm_version_header (outbfd)->month == 0
- && nlm_version_header (outbfd)->day == 0
- && nlm_version_header (outbfd)->year == 0)
- {
- time_t now;
- struct tm *ptm;
-
- time (&now);
- ptm = localtime (&now);
- nlm_version_header (outbfd)->month = ptm->tm_mon + 1;
- nlm_version_header (outbfd)->day = ptm->tm_mday;
- nlm_version_header (outbfd)->year = ptm->tm_year + 1900;
- LITMEMCPY (version_hdr->stamp, "VeRsIoN#");
- }
-
-#ifdef NLMCONV_POWERPC
- /* Resolve the stubs we build for PowerPC NetWare. */
- if (bfd_get_arch (inbfd) == bfd_arch_powerpc)
- powerpc_resolve_stubs (inbfd, outbfd);
-#endif
-
- /* Copy over the sections. */
- bfd_map_over_sections (inbfd, copy_sections, (void *) outbfd);
-
- /* Finish up the header information. */
- if (custom_file != NULL)
- {
- void *data;
-
- data = xmalloc (custom_size);
- if (fread (data, 1, custom_size, custom_data) != custom_size)
- non_fatal (_("%s: read: %s"), custom_file, strerror (errno));
- else
- {
- if (! bfd_set_section_contents (outbfd, custom_section, data,
- (file_ptr) 0, custom_size))
- bfd_fatal (_("custom section"));
- nlm_fixed_header (outbfd)->customDataOffset =
- custom_section->filepos;
- nlm_fixed_header (outbfd)->customDataSize = custom_size;
- }
- free (data);
- }
- if (! debug_info)
- {
- /* As a special hack, the backend recognizes a debugInfoOffset
- of -1 to mean that it should not output any debugging
- information. This can not be handling by fiddling with the
- symbol table because exported symbols appear in both the
- export information and the debugging information. */
- nlm_fixed_header (outbfd)->debugInfoOffset = (file_ptr) -1;
- }
- if (full_map)
- non_fatal (_("warning: FULLMAP is not supported; try ld -M"));
- if (help_file != NULL)
- {
- void *data;
-
- data = xmalloc (help_size);
- if (fread (data, 1, help_size, help_data) != help_size)
- non_fatal (_("%s: read: %s"), help_file, strerror (errno));
- else
- {
- if (! bfd_set_section_contents (outbfd, help_section, data,
- (file_ptr) 0, help_size))
- bfd_fatal (_("help section"));
- nlm_extended_header (outbfd)->helpFileOffset =
- help_section->filepos;
- nlm_extended_header (outbfd)->helpFileLength = help_size;
- }
- free (data);
- }
- if (message_file != NULL)
- {
- void *data;
-
- data = xmalloc (message_size);
- if (fread (data, 1, message_size, message_data) != message_size)
- non_fatal (_("%s: read: %s"), message_file, strerror (errno));
- else
- {
- if (! bfd_set_section_contents (outbfd, message_section, data,
- (file_ptr) 0, message_size))
- bfd_fatal (_("message section"));
- nlm_extended_header (outbfd)->messageFileOffset =
- message_section->filepos;
- nlm_extended_header (outbfd)->messageFileLength = message_size;
-
- /* FIXME: Are these offsets correct on all platforms? Are
- they 32 bits on all platforms? What endianness? */
- nlm_extended_header (outbfd)->languageID =
- bfd_h_get_32 (outbfd, (bfd_byte *) data + 106);
- nlm_extended_header (outbfd)->messageCount =
- bfd_h_get_32 (outbfd, (bfd_byte *) data + 110);
- }
- free (data);
- }
- if (modules != NULL)
- {
- void *data;
- unsigned char *set;
- struct string_list *l;
- bfd_size_type c;
-
- data = xmalloc (module_size);
- c = 0;
- set = (unsigned char *) data;
- for (l = modules; l != NULL; l = l->next)
- {
- *set = strlen (l->string);
- strncpy ((char *) set + 1, l->string, *set);
- set += *set + 1;
- ++c;
- }
- if (! bfd_set_section_contents (outbfd, module_section, data,
- (file_ptr) 0, module_size))
- bfd_fatal (_("module section"));
- nlm_fixed_header (outbfd)->moduleDependencyOffset =
- module_section->filepos;
- nlm_fixed_header (outbfd)->numberOfModuleDependencies = c;
- }
- if (rpc_file != NULL)
- {
- void *data;
-
- data = xmalloc (rpc_size);
- if (fread (data, 1, rpc_size, rpc_data) != rpc_size)
- non_fatal (_("%s: read: %s"), rpc_file, strerror (errno));
- else
- {
- if (! bfd_set_section_contents (outbfd, rpc_section, data,
- (file_ptr) 0, rpc_size))
- bfd_fatal (_("rpc section"));
- nlm_extended_header (outbfd)->RPCDataOffset =
- rpc_section->filepos;
- nlm_extended_header (outbfd)->RPCDataLength = rpc_size;
- }
- free (data);
- }
- if (sharelib_file != NULL)
- {
- void *data;
-
- data = xmalloc (shared_size);
- if (fseek (shared_data, shared_offset, SEEK_SET) != 0
- || fread (data, 1, shared_size, shared_data) != shared_size)
- non_fatal (_("%s: read: %s"), sharelib_file, strerror (errno));
- else
- {
- if (! bfd_set_section_contents (outbfd, shared_section, data,
- (file_ptr) 0, shared_size))
- bfd_fatal (_("shared section"));
- }
- nlm_extended_header (outbfd)->sharedCodeOffset =
- sharedhdr.codeImageOffset - shared_offset + shared_section->filepos;
- nlm_extended_header (outbfd)->sharedCodeLength =
- sharedhdr.codeImageSize;
- nlm_extended_header (outbfd)->sharedDataOffset =
- sharedhdr.dataImageOffset - shared_offset + shared_section->filepos;
- nlm_extended_header (outbfd)->sharedDataLength =
- sharedhdr.dataImageSize;
- nlm_extended_header (outbfd)->sharedRelocationFixupOffset =
- (sharedhdr.relocationFixupOffset
- - shared_offset
- + shared_section->filepos);
- nlm_extended_header (outbfd)->sharedRelocationFixupCount =
- sharedhdr.numberOfRelocationFixups;
- nlm_extended_header (outbfd)->sharedExternalReferenceOffset =
- (sharedhdr.externalReferencesOffset
- - shared_offset
- + shared_section->filepos);
- nlm_extended_header (outbfd)->sharedExternalReferenceCount =
- sharedhdr.numberOfExternalReferences;
- nlm_extended_header (outbfd)->sharedPublicsOffset =
- sharedhdr.publicsOffset - shared_offset + shared_section->filepos;
- nlm_extended_header (outbfd)->sharedPublicsCount =
- sharedhdr.numberOfPublics;
- nlm_extended_header (outbfd)->sharedDebugRecordOffset =
- sharedhdr.debugInfoOffset - shared_offset + shared_section->filepos;
- nlm_extended_header (outbfd)->sharedDebugRecordCount =
- sharedhdr.numberOfDebugRecords;
- nlm_extended_header (outbfd)->SharedInitializationOffset =
- sharedhdr.codeStartOffset;
- nlm_extended_header (outbfd)->SharedExitProcedureOffset =
- sharedhdr.exitProcedureOffset;
- free (data);
- }
-
- {
- const int max_len = NLM_MODULE_NAME_SIZE - 2;
- const char * filename = lbasename (output_file);
-
- len = strlen (filename);
- if (len > max_len)
- len = max_len;
- nlm_fixed_header (outbfd)->moduleName[0] = len;
-
- strncpy (nlm_fixed_header (outbfd)->moduleName + 1, filename, max_len);
- nlm_fixed_header (outbfd)->moduleName[max_len + 1] = '\0';
-
- for (modname = nlm_fixed_header (outbfd)->moduleName;
- *modname != '\0';
- modname++)
- *modname = TOUPPER (*modname);
- }
-
- strncpy (nlm_variable_header (outbfd)->oldThreadName, " LONG",
- NLM_OLD_THREAD_NAME_LENGTH);
-
- nlm_cygnus_ext_header (outbfd)->offset = secsec->filepos;
- nlm_cygnus_ext_header (outbfd)->length = bfd_section_size (outbfd, secsec);
-
- if (! bfd_close (outbfd))
- bfd_fatal (output_file);
- if (! bfd_close (inbfd))
- bfd_fatal (input_file);
-
- if (unlink_on_exit != NULL)
- unlink (unlink_on_exit);
-
- return 0;
-}
-
-
-/* Show a usage message and exit. */
-
-static void
-show_usage (FILE *file, int status)
-{
- fprintf (file, _("Usage: %s [option(s)] [in-file [out-file]]\n"), program_name);
- fprintf (file, _(" Convert an object file into a NetWare Loadable Module\n"));
- fprintf (file, _(" The options are:\n\
- -I --input-target=<bfdname> Set the input binary file format\n\
- -O --output-target=<bfdname> Set the output binary file format\n\
- -T --header-file=<file> Read <file> for NLM header information\n\
- -l --linker=<linker> Use <linker> for any linking\n\
- -d --debug Display on stderr the linker command line\n\
- @<file> Read options from <file>.\n\
- -h --help Display this information\n\
- -v --version Display the program's version\n\
-"));
- if (REPORT_BUGS_TO[0] && status == 0)
- fprintf (file, _("Report bugs to %s\n"), REPORT_BUGS_TO);
- exit (status);
-}
-
-/* Select the output format based on the input architecture, machine,
- and endianness. This chooses the appropriate NLM target. */
-
-static const char *
-select_output_format (enum bfd_architecture arch, unsigned long mach,
- bfd_boolean bigendian ATTRIBUTE_UNUSED)
-{
- switch (arch)
- {
-#ifdef NLMCONV_I386
- case bfd_arch_i386:
- return "nlm32-i386";
-#endif
-#ifdef NLMCONV_SPARC
- case bfd_arch_sparc:
- return "nlm32-sparc";
-#endif
-#ifdef NLMCONV_ALPHA
- case bfd_arch_alpha:
- return "nlm32-alpha";
-#endif
-#ifdef NLMCONV_POWERPC
- case bfd_arch_powerpc:
- return "nlm32-powerpc";
-#endif
- default:
- fatal (_("support not compiled in for %s"),
- bfd_printable_arch_mach (arch, mach));
- }
- /*NOTREACHED*/
-}
-
-/* The BFD sections are copied in two passes. This function selects
- the output section for each input section, and sets up the section
- name, size, etc. */
-
-static void
-setup_sections (bfd *inbfd ATTRIBUTE_UNUSED, asection *insec, void *data_ptr)
-{
- bfd *outbfd = (bfd *) data_ptr;
- flagword f;
- const char *outname;
- asection *outsec;
- bfd_vma offset;
- bfd_size_type align;
- bfd_size_type add;
- bfd_size_type secsecsize;
-
- f = bfd_get_section_flags (inbfd, insec);
- if (f & SEC_CODE)
- outname = NLM_CODE_NAME;
- else if ((f & SEC_LOAD) && (f & SEC_HAS_CONTENTS))
- outname = NLM_INITIALIZED_DATA_NAME;
- else if (f & SEC_ALLOC)
- outname = NLM_UNINITIALIZED_DATA_NAME;
- else
- outname = bfd_section_name (inbfd, insec);
-
- outsec = bfd_get_section_by_name (outbfd, outname);
- if (outsec == NULL)
- {
- outsec = bfd_make_section (outbfd, outname);
- if (outsec == NULL)
- bfd_fatal (_("make section"));
- }
-
- insec->output_section = outsec;
-
- offset = bfd_section_size (outbfd, outsec);
- align = 1 << bfd_section_alignment (inbfd, insec);
- add = ((offset + align - 1) &~ (align - 1)) - offset;
- insec->output_offset = offset + add;
-
- if (! bfd_set_section_size (outbfd, outsec,
- (bfd_section_size (outbfd, outsec)
- + bfd_section_size (inbfd, insec)
- + add)))
- bfd_fatal (_("set section size"));
-
- if ((bfd_section_alignment (inbfd, insec)
- > bfd_section_alignment (outbfd, outsec))
- && ! bfd_set_section_alignment (outbfd, outsec,
- bfd_section_alignment (inbfd, insec)))
- bfd_fatal (_("set section alignment"));
-
- if (! bfd_set_section_flags (outbfd, outsec,
- f | bfd_get_section_flags (outbfd, outsec)))
- bfd_fatal (_("set section flags"));
-
- bfd_set_reloc (outbfd, outsec, (arelent **) NULL, 0);
-
- /* For each input section we allocate space for an entry in
- .nlmsections. */
- secsecsize = bfd_section_size (outbfd, secsec);
- secsecsize += strlen (bfd_section_name (inbfd, insec)) + 1;
- secsecsize = (secsecsize + 3) &~ 3;
- secsecsize += 8;
- if (! bfd_set_section_size (outbfd, secsec, secsecsize))
- bfd_fatal (_("set .nlmsections size"));
-}
-
-/* Copy the section contents. */
-
-static void
-copy_sections (bfd *inbfd, asection *insec, void *data_ptr)
-{
- static bfd_size_type secsecoff = 0;
- bfd *outbfd = (bfd *) data_ptr;
- const char *inname;
- asection *outsec;
- bfd_size_type size;
- bfd_byte *contents;
- long reloc_size;
- bfd_byte buf[4];
- bfd_size_type add;
-
- inname = bfd_section_name (inbfd, insec);
-
- outsec = insec->output_section;
- assert (outsec != NULL);
-
- size = bfd_get_section_size (insec);
-
- if ((bfd_get_section_flags (inbfd, insec) & SEC_HAS_CONTENTS) == 0)
- contents = NULL;
- else
- {
- if (!bfd_malloc_and_get_section (inbfd, insec, &contents))
- bfd_fatal (bfd_get_filename (inbfd));
- }
-
- reloc_size = bfd_get_reloc_upper_bound (inbfd, insec);
- if (reloc_size < 0)
- bfd_fatal (bfd_get_filename (inbfd));
- if (reloc_size != 0)
- {
- arelent **relocs;
- long reloc_count;
-
- relocs = (arelent **) xmalloc (reloc_size);
- reloc_count = bfd_canonicalize_reloc (inbfd, insec, relocs, symbols);
- if (reloc_count < 0)
- bfd_fatal (bfd_get_filename (inbfd));
- mangle_relocs (outbfd, insec, &relocs, &reloc_count, (char *) contents,
- size);
-
- /* FIXME: refers to internal BFD fields. */
- if (outsec->orelocation != (arelent **) NULL)
- {
- bfd_size_type total_count;
- arelent **combined;
-
- total_count = reloc_count + outsec->reloc_count;
- combined = (arelent **) xmalloc (total_count * sizeof (arelent *));
- memcpy (combined, outsec->orelocation,
- outsec->reloc_count * sizeof (arelent *));
- memcpy (combined + outsec->reloc_count, relocs,
- (size_t) (reloc_count * sizeof (arelent *)));
- free (outsec->orelocation);
- reloc_count = total_count;
- relocs = combined;
- }
-
- bfd_set_reloc (outbfd, outsec, relocs, reloc_count);
- }
-
- if (contents != NULL)
- {
- if (! bfd_set_section_contents (outbfd, outsec, contents,
- insec->output_offset, size))
- bfd_fatal (bfd_get_filename (outbfd));
- free (contents);
- }
-
- /* Add this section to .nlmsections. */
- if (! bfd_set_section_contents (outbfd, secsec, (void *) inname, secsecoff,
- strlen (inname) + 1))
- bfd_fatal (_("set .nlmsection contents"));
- secsecoff += strlen (inname) + 1;
-
- add = ((secsecoff + 3) &~ 3) - secsecoff;
- if (add != 0)
- {
- bfd_h_put_32 (outbfd, (bfd_vma) 0, buf);
- if (! bfd_set_section_contents (outbfd, secsec, buf, secsecoff, add))
- bfd_fatal (_("set .nlmsection contents"));
- secsecoff += add;
- }
-
- if (contents != NULL)
- bfd_h_put_32 (outbfd, (bfd_vma) outsec->filepos, buf);
- else
- bfd_h_put_32 (outbfd, (bfd_vma) 0, buf);
- if (! bfd_set_section_contents (outbfd, secsec, buf, secsecoff, 4))
- bfd_fatal (_("set .nlmsection contents"));
- secsecoff += 4;
-
- bfd_h_put_32 (outbfd, (bfd_vma) size, buf);
- if (! bfd_set_section_contents (outbfd, secsec, buf, secsecoff, 4))
- bfd_fatal (_("set .nlmsection contents"));
- secsecoff += 4;
-}
-
-/* Some, perhaps all, NetWare targets require changing the relocs used
- by the input formats. */
-
-static void
-mangle_relocs (bfd *outbfd, asection *insec, arelent ***relocs_ptr,
- long *reloc_count_ptr, char *contents,
- bfd_size_type contents_size)
-{
- switch (bfd_get_arch (outbfd))
- {
-#ifdef NLMCONV_I386
- case bfd_arch_i386:
- i386_mangle_relocs (outbfd, insec, relocs_ptr, reloc_count_ptr,
- contents, contents_size);
- break;
-#endif
-#ifdef NLMCONV_ALPHA
- case bfd_arch_alpha:
- alpha_mangle_relocs (outbfd, insec, relocs_ptr, reloc_count_ptr,
- contents, contents_size);
- break;
-#endif
-#ifdef NLMCONV_POWERPC
- case bfd_arch_powerpc:
- powerpc_mangle_relocs (outbfd, insec, relocs_ptr, reloc_count_ptr,
- contents, contents_size);
- break;
-#endif
- default:
- default_mangle_relocs (outbfd, insec, relocs_ptr, reloc_count_ptr,
- contents, contents_size);
- break;
- }
-}
-
-/* By default all we need to do for relocs is change the address by
- the output_offset. */
-
-static void
-default_mangle_relocs (bfd *outbfd ATTRIBUTE_UNUSED, asection *insec,
- arelent ***relocs_ptr, long *reloc_count_ptr,
- char *contents ATTRIBUTE_UNUSED,
- bfd_size_type contents_size ATTRIBUTE_UNUSED)
-{
- if (insec->output_offset != 0)
- {
- long reloc_count;
- arelent **relocs;
- long i;
-
- reloc_count = *reloc_count_ptr;
- relocs = *relocs_ptr;
- for (i = 0; i < reloc_count; i++, relocs++)
- (*relocs)->address += insec->output_offset;
- }
-}
-
-#ifdef NLMCONV_I386
-
-/* NetWare on the i386 supports a restricted set of relocs, which are
- different from those used on other i386 targets. This routine
- converts the relocs. It is, obviously, very target dependent. At
- the moment, the nlm32-i386 backend performs similar translations;
- however, it is more reliable and efficient to do them here. */
-
-static reloc_howto_type nlm_i386_pcrel_howto =
- HOWTO (1, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- TRUE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- 0, /* special_function */
- "DISP32", /* name */
- TRUE, /* partial_inplace */
- 0xffffffff, /* src_mask */
- 0xffffffff, /* dst_mask */
- TRUE); /* pcrel_offset */
-
-static void
-i386_mangle_relocs (bfd *outbfd, asection *insec, arelent ***relocs_ptr,
- long *reloc_count_ptr, char *contents,
- bfd_size_type contents_size)
-{
- long reloc_count, i;
- arelent **relocs;
-
- reloc_count = *reloc_count_ptr;
- relocs = *relocs_ptr;
- for (i = 0; i < reloc_count; i++)
- {
- arelent *rel;
- asymbol *sym;
- bfd_size_type address;
- bfd_vma addend;
-
- rel = *relocs++;
- /* PR 17512: file: 057f89c1. */
- if (rel->sym_ptr_ptr == NULL)
- continue;
- sym = *rel->sym_ptr_ptr;
-
- /* We're moving the relocs from the input section to the output
- section, so we must adjust the address accordingly. */
- address = rel->address;
- rel->address += insec->output_offset;
-
- /* Note that no serious harm will ensue if we fail to change a
- reloc. The backend will fail when writing out the reloc. */
-
- /* Make sure this reloc is within the data we have. We use only
- 4 byte relocs here, so we insist on having 4 bytes. */
- if (address + 4 > contents_size)
- continue;
-
- /* A PC relative reloc entirely within a single section is
- completely unnecessary. This can be generated by ld -r. */
- if (sym == insec->symbol
- && rel->howto != NULL
- && rel->howto->pc_relative
- && ! rel->howto->pcrel_offset)
- {
- --*reloc_count_ptr;
- --relocs;
- memmove (relocs, relocs + 1,
- (size_t) ((reloc_count - i) * sizeof (arelent *)));
- continue;
- }
-
- /* Get the amount the relocation will add in. */
- addend = rel->addend + sym->value;
-
- /* NetWare doesn't support PC relative relocs against defined
- symbols, so we have to eliminate them by doing the relocation
- now. We can only do this if the reloc is within a single
- section. */
- if (rel->howto != NULL
- && rel->howto->pc_relative
- && bfd_get_section (sym) == insec->output_section)
- {
- bfd_vma val;
-
- if (rel->howto->pcrel_offset)
- addend -= address;
-
- val = bfd_get_32 (outbfd, (bfd_byte *) contents + address);
- val += addend;
- bfd_put_32 (outbfd, val, (bfd_byte *) contents + address);
-
- --*reloc_count_ptr;
- --relocs;
- memmove (relocs, relocs + 1,
- (size_t) ((reloc_count - i) * sizeof (arelent *)));
- continue;
- }
-
- /* NetWare doesn't support reloc addends, so we get rid of them
- here by simply adding them into the object data. We handle
- the symbol value, if any, the same way. */
- if (addend != 0
- && rel->howto != NULL
- && rel->howto->rightshift == 0
- && rel->howto->size == 2
- && rel->howto->bitsize == 32
- && rel->howto->bitpos == 0
- && rel->howto->src_mask == 0xffffffff
- && rel->howto->dst_mask == 0xffffffff)
- {
- bfd_vma val;
-
- val = bfd_get_32 (outbfd, (bfd_byte *) contents + address);
- val += addend;
- bfd_put_32 (outbfd, val, (bfd_byte *) contents + address);
-
- /* Adjust the reloc for the changes we just made. */
- rel->addend = 0;
- if (! bfd_is_und_section (bfd_get_section (sym)))
- rel->sym_ptr_ptr = bfd_get_section (sym)->symbol_ptr_ptr;
- }
-
- /* NetWare uses a reloc with pcrel_offset set. We adjust
- pc_relative relocs accordingly. We are going to change the
- howto field, so we can only do this if the current one is
- compatible. We should check that special_function is NULL
- here, but at the moment coff-i386 uses a special_function
- which does not affect what we are doing here. */
- if (rel->howto != NULL
- && rel->howto->pc_relative
- && ! rel->howto->pcrel_offset
- && rel->howto->rightshift == 0
- && rel->howto->size == 2
- && rel->howto->bitsize == 32
- && rel->howto->bitpos == 0
- && rel->howto->src_mask == 0xffffffff
- && rel->howto->dst_mask == 0xffffffff)
- {
- bfd_vma val;
-
- /* When pcrel_offset is not set, it means that the negative
- of the address of the memory location is stored in the
- memory location. We must add it back in. */
- val = bfd_get_32 (outbfd, (bfd_byte *) contents + address);
- val += address;
- bfd_put_32 (outbfd, val, (bfd_byte *) contents + address);
-
- /* We must change to a new howto. */
- rel->howto = &nlm_i386_pcrel_howto;
- }
- }
-}
-
-#endif /* NLMCONV_I386 */
-
-#ifdef NLMCONV_ALPHA
-
-/* On the Alpha the first reloc for every section must be a special
- relocs which hold the GP address. Also, the first reloc in the
- file must be a special reloc which holds the address of the .lita
- section. */
-
-static reloc_howto_type nlm32_alpha_nw_howto =
- HOWTO (ALPHA_R_NW_RELOC, /* type */
- 0, /* rightshift */
- 0, /* size (0 = byte, 1 = short, 2 = long) */
- 0, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- 0, /* special_function */
- "NW_RELOC", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0, /* dst_mask */
- FALSE); /* pcrel_offset */
-
-static void
-alpha_mangle_relocs (bfd *outbfd, asection *insec,
- arelent ***relocs_ptr, long *reloc_count_ptr,
- char *contents ATTRIBUTE_UNUSED,
- bfd_size_type contents_size ATTRIBUTE_UNUSED)
-{
- long old_reloc_count;
- arelent **old_relocs;
- arelent **relocs;
-
- old_reloc_count = *reloc_count_ptr;
- old_relocs = *relocs_ptr;
- relocs = (arelent **) xmalloc ((old_reloc_count + 3) * sizeof (arelent *));
- *relocs_ptr = relocs;
-
- if (nlm_alpha_backend_data (outbfd)->lita_address == 0)
- {
- bfd *inbfd;
- asection *lita_section;
-
- inbfd = insec->owner;
- lita_section = bfd_get_section_by_name (inbfd, _LITA);
- if (lita_section != (asection *) NULL)
- {
- nlm_alpha_backend_data (outbfd)->lita_address =
- bfd_get_section_vma (inbfd, lita_section);
- nlm_alpha_backend_data (outbfd)->lita_size =
- bfd_section_size (inbfd, lita_section);
- }
- else
- {
- /* Avoid outputting this reloc again. */
- nlm_alpha_backend_data (outbfd)->lita_address = 4;
- }
-
- *relocs = (arelent *) xmalloc (sizeof (arelent));
- (*relocs)->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr;
- (*relocs)->address = nlm_alpha_backend_data (outbfd)->lita_address;
- (*relocs)->addend = nlm_alpha_backend_data (outbfd)->lita_size + 1;
- (*relocs)->howto = &nlm32_alpha_nw_howto;
- ++relocs;
- ++(*reloc_count_ptr);
- }
-
- /* Get the GP value from bfd. */
- if (nlm_alpha_backend_data (outbfd)->gp == 0)
- nlm_alpha_backend_data (outbfd)->gp =
- bfd_ecoff_get_gp_value (insec->owner);
-
- *relocs = (arelent *) xmalloc (sizeof (arelent));
- (*relocs)->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr;
- (*relocs)->address = nlm_alpha_backend_data (outbfd)->gp;
- (*relocs)->addend = 0;
- (*relocs)->howto = &nlm32_alpha_nw_howto;
- ++relocs;
- ++(*reloc_count_ptr);
-
- memcpy (relocs, old_relocs, (size_t) old_reloc_count * sizeof (arelent *));
- relocs[old_reloc_count] = (arelent *) NULL;
-
- free (old_relocs);
-
- if (insec->output_offset != 0)
- {
- bfd_size_type i;
-
- for (i = 0; i < (bfd_size_type) old_reloc_count; i++, relocs++)
- (*relocs)->address += insec->output_offset;
- }
-}
-
-#endif /* NLMCONV_ALPHA */
-
-#ifdef NLMCONV_POWERPC
-
-/* We keep a linked list of stubs which we must build. Because BFD
- requires us to know the sizes of all sections before we can set the
- contents of any, we must figure out which stubs we want to build
- before we can actually build any of them. */
-
-struct powerpc_stub
-{
- /* Next stub in linked list. */
- struct powerpc_stub *next;
-
- /* Symbol whose value is the start of the stub. This is a symbol
- whose name begins with `.'. */
- asymbol *start;
-
- /* Symbol we are going to create a reloc against. This is a symbol
- with the same name as START but without the leading `.'. */
- asymbol *reloc;
-
- /* The TOC index for this stub. This is the index into the TOC
- section at which the reloc is created. */
- unsigned int toc_index;
-};
-
-/* The linked list of stubs. */
-
-static struct powerpc_stub *powerpc_stubs;
-
-/* This is what a stub looks like. The first instruction will get
- adjusted with the correct TOC index. */
-
-static unsigned long powerpc_stub_insns[] =
-{
- 0x81820000, /* lwz r12,0(r2) */
- 0x90410014, /* stw r2,20(r1) */
- 0x800c0000, /* lwz r0,0(r12) */
- 0x804c0004, /* lwz r2,r(r12) */
- 0x7c0903a6, /* mtctr r0 */
- 0x4e800420, /* bctr */
- 0, /* Traceback table. */
- 0xc8000,
- 0
-};
-
-#define POWERPC_STUB_INSN_COUNT \
- (sizeof powerpc_stub_insns / sizeof powerpc_stub_insns[0])
-
-#define POWERPC_STUB_SIZE (4 * POWERPC_STUB_INSN_COUNT)
-
-/* Each stub uses a four byte TOC entry. */
-#define POWERPC_STUB_TOC_ENTRY_SIZE (4)
-
-/* The original size of the .got section. */
-static bfd_size_type powerpc_initial_got_size;
-
-/* Look for all undefined symbols beginning with `.', and prepare to
- build a stub for each one. */
-
-static void
-powerpc_build_stubs (bfd *inbfd, bfd *outbfd ATTRIBUTE_UNUSED,
- asymbol ***symbols_ptr, long *symcount_ptr)
-{
- asection *stub_sec;
- asection *got_sec;
- unsigned int got_base;
- long i;
- long symcount;
- long stubcount;
-
- /* Make a section to hold stubs. We don't set SEC_HAS_CONTENTS for
- the section to prevent copy_sections from reading from it. */
- stub_sec = bfd_make_section_with_flags (inbfd, ".stubs",
- (SEC_CODE
- | SEC_RELOC
- | SEC_ALLOC
- | SEC_LOAD));
- if (stub_sec == (asection *) NULL
- || ! bfd_set_section_alignment (inbfd, stub_sec, 2))
- bfd_fatal (".stubs");
-
- /* Get the TOC section, which is named .got. */
- got_sec = bfd_get_section_by_name (inbfd, ".got");
- if (got_sec == (asection *) NULL)
- {
- got_sec = bfd_make_section_with_flags (inbfd, ".got",
- (SEC_DATA
- | SEC_RELOC
- | SEC_ALLOC
- | SEC_LOAD
- | SEC_HAS_CONTENTS));
- if (got_sec == (asection *) NULL
- || ! bfd_set_section_alignment (inbfd, got_sec, 2))
- bfd_fatal (".got");
- }
-
- powerpc_initial_got_size = bfd_section_size (inbfd, got_sec);
- got_base = powerpc_initial_got_size;
- got_base = (got_base + 3) &~ 3;
-
- stubcount = 0;
-
- symcount = *symcount_ptr;
- for (i = 0; i < symcount; i++)
- {
- asymbol *sym;
- asymbol *newsym;
- char *newname;
- struct powerpc_stub *item;
-
- sym = (*symbols_ptr)[i];
-
- /* We must make a stub for every undefined symbol whose name
- starts with '.'. */
- if (bfd_asymbol_name (sym)[0] != '.'
- || ! bfd_is_und_section (bfd_get_section (sym)))
- continue;
-
- /* Make a new undefined symbol with the same name but without
- the leading `.'. */
- newsym = xmalloc (sizeof (asymbol));
- *newsym = *sym;
- newname = xmalloc (strlen (bfd_asymbol_name (sym)));
- strcpy (newname, bfd_asymbol_name (sym) + 1);
- newsym->name = newname;
-
- /* Define the `.' symbol to be in the stub section. */
- sym->section = stub_sec;
- sym->value = stubcount * POWERPC_STUB_SIZE;
- /* We set the BSF_DYNAMIC flag here so that we can check it when
- we are mangling relocs. FIXME: This is a hack. */
- sym->flags = BSF_LOCAL | BSF_DYNAMIC;
-
- /* Add this stub to the linked list. */
- item = (struct powerpc_stub *) xmalloc (sizeof (struct powerpc_stub));
- item->start = sym;
- item->reloc = newsym;
- item->toc_index = got_base + stubcount * POWERPC_STUB_TOC_ENTRY_SIZE;
-
- item->next = powerpc_stubs;
- powerpc_stubs = item;
-
- ++stubcount;
- }
-
- if (stubcount > 0)
- {
- asymbol **s;
- struct powerpc_stub *l;
-
- /* Add the new symbols we just created to the symbol table. */
- *symbols_ptr = (asymbol **) xrealloc ((char *) *symbols_ptr,
- ((symcount + stubcount)
- * sizeof (asymbol)));
- *symcount_ptr += stubcount;
- s = &(*symbols_ptr)[symcount];
- for (l = powerpc_stubs; l != (struct powerpc_stub *) NULL; l = l->next)
- *s++ = l->reloc;
-
- /* Set the size of the .stubs section and increase the size of
- the .got section. */
- if (! bfd_set_section_size (inbfd, stub_sec,
- stubcount * POWERPC_STUB_SIZE)
- || ! bfd_set_section_size (inbfd, got_sec,
- (got_base
- + (stubcount
- * POWERPC_STUB_TOC_ENTRY_SIZE))))
- bfd_fatal (_("stub section sizes"));
- }
-}
-
-/* Resolve all the stubs for PowerPC NetWare. We fill in the contents
- of the output section, and create new relocs in the TOC. */
-
-static void
-powerpc_resolve_stubs (bfd *inbfd, bfd *outbfd)
-{
- bfd_byte buf[POWERPC_STUB_SIZE];
- unsigned int i;
- unsigned int stubcount;
- arelent **relocs;
- asection *got_sec;
- arelent **r;
- struct powerpc_stub *l;
-
- if (powerpc_stubs == (struct powerpc_stub *) NULL)
- return;
-
- for (i = 0; i < POWERPC_STUB_INSN_COUNT; i++)
- bfd_put_32 (outbfd, (bfd_vma) powerpc_stub_insns[i], buf + i * 4);
-
- got_sec = bfd_get_section_by_name (inbfd, ".got");
- assert (got_sec != (asection *) NULL);
- assert (got_sec->output_section->orelocation == (arelent **) NULL);
-
- stubcount = 0;
- for (l = powerpc_stubs; l != (struct powerpc_stub *) NULL; l = l->next)
- ++stubcount;
- relocs = (arelent **) xmalloc (stubcount * sizeof (arelent *));
-
- r = relocs;
- for (l = powerpc_stubs; l != (struct powerpc_stub *) NULL; l = l->next)
- {
- arelent *reloc;
-
- /* Adjust the first instruction to use the right TOC index. */
- bfd_put_32 (outbfd, (bfd_vma) powerpc_stub_insns[0] + l->toc_index, buf);
-
- /* Write this stub out. */
- if (! bfd_set_section_contents (outbfd,
- bfd_get_section (l->start),
- buf,
- l->start->value,
- POWERPC_STUB_SIZE))
- bfd_fatal (_("writing stub"));
-
- /* Create a new reloc for the TOC entry. */
- reloc = (arelent *) xmalloc (sizeof (arelent));
- reloc->sym_ptr_ptr = &l->reloc;
- reloc->address = l->toc_index + got_sec->output_offset;
- reloc->addend = 0;
- reloc->howto = bfd_reloc_type_lookup (inbfd, BFD_RELOC_32);
-
- *r++ = reloc;
- }
-
- bfd_set_reloc (outbfd, got_sec->output_section, relocs, stubcount);
-}
-
-/* Adjust relocation entries for PowerPC NetWare. We do not output
- TOC relocations. The object code already contains the offset from
- the TOC pointer. When the function is called, the TOC register,
- r2, will be set to the correct TOC value, so there is no need for
- any further reloc. */
-
-static void
-powerpc_mangle_relocs (bfd *outbfd, asection *insec,
- arelent ***relocs_ptr,
- long *reloc_count_ptr, char *contents,
- bfd_size_type contents_size ATTRIBUTE_UNUSED)
-{
- reloc_howto_type *toc_howto;
- long reloc_count;
- arelent **relocs;
- long i;
-
- toc_howto = bfd_reloc_type_lookup (insec->owner, BFD_RELOC_PPC_TOC16);
- if (toc_howto == (reloc_howto_type *) NULL)
- fatal (_("Unable to locate PPC_TOC16 reloc information"));
-
- /* If this is the .got section, clear out all the contents beyond
- the initial size. We must do this here because copy_sections is
- going to write out whatever we return in the contents field. */
- if (strcmp (bfd_get_section_name (insec->owner, insec), ".got") == 0)
- memset (contents + powerpc_initial_got_size, 0,
- (size_t) (bfd_get_section_size (insec) - powerpc_initial_got_size));
-
- reloc_count = *reloc_count_ptr;
- relocs = *relocs_ptr;
- for (i = 0; i < reloc_count; i++)
- {
- arelent *rel;
- asymbol *sym;
- bfd_vma sym_value;
-
- rel = *relocs++;
- sym = *rel->sym_ptr_ptr;
-
- /* Convert any relocs against the .bss section into relocs
- against the .data section. */
- if (strcmp (bfd_get_section_name (outbfd, bfd_get_section (sym)),
- NLM_UNINITIALIZED_DATA_NAME) == 0)
- {
- asection *datasec;
-
- datasec = bfd_get_section_by_name (outbfd,
- NLM_INITIALIZED_DATA_NAME);
- if (datasec != NULL)
- {
- rel->addend += (bfd_get_section_vma (outbfd,
- bfd_get_section (sym))
- + sym->value);
- rel->sym_ptr_ptr = datasec->symbol_ptr_ptr;
- sym = *rel->sym_ptr_ptr;
- }
- }
-
- /* PR 17512: file: 70cfde95. */
- if (rel->howto == NULL)
- continue;
-
- /* We must be able to resolve all PC relative relocs at this
- point. If we get a branch to an undefined symbol we build a
- stub, since NetWare will resolve undefined symbols into a
- pointer to a function descriptor. */
- if (rel->howto->pc_relative)
- {
- /* This check for whether a symbol is in the same section as
- the reloc will be wrong if there is a PC relative reloc
- between two sections both of which were placed in the
- same output section. This should not happen. */
- if (bfd_get_section (sym) != insec->output_section)
- non_fatal (_("unresolved PC relative reloc against %s"),
- bfd_asymbol_name (sym));
- else
- {
- bfd_vma val;
-
- if (rel->address > contents_size - 4)
- {
- non_fatal (_("Out of range relocation: %lx"),
- (long) rel->address);
- break;
- }
-
- assert (rel->howto->size == 2 && rel->howto->pcrel_offset);
- val = bfd_get_32 (outbfd, (bfd_byte *) contents + rel->address);
- val = ((val &~ rel->howto->dst_mask)
- | (((val & rel->howto->src_mask)
- + (sym->value - rel->address)
- + rel->addend)
- & rel->howto->dst_mask));
- bfd_put_32 (outbfd, val, (bfd_byte *) contents + rel->address);
-
- /* If this reloc is against an stubbed symbol and the
- next instruction is
- cror 31,31,31
- then we replace the next instruction with
- lwz r2,20(r1)
- This reloads the TOC pointer after a stub call. */
- if (bfd_asymbol_name (sym)[0] == '.'
- && (sym->flags & BSF_DYNAMIC) != 0
- && (bfd_get_32 (outbfd,
- (bfd_byte *) contents + rel->address + 4)
- == 0x4ffffb82)) /* cror 31,31,31 */
- bfd_put_32 (outbfd, (bfd_vma) 0x80410014, /* lwz r2,20(r1) */
- (bfd_byte *) contents + rel->address + 4);
-
- --*reloc_count_ptr;
- --relocs;
- memmove (relocs, relocs + 1,
- (size_t) ((reloc_count - 1) * sizeof (arelent *)));
- continue;
- }
- }
-
- /* When considering a TOC reloc, we do not want to include the
- symbol value. The symbol will be start of the TOC section
- (which is named .got). We do want to include the addend. */
- if (rel->howto == toc_howto)
- sym_value = 0;
- else
- sym_value = sym->value;
-
- /* If this is a relocation against a symbol with a value, or
- there is a reloc addend, we need to update the addend in the
- object file. */
- if (sym_value + rel->addend != 0)
- {
- bfd_vma val;
-
- switch (rel->howto->size)
- {
- case 1:
- if (rel->address > contents_size - 2)
- {
- non_fatal (_("Out of range relocation: %lx"),
- (long) rel->address);
- break;
- }
-
- val = bfd_get_16 (outbfd,
- (bfd_byte *) contents + rel->address);
- val = ((val &~ rel->howto->dst_mask)
- | (((val & rel->howto->src_mask)
- + sym_value
- + rel->addend)
- & rel->howto->dst_mask));
- if ((bfd_signed_vma) val < - 0x8000
- || (bfd_signed_vma) val >= 0x8000)
- non_fatal (_("overflow when adjusting relocation against %s"),
- bfd_asymbol_name (sym));
- bfd_put_16 (outbfd, val, (bfd_byte *) contents + rel->address);
- break;
-
- case 2:
- /* PR 17512: file: 0455a112. */
- if (rel->address > contents_size - 4)
- {
- non_fatal (_("Out of range relocation: %lx"),
- (long) rel->address);
- break;
- }
-
- val = bfd_get_32 (outbfd,
- (bfd_byte *) contents + rel->address);
- val = ((val &~ rel->howto->dst_mask)
- | (((val & rel->howto->src_mask)
- + sym_value
- + rel->addend)
- & rel->howto->dst_mask));
- bfd_put_32 (outbfd, val, (bfd_byte *) contents + rel->address);
- break;
-
- default:
- fatal (_("Unsupported relocation size: %d"), rel->howto->size);
- }
-
- if (! bfd_is_und_section (bfd_get_section (sym)))
- rel->sym_ptr_ptr = bfd_get_section (sym)->symbol_ptr_ptr;
- rel->addend = 0;
- }
-
- /* Now that we have incorporated the addend, remove any TOC
- relocs. */
- if (rel->howto == toc_howto)
- {
- --*reloc_count_ptr;
- --relocs;
- memmove (relocs, relocs + 1,
- (size_t) ((reloc_count - i) * sizeof (arelent *)));
- continue;
- }
-
- rel->address += insec->output_offset;
- }
-}
-
-#endif /* NLMCONV_POWERPC */
-
-/* Name of linker. */
-#ifndef LD_NAME
-#define LD_NAME "ld"
-#endif
-
-/* The user has specified several input files. Invoke the linker to
- link them all together, and convert and delete the resulting output
- file. */
-
-static char *
-link_inputs (struct string_list *inputs, char *ld, char * mfile)
-{
- size_t c;
- struct string_list *q;
- char **argv;
- size_t i;
- int pid;
- int status;
- char *errfmt;
- char *errarg;
-
- c = 0;
- for (q = inputs; q != NULL; q = q->next)
- ++c;
-
- argv = (char **) xmalloc ((c + 7) * sizeof (char *));
-
-#ifndef __MSDOS__
- if (ld == NULL)
- {
- char *p;
-
- /* Find the linker to invoke based on how nlmconv was run. */
- p = program_name + strlen (program_name);
- while (p != program_name)
- {
- if (p[-1] == '/')
- {
- ld = (char *) xmalloc (p - program_name + strlen (LD_NAME) + 1);
- memcpy (ld, program_name, p - program_name);
- strcpy (ld + (p - program_name), LD_NAME);
- break;
- }
- --p;
- }
- }
-#endif
-
- if (ld == NULL)
- ld = (char *) LD_NAME;
-
- unlink_on_exit = make_temp_file (".O");
-
- argv[0] = ld;
- argv[1] = (char *) "-Ur";
- argv[2] = (char *) "-o";
- argv[3] = unlink_on_exit;
- /* If we have been given the name of a mapfile and that
- name is not 'stderr' then pass it on to the linker. */
- if (mfile
- && * mfile
- && strcmp (mfile, "stderr") == 0)
- {
- argv[4] = (char *) "-Map";
- argv[5] = mfile;
- i = 6;
- }
- else
- i = 4;
-
- for (q = inputs; q != NULL; q = q->next, i++)
- argv[i] = q->string;
- argv[i] = NULL;
-
- if (debug)
- {
- for (i = 0; argv[i] != NULL; i++)
- fprintf (stderr, " %s", argv[i]);
- fprintf (stderr, "\n");
- }
-
- pid = pexecute (ld, argv, program_name, (char *) NULL, &errfmt, &errarg,
- PEXECUTE_SEARCH | PEXECUTE_ONE);
- free (argv);
-
- if (pid == -1)
- {
- fprintf (stderr, _("%s: execution of %s failed: "), program_name, ld);
- fprintf (stderr, errfmt, errarg);
- unlink (unlink_on_exit);
- exit (1);
- }
-
- if (pwait (pid, &status, 0) < 0)
- {
- perror ("pwait");
- unlink (unlink_on_exit);
- exit (1);
- }
-
- if (status != 0)
- {
- non_fatal (_("Execution of %s failed"), ld);
- unlink (unlink_on_exit);
- exit (1);
- }
-
- return unlink_on_exit;
-}
diff --git a/binutils/nlmconv.h b/binutils/nlmconv.h
deleted file mode 100644
index b2267d9..0000000
--- a/binutils/nlmconv.h
+++ /dev/null
@@ -1,86 +0,0 @@
-/* nlmconv.h -- header file for NLM conversion program
- Copyright (C) 1993-2018 Free Software Foundation, Inc.
-
- This file is part of GNU Binutils.
-
- 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. */
-
-
-/* Written by Ian Lance Taylor <ian@cygnus.com>.
-
- bfd.h, nlm/common.h and nlm/internal.h must be included before this
- file. */
-
-/* A linked list of strings. */
-
-struct string_list
-{
- struct string_list *next;
- char *string;
-};
-
-/* The NLM header parser in nlmheader.y stores information in the
- following variables. */
-
-extern Nlm_Internal_Fixed_Header *fixed_hdr;
-extern Nlm_Internal_Variable_Header *var_hdr;
-extern Nlm_Internal_Version_Header *version_hdr;
-extern Nlm_Internal_Copyright_Header *copyright_hdr;
-extern Nlm_Internal_Extended_Header *extended_hdr;
-
-/* Procedure named by CHECK. */
-extern char *check_procedure;
-/* File named by CUSTOM. */
-extern char *custom_file;
-/* Whether to generate debugging information (DEBUG). */
-extern bfd_boolean debug_info;
-/* Procedure named by EXIT. */
-extern char *exit_procedure;
-/* Exported symbols (EXPORT). */
-extern struct string_list *export_symbols;
-/* List of files from INPUT. */
-extern struct string_list *input_files;
-/* Map file name (MAP, FULLMAP). */
-extern char *map_file;
-/* Whether a full map has been requested (FULLMAP). */
-extern bfd_boolean full_map;
-/* File named by HELP. */
-extern char *help_file;
-/* Imported symbols (IMPORT). */
-extern struct string_list *import_symbols;
-/* File named by MESSAGES. */
-extern char *message_file;
-/* Autoload module list (MODULE). */
-extern struct string_list *modules;
-/* File named by OUTPUT. */
-extern char *output_file;
-/* File named by SHARELIB. */
-extern char *sharelib_file;
-/* Start procedure name (START). */
-extern char *start_procedure;
-/* VERBOSE. */
-extern bfd_boolean verbose;
-/* RPC description file (XDCDATA). */
-extern char *rpc_file;
-
-/* The number of serious parse errors. */
-extern int parse_errors;
-
-/* The parser. */
-extern int yyparse (void);
-
-/* Tell the lexer what file to read. */
-extern bfd_boolean nlmlex_file (const char *);
diff --git a/binutils/nlmheader.y b/binutils/nlmheader.y
deleted file mode 100644
index 1bf01e0..0000000
--- a/binutils/nlmheader.y
+++ /dev/null
@@ -1,959 +0,0 @@
-%{/* nlmheader.y - parse NLM header specification keywords.
- Copyright (C) 1993-2018 Free Software Foundation, Inc.
-
- This file is part of GNU Binutils.
-
- 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. */
-
-/* Written by Ian Lance Taylor <ian@cygnus.com>.
-
- This bison file parses the commands recognized by the NetWare NLM
- linker, except for lists of object files. It stores the
- information in global variables.
-
- This implementation is based on the description in the NetWare Tool
- Maker Specification manual, edition 1.0. */
-
-#include "sysdep.h"
-#include "safe-ctype.h"
-#include "bfd.h"
-#include "nlm/common.h"
-#include "nlm/internal.h"
-#include "bucomm.h"
-#include "nlmconv.h"
-
-/* Information is stored in the structures pointed to by these
- variables. */
-
-Nlm_Internal_Fixed_Header *fixed_hdr;
-Nlm_Internal_Variable_Header *var_hdr;
-Nlm_Internal_Version_Header *version_hdr;
-Nlm_Internal_Copyright_Header *copyright_hdr;
-Nlm_Internal_Extended_Header *extended_hdr;
-
-/* Procedure named by CHECK. */
-char *check_procedure;
-/* File named by CUSTOM. */
-char *custom_file;
-/* Whether to generate debugging information (DEBUG). */
-bfd_boolean debug_info;
-/* Procedure named by EXIT. */
-char *exit_procedure;
-/* Exported symbols (EXPORT). */
-struct string_list *export_symbols;
-/* List of files from INPUT. */
-struct string_list *input_files;
-/* Map file name (MAP, FULLMAP). */
-char *map_file;
-/* Whether a full map has been requested (FULLMAP). */
-bfd_boolean full_map;
-/* File named by HELP. */
-char *help_file;
-/* Imported symbols (IMPORT). */
-struct string_list *import_symbols;
-/* File named by MESSAGES. */
-char *message_file;
-/* Autoload module list (MODULE). */
-struct string_list *modules;
-/* File named by OUTPUT. */
-char *output_file;
-/* File named by SHARELIB. */
-char *sharelib_file;
-/* Start procedure name (START). */
-char *start_procedure;
-/* VERBOSE. */
-bfd_boolean verbose;
-/* RPC description file (XDCDATA). */
-char *rpc_file;
-
-/* The number of serious errors that have occurred. */
-int parse_errors;
-
-/* The current symbol prefix when reading a list of import or export
- symbols. */
-static char *symbol_prefix;
-
-/* Parser error message handler. */
-#define yyerror(msg) nlmheader_error (msg);
-
-/* Local functions. */
-static int yylex (void);
-static void nlmlex_file_push (const char *);
-static bfd_boolean nlmlex_file_open (const char *);
-static int nlmlex_buf_init (void);
-static char nlmlex_buf_add (int);
-static long nlmlex_get_number (const char *);
-static void nlmheader_identify (void);
-static void nlmheader_warn (const char *, int);
-static void nlmheader_error (const char *);
-static struct string_list * string_list_cons (char *, struct string_list *);
-static struct string_list * string_list_append (struct string_list *,
- struct string_list *);
-static struct string_list * string_list_append1 (struct string_list *,
- char *);
-static char *xstrdup (const char *);
-
-%}
-
-%union
-{
- char *string;
- struct string_list *list;
-};
-
-/* The reserved words. */
-
-%token CHECK CODESTART COPYRIGHT CUSTOM DATE DEBUG_K DESCRIPTION EXIT
-%token EXPORT FLAG_ON FLAG_OFF FULLMAP HELP IMPORT INPUT MAP MESSAGES
-%token MODULE MULTIPLE OS_DOMAIN OUTPUT PSEUDOPREEMPTION REENTRANT
-%token SCREENNAME SHARELIB STACK START SYNCHRONIZE
-%token THREADNAME TYPE VERBOSE VERSIONK XDCDATA
-
-/* Arguments. */
-
-%token <string> STRING
-%token <string> QUOTED_STRING
-
-/* Typed non-terminals. */
-%type <list> symbol_list_opt symbol_list string_list
-%type <string> symbol
-
-%%
-
-/* Keywords must start in the leftmost column of the file. Arguments
- may appear anywhere else. The lexer uses this to determine what
- token to return, so we don't have to worry about it here. */
-
-/* The entire file is just a list of commands. */
-
-file:
- commands
- ;
-
-/* A possibly empty list of commands. */
-
-commands:
- /* May be empty. */
- | command commands
- ;
-
-/* A single command. There is where most of the work takes place. */
-
-command:
- CHECK STRING
- {
- check_procedure = $2;
- }
- | CODESTART STRING
- {
- nlmheader_warn (_("CODESTART is not implemented; sorry"), -1);
- free ($2);
- }
- | COPYRIGHT QUOTED_STRING
- {
- int len;
-
- strncpy (copyright_hdr->stamp, "CoPyRiGhT=", 10);
- len = strlen ($2);
- if (len >= NLM_MAX_COPYRIGHT_MESSAGE_LENGTH)
- {
- nlmheader_warn (_("copyright string is too long"),
- NLM_MAX_COPYRIGHT_MESSAGE_LENGTH - 1);
- len = NLM_MAX_COPYRIGHT_MESSAGE_LENGTH - 1;
- }
- copyright_hdr->copyrightMessageLength = len;
- strncpy (copyright_hdr->copyrightMessage, $2, len);
- copyright_hdr->copyrightMessage[len] = '\0';
- free ($2);
- }
- | CUSTOM STRING
- {
- custom_file = $2;
- }
- | DATE STRING STRING STRING
- {
- /* We don't set the version stamp here, because we use the
- version stamp to detect whether the required VERSION
- keyword was given. */
- version_hdr->month = nlmlex_get_number ($2);
- version_hdr->day = nlmlex_get_number ($3);
- version_hdr->year = nlmlex_get_number ($4);
- free ($2);
- free ($3);
- free ($4);
- if (version_hdr->month < 1 || version_hdr->month > 12)
- nlmheader_warn (_("illegal month"), -1);
- if (version_hdr->day < 1 || version_hdr->day > 31)
- nlmheader_warn (_("illegal day"), -1);
- if (version_hdr->year < 1900 || version_hdr->year > 3000)
- nlmheader_warn (_("illegal year"), -1);
- }
- | DEBUG_K
- {
- debug_info = TRUE;
- }
- | DESCRIPTION QUOTED_STRING
- {
- int len;
-
- len = strlen ($2);
- if (len > NLM_MAX_DESCRIPTION_LENGTH)
- {
- nlmheader_warn (_("description string is too long"),
- NLM_MAX_DESCRIPTION_LENGTH);
- len = NLM_MAX_DESCRIPTION_LENGTH;
- }
- var_hdr->descriptionLength = len;
- strncpy (var_hdr->descriptionText, $2, len);
- var_hdr->descriptionText[len] = '\0';
- free ($2);
- }
- | EXIT STRING
- {
- exit_procedure = $2;
- }
- | EXPORT
- {
- symbol_prefix = NULL;
- }
- symbol_list_opt
- {
- export_symbols = string_list_append (export_symbols, $3);
- }
- | FLAG_ON STRING
- {
- fixed_hdr->flags |= nlmlex_get_number ($2);
- free ($2);
- }
- | FLAG_OFF STRING
- {
- fixed_hdr->flags &=~ nlmlex_get_number ($2);
- free ($2);
- }
- | FULLMAP
- {
- map_file = "";
- full_map = TRUE;
- }
- | FULLMAP STRING
- {
- map_file = $2;
- full_map = TRUE;
- }
- | HELP STRING
- {
- help_file = $2;
- }
- | IMPORT
- {
- symbol_prefix = NULL;
- }
- symbol_list_opt
- {
- import_symbols = string_list_append (import_symbols, $3);
- }
- | INPUT string_list
- {
- input_files = string_list_append (input_files, $2);
- }
- | MAP
- {
- map_file = "";
- }
- | MAP STRING
- {
- map_file = $2;
- }
- | MESSAGES STRING
- {
- message_file = $2;
- }
- | MODULE string_list
- {
- modules = string_list_append (modules, $2);
- }
- | MULTIPLE
- {
- fixed_hdr->flags |= 0x2;
- }
- | OS_DOMAIN
- {
- fixed_hdr->flags |= 0x10;
- }
- | OUTPUT STRING
- {
- if (output_file == NULL)
- output_file = $2;
- else
- nlmheader_warn (_("ignoring duplicate OUTPUT statement"), -1);
- }
- | PSEUDOPREEMPTION
- {
- fixed_hdr->flags |= 0x8;
- }
- | REENTRANT
- {
- fixed_hdr->flags |= 0x1;
- }
- | SCREENNAME QUOTED_STRING
- {
- int len;
-
- len = strlen ($2);
- if (len >= NLM_MAX_SCREEN_NAME_LENGTH)
- {
- nlmheader_warn (_("screen name is too long"),
- NLM_MAX_SCREEN_NAME_LENGTH);
- len = NLM_MAX_SCREEN_NAME_LENGTH;
- }
- var_hdr->screenNameLength = len;
- strncpy (var_hdr->screenName, $2, len);
- var_hdr->screenName[NLM_MAX_SCREEN_NAME_LENGTH] = '\0';
- free ($2);
- }
- | SHARELIB STRING
- {
- sharelib_file = $2;
- }
- | STACK STRING
- {
- var_hdr->stackSize = nlmlex_get_number ($2);
- free ($2);
- }
- | START STRING
- {
- start_procedure = $2;
- }
- | SYNCHRONIZE
- {
- fixed_hdr->flags |= 0x4;
- }
- | THREADNAME QUOTED_STRING
- {
- int len;
-
- len = strlen ($2);
- if (len >= NLM_MAX_THREAD_NAME_LENGTH)
- {
- nlmheader_warn (_("thread name is too long"),
- NLM_MAX_THREAD_NAME_LENGTH);
- len = NLM_MAX_THREAD_NAME_LENGTH;
- }
- var_hdr->threadNameLength = len;
- strncpy (var_hdr->threadName, $2, len);
- var_hdr->threadName[len] = '\0';
- free ($2);
- }
- | TYPE STRING
- {
- fixed_hdr->moduleType = nlmlex_get_number ($2);
- free ($2);
- }
- | VERBOSE
- {
- verbose = TRUE;
- }
- | VERSIONK STRING STRING STRING
- {
- long val;
-
- strncpy (version_hdr->stamp, "VeRsIoN#", 8);
- version_hdr->majorVersion = nlmlex_get_number ($2);
- val = nlmlex_get_number ($3);
- if (val < 0 || val > 99)
- nlmheader_warn (_("illegal minor version number (must be between 0 and 99)"),
- -1);
- else
- version_hdr->minorVersion = val;
- val = nlmlex_get_number ($4);
- if (val < 0)
- nlmheader_warn (_("illegal revision number (must be between 0 and 26)"),
- -1);
- else if (val > 26)
- version_hdr->revision = 0;
- else
- version_hdr->revision = val;
- free ($2);
- free ($3);
- free ($4);
- }
- | VERSIONK STRING STRING
- {
- long val;
-
- strncpy (version_hdr->stamp, "VeRsIoN#", 8);
- version_hdr->majorVersion = nlmlex_get_number ($2);
- val = nlmlex_get_number ($3);
- if (val < 0 || val > 99)
- nlmheader_warn (_("illegal minor version number (must be between 0 and 99)"),
- -1);
- else
- version_hdr->minorVersion = val;
- version_hdr->revision = 0;
- free ($2);
- free ($3);
- }
- | XDCDATA STRING
- {
- rpc_file = $2;
- }
- ;
-
-/* A possibly empty list of symbols. */
-
-symbol_list_opt:
- /* Empty. */
- {
- $$ = NULL;
- }
- | symbol_list
- {
- $$ = $1;
- }
- ;
-
-/* A list of symbols in an import or export list. Prefixes may appear
- in parentheses. We need to use left recursion here to avoid
- building up a large import list on the parser stack. */
-
-symbol_list:
- symbol
- {
- $$ = string_list_cons ($1, NULL);
- }
- | symbol_prefix
- {
- $$ = NULL;
- }
- | symbol_list symbol
- {
- $$ = string_list_append1 ($1, $2);
- }
- | symbol_list symbol_prefix
- {
- $$ = $1;
- }
- ;
-
-/* A prefix for subsequent symbols. */
-
-symbol_prefix:
- '(' STRING ')'
- {
- if (symbol_prefix != NULL)
- free (symbol_prefix);
- symbol_prefix = $2;
- }
- ;
-
-/* A single symbol. */
-
-symbol:
- STRING
- {
- if (symbol_prefix == NULL)
- $$ = $1;
- else
- {
- $$ = xmalloc (strlen (symbol_prefix) + strlen ($1) + 2);
- sprintf ($$, "%s@%s", symbol_prefix, $1);
- free ($1);
- }
- }
- ;
-
-/* A list of strings. */
-
-string_list:
- /* May be empty. */
- {
- $$ = NULL;
- }
- | STRING string_list
- {
- $$ = string_list_cons ($1, $2);
- }
- ;
-
-%%
-
-/* If strerror is just a macro, we want to use the one from libiberty
- since it will handle undefined values. */
-#undef strerror
-extern char *strerror (int);
-
-/* The lexer is simple, too simple for flex. Keywords are only
- recognized at the start of lines. Everything else must be an
- argument. A comma is treated as whitespace. */
-
-/* The states the lexer can be in. */
-
-enum lex_state
-{
- /* At the beginning of a line. */
- BEGINNING_OF_LINE,
- /* In the middle of a line. */
- IN_LINE
-};
-
-/* We need to keep a stack of files to handle file inclusion. */
-
-struct input
-{
- /* The file to read from. */
- FILE *file;
- /* The name of the file. */
- char *name;
- /* The current line number. */
- int lineno;
- /* The current state. */
- enum lex_state state;
- /* The next file on the stack. */
- struct input *next;
-};
-
-/* The current input file. */
-
-static struct input current;
-
-/* The character which introduces comments. */
-#define COMMENT_CHAR '#'
-
-/* Start the lexer going on the main input file. */
-
-bfd_boolean
-nlmlex_file (const char *name)
-{
- current.next = NULL;
- return nlmlex_file_open (name);
-}
-
-/* Start the lexer going on a subsidiary input file. */
-
-static void
-nlmlex_file_push (const char *name)
-{
- struct input *push;
-
- push = (struct input *) xmalloc (sizeof (struct input));
- *push = current;
- if (nlmlex_file_open (name))
- current.next = push;
- else
- {
- current = *push;
- free (push);
- }
-}
-
-/* Start lexing from a file. */
-
-static bfd_boolean
-nlmlex_file_open (const char *name)
-{
- current.file = fopen (name, "r");
- if (current.file == NULL)
- {
- fprintf (stderr, "%s:%s: %s\n", program_name, name, strerror (errno));
- ++parse_errors;
- return FALSE;
- }
- current.name = xstrdup (name);
- current.lineno = 1;
- current.state = BEGINNING_OF_LINE;
- return TRUE;
-}
-
-/* Table used to turn keywords into tokens. */
-
-struct keyword_tokens_struct
-{
- const char *keyword;
- int token;
-};
-
-static struct keyword_tokens_struct keyword_tokens[] =
-{
- { "CHECK", CHECK },
- { "CODESTART", CODESTART },
- { "COPYRIGHT", COPYRIGHT },
- { "CUSTOM", CUSTOM },
- { "DATE", DATE },
- { "DEBUG", DEBUG_K },
- { "DESCRIPTION", DESCRIPTION },
- { "EXIT", EXIT },
- { "EXPORT", EXPORT },
- { "FLAG_ON", FLAG_ON },
- { "FLAG_OFF", FLAG_OFF },
- { "FULLMAP", FULLMAP },
- { "HELP", HELP },
- { "IMPORT", IMPORT },
- { "INPUT", INPUT },
- { "MAP", MAP },
- { "MESSAGES", MESSAGES },
- { "MODULE", MODULE },
- { "MULTIPLE", MULTIPLE },
- { "OS_DOMAIN", OS_DOMAIN },
- { "OUTPUT", OUTPUT },
- { "PSEUDOPREEMPTION", PSEUDOPREEMPTION },
- { "REENTRANT", REENTRANT },
- { "SCREENNAME", SCREENNAME },
- { "SHARELIB", SHARELIB },
- { "STACK", STACK },
- { "STACKSIZE", STACK },
- { "START", START },
- { "SYNCHRONIZE", SYNCHRONIZE },
- { "THREADNAME", THREADNAME },
- { "TYPE", TYPE },
- { "VERBOSE", VERBOSE },
- { "VERSION", VERSIONK },
- { "XDCDATA", XDCDATA }
-};
-
-#define KEYWORD_COUNT (sizeof (keyword_tokens) / sizeof (keyword_tokens[0]))
-
-/* The lexer accumulates strings in these variables. */
-static char *lex_buf;
-static int lex_size;
-static int lex_pos;
-
-/* Start accumulating strings into the buffer. */
-#define BUF_INIT() \
- ((void) (lex_buf != NULL ? lex_pos = 0 : nlmlex_buf_init ()))
-
-static int
-nlmlex_buf_init (void)
-{
- lex_size = 10;
- lex_buf = xmalloc (lex_size + 1);
- lex_pos = 0;
- return 0;
-}
-
-/* Finish a string in the buffer. */
-#define BUF_FINISH() ((void) (lex_buf[lex_pos] = '\0'))
-
-/* Accumulate a character into the buffer. */
-#define BUF_ADD(c) \
- ((void) (lex_pos < lex_size \
- ? lex_buf[lex_pos++] = (c) \
- : nlmlex_buf_add (c)))
-
-static char
-nlmlex_buf_add (int c)
-{
- if (lex_pos >= lex_size)
- {
- lex_size *= 2;
- lex_buf = xrealloc (lex_buf, lex_size + 1);
- }
-
- return lex_buf[lex_pos++] = c;
-}
-
-/* The lexer proper. This is called by the bison generated parsing
- code. */
-
-static int
-yylex (void)
-{
- int c;
-
-tail_recurse:
-
- c = getc (current.file);
-
- /* Commas are treated as whitespace characters. */
- while (ISSPACE (c) || c == ',')
- {
- current.state = IN_LINE;
- if (c == '\n')
- {
- ++current.lineno;
- current.state = BEGINNING_OF_LINE;
- }
- c = getc (current.file);
- }
-
- /* At the end of the file we either pop to the previous file or
- finish up. */
- if (c == EOF)
- {
- fclose (current.file);
- free (current.name);
- if (current.next == NULL)
- return 0;
- else
- {
- struct input *next;
-
- next = current.next;
- current = *next;
- free (next);
- goto tail_recurse;
- }
- }
-
- /* A comment character always means to drop everything until the
- next newline. */
- if (c == COMMENT_CHAR)
- {
- do
- {
- c = getc (current.file);
- }
- while (c != '\n');
- ++current.lineno;
- current.state = BEGINNING_OF_LINE;
- goto tail_recurse;
- }
-
- /* An '@' introduces an include file. */
- if (c == '@')
- {
- do
- {
- c = getc (current.file);
- if (c == '\n')
- ++current.lineno;
- }
- while (ISSPACE (c));
- BUF_INIT ();
- while (! ISSPACE (c) && c != EOF)
- {
- BUF_ADD (c);
- c = getc (current.file);
- }
- BUF_FINISH ();
-
- ungetc (c, current.file);
-
- nlmlex_file_push (lex_buf);
- goto tail_recurse;
- }
-
- /* A non-space character at the start of a line must be the start of
- a keyword. */
- if (current.state == BEGINNING_OF_LINE)
- {
- BUF_INIT ();
- while (ISALNUM (c) || c == '_')
- {
- BUF_ADD (TOUPPER (c));
- c = getc (current.file);
- }
- BUF_FINISH ();
-
- if (c != EOF && ! ISSPACE (c) && c != ',')
- {
- nlmheader_identify ();
- fprintf (stderr, _("%s:%d: illegal character in keyword: %c\n"),
- current.name, current.lineno, c);
- }
- else
- {
- unsigned int i;
-
- for (i = 0; i < KEYWORD_COUNT; i++)
- {
- if (lex_buf[0] == keyword_tokens[i].keyword[0]
- && strcmp (lex_buf, keyword_tokens[i].keyword) == 0)
- {
- /* Pushing back the final whitespace avoids worrying
- about \n here. */
- ungetc (c, current.file);
- current.state = IN_LINE;
- return keyword_tokens[i].token;
- }
- }
-
- nlmheader_identify ();
- fprintf (stderr, _("%s:%d: unrecognized keyword: %s\n"),
- current.name, current.lineno, lex_buf);
- }
-
- ++parse_errors;
- /* Treat the rest of this line as a comment. */
- ungetc (COMMENT_CHAR, current.file);
- goto tail_recurse;
- }
-
- /* Parentheses just represent themselves. */
- if (c == '(' || c == ')')
- return c;
-
- /* Handle quoted strings. */
- if (c == '"' || c == '\'')
- {
- int quote;
- int start_lineno;
-
- quote = c;
- start_lineno = current.lineno;
-
- c = getc (current.file);
- BUF_INIT ();
- while (c != quote && c != EOF)
- {
- BUF_ADD (c);
- if (c == '\n')
- ++current.lineno;
- c = getc (current.file);
- }
- BUF_FINISH ();
-
- if (c == EOF)
- {
- nlmheader_identify ();
- fprintf (stderr, _("%s:%d: end of file in quoted string\n"),
- current.name, start_lineno);
- ++parse_errors;
- }
-
- /* FIXME: Possible memory leak. */
- yylval.string = xstrdup (lex_buf);
- return QUOTED_STRING;
- }
-
- /* Gather a generic argument. */
- BUF_INIT ();
- while (! ISSPACE (c)
- && c != ','
- && c != COMMENT_CHAR
- && c != '('
- && c != ')')
- {
- BUF_ADD (c);
- c = getc (current.file);
- }
- BUF_FINISH ();
-
- ungetc (c, current.file);
-
- /* FIXME: Possible memory leak. */
- yylval.string = xstrdup (lex_buf);
- return STRING;
-}
-
-/* Get a number from a string. */
-
-static long
-nlmlex_get_number (const char *s)
-{
- long ret;
- char *send;
-
- ret = strtol (s, &send, 10);
- if (*send != '\0')
- nlmheader_warn (_("bad number"), -1);
- return ret;
-}
-
-/* Prefix the nlmconv warnings with a note as to where they come from.
- We don't use program_name on every warning, because then some
- versions of the emacs next-error function can't recognize the line
- number. */
-
-static void
-nlmheader_identify (void)
-{
- static int done;
-
- if (! done)
- {
- fprintf (stderr, _("%s: problems in NLM command language input:\n"),
- program_name);
- done = 1;
- }
-}
-
-/* Issue a warning. */
-
-static void
-nlmheader_warn (const char *s, int imax)
-{
- nlmheader_identify ();
- fprintf (stderr, "%s:%d: %s", current.name, current.lineno, s);
- if (imax != -1)
- fprintf (stderr, " (max %d)", imax);
- fprintf (stderr, "\n");
-}
-
-/* Report an error. */
-
-static void
-nlmheader_error (const char *s)
-{
- nlmheader_warn (s, -1);
- ++parse_errors;
-}
-
-/* Add a string to a string list. */
-
-static struct string_list *
-string_list_cons (char *s, struct string_list *l)
-{
- struct string_list *ret;
-
- ret = (struct string_list *) xmalloc (sizeof (struct string_list));
- ret->next = l;
- ret->string = s;
- return ret;
-}
-
-/* Append a string list to another string list. */
-
-static struct string_list *
-string_list_append (struct string_list *l1, struct string_list *l2)
-{
- register struct string_list **pp;
-
- for (pp = &l1; *pp != NULL; pp = &(*pp)->next)
- ;
- *pp = l2;
- return l1;
-}
-
-/* Append a string to a string list. */
-
-static struct string_list *
-string_list_append1 (struct string_list *l, char *s)
-{
- struct string_list *n;
- register struct string_list **pp;
-
- n = (struct string_list *) xmalloc (sizeof (struct string_list));
- n->next = NULL;
- n->string = s;
- for (pp = &l; *pp != NULL; pp = &(*pp)->next)
- ;
- *pp = n;
- return l;
-}
-
-/* Duplicate a string in memory. */
-
-static char *
-xstrdup (const char *s)
-{
- unsigned long len;
- char *ret;
-
- len = strlen (s);
- ret = xmalloc (len + 1);
- strcpy (ret, s);
- return ret;
-}
diff --git a/binutils/po/POTFILES.in b/binutils/po/POTFILES.in
index 7bda4c3..2795582 100644
--- a/binutils/po/POTFILES.in
+++ b/binutils/po/POTFILES.in
@@ -33,8 +33,6 @@ is-strip.c
maybe-ranlib.c
maybe-strip.c
mclex.c
-nlmconv.c
-nlmconv.h
nm.c
not-ranlib.c
not-strip.c
diff --git a/binutils/testsuite/binutils-all/nm.exp b/binutils/testsuite/binutils-all/nm.exp
index f8779c1..f966323 100644
--- a/binutils/testsuite/binutils-all/nm.exp
+++ b/binutils/testsuite/binutils-all/nm.exp
@@ -44,7 +44,7 @@ if {![binutils_assemble $srcdir/$subdir/bintest.s tmpdir/bintest.o]} then {
# This test does not work correctly on ECOFF targets, because ECOFF
# stores most symbols twice, which messes up the nm output.
- setup_xfail "alpha*-*-osf*" "alpha*-*-netware*"
+ setup_xfail "alpha*-*-osf*"
setup_xfail "mips*-*-ultrix*" "mips*-*-ecoff*" "mips*-*-irix4*"
setup_xfail "mips*-*-riscos*" "mips*-*-sysv3*" "mips*-sony-bsd*"
@@ -102,7 +102,7 @@ if {![binutils_assemble $srcdir/$subdir/bintest.s tmpdir/bintest.o]} then {
# This test does not work correctly on ECOFF targets, because ECOFF
# stores most symbols twice, which messes up the nm output.
- setup_xfail "alpha*-*-osf*" "alpha*-*-netware*"
+ setup_xfail "alpha*-*-osf*"
setup_xfail "mips*-*-ultrix*" "mips*-*-ecoff*" "mips*-*-irix4*"
setup_xfail "mips*-*-riscos*" "mips*-*-sysv3*" "mips*-sony-bsd*"
@@ -135,7 +135,6 @@ if { [is_elf_format]
|| [istarget *-*-freebsd*]
|| [istarget *-*-lynxos*]
|| [istarget "mmix-knuth-mmixware"]
- || [istarget *-*-netware*]
|| [istarget *-*-nto*]
|| [istarget *-*-rdos*]
|| [istarget *-*-tpf*]
@@ -160,7 +159,7 @@ if {![binutils_assemble $srcdir/$subdir/$nm_1_src tmpdir/nm-1.o]} then {
# This test does not work correctly on ECOFF targets, because ECOFF
# stores most symbols twice, which messes up the nm output.
- setup_xfail "alpha*-*-osf*" "alpha*-*-netware*"
+ setup_xfail "alpha*-*-osf*"
setup_xfail "mips*-*-ultrix*" "mips*-*-ecoff*" "mips*-*-irix4*"
setup_xfail "mips*-*-riscos*" "mips*-*-sysv3*" "mips*-sony-bsd*"
diff --git a/gas/ChangeLog b/gas/ChangeLog
index ad99365..d54a09d 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,3 +1,12 @@
+2018-04-16 Alan Modra <amodra@gmail.com>
+
+ * Makefile.am: Remove netware support.
+ * config/tc-i386.c: Likewise.
+ * configure.tgt: Likewise.
+ * config/te-netware.h: Delete.
+ * Makefile.in: Regenerate.
+ * po/POTFILES.in: Regenerate.
+
2018-04-15 H.J. Lu <hongjiu.lu@intel.com>
* testsuite/gas/i386/x86-64-waitpkg.s: Add 32-bit registers
diff --git a/gas/Makefile.am b/gas/Makefile.am
index 3b0dd03..2b34227 100644
--- a/gas/Makefile.am
+++ b/gas/Makefile.am
@@ -327,7 +327,6 @@ TARG_ENV_HFILES = \
config/te-macos.h \
config/te-nbsd.h \
config/te-nbsd532.h \
- config/te-netware.h \
config/te-pc532mach.h \
config/te-pe.h \
config/te-psos.h \
diff --git a/gas/Makefile.in b/gas/Makefile.in
index 8968b1e..4683a44 100644
--- a/gas/Makefile.in
+++ b/gas/Makefile.in
@@ -623,7 +623,6 @@ TARG_ENV_HFILES = \
config/te-macos.h \
config/te-nbsd.h \
config/te-nbsd532.h \
- config/te-netware.h \
config/te-pc532mach.h \
config/te-pe.h \
config/te-psos.h \
diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c
index 028e062..9d5293d 100644
--- a/gas/config/tc-i386.c
+++ b/gas/config/tc-i386.c
@@ -432,7 +432,6 @@ const char extra_symbol_chars[] = "*%-([{}"
&& !defined (TE_GNU) \
&& !defined (TE_LINUX) \
&& !defined (TE_NACL) \
- && !defined (TE_NETWARE) \
&& !defined (TE_FreeBSD) \
&& !defined (TE_DragonFly) \
&& !defined (TE_NetBSD)))
diff --git a/gas/config/te-netware.h b/gas/config/te-netware.h
deleted file mode 100644
index e2586a8..0000000
--- a/gas/config/te-netware.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/* te-netware.h -- NetWare target environment declarations.
- Copyright (C) 2004-2018 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. */
-
-#define TE_NETWARE
-#define LOCAL_LABELS_FB 1
-
-#define LEX_AT (LEX_NAME | LEX_BEGIN_NAME) /* Can have @'s inside labels. */
-#define LEX_PCT (LEX_NAME | LEX_BEGIN_NAME) /* Can have %'s inside labels. */
-#define LEX_QM (LEX_NAME | LEX_BEGIN_NAME) /* Can have ?'s inside labels. */
-
-#include "obj-format.h"
diff --git a/gas/configure.tgt b/gas/configure.tgt
index 0f5626b..96a74dd 100644
--- a/gas/configure.tgt
+++ b/gas/configure.tgt
@@ -490,7 +490,6 @@ case ${generic_target} in
*-*-solaris*) fmt=elf em=solaris ;;
*-*-aros*) fmt=elf em=linux ;;
*-*-vxworks* | *-*-windiss) fmt=elf em=vxworks ;;
- *-*-netware) fmt=elf em=netware ;;
esac
case ${cpu_type} in
diff --git a/gas/po/POTFILES.in b/gas/po/POTFILES.in
index f4fe666..847a5cf 100644
--- a/gas/po/POTFILES.in
+++ b/gas/po/POTFILES.in
@@ -202,7 +202,6 @@ config/te-mach.h
config/te-macos.h
config/te-nbsd.h
config/te-nbsd532.h
-config/te-netware.h
config/te-pc532mach.h
config/te-pe.h
config/te-psos.h
diff --git a/gprof/ChangeLog b/gprof/ChangeLog
index 1476aaa..aa2fff1 100644
--- a/gprof/ChangeLog
+++ b/gprof/ChangeLog
@@ -1,5 +1,9 @@
2018-04-16 Alan Modra <amodra@gmail.com>
+ * corefile.c: Remove netware support.
+
+2018-04-16 Alan Modra <amodra@gmail.com>
+
* Makefile.am: Remove tahoe support.
* corefile.c: Likewise.
* tahoe.c: Delete.
diff --git a/gprof/corefile.c b/gprof/corefile.c
index a179668..a92f065 100644
--- a/gprof/corefile.c
+++ b/gprof/corefile.c
@@ -603,7 +603,6 @@ core_create_function_syms (void)
case bfd_target_ecoff_flavour:
case bfd_target_xcoff_flavour:
case bfd_target_elf_flavour:
- case bfd_target_nlm_flavour:
case bfd_target_som_flavour:
core_has_func_syms = 1;
}
diff --git a/include/ChangeLog b/include/ChangeLog
index 6c16643..75e0b971 100644
--- a/include/ChangeLog
+++ b/include/ChangeLog
@@ -1,5 +1,16 @@
2018-04-16 Alan Modra <amodra@gmail.com>
+ * nlm/ChangeLog-9315: Delete.
+ * nlm/alpha-ext.h: Delete.
+ * nlm/common.h: Delete.
+ * nlm/external.h: Delete.
+ * nlm/i386-ext.h: Delete.
+ * nlm/internal.h: Delete.
+ * nlm/ppc-ext.h: Delete.
+ * nlm/sparc32-ext.h: Delete.
+
+2018-04-16 Alan Modra <amodra@gmail.com>
+
* opcode/tahoe.h: Delete.
2018-04-11 Alan Modra <amodra@gmail.com>
diff --git a/include/nlm/ChangeLog-9315 b/include/nlm/ChangeLog-9315
deleted file mode 100644
index 7f0ce04..0000000
--- a/include/nlm/ChangeLog-9315
+++ /dev/null
@@ -1,127 +0,0 @@
-2015-01-01 Alan Modra <amodra@gmail.com>
-
- Update year range in copyright notice of all files.
-
-2014-03-05 Alan Modra <amodra@gmail.com>
-
- Update copyright years.
-
-2010-04-15 Nick Clifton <nickc@redhat.com>
-
- * alpha-ext.h: Update copyright notice to use GPLv3.
- * common.h: Likewise.
- * external.h: Likewise.
- * i386-ext.h: Likewise.
- * internal.h: Likewise.
- * ppc-ext.h: Likewise.
- * sparc32-ext.h: Likewise.
-
-2005-05-10 Nick Clifton <nickc@redhat.com>
-
- * Update the address and phone number of the FSF organization in
- the GPL notices in the following files:
- alpha-ext.h, common.h, external.h, i386-ext.h, internal.h,
- ppc-ext.h, sparc32-ext.h
-
-2003-08-07 Alan Modra <amodra@bigpond.net.au>
-
- * internal.h (Nlm_Internal_Custom_Header): Replace PTR with void *.
-
-2001-10-02 Alan Modra <amodra@bigpond.net.au>
-
- * common.h (NLM_CAT, NLM_CAT3): Don't define.
- (NLM_CAT4): Update conditions under which this is defined. Document
- why CONCAT4 can't be used.
-
-1994-05-06 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
-
- * external.h (nlmNAME(External_Custom_Header)): Add length,
- dataOffset, and dataStamp field.
- (nlmNAME(External_Cygnus_Ext_Header)): Remove.
- * internal.h (Nlm_Internal_Custom_Header): Add hdrLength,
- dataOffset, dataStamp and hdr fields.
-
-1994-04-22 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
-
- * external.h (struct nlmNAME(external_cygnus_ext_header)): Rename
- from nlmNAME(external_cygnus_section_header). Change stamp field
- to 8 bytes. Add bytes field.
- * internal.h (nlm_internal_cygnus_ext_header): Rename from
- nlm_internal_cygnus_section_header. Change stamp field to 8
- bytes.
-
-1994-04-21 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
-
- * internal.h (struct nlm_internal_cygnus_section_header): Define.
- * external.h (struct nlmNAME(external_cygnus_section_header):
- Define.
-
-1994-04-20 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
-
- * internal.h (struct nlm_internal_custom_header): Remove
- debugRecOffset and debugRecLength fields. Add data field.
- * external.h (struct nlmNAME(external_custom_header)): Remove
- debugRecOffset and debugRecLength fields.
-
-1994-02-07 Jim Kingdon (kingdon@lioth.cygnus.com)
-
- * internal.h: Change HOST_64_BIT to BFD_HOST_64_BIT.
-
-1993-12-02 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
-
- * alpha-ext.h: New file describing formats of information in Alpha
- NetWare files.
- * common.h: Define some non-external Alpha information.
-
-1993-11-17 Sean Eric Fagan (sef@cygnus.com)
-
- * external.h: Don't define external_fixed_header here.
- * i386-ext.h, sparc32-ext.h: New header files to define
- external_fixed_header for particular CPU's.
-
-1993-10-27 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
-
- * internal.h (Nlm_Internal_Extended_Header): Added fields
- sharedDebugRecordOffset and sharedDebugRecordCount.
- * external.h (NlmNAME(External_Extended_Header)): Likewise.
-
- * common.h (NLM_SIGNATURE): Do not define (it's different for each
- backend).
-
-1993-08-31 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
-
- * internal.h: Change length fields of type char to type unsigned
- char.
-
-1993-07-31 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
-
- * common.h (NLM_HIBIT, NLM_HEADER_VERSION): Define.
-
-1993-07-22 Fred Fish (fnf@deneb.cygnus.com)
-
- * common.h (NLM_CAT*, NLM_ARCH_SIZE, NLM_TARGET_LONG_SIZE,
- NLM_TARGET_ADDRESS_SIZE, NLM_NAME, NlmNAME, nlmNAME): New
- macros.
- * external.h (TARGET_LONG_SIZE, TARGET_ADDRESS_SIZE): Remove
- macros, convert usages to NLM_ equivalents.
- * external.h: Use nlmNAME and NlmNAME macros to derive both
- 32 and 64 bit versions.
-
-1993-07-20 Fred Fish (fnf@deneb.cygnus.com)
-
- * (common.h, external.h, internal.h): New files for NLM/NetWare
- support.
-
-
-Copyright (C) 1993-2015 Free Software Foundation, Inc.
-
-Copying and distribution of this file, with or without modification,
-are permitted in any medium without royalty provided the copyright
-notice and this notice are preserved.
-
-Local Variables:
-mode: change-log
-left-margin: 8
-fill-column: 74
-version-control: never
-End:
diff --git a/include/nlm/alpha-ext.h b/include/nlm/alpha-ext.h
deleted file mode 100644
index 73bedad..0000000
--- a/include/nlm/alpha-ext.h
+++ /dev/null
@@ -1,167 +0,0 @@
-/* Alpha NLM (NetWare Loadable Module) support for BFD.
- Copyright (C) 1993-2018 Free Software Foundation, Inc.
- By Ian Lance Taylor, 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. */
-
-/* An Alpha NLM starts with an instance of this structure. */
-
-struct nlm32_alpha_external_prefix_header
-{
- /* Magic number. Must be NLM32_ALPHA_MAGIC. */
- unsigned char magic[4];
- /* Format descriptor. Current value is 2. */
- unsigned char format[4];
- /* Size of prefix header. */
- unsigned char size[4];
- /* Padding. */
- unsigned char pad1[4];
- /* More fields may be added later, supposedly. */
-};
-
-/* The external format of an Alpha NLM reloc. This is the same as an
- Alpha ECOFF reloc. */
-
-struct nlm32_alpha_external_reloc
-{
- unsigned char r_vaddr[8];
- unsigned char r_symndx[4];
- unsigned char r_bits[4];
-};
-
-/* Constants to unpack the r_bits field of a reloc. */
-
-#define RELOC_BITS0_TYPE_LITTLE 0xff
-#define RELOC_BITS0_TYPE_SH_LITTLE 0
-
-#define RELOC_BITS1_EXTERN_LITTLE 0x01
-
-#define RELOC_BITS1_OFFSET_LITTLE 0x7e
-#define RELOC_BITS1_OFFSET_SH_LITTLE 1
-
-#define RELOC_BITS1_RESERVED_LITTLE 0x80
-#define RELOC_BITS1_RESERVED_SH_LITTLE 7
-#define RELOC_BITS2_RESERVED_LITTLE 0xff
-#define RELOC_BITS2_RESERVED_SH_LEFT_LITTLE 1
-#define RELOC_BITS3_RESERVED_LITTLE 0x03
-#define RELOC_BITS3_RESERVED_SH_LEFT_LITTLE 9
-
-#define RELOC_BITS3_SIZE_LITTLE 0xfc
-#define RELOC_BITS3_SIZE_SH_LITTLE 2
-
-/* The external format of the fixed header. */
-
-typedef struct nlm32_alpha_external_fixed_header
-{
-
- /* The signature field identifies the file as an NLM. It must contain
- the signature string, which depends upon the NLM target. */
-
- unsigned char signature[24];
-
- /* The version of the header. At this time, the highest version number
- is 4. */
-
- unsigned char version[4];
-
- /* The name of the module, which must be a DOS name (1-8 characters followed
- by a period and a 1-3 character extension). The first byte is the byte
- length of the name and the last byte is a null terminator byte. This
- field is fixed length, and any unused bytes should be null bytes. The
- value is set by the OUTPUT keyword to NLMLINK. */
-
- unsigned char moduleName[14];
-
- /* Padding to make it come out correct. */
-
- unsigned char pad1[2];
-
- /* The byte offset of the code image from the start of the file. */
-
- unsigned char codeImageOffset[4];
-
- /* The size of the code image, in bytes. */
-
- unsigned char codeImageSize[4];
-
- /* The byte offset of the data image from the start of the file. */
-
- unsigned char dataImageOffset[4];
-
- /* The size of the data image, in bytes. */
-
- unsigned char dataImageSize[4];
-
- /* The size of the uninitialized data region that the loader is to be
- allocated at load time. Uninitialized data follows the initialized
- data in the NLM address space. */
-
- unsigned char uninitializedDataSize[4];
-
- /* The byte offset of the custom data from the start of the file. The
- custom data is set by the CUSTOM keyword to NLMLINK. It is possible
- for this to be EOF if there is no custom data. */
-
- unsigned char customDataOffset[4];
-
- /* The size of the custom data, in bytes. */
-
- unsigned char customDataSize[4];
-
- /* The byte offset of the module dependencies from the start of the file.
- The module dependencies are determined by the MODULE keyword in
- NLMLINK. */
-
- unsigned char moduleDependencyOffset[4];
-
- /* The number of module dependencies at the moduleDependencyOffset. */
-
- unsigned char numberOfModuleDependencies[4];
-
- /* The byte offset of the relocation fixup data from the start of the file */
-
- unsigned char relocationFixupOffset[4];
-
- unsigned char numberOfRelocationFixups[4];
-
- unsigned char externalReferencesOffset[4];
-
- unsigned char numberOfExternalReferences[4];
-
- unsigned char publicsOffset[4];
-
- unsigned char numberOfPublics[4];
-
- /* The byte offset of the internal debug info from the start of the file.
- It is possible for this to be EOF if there is no debug info. */
-
- unsigned char debugInfoOffset[4];
-
- unsigned char numberOfDebugRecords[4];
-
- unsigned char codeStartOffset[4];
-
- unsigned char exitProcedureOffset[4];
-
- unsigned char checkUnloadProcedureOffset[4];
-
- unsigned char moduleType[4];
-
- unsigned char flags[4];
-
-} Nlm32_alpha_External_Fixed_Header;
diff --git a/include/nlm/common.h b/include/nlm/common.h
deleted file mode 100644
index 8b2b30e..0000000
--- a/include/nlm/common.h
+++ /dev/null
@@ -1,123 +0,0 @@
-/* NLM (NetWare Loadable Module) support for BFD.
- Copyright (C) 1993-2018 Free Software Foundation, Inc.
-
- Written by Fred Fish @ 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. */
-
-/* This file is part of NLM support for BFD, and contains the portions
- that are common to both the internal and external representations. */
-
-/* If NLM_ARCH_SIZE is not defined, default to 32. NLM_ARCH_SIZE is
- optionally defined by the application. */
-
-#ifndef NLM_ARCH_SIZE
-# define NLM_ARCH_SIZE 32
-#endif
-
-/* Due to horrible details of ANSI macro expansion, we can't use CONCAT4
- for NLM_NAME. CONCAT2 is used in BFD_JUMP_TABLE macros, and some of
- them will expand to tokens that themselves are macros defined in terms
- of NLM_NAME. If NLM_NAME were defined using CONCAT4 (which is itself
- defined in bfd-in.h using CONCAT2), ANSI preprocessor rules say that
- the CONCAT2 within NLM_NAME should not be expanded.
- So use another name. */
-#if defined (__STDC__) || defined (ALMOST_STDC) || defined (HAVE_STRINGIZE)
-#ifdef SABER
-#define NLM_CAT4(a,b,c,d) a##b##c##d
-#else
-/* This hack is to avoid a problem with some strict ANSI C preprocessors.
- The problem is, "32_" is not a valid preprocessing token, and we don't
- want extra underscores (e.g., "nlm_32_"). The NLM_XCAT2 macro will
- cause the inner CAT2 macros to be evaluated first, producing
- still-valid pp-tokens. Then the final concatenation can be done. */
-#define NLM_CAT2(a,b) a##b
-#define NLM_XCAT2(a,b) NLM_CAT2(a,b)
-#define NLM_CAT4(a,b,c,d) NLM_XCAT2(NLM_CAT2(a,b),NLM_CAT2(c,d))
-#endif
-#else
-#define NLM_CAT4(a,b,c,d) a/**/b/**/c/**/d
-#endif
-
-#if NLM_ARCH_SIZE == 32
-# define NLM_TARGET_LONG_SIZE 4
-# define NLM_TARGET_ADDRESS_SIZE 4
-# define NLM_NAME(x,y) NLM_CAT4(x,32,_,y)
-# define NLM_HIBIT (((bfd_vma) 1) << 31)
-#endif
-#if NLM_ARCH_SIZE == 64
-# define NLM_TARGET_LONG_SIZE 8
-# define NLM_TARGET_ADDRESS_SIZE 8
-# define NLM_NAME(x,y) NLM_CAT4(x,64,_,y)
-# define NLM_HIBIT (((bfd_vma) 1) << 63)
-#endif
-
-#define NlmNAME(X) NLM_NAME(Nlm,X)
-#define nlmNAME(X) NLM_NAME(nlm,X)
-
-/* Give names to things that should not change. */
-
-#define NLM_MAX_DESCRIPTION_LENGTH 127
-#define NLM_MAX_SCREEN_NAME_LENGTH 71
-#define NLM_MAX_THREAD_NAME_LENGTH 71
-#define NLM_MAX_COPYRIGHT_MESSAGE_LENGTH 255
-#define NLM_OTHER_DATA_LENGTH 400 /* FIXME */
-#define NLM_OLD_THREAD_NAME_LENGTH 5
-#define NLM_SIGNATURE_SIZE 24
-#define NLM_HEADER_VERSION 4
-#define NLM_MODULE_NAME_SIZE 14
-#define NLM_DEFAULT_STACKSIZE (8 * 1024)
-
-/* Alpha information. This should probably be in a separate Alpha
- header file, but it can't go in alpha-ext.h because some of it is
- needed by nlmconv.c. */
-
-/* Magic number in Alpha prefix header. */
-#define NLM32_ALPHA_MAGIC (0x83561840)
-
-/* The r_type field in an Alpha reloc is one of the following values. */
-#define ALPHA_R_IGNORE 0
-#define ALPHA_R_REFLONG 1
-#define ALPHA_R_REFQUAD 2
-#define ALPHA_R_GPREL32 3
-#define ALPHA_R_LITERAL 4
-#define ALPHA_R_LITUSE 5
-#define ALPHA_R_GPDISP 6
-#define ALPHA_R_BRADDR 7
-#define ALPHA_R_HINT 8
-#define ALPHA_R_SREL16 9
-#define ALPHA_R_SREL32 10
-#define ALPHA_R_SREL64 11
-#define ALPHA_R_OP_PUSH 12
-#define ALPHA_R_OP_STORE 13
-#define ALPHA_R_OP_PSUB 14
-#define ALPHA_R_OP_PRSHIFT 15
-#define ALPHA_R_GPVALUE 16
-#define ALPHA_R_NW_RELOC 250
-
-/* A local reloc, other than ALPHA_R_GPDISP or ALPHA_R_IGNORE, must be
- against one of these symbol indices. */
-#define ALPHA_RELOC_SECTION_TEXT 1
-#define ALPHA_RELOC_SECTION_DATA 3
-
-/* An ALPHA_R_NW_RELOC has one of these values in the size field. If
- it is SETGP, the r_vaddr field holds the GP value to use. If it is
- LITA, the r_vaddr field holds the address of the .lita section and
- the r_symndx field holds the size of the .lita section. */
-#define ALPHA_R_NW_RELOC_SETGP 1
-#define ALPHA_R_NW_RELOC_LITA 2
diff --git a/include/nlm/external.h b/include/nlm/external.h
deleted file mode 100644
index fb25f71..0000000
--- a/include/nlm/external.h
+++ /dev/null
@@ -1,172 +0,0 @@
-/* NLM (NetWare Loadable Module) support for BFD.
- Copyright (C) 1993-2018 Free Software Foundation, Inc.
-
- Written by Fred Fish @ 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. */
-
-/* This file is part of NLM support for BFD, and contains the portions
- that describe how NLM is represented externally by the BFD library.
- I.E. it describes the in-file representation of NLM. It requires
- the nlm/common.h file which contains the portions that are common to
- both the internal and external representations.
-
- Note that an NLM header consists of three parts:
-
- (1) A fixed length header that has specific fields of known length,
- at specific offsets in the file.
-
- (2) A variable length header that has specific fields in a specific
- order, but some fields may be variable length.
-
- (3) A auxiliary header that has various optional fields in no specific
- order. There is no way to identify the end of the auxiliary headers
- except by finding a header without a recognized 'stamp'.
-
- The exact format of the fixed length header unfortunately varies
- from one NLM target to another, due to padding. Each target
- defines the correct external format in a separate header file. */
-
-/* NLM Header. */
-
-/* The version header is one of the optional auxiliary headers and
- follows the fixed length and variable length NLM headers. */
-
-typedef struct nlmNAME(external_version_header)
-{
-
- /* The header is recognized by "VeRsIoN#" in the stamp field. */
- char stamp[8];
-
- unsigned char majorVersion[NLM_TARGET_LONG_SIZE];
-
- unsigned char minorVersion[NLM_TARGET_LONG_SIZE];
-
- unsigned char revision[NLM_TARGET_LONG_SIZE];
-
- unsigned char year[NLM_TARGET_LONG_SIZE];
-
- unsigned char month[NLM_TARGET_LONG_SIZE];
-
- unsigned char day[NLM_TARGET_LONG_SIZE];
-
-} NlmNAME(External_Version_Header);
-
-
-typedef struct nlmNAME(external_copyright_header)
-{
-
- /* The header is recognized by "CoPyRiGhT=" in the stamp field. */
-
- char stamp[10];
-
- unsigned char copyrightMessageLength[1];
-
- /* There is a variable length field here called 'copyrightMessage'
- that is the length specified by copyrightMessageLength. */
-
-} NlmNAME(External_Copyright_Header);
-
-
-typedef struct nlmNAME(external_extended_header)
-{
-
- /* The header is recognized by "MeSsAgEs" in the stamp field. */
-
- char stamp[8];
-
- unsigned char languageID[NLM_TARGET_LONG_SIZE];
-
- unsigned char messageFileOffset[NLM_TARGET_LONG_SIZE];
-
- unsigned char messageFileLength[NLM_TARGET_LONG_SIZE];
-
- unsigned char messageCount[NLM_TARGET_LONG_SIZE];
-
- unsigned char helpFileOffset[NLM_TARGET_LONG_SIZE];
-
- unsigned char helpFileLength[NLM_TARGET_LONG_SIZE];
-
- unsigned char RPCDataOffset[NLM_TARGET_LONG_SIZE];
-
- unsigned char RPCDataLength[NLM_TARGET_LONG_SIZE];
-
- unsigned char sharedCodeOffset[NLM_TARGET_LONG_SIZE];
-
- unsigned char sharedCodeLength[NLM_TARGET_LONG_SIZE];
-
- unsigned char sharedDataOffset[NLM_TARGET_LONG_SIZE];
-
- unsigned char sharedDataLength[NLM_TARGET_LONG_SIZE];
-
- unsigned char sharedRelocationFixupOffset[NLM_TARGET_LONG_SIZE];
-
- unsigned char sharedRelocationFixupCount[NLM_TARGET_LONG_SIZE];
-
- unsigned char sharedExternalReferenceOffset[NLM_TARGET_LONG_SIZE];
-
- unsigned char sharedExternalReferenceCount[NLM_TARGET_LONG_SIZE];
-
- unsigned char sharedPublicsOffset[NLM_TARGET_LONG_SIZE];
-
- unsigned char sharedPublicsCount[NLM_TARGET_LONG_SIZE];
-
- unsigned char sharedDebugRecordOffset[NLM_TARGET_LONG_SIZE];
-
- unsigned char sharedDebugRecordCount[NLM_TARGET_LONG_SIZE];
-
- unsigned char sharedInitializationOffset[NLM_TARGET_ADDRESS_SIZE];
-
- unsigned char SharedExitProcedureOffset[NLM_TARGET_ADDRESS_SIZE];
-
- unsigned char productID[NLM_TARGET_LONG_SIZE];
-
- unsigned char reserved0[NLM_TARGET_LONG_SIZE];
-
- unsigned char reserved1[NLM_TARGET_LONG_SIZE];
-
- unsigned char reserved2[NLM_TARGET_LONG_SIZE];
-
- unsigned char reserved3[NLM_TARGET_LONG_SIZE];
-
- unsigned char reserved4[NLM_TARGET_LONG_SIZE];
-
- unsigned char reserved5[NLM_TARGET_LONG_SIZE];
-
-} NlmNAME(External_Extended_Header);
-
-
-typedef struct nlmNAME(external_custom_header)
-{
-
- /* The header is recognized by "CuStHeAd" in the stamp field. */
- char stamp[8];
-
- /* Length of this header. */
- unsigned char length[NLM_TARGET_LONG_SIZE];
-
- /* Offset to data. */
- unsigned char dataOffset[NLM_TARGET_LONG_SIZE];
-
- /* Length of data. */
- unsigned char dataLength[NLM_TARGET_LONG_SIZE];
-
- /* Stamp for this customer header--we recognize "CyGnUsEx". */
- char dataStamp[8];
-
-} NlmNAME(External_Custom_Header);
diff --git a/include/nlm/i386-ext.h b/include/nlm/i386-ext.h
deleted file mode 100644
index 78d3f7d..0000000
--- a/include/nlm/i386-ext.h
+++ /dev/null
@@ -1,117 +0,0 @@
-/* i386 NLM (NetWare Loadable Module) support for BFD.
- Copyright (C) 1993-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. */
-
-/* The external format of the fixed header. */
-
-typedef struct nlm32_i386_external_fixed_header
-{
-
- /* The signature field identifies the file as an NLM. It must contain
- the signature string, which depends upon the NLM target. */
-
- unsigned char signature[24];
-
- /* The version of the header. At this time, the highest version number
- is 4. */
-
- unsigned char version[4];
-
- /* The name of the module, which must be a DOS name (1-8 characters followed
- by a period and a 1-3 character extension). The first byte is the byte
- length of the name and the last byte is a null terminator byte. This
- field is fixed length, and any unused bytes should be null bytes. The
- value is set by the OUTPUT keyword to NLMLINK. */
-
- unsigned char moduleName[14];
-
- /* The byte offset of the code image from the start of the file. */
-
- unsigned char codeImageOffset[4];
-
- /* The size of the code image, in bytes. */
-
- unsigned char codeImageSize[4];
-
- /* The byte offset of the data image from the start of the file. */
-
- unsigned char dataImageOffset[4];
-
- /* The size of the data image, in bytes. */
-
- unsigned char dataImageSize[4];
-
- /* The size of the uninitialized data region that the loader is to be
- allocated at load time. Uninitialized data follows the initialized
- data in the NLM address space. */
-
- unsigned char uninitializedDataSize[4];
-
- /* The byte offset of the custom data from the start of the file. The
- custom data is set by the CUSTOM keyword to NLMLINK. It is possible
- for this to be EOF if there is no custom data. */
-
- unsigned char customDataOffset[4];
-
- /* The size of the custom data, in bytes. */
-
- unsigned char customDataSize[4];
-
- /* The byte offset of the module dependencies from the start of the file.
- The module dependencies are determined by the MODULE keyword in
- NLMLINK. */
-
- unsigned char moduleDependencyOffset[4];
-
- /* The number of module dependencies at the moduleDependencyOffset. */
-
- unsigned char numberOfModuleDependencies[4];
-
- /* The byte offset of the relocation fixup data from the start of the file */
-
- unsigned char relocationFixupOffset[4];
-
- unsigned char numberOfRelocationFixups[4];
-
- unsigned char externalReferencesOffset[4];
-
- unsigned char numberOfExternalReferences[4];
-
- unsigned char publicsOffset[4];
-
- unsigned char numberOfPublics[4];
-
- /* The byte offset of the internal debug info from the start of the file.
- It is possible for this to be EOF if there is no debug info. */
-
- unsigned char debugInfoOffset[4];
-
- unsigned char numberOfDebugRecords[4];
-
- unsigned char codeStartOffset[4];
-
- unsigned char exitProcedureOffset[4];
-
- unsigned char checkUnloadProcedureOffset[4];
-
- unsigned char moduleType[4];
-
- unsigned char flags[4];
-
-} Nlm32_i386_External_Fixed_Header;
diff --git a/include/nlm/internal.h b/include/nlm/internal.h
deleted file mode 100644
index b3691bd..0000000
--- a/include/nlm/internal.h
+++ /dev/null
@@ -1,309 +0,0 @@
-/* NLM (NetWare Loadable Module) support for BFD.
- Copyright (C) 1993-2018 Free Software Foundation, Inc.
-
- Written by Fred Fish @ 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. */
-
-/* This file is part of NLM support for BFD, and contains the portions
- that describe how NLM is represented internally in the BFD library.
- I.E. it describes the in-memory representation of NLM. It requires
- the nlm/common.h file which contains the portions that are common to
- both the internal and external representations. */
-
-#if 0
-
-/* Types used by various structures, functions, etc. */
-
-typedef unsigned long Nlm32_Addr; /* Unsigned program address */
-typedef unsigned long Nlm32_Off; /* Unsigned file offset */
-typedef long Nlm32_Sword; /* Signed large integer */
-typedef unsigned long Nlm32_Word; /* Unsigned large integer */
-typedef unsigned short Nlm32_Half; /* Unsigned medium integer */
-typedef unsigned char Nlm32_Char; /* Unsigned tiny integer */
-
-#ifdef BFD_HOST_64_BIT
-typedef unsigned BFD_HOST_64_BIT Nlm64_Addr;
-typedef unsigned BFD_HOST_64_BIT Nlm64_Off;
-typedef BFD_HOST_64_BIT Nlm64_Sxword;
-typedef unsigned BFD_HOST_64_BIT Nlm64_Xword;
-#endif
-typedef long Nlm64_Sword;
-typedef unsigned long Nlm64_Word;
-typedef unsigned short Nlm64_Half;
-
-#endif /* 0 */
-
-/* This structure contains the internal form of the portion of the NLM
- header that is fixed length. */
-
-typedef struct nlm_internal_fixed_header
-{
- /* The signature field identifies the file as an NLM. It must contain
- the signature string, which depends upon the NLM target. */
-
- char signature[NLM_SIGNATURE_SIZE];
-
- /* The version of the header. At this time, the highest version number
- is 4. */
-
- long version;
-
- /* The name of the module, which must be a DOS name (1-8 characters followed
- by a period and a 1-3 character extension. The first byte is the byte
- length of the name and the last byte is a null terminator byte. This
- field is fixed length, and any unused bytes should be null bytes. The
- value is set by the OUTPUT keyword to NLMLINK. */
-
- char moduleName[NLM_MODULE_NAME_SIZE];
-
- /* The byte offset of the code image from the start of the file. */
-
- file_ptr codeImageOffset;
-
- /* The size of the code image, in bytes. */
-
- bfd_size_type codeImageSize;
-
- /* The byte offset of the data image from the start of the file. */
-
- file_ptr dataImageOffset;
-
- /* The size of the data image, in bytes. */
-
- bfd_size_type dataImageSize;
-
- /* The size of the uninitialized data region that the loader is to be
- allocated at load time. Uninitialized data follows the initialized
- data in the NLM address space. */
-
- bfd_size_type uninitializedDataSize;
-
- /* The byte offset of the custom data from the start of the file. The
- custom data is set by the CUSTOM keyword to NLMLINK. */
-
- file_ptr customDataOffset;
-
- /* The size of the custom data, in bytes. */
-
- bfd_size_type customDataSize;
-
- /* The byte offset of the module dependencies from the start of the file.
- The module dependencies are determined by the MODULE keyword in
- NLMLINK. */
-
- file_ptr moduleDependencyOffset;
-
- /* The number of module dependencies at the moduleDependencyOffset. */
-
- long numberOfModuleDependencies;
-
- /* The byte offset of the relocation fixup data from the start of the file */
-
- file_ptr relocationFixupOffset;
- long numberOfRelocationFixups;
- file_ptr externalReferencesOffset;
- long numberOfExternalReferences;
- file_ptr publicsOffset;
- long numberOfPublics;
- file_ptr debugInfoOffset;
- long numberOfDebugRecords;
- file_ptr codeStartOffset;
- file_ptr exitProcedureOffset;
- file_ptr checkUnloadProcedureOffset;
- long moduleType;
- long flags;
-} Nlm_Internal_Fixed_Header;
-
-#define nlm32_internal_fixed_header nlm_internal_fixed_header
-#define Nlm32_Internal_Fixed_Header Nlm_Internal_Fixed_Header
-#define nlm64_internal_fixed_header nlm_internal_fixed_header
-#define Nlm64_Internal_Fixed_Header Nlm_Internal_Fixed_Header
-
-/* This structure contains the portions of the NLM header that are either
- variable in size in the external representation, or else are not at a
- fixed offset relative to the start of the NLM header due to preceding
- variable sized fields.
-
- Note that all the fields must exist in the external header, and in
- the order used here (the same order is used in the internal form
- for consistency, not out of necessity). */
-
-typedef struct nlm_internal_variable_header
-{
-
- /* The descriptionLength field contains the length of the text in
- descriptionText, excluding the null terminator. The descriptionText
- field contains the NLM description obtained from the DESCRIPTION
- keyword in NLMLINK plus the null byte terminator. The descriptionText
- can be up to NLM_MAX_DESCRIPTION_LENGTH characters. */
-
- unsigned char descriptionLength;
- char descriptionText[NLM_MAX_DESCRIPTION_LENGTH + 1];
-
- /* The stackSize field contains the size of the stack in bytes, as
- specified by the STACK or STACKSIZE keyword in NLMLINK. If no size
- is specified, the default is NLM_DEFAULT_STACKSIZE. */
-
- long stackSize;
-
- /* The reserved field is included only for completeness. It should contain
- zero. */
-
- long reserved;
-
- /* This field is fixed length, should contain " LONG" (note leading
- space), and is unused. */
-
- char oldThreadName[NLM_OLD_THREAD_NAME_LENGTH];
-
- /* The screenNameLength field contains the length of the actual text stored
- in the screenName field, excluding the null byte terminator. The
- screenName field contains the screen name as specified by the SCREENNAME
- keyword in NLMLINK, and can be up to NLM_MAX_SCREEN_NAME_LENGTH
- characters. */
-
- unsigned char screenNameLength;
- char screenName[NLM_MAX_SCREEN_NAME_LENGTH + 1];
-
- /* The threadNameLength field contains the length of the actual text stored
- in the threadName field, excluding the null byte terminator. The
- threadName field contains the thread name as specified by the THREADNAME
- keyword in NLMLINK, and can be up to NLM_MAX_THREAD_NAME_LENGTH
- characters. */
-
- unsigned char threadNameLength;
- char threadName[NLM_MAX_THREAD_NAME_LENGTH + 1];
-
-} Nlm_Internal_Variable_Header;
-
-#define nlm32_internal_variable_header nlm_internal_variable_header
-#define Nlm32_Internal_Variable_Header Nlm_Internal_Variable_Header
-#define nlm64_internal_variable_header nlm_internal_variable_header
-#define Nlm64_Internal_Variable_Header Nlm_Internal_Variable_Header
-
-/* The version header is one of the optional auxiliary headers and
- follows the fixed length and variable length NLM headers. */
-
-typedef struct nlm_internal_version_header
-{
- /* The header is recognized by "VeRsIoN#" in the stamp field. */
- char stamp[8];
- long majorVersion;
- long minorVersion;
- long revision;
- long year;
- long month;
- long day;
-} Nlm_Internal_Version_Header;
-
-#define nlm32_internal_version_header nlm_internal_version_header
-#define Nlm32_Internal_Version_Header Nlm_Internal_Version_Header
-#define nlm64_internal_version_header nlm_internal_version_header
-#define Nlm64_Internal_Version_Header Nlm_Internal_Version_Header
-
-typedef struct nlm_internal_copyright_header
-{
- /* The header is recognized by "CoPyRiGhT=" in the stamp field. */
- char stamp[10];
- unsigned char copyrightMessageLength;
- char copyrightMessage[NLM_MAX_COPYRIGHT_MESSAGE_LENGTH];
-} Nlm_Internal_Copyright_Header;
-
-#define nlm32_internal_copyright_header nlm_internal_copyright_header
-#define Nlm32_Internal_Copyright_Header Nlm_Internal_Copyright_Header
-#define nlm64_internal_copyright_header nlm_internal_copyright_header
-#define Nlm64_Internal_Copyright_Header Nlm_Internal_Copyright_Header
-
-typedef struct nlm_internal_extended_header
-{
- /* The header is recognized by "MeSsAgEs" in the stamp field. */
- char stamp[8];
- long languageID;
- file_ptr messageFileOffset;
- bfd_size_type messageFileLength;
- long messageCount;
- file_ptr helpFileOffset;
- bfd_size_type helpFileLength;
- file_ptr RPCDataOffset;
- bfd_size_type RPCDataLength;
- file_ptr sharedCodeOffset;
- bfd_size_type sharedCodeLength;
- file_ptr sharedDataOffset;
- bfd_size_type sharedDataLength;
- file_ptr sharedRelocationFixupOffset;
- long sharedRelocationFixupCount;
- file_ptr sharedExternalReferenceOffset;
- long sharedExternalReferenceCount;
- file_ptr sharedPublicsOffset;
- long sharedPublicsCount;
- file_ptr sharedDebugRecordOffset;
- long sharedDebugRecordCount;
- bfd_vma SharedInitializationOffset;
- bfd_vma SharedExitProcedureOffset;
- long productID;
- long reserved0;
- long reserved1;
- long reserved2;
- long reserved3;
- long reserved4;
- long reserved5;
-} Nlm_Internal_Extended_Header;
-
-#define nlm32_internal_extended_header nlm_internal_extended_header
-#define Nlm32_Internal_Extended_Header Nlm_Internal_Extended_Header
-#define nlm64_internal_extended_header nlm_internal_extended_header
-#define Nlm64_Internal_Extended_Header Nlm_Internal_Extended_Header
-
-/* The format of a custom header as stored internally is different
- from the external format. This is how we store a custom header
- which we do not recognize. */
-
-typedef struct nlm_internal_custom_header
-{
- /* The header is recognized by "CuStHeAd" in the stamp field. */
- char stamp[8];
- bfd_size_type hdrLength;
- file_ptr dataOffset;
- bfd_size_type dataLength;
- char dataStamp[8];
- void *hdr;
-} Nlm_Internal_Custom_Header;
-
-#define nlm32_internal_custom_header nlm_internal_custom_header
-#define Nlm32_Internal_Custom_Header Nlm_Internal_Custom_Header
-#define nlm64_internal_custom_header nlm_internal_custom_header
-#define Nlm64_Internal_Custom_Header Nlm_Internal_Custom_Header
-
-/* The internal Cygnus header is written out externally as a custom
- header. We don't try to replicate that structure here. */
-
-typedef struct nlm_internal_cygnus_ext_header
-{
- /* The header is recognized by "CyGnUsEx" in the stamp field. */
- char stamp[8];
- /* File location of debugging information. */
- file_ptr offset;
- /* Length of debugging information. */
- bfd_size_type length;
-} Nlm_Internal_Cygnus_Ext_Header;
-
-#define nlm32_internal_cygnus_ext_header nlm_internal_cygnus_ext_header
-#define Nlm32_Internal_Cygnus_Ext_Header Nlm_Internal_Cygnus_Ext_Header
-#define nlm64_internal_cygnus_ext_header nlm_internal_cygnus_ext_header
-#define Nlm64_Internal_Cygnus_Ext_Header Nlm_Internal_Cygnus_Ext_Header
diff --git a/include/nlm/ppc-ext.h b/include/nlm/ppc-ext.h
deleted file mode 100644
index 681e830..0000000
--- a/include/nlm/ppc-ext.h
+++ /dev/null
@@ -1,164 +0,0 @@
-/* PowerPC NLM (NetWare Loadable Module) support for BFD.
- 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. */
-
-#ifdef OLDFORMAT
-
-/* The format of a PowerPC NLM changed. These structures are only
- used in the old format. */
-
-/* A PowerPC NLM starts with an instance of this structure. */
-
-struct nlm32_powerpc_external_prefix_header
-{
- /* Signature. Must be "AppleNLM". */
- char signature[8];
- /* Version number. Current value is 1. */
- unsigned char headerVersion[4];
- /* ??. Should be set to 0. */
- unsigned char origins[4];
- /* File creation date in standard Unix time format (seconds since
- 1/1/70). */
- unsigned char date[4];
-};
-
-#define NLM32_POWERPC_SIGNATURE "AppleNLM"
-#define NLM32_POWERPC_HEADER_VERSION 1
-
-/* The external format of a PowerPC NLM reloc. This is the same as an
- XCOFF dynamic reloc. */
-
-struct nlm32_powerpc_external_reloc
-{
- /* Address. */
- unsigned char l_vaddr[4];
- /* Symbol table index. This is 0 for .text and 1 for .data. 2
- means .bss, but I don't know if it is used. In XCOFF, larger
- numbers are indices into the dynamic symbol table, but they are
- presumably not used in an NLM. */
- unsigned char l_symndx[4];
- /* Relocation type. */
- unsigned char l_rtype[2];
- /* Section number being relocated. */
- unsigned char l_rsecnm[2];
-};
-
-#endif /* OLDFORMAT */
-
-/* The external format of the fixed header. */
-
-typedef struct nlm32_powerpc_external_fixed_header
-{
-
- /* The signature field identifies the file as an NLM. It must contain
- the signature string, which depends upon the NLM target. */
-
- unsigned char signature[24];
-
- /* The version of the header. At this time, the highest version number
- is 4. */
-
- unsigned char version[4];
-
- /* The name of the module, which must be a DOS name (1-8 characters followed
- by a period and a 1-3 character extension). The first byte is the byte
- length of the name and the last byte is a null terminator byte. This
- field is fixed length, and any unused bytes should be null bytes. The
- value is set by the OUTPUT keyword to NLMLINK. */
-
- unsigned char moduleName[14];
-
- /* Padding to make it come out correct. */
-
- unsigned char pad1[2];
-
- /* The byte offset of the code image from the start of the file. */
-
- unsigned char codeImageOffset[4];
-
- /* The size of the code image, in bytes. */
-
- unsigned char codeImageSize[4];
-
- /* The byte offset of the data image from the start of the file. */
-
- unsigned char dataImageOffset[4];
-
- /* The size of the data image, in bytes. */
-
- unsigned char dataImageSize[4];
-
- /* The size of the uninitialized data region that the loader is to be
- allocated at load time. Uninitialized data follows the initialized
- data in the NLM address space. */
-
- unsigned char uninitializedDataSize[4];
-
- /* The byte offset of the custom data from the start of the file. The
- custom data is set by the CUSTOM keyword to NLMLINK. It is possible
- for this to be EOF if there is no custom data. */
-
- unsigned char customDataOffset[4];
-
- /* The size of the custom data, in bytes. */
-
- unsigned char customDataSize[4];
-
- /* The byte offset of the module dependencies from the start of the file.
- The module dependencies are determined by the MODULE keyword in
- NLMLINK. */
-
- unsigned char moduleDependencyOffset[4];
-
- /* The number of module dependencies at the moduleDependencyOffset. */
-
- unsigned char numberOfModuleDependencies[4];
-
- /* The byte offset of the relocation fixup data from the start of the file */
-
- unsigned char relocationFixupOffset[4];
-
- unsigned char numberOfRelocationFixups[4];
-
- unsigned char externalReferencesOffset[4];
-
- unsigned char numberOfExternalReferences[4];
-
- unsigned char publicsOffset[4];
-
- unsigned char numberOfPublics[4];
-
- /* The byte offset of the internal debug info from the start of the file.
- It is possible for this to be EOF if there is no debug info. */
-
- unsigned char debugInfoOffset[4];
-
- unsigned char numberOfDebugRecords[4];
-
- unsigned char codeStartOffset[4];
-
- unsigned char exitProcedureOffset[4];
-
- unsigned char checkUnloadProcedureOffset[4];
-
- unsigned char moduleType[4];
-
- unsigned char flags[4];
-
-} Nlm32_powerpc_External_Fixed_Header;
diff --git a/include/nlm/sparc32-ext.h b/include/nlm/sparc32-ext.h
deleted file mode 100644
index c9eca63..0000000
--- a/include/nlm/sparc32-ext.h
+++ /dev/null
@@ -1,121 +0,0 @@
-/* SPARC NLM (NetWare Loadable Module) support for BFD.
- Copyright (C) 1993-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. */
-
-/* The external format of the fixed header. */
-
-typedef struct nlm32_sparc_external_fixed_header
-{
-
- /* The signature field identifies the file as an NLM. It must contain
- the signature string, which depends upon the NLM target. */
-
- unsigned char signature[24];
-
- /* The version of the header. At this time, the highest version number
- is 4. */
-
- unsigned char version[4];
-
- /* The name of the module, which must be a DOS name (1-8 characters followed
- by a period and a 1-3 character extension). The first byte is the byte
- length of the name and the last byte is a null terminator byte. This
- field is fixed length, and any unused bytes should be null bytes. The
- value is set by the OUTPUT keyword to NLMLINK. */
-
- unsigned char moduleName[14];
-
- /* Padding to make it come out correct. */
-
- unsigned char pad1[2];
-
- /* The byte offset of the code image from the start of the file. */
-
- unsigned char codeImageOffset[4];
-
- /* The size of the code image, in bytes. */
-
- unsigned char codeImageSize[4];
-
- /* The byte offset of the data image from the start of the file. */
-
- unsigned char dataImageOffset[4];
-
- /* The size of the data image, in bytes. */
-
- unsigned char dataImageSize[4];
-
- /* The size of the uninitialized data region that the loader is to be
- allocated at load time. Uninitialized data follows the initialized
- data in the NLM address space. */
-
- unsigned char uninitializedDataSize[4];
-
- /* The byte offset of the custom data from the start of the file. The
- custom data is set by the CUSTOM keyword to NLMLINK. It is possible
- for this to be EOF if there is no custom data. */
-
- unsigned char customDataOffset[4];
-
- /* The size of the custom data, in bytes. */
-
- unsigned char customDataSize[4];
-
- /* The byte offset of the module dependencies from the start of the file.
- The module dependencies are determined by the MODULE keyword in
- NLMLINK. */
-
- unsigned char moduleDependencyOffset[4];
-
- /* The number of module dependencies at the moduleDependencyOffset. */
-
- unsigned char numberOfModuleDependencies[4];
-
- /* The byte offset of the relocation fixup data from the start of the file */
-
- unsigned char relocationFixupOffset[4];
-
- unsigned char numberOfRelocationFixups[4];
-
- unsigned char externalReferencesOffset[4];
-
- unsigned char numberOfExternalReferences[4];
-
- unsigned char publicsOffset[4];
-
- unsigned char numberOfPublics[4];
-
- /* The byte offset of the internal debug info from the start of the file.
- It is possible for this to be EOF if there is no debug info. */
-
- unsigned char debugInfoOffset[4];
-
- unsigned char numberOfDebugRecords[4];
-
- unsigned char codeStartOffset[4];
-
- unsigned char exitProcedureOffset[4];
-
- unsigned char checkUnloadProcedureOffset[4];
-
- unsigned char moduleType[4];
-
- unsigned char flags[4];
-
-} Nlm32_sparc_External_Fixed_Header;
diff --git a/ld/ChangeLog b/ld/ChangeLog
index d7f3e18..bb1c445 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,14 @@
+2018-04-16 Alan Modra <amodra@gmail.com>
+
+ * Makefile.am: Remove netware support.
+ * configure.tgt: Likewise.
+ * testsuite/ld-powerpc/powerpc.exp: Likewise.
+ * emulparams/i386nw.sh: Delete.
+ * emulparams/ppcnw.sh: Delete.
+ * scripttempl/nw.sc: Delete.
+ * Makefile.in: Regenerate.
+ * po/BLD-POTFILES.in: Regenerate.
+
2018-04-14 Alan Modra <amodra@gmail.com>
* ldmain.c (main): Move config.maxpagesize and
diff --git a/ld/Makefile.am b/ld/Makefile.am
index aa1c69d..a919831 100644
--- a/ld/Makefile.am
+++ b/ld/Makefile.am
@@ -335,7 +335,6 @@ ALL_EMULATION_SOURCES = \
ei386msdos.c \
ei386nbsd.c \
ei386nto.c \
- ei386nw.c \
ei386pe.c \
ei386pe_posix.c \
em32relf.c \
@@ -377,7 +376,6 @@ ALL_EMULATION_SOURCES = \
epjlelf.c \
eppclynx.c \
eppcmacos.c \
- eppcnw.c \
eppcpe.c \
epruelf.c \
eriscix.c \
@@ -1500,9 +1498,6 @@ ei386nbsd.c: $(srcdir)/emulparams/i386nbsd.sh \
ei386nto.c: $(srcdir)/emulparams/i386nto.sh \
$(ELF_DEPS) $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
-ei386nw.c: $(srcdir)/emulparams/i386nw.sh \
- $(ELF_DEPS) $(srcdir)/scripttempl/nw.sc ${GEN_DEPENDS}
-
ei386pe.c: $(srcdir)/emulparams/i386pe.sh \
$(srcdir)/emultempl/pe.em $(srcdir)/scripttempl/pe.sc ${GEN_DEPENDS}
@@ -1696,9 +1691,6 @@ eppclynx.c: $(srcdir)/emulparams/ppclynx.sh \
eppcmacos.c: $(srcdir)/emulparams/ppcmacos.sh \
$(srcdir)/emultempl/aix.em $(srcdir)/scripttempl/aix.sc ${GEN_DEPENDS}
-eppcnw.c: $(srcdir)/emulparams/ppcnw.sh \
- $(ELF_DEPS) $(srcdir)/scripttempl/nw.sc ${GEN_DEPENDS}
-
eppcpe.c: $(srcdir)/emulparams/ppcpe.sh \
$(srcdir)/emultempl/pe.em $(srcdir)/scripttempl/ppcpe.sc ${GEN_DEPENDS}
diff --git a/ld/Makefile.in b/ld/Makefile.in
index 2cd0535..3f7ced7 100644
--- a/ld/Makefile.in
+++ b/ld/Makefile.in
@@ -704,7 +704,6 @@ ALL_EMULATION_SOURCES = \
ei386msdos.c \
ei386nbsd.c \
ei386nto.c \
- ei386nw.c \
ei386pe.c \
ei386pe_posix.c \
em32relf.c \
@@ -746,7 +745,6 @@ ALL_EMULATION_SOURCES = \
epjlelf.c \
eppclynx.c \
eppcmacos.c \
- eppcnw.c \
eppcpe.c \
epruelf.c \
eriscix.c \
@@ -1366,7 +1364,6 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ei386msdos.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ei386nbsd.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ei386nto.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ei386nw.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ei386pe.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ei386pe_posix.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ei386pep.Po@am__quote@
@@ -1411,7 +1408,6 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/epjlelf.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eppclynx.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eppcmacos.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eppcnw.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eppcpe.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/epruelf.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eriscix.Po@am__quote@
@@ -3058,9 +3054,6 @@ ei386nbsd.c: $(srcdir)/emulparams/i386nbsd.sh \
ei386nto.c: $(srcdir)/emulparams/i386nto.sh \
$(ELF_DEPS) $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
-ei386nw.c: $(srcdir)/emulparams/i386nw.sh \
- $(ELF_DEPS) $(srcdir)/scripttempl/nw.sc ${GEN_DEPENDS}
-
ei386pe.c: $(srcdir)/emulparams/i386pe.sh \
$(srcdir)/emultempl/pe.em $(srcdir)/scripttempl/pe.sc ${GEN_DEPENDS}
@@ -3254,9 +3247,6 @@ eppclynx.c: $(srcdir)/emulparams/ppclynx.sh \
eppcmacos.c: $(srcdir)/emulparams/ppcmacos.sh \
$(srcdir)/emultempl/aix.em $(srcdir)/scripttempl/aix.sc ${GEN_DEPENDS}
-eppcnw.c: $(srcdir)/emulparams/ppcnw.sh \
- $(ELF_DEPS) $(srcdir)/scripttempl/nw.sc ${GEN_DEPENDS}
-
eppcpe.c: $(srcdir)/emulparams/ppcpe.sh \
$(srcdir)/emultempl/pe.em $(srcdir)/scripttempl/ppcpe.sc ${GEN_DEPENDS}
diff --git a/ld/configure.tgt b/ld/configure.tgt
index f06ae05..e4b2cb8 100644
--- a/ld/configure.tgt
+++ b/ld/configure.tgt
@@ -80,7 +80,6 @@ alpha*-*-linux-*) targ_emul=elf64alpha targ_extra_emuls=alpha
tdir_alpha=`echo ${targ_alias} | sed -e 's/linux\(-gnu\)*/linux\1ecoff/'` ;;
alpha*-*-osf*) targ_emul=alpha ;;
alpha*-*-gnu*) targ_emul=elf64alpha ;;
-alpha*-*-netware*) targ_emul=alpha ;;
alpha*-*-netbsd*) targ_emul=elf64alpha_nbsd ;;
alpha*-*-openbsd*) targ_emul=elf64alpha ;;
alpha*-*-*vms*) targ_emul=alphavms
@@ -328,7 +327,6 @@ x86_64-*-netbsd*) targ_emul=elf_x86_64
*) tdir_elf_i386=`echo ${tdir_elf_i386} | \
sed -e 's/netbsd/netbsdelf/'`;;
esac ;;
-i[3-7]86-*-netware) targ_emul=i386nw ;;
i[3-7]86-*-elfiamcu) targ_emul=elf_iamcu
targ_extra_emuls=elf_i386 ;;
i[3-7]86-*-elf* | i[3-7]86-*-rtems*)
@@ -680,7 +678,6 @@ powerpc*-*-elf* | powerpc*-*-eabi* | powerpc*-*-sysv* \
powerpc-*-nto*) targ_emul=elf32ppcnto ;;
powerpcle-*-nto*) targ_emul=elf32lppcnto ;;
powerpc-*-macos*) targ_emul=ppcmacos ;;
-powerpc-*-netware*) targ_emul=ppcnw ;;
powerpcle-*-pe | powerpcle-*-winnt* | powerpcle-*-cygwin*)
targ_emul=ppcpe
targ_extra_ofiles="deffilep.o pe-dll.o" ;;
diff --git a/ld/emulparams/i386nw.sh b/ld/emulparams/i386nw.sh
deleted file mode 100644
index e1897be..0000000
--- a/ld/emulparams/i386nw.sh
+++ /dev/null
@@ -1,8 +0,0 @@
-SCRIPT_NAME=nw
-OUTPUT_FORMAT="elf32-i386"
-TEXT_START_ADDR=0x08000000
-MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
-ARCH=i386
-NOP=0x90909090
-TEMPLATE_NAME=elf32
-GENERATE_SHLIB_SCRIPT=yes
diff --git a/ld/emulparams/ppcnw.sh b/ld/emulparams/ppcnw.sh
deleted file mode 100644
index e7d197d..0000000
--- a/ld/emulparams/ppcnw.sh
+++ /dev/null
@@ -1,6 +0,0 @@
-SCRIPT_NAME=nw
-OUTPUT_FORMAT="elf32-powerpc"
-TEXT_START_ADDR=0x0400000
-DATA_ADDR=0x10000000
-MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
-ARCH=powerpc
diff --git a/ld/po/BLD-POTFILES.in b/ld/po/BLD-POTFILES.in
index 33280c4..db4bafa 100644
--- a/ld/po/BLD-POTFILES.in
+++ b/ld/po/BLD-POTFILES.in
@@ -250,7 +250,6 @@ ei386moss.c
ei386msdos.c
ei386nbsd.c
ei386nto.c
-ei386nw.c
ei386pe.c
ei386pe_posix.c
ei386pep.c
@@ -295,7 +294,6 @@ epjelf.c
epjlelf.c
eppclynx.c
eppcmacos.c
-eppcnw.c
eppcpe.c
epruelf.c
eriscix.c
diff --git a/ld/scripttempl/nw.sc b/ld/scripttempl/nw.sc
deleted file mode 100644
index b232fe3..0000000
--- a/ld/scripttempl/nw.sc
+++ /dev/null
@@ -1,143 +0,0 @@
-# Copyright (C) 2014-2018 Free Software Foundation, Inc.
-#
-# Copying and distribution of this file, with or without modification,
-# are permitted in any medium without royalty provided the copyright
-# notice and this notice are preserved.
-#
-# Unusual variables checked by this code:
-# NOP - four byte opcode for no-op (defaults to 0)
-# DATA_ADDR - if end-of-text-plus-one-page isn't right for data start
-# OTHER_READONLY_SECTIONS - other than .text .init .ctors .rodata ...
-# (e.g., .PARISC.milli)
-# OTHER_READWRITE_SECTIONS - other than .data .bss .sdata ...
-# (e.g., .PARISC.global)
-# OTHER_SECTIONS - at the end
-# EXECUTABLE_SYMBOLS - symbols that must be defined for an
-# executable (e.g., _DYNAMIC_LINK)
-# TEXT_START_SYMBOLS - symbols that appear at the start of the
-# .text section.
-# DATA_START_SYMBOLS - symbols that appear at the start of the
-# .data section.
-# OTHER_BSS_SYMBOLS - symbols that appear at the start of the
-# .bss section besides __bss_start.
-# DATA_PLT - .plt should be in data segment, not text segment.
-#
-# When adding sections, do note that the names of some sections are used
-# when specifying the start address of the next.
-#
-
-test -z "${BIG_OUTPUT_FORMAT}" && BIG_OUTPUT_FORMAT=${OUTPUT_FORMAT}
-test -z "${LITTLE_OUTPUT_FORMAT}" && LITTLE_OUTPUT_FORMAT=${OUTPUT_FORMAT}
-test "$LD_FLAG" = "N" && DATA_ADDR=.
-INTERP=".interp ${RELOCATING-0} : { *(.interp) }"
-PLT=".plt ${RELOCATING-0} : { *(.plt) }"
-
-cat <<EOF
-/* Copyright (C) 2014-2018 Free Software Foundation, Inc.
-
- Copying and distribution of this script, with or without modification,
- are permitted in any medium without royalty provided the copyright
- notice and this notice are preserved. */
-
-OUTPUT_FORMAT("${OUTPUT_FORMAT}", "${BIG_OUTPUT_FORMAT}",
- "${LITTLE_OUTPUT_FORMAT}")
-OUTPUT_ARCH(${ARCH})
-
-${RELOCATING+${LIB_SEARCH_DIRS}}
-${RELOCATING+/* Do we need any of these for elf?
- __DYNAMIC = 0; ${STACKZERO+${STACKZERO}} ${SHLIB_PATH+${SHLIB_PATH}} */}
-${RELOCATING+${EXECUTABLE_SYMBOLS}}
-${RELOCATING- /* For some reason, the Solaris linker makes bad executables
- if gld -r is used and the intermediate file has sections starting
- at non-zero addresses. Could be a Solaris ld bug, could be a GNU ld
- bug. But for now assigning the zero vmas works. */}
-SECTIONS
-{
- /* Read-only sections, merged into text segment: */
- ${CREATE_SHLIB-${RELOCATING+. = ${TEXT_START_ADDR} + SIZEOF_HEADERS;}}
- ${CREATE_SHLIB+${RELOCATING+. = SIZEOF_HEADERS;}}
- ${CREATE_SHLIB-${INTERP}}
- .hash ${RELOCATING-0} : { *(.hash) }
- .dynsym ${RELOCATING-0} : { *(.dynsym) }
- .dynstr ${RELOCATING-0} : { *(.dynstr) }
- .rel.text ${RELOCATING-0} : { *(.rel.text) }
- .rela.text ${RELOCATING-0} : { *(.rela.text) }
- .rel.data ${RELOCATING-0} : { *(.rel.data) }
- .rela.data ${RELOCATING-0} : { *(.rela.data) }
- .rel.rodata ${RELOCATING-0} : { *(.rel.rodata) }
- .rela.rodata ${RELOCATING-0} : { *(.rela.rodata) }
- .rel.got ${RELOCATING-0} : { *(.rel.got) }
- .rela.got ${RELOCATING-0} : { *(.rela.got) }
- .rel.ctors ${RELOCATING-0} : { *(.rel.ctors) }
- .rela.ctors ${RELOCATING-0} : { *(.rela.ctors) }
- .rel.dtors ${RELOCATING-0} : { *(.rel.dtors) }
- .rela.dtors ${RELOCATING-0} : { *(.rela.dtors) }
- .rel.bss ${RELOCATING-0} : { *(.rel.bss) }
- .rela.bss ${RELOCATING-0} : { *(.rela.bss) }
- .rel.plt ${RELOCATING-0} : { *(.rel.plt) }
- .rela.plt ${RELOCATING-0} : { *(.rela.plt) }
- .init ${RELOCATING-0} : { *(.init) } =${NOP-0}
- ${DATA_PLT-${PLT}}
- .text ${RELOCATING-0} :
- {
- ${RELOCATING+${TEXT_START_SYMBOLS}}
- *(.text)
- ${CONSTRUCTING+ __CTOR_LIST__ = .;}
- ${CONSTRUCTING+ LONG((__CTOR_END__ - __CTOR_LIST__) / 4 - 2)}
- ${CONSTRUCTING+ *(.ctors)}
- ${CONSTRUCTING+ LONG(0)}
- ${CONSTRUCTING+ __CTOR_END__ = .;}
- ${CONSTRUCTING+ __DTOR_LIST__ = .;}
- ${CONSTRUCTING+ LONG((__DTOR_END__ - __DTOR_LIST__) / 4 - 2)}
- ${CONSTRUCTING+ *(.dtors)}
- ${CONSTRUCTING+ LONG(0)}
- ${CONSTRUCTING+ __DTOR_END__ = .;}
- }
- ${RELOCATING+_etext = .;}
- ${RELOCATING+PROVIDE (etext = .);}
- .fini ${RELOCATING-0} : { *(.fini) } =${NOP-0}
- .ctors ${RELOCATING-0} : { *(.ctors) }
- .dtors ${RELOCATING-0} : { *(.dtors) }
- .rodata ${RELOCATING-0} : { *(.rodata) }
- .rodata1 ${RELOCATING-0} : { *(.rodata1) }
- ${OTHER_READONLY_SECTIONS}
-
- /* Read-write section, merged into data segment: */
- ${RELOCATING+. = ${DATA_ADDR- ALIGN(8) + ${MAXPAGESIZE}};}
- .data ${RELOCATING-0} :
- {
- ${RELOCATING+${DATA_START_SYMBOLS}}
- *(.data)
- ${CONSTRUCTING+CONSTRUCTORS}
- }
- .data1 ${RELOCATING-0} : { *(.data1) }
- ${OTHER_READWRITE_SECTIONS}
- .got ${RELOCATING-0} : { *(.got.plt) *(.got) }
- .dynamic ${RELOCATING-0} : { *(.dynamic) }
- ${DATA_PLT+${PLT}}
- /* We want the small data sections together, so single-instruction offsets
- can access them all, and initialized data all before uninitialized, so
- we can shorten the on-disk segment size. */
- .sdata ${RELOCATING-0} : { *(.sdata) }
- ${RELOCATING+_edata = .;}
- ${RELOCATING+PROVIDE (edata = .);}
- ${RELOCATING+__bss_start = .;}
- ${RELOCATING+${OTHER_BSS_SYMBOLS}}
- .sbss ${RELOCATING-0} : { *(.sbss) *(.scommon) }
- .bss ${RELOCATING-0} :
- {
- *(.dynbss)
- *(.bss)
- *(COMMON)
- }
- ${RELOCATING+_end = . ;}
- ${RELOCATING+PROVIDE (end = .);}
-
- /* These are needed for ELF backends which have not yet been
- converted to the new style linker. */
- .stab 0 : { *(.stab) }
- .stabstr 0 : { *(.stabstr) }
-
- ${OTHER_SECTIONS}
-}
-EOF
diff --git a/ld/testsuite/ld-powerpc/powerpc.exp b/ld/testsuite/ld-powerpc/powerpc.exp
index 14c9d17..0359ba2 100644
--- a/ld/testsuite/ld-powerpc/powerpc.exp
+++ b/ld/testsuite/ld-powerpc/powerpc.exp
@@ -70,7 +70,7 @@ if {[istarget "*-*-vxworks"]} {
# is ELF, because we pass -melf32ppc to ld and powerpc-nto-ld wants
# -melf32ppcnto.
-if { [istarget "*-*-macos*"] || [istarget "*-*-netware*"]
+if { [istarget "*-*-macos*"]
|| [istarget "*-*-pe"] || [istarget "*-*-winnt*"]
|| [istarget "*-*-cygwin*"] || [istarget "*-*-aix*"]
|| [istarget "*-*-beos*"] || [istarget "*-*-lynxos*"]