+2018-04-16 Alan Modra <amodra@gmail.com>
+
+ * Makefile.am: Remove sparc-aout and sparc-coff support.
+ * config.bfd: Likewise.
+ * configure.ac: Likewise.
+ * targets.c: Likewise.
+ * aout-sparcle.c: Delete.
+ * aoutf1.h: Delete.
+ * cf-sparclynx.c: Delete.
+ * coff-sparc.c: Delete.
+ * demo64.c: Delete.
+ * sparclinux.c: Delete.
+ * sparclynx.c: Delete.
+ * sparcnetbsd.c: Delete.
+ * sunos.c: Delete.
+ * Makefile.in: Regenerate.
+ * configure: Regenerate.
+ * po/SRC-POTFILES.in: Regenerate.
+
2018-04-16 Alan Modra <amodra@gmail.com>
* Makefile.am: Remove m68k-aout and m68k-coff support.
aout-arm.lo \
aout-cris.lo \
aout-ns32k.lo \
- aout-sparcle.lo \
aout-tic30.lo \
aout32.lo \
armnetbsd.lo \
cf-i386lynx.lo \
- cf-sparclynx.lo \
coff-arm.lo \
coff-go32.lo \
coff-i386.lo \
coff-mips.lo \
coff-rs6000.lo \
coff-sh.lo \
- coff-sparc.lo \
coff-stgo32.lo \
coff-tic30.lo \
coff-tic4x.lo \
reloc16.lo \
riscix.lo \
som.lo \
- sparclinux.lo \
- sparclynx.lo \
- sparcnetbsd.lo \
- sunos.lo \
vax1knetbsd.lo \
vaxnetbsd.lo \
vms-lib.lo \
aout-arm.c \
aout-cris.c \
aout-ns32k.c \
- aout-sparcle.c \
aout-tic30.c \
aout32.c \
armnetbsd.c \
cf-i386lynx.c \
- cf-sparclynx.c \
coff-arm.c \
coff-go32.c \
coff-i386.c \
coff-mips.c \
coff-rs6000.c \
coff-sh.c \
- coff-sparc.c \
coff-stgo32.c \
coff-tic30.c \
coff-tic4x.c \
reloc16.c \
riscix.c \
som.c \
- sparclinux.c \
- sparclynx.c \
- sparcnetbsd.c \
- sunos.c \
vax1knetbsd.c \
vaxnetbsd.c \
vms-lib.c \
coff-alpha.lo \
coff-x86_64.lo \
coff64-rs6000.lo \
- demo64.lo \
elf32-ia64.lo \
elf32-mips.lo \
elf32-score.lo \
coff-alpha.c \
coff-x86_64.c \
coff64-rs6000.c \
- demo64.c \
elf32-mips.c \
elf32-score.c \
elf32-score7.c \
## This is a list of all .h files which are in the source tree.
SOURCE_HFILES = \
- aout-target.h aoutf1.h aoutx.h coffcode.h coffswap.h ecoffswap.h \
+ aout-target.h aoutx.h coffcode.h coffswap.h ecoffswap.h \
elf-bfd.h elf-hppa.h elf-linux-core.h elf32-hppa.h \
elf64-hppa.h elfcode.h elfcore.h \
freebsd.h genlink.h go32stub.h \
aout-arm.lo \
aout-cris.lo \
aout-ns32k.lo \
- aout-sparcle.lo \
aout-tic30.lo \
aout32.lo \
armnetbsd.lo \
cf-i386lynx.lo \
- cf-sparclynx.lo \
coff-arm.lo \
coff-go32.lo \
coff-i386.lo \
coff-mips.lo \
coff-rs6000.lo \
coff-sh.lo \
- coff-sparc.lo \
coff-stgo32.lo \
coff-tic30.lo \
coff-tic4x.lo \
reloc16.lo \
riscix.lo \
som.lo \
- sparclinux.lo \
- sparclynx.lo \
- sparcnetbsd.lo \
- sunos.lo \
vax1knetbsd.lo \
vaxnetbsd.lo \
vms-lib.lo \
aout-arm.c \
aout-cris.c \
aout-ns32k.c \
- aout-sparcle.c \
aout-tic30.c \
aout32.c \
armnetbsd.c \
cf-i386lynx.c \
- cf-sparclynx.c \
coff-arm.c \
coff-go32.c \
coff-i386.c \
coff-mips.c \
coff-rs6000.c \
coff-sh.c \
- coff-sparc.c \
coff-stgo32.c \
coff-tic30.c \
coff-tic4x.c \
reloc16.c \
riscix.c \
som.c \
- sparclinux.c \
- sparclynx.c \
- sparcnetbsd.c \
- sunos.c \
vax1knetbsd.c \
vaxnetbsd.c \
vms-lib.c \
coff-alpha.lo \
coff-x86_64.lo \
coff64-rs6000.lo \
- demo64.lo \
elf32-ia64.lo \
elf32-mips.lo \
elf32-score.lo \
coff-alpha.c \
coff-x86_64.c \
coff64-rs6000.c \
- demo64.c \
elf32-mips.c \
elf32-score.c \
elf32-score7.c \
CFILES = $(SOURCE_CFILES) $(BUILD_CFILES)
SOURCE_HFILES = \
- aout-target.h aoutf1.h aoutx.h coffcode.h coffswap.h ecoffswap.h \
+ aout-target.h aoutx.h coffcode.h coffswap.h ecoffswap.h \
elf-bfd.h elf-hppa.h elf-linux-core.h elf32-hppa.h \
elf64-hppa.h elfcode.h elfcore.h \
freebsd.h genlink.h go32stub.h \
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/aout-arm.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/aout-cris.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/aout-ns32k.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/aout-sparcle.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/aout-tic30.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/aout32.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/aout64.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/binary.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cache.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cf-i386lynx.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cf-sparclynx.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cisco-core.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/coff-alpha.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/coff-arm.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/coff-mips.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/coff-rs6000.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/coff-sh.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/coff-sparc.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/coff-stgo32.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/coff-tic30.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/coff-tic4x.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpu-xtensa.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpu-z80.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpu-z8k.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/demo64.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwarf1.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwarf2.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecoff.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/section.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/simple.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/som.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sparclinux.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sparclynx.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sparcnetbsd.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/srec.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stab-syms.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stabs.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sunos.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/syms.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/targets.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tekhex.Plo@am__quote@
+++ /dev/null
-/* BFD backend for sparc little-endian aout binaries.
- Copyright (C) 1996-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. */
-
-#define TARGETNAME "a.out-sparc-little"
-
-/* Do not "beautify" the CONCAT* macro args. Traditional C will not
- remove whitespace added here, and thus will fail to concatenate
- the tokens. */
-#define MY(OP) CONCAT2 (sparc_aout_le_,OP)
-
-#include "sysdep.h"
-#include "bfd.h"
-#include "bfdlink.h"
-#include "libaout.h"
-
-#define MACHTYPE_OK(mtype) ((mtype) == M_SPARC || (mtype) == M_SPARCLET)
-
-/* Include the usual a.out support. */
-#define TARGET_IS_LITTLE_ENDIAN_P
-#include "aoutf1.h"
+++ /dev/null
-/* A.out "format 1" file handling code for BFD.
- Copyright (C) 1990-2018 Free Software Foundation, Inc.
- Written by Cygnus Support.
-
- This file is part of BFD, the Binary File Descriptor library.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
- MA 02110-1301, USA. */
-
-#include "sysdep.h"
-#include "bfd.h"
-#include "libbfd.h"
-
-#include "aout/sun4.h"
-#include "libaout.h" /* BFD a.out internal data structures. */
-
-#include "aout/aout64.h"
-#include "aout/stab_gnu.h"
-#include "aout/ar.h"
-
-/* This is needed to reject a NewsOS file, e.g. in
- gdb/testsuite/gdb.t10/crossload.exp. <kingdon@cygnus.com>
- I needed to add M_UNKNOWN to recognize a 68000 object, so this will
- probably no longer reject a NewsOS object. <ian@cygnus.com>. */
-#ifndef MACHTYPE_OK
-#define MACHTYPE_OK(mtype) \
- ((mtype) == M_SPARC && bfd_lookup_arch (bfd_arch_sparc, 0) != NULL)
-#endif
-
-/* The file @code{aoutf1.h} contains the code for BFD's
- a.out back end. Control over the generated back end is given by these
- two preprocessor names:
- @table @code
- @item ARCH_SIZE
- This value should be either 32 or 64, depending upon the size of an
- int in the target format. It changes the sizes of the structs which
- perform the memory/disk mapping of structures.
-
- The 64 bit backend may only be used if the host compiler supports 64
- ints (eg long long with gcc), by defining the name @code{BFD_HOST_64_BIT} in @code{bfd.h}.
- With this name defined, @emph{all} bfd operations are performed with 64bit
- arithmetic, not just those to a 64bit target.
-
- @item TARGETNAME
- The name put into the target vector.
- @item
- @end table. */
-
-#if ARCH_SIZE == 64
-#define sunos_set_arch_mach sunos_64_set_arch_mach
-#define sunos_write_object_contents aout_64_sunos4_write_object_contents
-#else
-#define sunos_set_arch_mach sunos_32_set_arch_mach
-#define sunos_write_object_contents aout_32_sunos4_write_object_contents
-#endif
-
-/* Merge backend data into the output file.
- This is necessary on sparclet-aout where we want the resultant machine
- number to be M_SPARCLET if any input file is M_SPARCLET. */
-
-#define MY_bfd_merge_private_bfd_data sunos_merge_private_bfd_data
-
-static bfd_boolean
-sunos_merge_private_bfd_data (bfd *ibfd, struct bfd_link_info *info)
-{
- bfd *obfd = info->output_bfd;
- if (bfd_get_flavour (ibfd) != bfd_target_aout_flavour
- || bfd_get_flavour (obfd) != bfd_target_aout_flavour)
- return TRUE;
-
- if (bfd_get_arch (obfd) == bfd_arch_sparc)
- {
- if (bfd_get_mach (obfd) < bfd_get_mach (ibfd))
- bfd_set_arch_mach (obfd, bfd_arch_sparc, bfd_get_mach (ibfd));
- }
-
- return TRUE;
-}
-
-/* This is either sunos_32_set_arch_mach or sunos_64_set_arch_mach,
- depending upon ARCH_SIZE. */
-
-static void
-sunos_set_arch_mach (bfd *abfd, enum machine_type machtype)
-{
- /* Determine the architecture and machine type of the object file. */
- enum bfd_architecture arch;
- unsigned long machine;
-
- switch (machtype)
- {
- case M_SPARC:
- arch = bfd_arch_sparc;
- machine = 0;
- break;
-
- case M_SPARCLET:
- arch = bfd_arch_sparc;
- machine = bfd_mach_sparc_sparclet;
- break;
-
- case M_SPARCLITE_LE:
- arch = bfd_arch_sparc;
- machine = bfd_mach_sparc_sparclite_le;
- break;
-
- case M_386:
- case M_386_DYNIX:
- arch = bfd_arch_i386;
- machine = 0;
- break;
-
- default:
- arch = bfd_arch_obscure;
- machine = 0;
- break;
- }
- bfd_set_arch_mach (abfd, arch, machine);
-}
-
-#define SET_ARCH_MACH(ABFD, EXECP) \
- NAME(sunos,set_arch_mach) (ABFD, N_MACHTYPE (EXECP)); \
- choose_reloc_size(ABFD);
-
-/* Determine the size of a relocation entry, based on the architecture. */
-
-static void
-choose_reloc_size (bfd *abfd)
-{
- switch (bfd_get_arch (abfd))
- {
- case bfd_arch_sparc:
- obj_reloc_entry_size (abfd) = RELOC_EXT_SIZE;
- break;
- default:
- obj_reloc_entry_size (abfd) = RELOC_STD_SIZE;
- break;
- }
-}
-
-/* Write an object file in SunOS format. Section contents have
- already been written. We write the file header, symbols, and
- relocation. The real name of this function is either
- aout_64_sunos4_write_object_contents or
- aout_32_sunos4_write_object_contents, depending upon ARCH_SIZE. */
-
-static bfd_boolean
-sunos_write_object_contents (bfd *abfd)
-{
- struct external_exec exec_bytes;
- struct internal_exec *execp = exec_hdr (abfd);
-
- /* Magic number, maestro, please! */
- switch (bfd_get_arch (abfd))
- {
- case bfd_arch_sparc:
- switch (bfd_get_mach (abfd))
- {
- case bfd_mach_sparc_sparclet:
- N_SET_MACHTYPE (execp, M_SPARCLET);
- break;
- case bfd_mach_sparc_sparclite_le:
- N_SET_MACHTYPE (execp, M_SPARCLITE_LE);
- break;
- default:
- N_SET_MACHTYPE (execp, M_SPARC);
- break;
- }
- break;
- case bfd_arch_i386:
- N_SET_MACHTYPE (execp, M_386);
- break;
- default:
- N_SET_MACHTYPE (execp, M_UNKNOWN);
- }
-
- choose_reloc_size (abfd);
-
- N_SET_FLAGS (execp, aout_backend_info (abfd)->exec_hdr_flags);
-
- N_SET_DYNAMIC (execp, (long)(bfd_get_file_flags (abfd) & DYNAMIC));
-
- WRITE_HEADERS (abfd, execp);
-
- return TRUE;
-}
-\f
-/* Core files. */
-
-#define CORE_MAGIC 0x080456
-#define CORE_NAMELEN 16
-
-/* The core structure is taken from the Sun documentation.
- Unfortunately, they don't document the FPA structure, or at least I
- can't find it easily. Fortunately the core header contains its own
- length. So this shouldn't cause problems, except for c_ucode, which
- so far we don't use but is easy to find with a little arithmetic. */
-
-/* But the reg structure can be gotten from the SPARC processor handbook.
- This really should be in a GNU include file though so that gdb can use
- the same info. */
-struct regs
-{
- int r_psr;
- int r_pc;
- int r_npc;
- int r_y;
- int r_g1;
- int r_g2;
- int r_g3;
- int r_g4;
- int r_g5;
- int r_g6;
- int r_g7;
- int r_o0;
- int r_o1;
- int r_o2;
- int r_o3;
- int r_o4;
- int r_o5;
- int r_o6;
- int r_o7;
-};
-
-/* Taken from Sun documentation: */
-
-/* FIXME: It's worse than we expect. This struct contains TWO substructs
- neither of whose size we know, WITH STUFF IN BETWEEN THEM! We can't
- even portably access the stuff in between! */
-
-struct external_sparc_core
-{
- int c_magic; /* Corefile magic number. */
- int c_len; /* Sizeof (struct core). */
-#define SPARC_CORE_LEN 432
- struct regs c_regs; /* General purpose registers -- MACHDEP SIZE. */
- struct external_exec c_aouthdr; /* A.out header. */
- int c_signo; /* Killing signal, if any. */
- int c_tsize; /* Text size (bytes). */
- int c_dsize; /* Data size (bytes). */
- int c_ssize; /* Stack size (bytes). */
- char c_cmdname[CORE_NAMELEN + 1]; /* Command name. */
- double fp_stuff[1]; /* External FPU state (size unknown by us). */
- /* The type "double" is critical here, for alignment.
- SunOS declares a struct here, but the struct's
- alignment is double since it contains doubles. */
- int c_ucode; /* Exception no. from u_code. */
- /* This member is not accessible by name since
- we don't portably know the size of fp_stuff. */
-};
-
-/* Core files generated by the BCP (the part of Solaris which allows
- it to run SunOS4 a.out files). */
-struct external_solaris_bcp_core
-{
- int c_magic; /* Corefile magic number. */
- int c_len; /* Sizeof (struct core). */
-#define SOLARIS_BCP_CORE_LEN 456
- struct regs c_regs; /* General purpose registers -- MACHDEP SIZE. */
- int c_exdata_vp; /* Exdata structure. */
- int c_exdata_tsize;
- int c_exdata_dsize;
- int c_exdata_bsize;
- int c_exdata_lsize;
- int c_exdata_nshlibs;
- short c_exdata_mach;
- short c_exdata_mag;
- int c_exdata_toffset;
- int c_exdata_doffset;
- int c_exdata_loffset;
- int c_exdata_txtorg;
- int c_exdata_datorg;
- int c_exdata_entloc;
- int c_signo; /* Killing signal, if any. */
- int c_tsize; /* Text size (bytes). */
- int c_dsize; /* Data size (bytes). */
- int c_ssize; /* Stack size (bytes). */
- char c_cmdname[CORE_NAMELEN + 1]; /* Command name. */
- double fp_stuff[1]; /* External FPU state (size unknown by us). */
- /* The type "double" is critical here, for alignment.
- SunOS declares a struct here, but the struct's
- alignment is double since it contains doubles. */
- int c_ucode; /* Exception no. from u_code. */
- /* This member is not accessible by name since
- we don't portably know the size of fp_stuff. */
-};
-
-struct external_sun3_core
-{
- int c_magic; /* Corefile magic number. */
- int c_len; /* Sizeof (struct core). */
-#define SUN3_CORE_LEN 826 /* As of SunOS 4.1.1. */
- int c_regs[18]; /* General purpose registers -- MACHDEP SIZE. */
- struct external_exec c_aouthdr; /* A.out header. */
- int c_signo; /* Killing signal, if any. */
- int c_tsize; /* Text size (bytes). */
- int c_dsize; /* Data size (bytes). */
- int c_ssize; /* Stack size (bytes). */
- char c_cmdname[CORE_NAMELEN + 1]; /* Command name. */
- double fp_stuff[1]; /* External FPU state (size unknown by us). */
- /* The type "double" is critical here, for alignment.
- SunOS declares a struct here, but the struct's
- alignment is double since it contains doubles. */
- int c_ucode; /* Exception no. from u_code. */
- /* This member is not accessible by name since
- we don't portably know the size of fp_stuff. */
-};
-
-struct internal_sunos_core
-{
- int c_magic; /* Corefile magic number. */
- int c_len; /* Sizeof (struct core). */
- long c_regs_pos; /* File offset of General purpose registers. */
- int c_regs_size; /* Size of General purpose registers. */
- struct internal_exec c_aouthdr; /* A.out header. */
- int c_signo; /* Killing signal, if any. */
- int c_tsize; /* Text size (bytes). */
- int c_dsize; /* Data size (bytes). */
- bfd_vma c_data_addr; /* Data start (address). */
- int c_ssize; /* Stack size (bytes). */
- bfd_vma c_stacktop; /* Stack top (address). */
- char c_cmdname[CORE_NAMELEN + 1]; /* Command name. */
- long fp_stuff_pos; /* File offset of external FPU state (regs). */
- int fp_stuff_size; /* Size of it. */
- int c_ucode; /* Exception no. from u_code. */
-};
-
-/* Byte-swap in the Sun-3 core structure. */
-
-static void
-swapcore_sun3 (bfd *abfd, char *ext, struct internal_sunos_core *intcore)
-{
- struct external_sun3_core *extcore = (struct external_sun3_core *) ext;
-
- intcore->c_magic = H_GET_32 (abfd, &extcore->c_magic);
- intcore->c_len = H_GET_32 (abfd, &extcore->c_len);
- intcore->c_regs_pos = offsetof (struct external_sun3_core, c_regs);
- intcore->c_regs_size = sizeof (extcore->c_regs);
-#if ARCH_SIZE == 64
- aout_64_swap_exec_header_in
-#else
- aout_32_swap_exec_header_in
-#endif
- (abfd, &extcore->c_aouthdr, &intcore->c_aouthdr);
- intcore->c_signo = H_GET_32 (abfd, &extcore->c_signo);
- intcore->c_tsize = H_GET_32 (abfd, &extcore->c_tsize);
- intcore->c_dsize = H_GET_32 (abfd, &extcore->c_dsize);
- intcore->c_data_addr = N_DATADDR (&intcore->c_aouthdr);
- intcore->c_ssize = H_GET_32 (abfd, &extcore->c_ssize);
- memcpy (intcore->c_cmdname, extcore->c_cmdname, sizeof (intcore->c_cmdname));
- intcore->fp_stuff_pos = offsetof (struct external_sun3_core, fp_stuff);
- /* FP stuff takes up whole rest of struct, except c_ucode. */
- intcore->fp_stuff_size = intcore->c_len - (sizeof extcore->c_ucode) -
- offsetof (struct external_sun3_core, fp_stuff);
- /* Ucode is the last thing in the struct -- just before the end. */
- intcore->c_ucode = H_GET_32 (abfd,
- (intcore->c_len
- - sizeof (extcore->c_ucode)
- + (unsigned char *) extcore));
- intcore->c_stacktop = 0x0E000000; /* By experimentation. */
-}
-
-/* Byte-swap in the Sparc core structure. */
-
-static void
-swapcore_sparc (bfd *abfd, char *ext, struct internal_sunos_core *intcore)
-{
- struct external_sparc_core *extcore = (struct external_sparc_core *) ext;
-
- intcore->c_magic = H_GET_32 (abfd, &extcore->c_magic);
- intcore->c_len = H_GET_32 (abfd, &extcore->c_len);
- intcore->c_regs_pos = offsetof (struct external_sparc_core, c_regs);
- intcore->c_regs_size = sizeof (extcore->c_regs);
-#if ARCH_SIZE == 64
- aout_64_swap_exec_header_in
-#else
- aout_32_swap_exec_header_in
-#endif
- (abfd, &extcore->c_aouthdr, &intcore->c_aouthdr);
- intcore->c_signo = H_GET_32 (abfd, &extcore->c_signo);
- intcore->c_tsize = H_GET_32 (abfd, &extcore->c_tsize);
- intcore->c_dsize = H_GET_32 (abfd, &extcore->c_dsize);
- intcore->c_data_addr = N_DATADDR (&intcore->c_aouthdr);
- intcore->c_ssize = H_GET_32 (abfd, &extcore->c_ssize);
- memcpy (intcore->c_cmdname, extcore->c_cmdname, sizeof (intcore->c_cmdname));
- intcore->fp_stuff_pos = offsetof (struct external_sparc_core, fp_stuff);
- /* FP stuff takes up whole rest of struct, except c_ucode. */
- intcore->fp_stuff_size = intcore->c_len - (sizeof extcore->c_ucode) -
- offsetof (struct external_sparc_core, fp_stuff);
- /* Ucode is the last thing in the struct -- just before the end. */
- intcore->c_ucode = H_GET_32 (abfd,
- (intcore->c_len
- - sizeof (extcore->c_ucode)
- + (unsigned char *) extcore));
-
- /* Supposedly the user stack grows downward from the bottom of kernel memory.
- Presuming that this remains true, this definition will work. */
- /* Now sun has provided us with another challenge. The value is different
- for sparc2 and sparc10 (both running SunOS 4.1.3). We pick one or
- the other based on the current value of the stack pointer. This
- loses (a) if the stack pointer has been clobbered, or (b) if the stack
- is larger than 128 megabytes.
-
- It's times like these you're glad they're switching to ELF.
-
- Note that using include files or nlist on /vmunix would be wrong,
- because we want the value for this core file, no matter what kind of
- machine we were compiled on or are running on. */
-#define SPARC_USRSTACK_SPARC2 ((bfd_vma)0xf8000000)
-#define SPARC_USRSTACK_SPARC10 ((bfd_vma)0xf0000000)
- {
- bfd_vma sp = H_GET_32 (abfd, &extcore->c_regs.r_o6);
- if (sp < SPARC_USRSTACK_SPARC10)
- intcore->c_stacktop = SPARC_USRSTACK_SPARC10;
- else
- intcore->c_stacktop = SPARC_USRSTACK_SPARC2;
- }
-}
-
-/* Byte-swap in the Solaris BCP core structure. */
-
-static void
-swapcore_solaris_bcp (bfd *abfd, char *ext, struct internal_sunos_core *intcore)
-{
- struct external_solaris_bcp_core *extcore =
- (struct external_solaris_bcp_core *) ext;
-
- intcore->c_magic = H_GET_32 (abfd, &extcore->c_magic);
- intcore->c_len = H_GET_32 (abfd, &extcore->c_len);
- intcore->c_regs_pos = offsetof (struct external_solaris_bcp_core, c_regs);
- intcore->c_regs_size = sizeof (extcore->c_regs);
-
- /* The Solaris BCP exdata structure does not contain an a_syms field,
- so we are unable to synthesize an internal exec header.
- Luckily we are able to figure out the start address of the data section,
- which is the only thing needed from the internal exec header,
- from the exdata structure.
-
- As of Solaris 2.3, BCP core files for statically linked executables
- are buggy. The exdata structure is not properly filled in, and
- the data section is written from address zero instead of the data
- start address. */
- memset ((void *) &intcore->c_aouthdr, 0, sizeof (struct internal_exec));
- intcore->c_data_addr = H_GET_32 (abfd, &extcore->c_exdata_datorg);
- intcore->c_signo = H_GET_32 (abfd, &extcore->c_signo);
- intcore->c_tsize = H_GET_32 (abfd, &extcore->c_tsize);
- intcore->c_dsize = H_GET_32 (abfd, &extcore->c_dsize);
- intcore->c_ssize = H_GET_32 (abfd, &extcore->c_ssize);
- memcpy (intcore->c_cmdname, extcore->c_cmdname, sizeof (intcore->c_cmdname));
- intcore->fp_stuff_pos =
- offsetof (struct external_solaris_bcp_core, fp_stuff);
- /* FP stuff takes up whole rest of struct, except c_ucode. */
- intcore->fp_stuff_size = intcore->c_len - (sizeof extcore->c_ucode) -
- offsetof (struct external_solaris_bcp_core, fp_stuff);
- /* Ucode is the last thing in the struct -- just before the end */
- intcore->c_ucode = H_GET_32 (abfd,
- (intcore->c_len
- - sizeof (extcore->c_ucode)
- + (unsigned char *) extcore));
-
- /* Supposedly the user stack grows downward from the bottom of kernel memory.
- Presuming that this remains true, this definition will work. */
- /* Now sun has provided us with another challenge. The value is different
- for sparc2 and sparc10 (both running SunOS 4.1.3). We pick one or
- the other based on the current value of the stack pointer. This
- loses (a) if the stack pointer has been clobbered, or (b) if the stack
- is larger than 128 megabytes.
-
- It's times like these you're glad they're switching to ELF.
-
- Note that using include files or nlist on /vmunix would be wrong,
- because we want the value for this core file, no matter what kind of
- machine we were compiled on or are running on. */
-#define SPARC_USRSTACK_SPARC2 ((bfd_vma)0xf8000000)
-#define SPARC_USRSTACK_SPARC10 ((bfd_vma)0xf0000000)
- {
- bfd_vma sp = H_GET_32 (abfd, &extcore->c_regs.r_o6);
- if (sp < SPARC_USRSTACK_SPARC10)
- intcore->c_stacktop = SPARC_USRSTACK_SPARC10;
- else
- intcore->c_stacktop = SPARC_USRSTACK_SPARC2;
- }
-}
-
-/* Need this cast because ptr is really void *. */
-#define core_hdr(bfd) ((bfd)->tdata.sun_core_data)
-#define core_datasec(bfd) (core_hdr (bfd)->data_section)
-#define core_stacksec(bfd) (core_hdr (bfd)->stack_section)
-#define core_regsec(bfd) (core_hdr (bfd)->reg_section)
-#define core_reg2sec(bfd) (core_hdr (bfd)->reg2_section)
-
-/* These are stored in the bfd's tdata. */
-struct sun_core_struct
-{
- struct internal_sunos_core *hdr; /* Core file header. */
- asection *data_section;
- asection *stack_section;
- asection *reg_section;
- asection *reg2_section;
-};
-
-static const bfd_target *
-sunos4_core_file_p (bfd *abfd)
-{
- unsigned char longbuf[4]; /* Raw bytes of various header fields. */
- bfd_size_type core_size, amt;
- unsigned long core_mag;
- struct internal_sunos_core *core;
- char *extcore;
- struct mergem
- {
- struct sun_core_struct suncoredata;
- struct internal_sunos_core internal_sunos_core;
- char external_core[1];
- } *mergem;
- flagword flags;
-
- if (bfd_bread ((void *) longbuf, (bfd_size_type) sizeof (longbuf), abfd)
- != sizeof (longbuf))
- return NULL;
- core_mag = H_GET_32 (abfd, longbuf);
-
- if (core_mag != CORE_MAGIC)
- return NULL;
-
- /* SunOS core headers can vary in length; second word is size; */
- if (bfd_bread ((void *) longbuf, (bfd_size_type) sizeof (longbuf), abfd)
- != sizeof (longbuf))
- return NULL;
- core_size = H_GET_32 (abfd, longbuf);
- /* Sanity check. */
- if (core_size > 20000)
- return NULL;
-
- if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0)
- return NULL;
-
- amt = core_size + sizeof (struct mergem);
- mergem = bfd_zalloc (abfd, amt);
- if (mergem == NULL)
- return NULL;
-
- extcore = mergem->external_core;
-
- if ((bfd_bread ((void *) extcore, core_size, abfd)) != core_size)
- {
- loser:
- bfd_release (abfd, (char *) mergem);
- abfd->tdata.any = NULL;
- bfd_section_list_clear (abfd);
- return NULL;
- }
-
- /* Validate that it's a core file we know how to handle, due to sun
- botching the positioning of registers and other fields in a machine
- dependent way. */
- core = &mergem->internal_sunos_core;
- switch (core_size)
- {
- case SPARC_CORE_LEN:
- swapcore_sparc (abfd, extcore, core);
- break;
- case SUN3_CORE_LEN:
- swapcore_sun3 (abfd, extcore, core);
- break;
- case SOLARIS_BCP_CORE_LEN:
- swapcore_solaris_bcp (abfd, extcore, core);
- break;
- default:
- bfd_set_error (bfd_error_system_call); /* FIXME. */
- goto loser;
- }
-
- abfd->tdata.sun_core_data = &mergem->suncoredata;
- abfd->tdata.sun_core_data->hdr = core;
-
- /* Create the sections. */
- flags = SEC_ALLOC + SEC_LOAD + SEC_HAS_CONTENTS;
- core_stacksec (abfd) = bfd_make_section_anyway_with_flags (abfd, ".stack",
- flags);
- if (core_stacksec (abfd) == NULL)
- /* bfd_release frees everything allocated after it's arg. */
- goto loser;
-
- flags = SEC_ALLOC + SEC_LOAD + SEC_HAS_CONTENTS;
- core_datasec (abfd) = bfd_make_section_anyway_with_flags (abfd, ".data",
- flags);
- if (core_datasec (abfd) == NULL)
- goto loser;
-
- flags = SEC_HAS_CONTENTS;
- core_regsec (abfd) = bfd_make_section_anyway_with_flags (abfd, ".reg",
- flags);
- if (core_regsec (abfd) == NULL)
- goto loser;
-
- flags = SEC_HAS_CONTENTS;
- core_reg2sec (abfd) = bfd_make_section_anyway_with_flags (abfd, ".reg2",
- flags);
- if (core_reg2sec (abfd) == NULL)
- goto loser;
-
- core_stacksec (abfd)->size = core->c_ssize;
- core_datasec (abfd)->size = core->c_dsize;
- core_regsec (abfd)->size = core->c_regs_size;
- core_reg2sec (abfd)->size = core->fp_stuff_size;
-
- core_stacksec (abfd)->vma = (core->c_stacktop - core->c_ssize);
- core_datasec (abfd)->vma = core->c_data_addr;
- core_regsec (abfd)->vma = 0;
- core_reg2sec (abfd)->vma = 0;
-
- core_stacksec (abfd)->filepos = core->c_len + core->c_dsize;
- core_datasec (abfd)->filepos = core->c_len;
- /* We'll access the regs afresh in the core file, like any section: */
- core_regsec (abfd)->filepos = (file_ptr) core->c_regs_pos;
- core_reg2sec (abfd)->filepos = (file_ptr) core->fp_stuff_pos;
-
- /* Align to word at least. */
- core_stacksec (abfd)->alignment_power = 2;
- core_datasec (abfd)->alignment_power = 2;
- core_regsec (abfd)->alignment_power = 2;
- core_reg2sec (abfd)->alignment_power = 2;
-
- return abfd->xvec;
-}
-
-static char *
-sunos4_core_file_failing_command (bfd *abfd)
-{
- return core_hdr (abfd)->hdr->c_cmdname;
-}
-
-static int
-sunos4_core_file_failing_signal (bfd *abfd)
-{
- return core_hdr (abfd)->hdr->c_signo;
-}
-
-static bfd_boolean
-sunos4_core_file_matches_executable_p (bfd *core_bfd, bfd *exec_bfd)
-{
- if (core_bfd->xvec != exec_bfd->xvec)
- {
- bfd_set_error (bfd_error_system_call);
- return FALSE;
- }
-
- /* Solaris core files do not include an aouthdr. */
- if ((core_hdr (core_bfd)->hdr)->c_len == SOLARIS_BCP_CORE_LEN)
- return TRUE;
-
- return memcmp ((char *) &((core_hdr (core_bfd)->hdr)->c_aouthdr),
- (char *) exec_hdr (exec_bfd),
- sizeof (struct internal_exec)) == 0;
-}
-
-#define MY_set_sizes sunos4_set_sizes
-
-static bfd_boolean
-sunos4_set_sizes (bfd *abfd)
-{
- switch (bfd_get_arch (abfd))
- {
- default:
- return FALSE;
- case bfd_arch_sparc:
- adata (abfd).page_size = 0x2000;
- adata (abfd).segment_size = 0x2000;
- adata (abfd).exec_bytes_size = EXEC_BYTES_SIZE;
- return TRUE;
- }
-}
-
-/* We default to setting the toolversion field to 1, as is required by
- SunOS. */
-#ifndef MY_exec_hdr_flags
-#define MY_exec_hdr_flags 1
-#endif
-
-#ifndef MY_entry_is_text_address
-#define MY_entry_is_text_address 0
-#endif
-#ifndef MY_add_dynamic_symbols
-#define MY_add_dynamic_symbols 0
-#endif
-#ifndef MY_add_one_symbol
-#define MY_add_one_symbol 0
-#endif
-#ifndef MY_link_dynamic_object
-#define MY_link_dynamic_object 0
-#endif
-#ifndef MY_write_dynamic_symbol
-#define MY_write_dynamic_symbol 0
-#endif
-#ifndef MY_check_dynamic_reloc
-#define MY_check_dynamic_reloc 0
-#endif
-#ifndef MY_finish_dynamic_link
-#define MY_finish_dynamic_link 0
-#endif
-
-static const struct aout_backend_data sunos4_aout_backend =
-{
- 0, /* Zmagic files are not contiguous. */
- 1, /* Text includes header. */
- MY_entry_is_text_address,
- MY_exec_hdr_flags,
- 0, /* Default text vma. */
- sunos4_set_sizes,
- 0, /* Header is counted in zmagic text. */
- MY_add_dynamic_symbols,
- MY_add_one_symbol,
- MY_link_dynamic_object,
- MY_write_dynamic_symbol,
- MY_check_dynamic_reloc,
- MY_finish_dynamic_link
-};
-\f
-#define MY_core_file_failing_command sunos4_core_file_failing_command
-#define MY_core_file_failing_signal sunos4_core_file_failing_signal
-#define MY_core_file_matches_executable_p sunos4_core_file_matches_executable_p
-
-#define MY_bfd_debug_info_start _bfd_void_bfd
-#define MY_bfd_debug_info_end _bfd_void_bfd
-#define MY_bfd_debug_info_accumulate _bfd_void_bfd_asection
-#define MY_core_file_p sunos4_core_file_p
-#define MY_write_object_contents NAME(aout, sunos4_write_object_contents)
-#define MY_backend_data & sunos4_aout_backend
-
-#ifndef TARGET_IS_LITTLE_ENDIAN_P
-#define TARGET_IS_BIG_ENDIAN_P
-#endif
-
-#include "aout-target.h"
+++ /dev/null
-/* BFD back-end for Sparc COFF LynxOS 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. */
-
-#define TARGET_SYM sparc_coff_lynx_vec
-#define TARGET_NAME "coff-sparc-lynx"
-
-#define LYNXOS
-
-#define COFF_LONG_FILENAMES
-
-#include "coff-sparc.c"
+++ /dev/null
-/* BFD back-end for Sparc COFF files.
- Copyright (C) 1990-2018 Free Software Foundation, Inc.
- Written by Cygnus Support.
-
- This file is part of BFD, the Binary File Descriptor library.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
- MA 02110-1301, USA. */
-
-#include "sysdep.h"
-#include "bfd.h"
-#include "libbfd.h"
-#include "coff/sparc.h"
-#include "coff/internal.h"
-#include "libcoff.h"
-
-#define COFF_DEFAULT_SECTION_ALIGNMENT_POWER (3)
-
-#define BADMAG(x) ((x).f_magic != SPARCMAGIC && (x).f_magic != LYNXCOFFMAGIC)
-
-/* The page size is a guess based on ELF. */
-#define COFF_PAGE_SIZE 0x10000
-
-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
- };
-
-/* This is stolen pretty directly from elf.c. */
-
-static bfd_reloc_status_type
-bfd_coff_generic_reloc (bfd *abfd ATTRIBUTE_UNUSED,
- arelent *reloc_entry,
- asymbol *symbol,
- void * data ATTRIBUTE_UNUSED,
- asection *input_section,
- bfd *output_bfd,
- char **error_message ATTRIBUTE_UNUSED)
-{
- if (output_bfd != (bfd *) NULL
- && (symbol->flags & BSF_SECTION_SYM) == 0)
- {
- reloc_entry->address += input_section->output_offset;
- return bfd_reloc_ok;
- }
-
- return bfd_reloc_continue;
-}
-
-static reloc_howto_type coff_sparc_howto_table[] =
-{
- HOWTO(R_SPARC_NONE, 0,3, 0,FALSE,0,complain_overflow_dont, bfd_coff_generic_reloc,"R_SPARC_NONE", FALSE,0,0x00000000,TRUE),
- HOWTO(R_SPARC_8, 0,0, 8,FALSE,0,complain_overflow_bitfield,bfd_coff_generic_reloc,"R_SPARC_8", FALSE,0,0x000000ff,TRUE),
- HOWTO(R_SPARC_16, 0,1,16,FALSE,0,complain_overflow_bitfield,bfd_coff_generic_reloc,"R_SPARC_16", FALSE,0,0x0000ffff,TRUE),
- HOWTO(R_SPARC_32, 0,2,32,FALSE,0,complain_overflow_bitfield,bfd_coff_generic_reloc,"R_SPARC_32", FALSE,0,0xffffffff,TRUE),
- HOWTO(R_SPARC_DISP8, 0,0, 8,TRUE, 0,complain_overflow_signed, bfd_coff_generic_reloc,"R_SPARC_DISP8", FALSE,0,0x000000ff,TRUE),
- HOWTO(R_SPARC_DISP16, 0,1,16,TRUE, 0,complain_overflow_signed, bfd_coff_generic_reloc,"R_SPARC_DISP16", FALSE,0,0x0000ffff,TRUE),
- HOWTO(R_SPARC_DISP32, 0,2,32,TRUE, 0,complain_overflow_signed, bfd_coff_generic_reloc,"R_SPARC_DISP32", FALSE,0,0x00ffffff,TRUE),
- HOWTO(R_SPARC_WDISP30, 2,2,30,TRUE, 0,complain_overflow_signed, bfd_coff_generic_reloc,"R_SPARC_WDISP30", FALSE,0,0x3fffffff,TRUE),
- HOWTO(R_SPARC_WDISP22, 2,2,22,TRUE, 0,complain_overflow_signed, bfd_coff_generic_reloc,"R_SPARC_WDISP22", FALSE,0,0x003fffff,TRUE),
- HOWTO(R_SPARC_HI22, 10,2,22,FALSE,0,complain_overflow_dont, bfd_coff_generic_reloc,"R_SPARC_HI22", FALSE,0,0x003fffff,TRUE),
- HOWTO(R_SPARC_22, 0,2,22,FALSE,0,complain_overflow_bitfield,bfd_coff_generic_reloc,"R_SPARC_22", FALSE,0,0x003fffff,TRUE),
- HOWTO(R_SPARC_13, 0,2,13,FALSE,0,complain_overflow_bitfield,bfd_coff_generic_reloc,"R_SPARC_13", FALSE,0,0x00001fff,TRUE),
- HOWTO(R_SPARC_LO10, 0,2,10,FALSE,0,complain_overflow_dont, bfd_coff_generic_reloc,"R_SPARC_LO10", FALSE,0,0x000003ff,TRUE),
- HOWTO(R_SPARC_GOT10, 0,2,10,FALSE,0,complain_overflow_bitfield,bfd_coff_generic_reloc,"R_SPARC_GOT10", FALSE,0,0x000003ff,TRUE),
- HOWTO(R_SPARC_GOT13, 0,2,13,FALSE,0,complain_overflow_bitfield,bfd_coff_generic_reloc,"R_SPARC_GOT13", FALSE,0,0x00001fff,TRUE),
- HOWTO(R_SPARC_GOT22, 10,2,22,FALSE,0,complain_overflow_bitfield,bfd_coff_generic_reloc,"R_SPARC_GOT22", FALSE,0,0x003fffff,TRUE),
- HOWTO(R_SPARC_PC10, 0,2,10,FALSE,0,complain_overflow_bitfield,bfd_coff_generic_reloc,"R_SPARC_PC10", FALSE,0,0x000003ff,TRUE),
- HOWTO(R_SPARC_PC22, 0,2,22,FALSE,0,complain_overflow_bitfield,bfd_coff_generic_reloc,"R_SPARC_PC22", FALSE,0,0x003fffff,TRUE),
- HOWTO(R_SPARC_WPLT30, 0,0,00,FALSE,0,complain_overflow_dont, bfd_coff_generic_reloc,"R_SPARC_WPLT30", FALSE,0,0x00000000,TRUE),
- HOWTO(R_SPARC_COPY, 0,0,00,FALSE,0,complain_overflow_dont, bfd_coff_generic_reloc,"R_SPARC_COPY", FALSE,0,0x00000000,TRUE),
- HOWTO(R_SPARC_GLOB_DAT,0,0,00,FALSE,0,complain_overflow_dont, bfd_coff_generic_reloc,"R_SPARC_GLOB_DAT",FALSE,0,0x00000000,TRUE),
- HOWTO(R_SPARC_JMP_SLOT,0,0,00,FALSE,0,complain_overflow_dont, bfd_coff_generic_reloc,"R_SPARC_JMP_SLOT",FALSE,0,0x00000000,TRUE),
- HOWTO(R_SPARC_RELATIVE,0,0,00,FALSE,0,complain_overflow_dont, bfd_coff_generic_reloc,"R_SPARC_RELATIVE",FALSE,0,0x00000000,TRUE),
- HOWTO(R_SPARC_UA32, 0,0,00,FALSE,0,complain_overflow_dont, bfd_coff_generic_reloc,"R_SPARC_UA32", FALSE,0,0x00000000,TRUE),
-};
-
-struct coff_reloc_map
-{
- bfd_reloc_code_real_type bfd_reloc_val;
- unsigned char coff_reloc_val;
-};
-
-static const struct coff_reloc_map sparc_reloc_map[] =
-{
- { BFD_RELOC_NONE, R_SPARC_NONE, },
- { BFD_RELOC_16, R_SPARC_16, },
- { BFD_RELOC_8, R_SPARC_8 },
- { BFD_RELOC_8_PCREL, R_SPARC_DISP8 },
- { BFD_RELOC_CTOR, R_SPARC_32 }, /* @@ Assumes 32 bits. */
- { BFD_RELOC_32, R_SPARC_32 },
- { BFD_RELOC_32_PCREL, R_SPARC_DISP32 },
- { BFD_RELOC_HI22, R_SPARC_HI22 },
- { BFD_RELOC_LO10, R_SPARC_LO10, },
- { BFD_RELOC_32_PCREL_S2, R_SPARC_WDISP30 },
- { BFD_RELOC_SPARC22, R_SPARC_22 },
- { BFD_RELOC_SPARC13, R_SPARC_13 },
- { BFD_RELOC_SPARC_GOT10, R_SPARC_GOT10 },
- { BFD_RELOC_SPARC_GOT13, R_SPARC_GOT13 },
- { BFD_RELOC_SPARC_GOT22, R_SPARC_GOT22 },
- { BFD_RELOC_SPARC_PC10, R_SPARC_PC10 },
- { BFD_RELOC_SPARC_PC22, R_SPARC_PC22 },
- { BFD_RELOC_SPARC_WPLT30, R_SPARC_WPLT30 },
- { BFD_RELOC_SPARC_COPY, R_SPARC_COPY },
- { BFD_RELOC_SPARC_GLOB_DAT, R_SPARC_GLOB_DAT },
- { BFD_RELOC_SPARC_JMP_SLOT, R_SPARC_JMP_SLOT },
- { BFD_RELOC_SPARC_RELATIVE, R_SPARC_RELATIVE },
- { BFD_RELOC_SPARC_WDISP22, R_SPARC_WDISP22 },
- /* { BFD_RELOC_SPARC_UA32, R_SPARC_UA32 }, not used?? */
-};
-
-static reloc_howto_type *
-coff_sparc_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED,
- bfd_reloc_code_real_type code)
-{
- unsigned int i;
- for (i = 0; i < sizeof (sparc_reloc_map) / sizeof (struct coff_reloc_map); i++)
- {
- if (sparc_reloc_map[i].bfd_reloc_val == code)
- return &coff_sparc_howto_table[(int) sparc_reloc_map[i].coff_reloc_val];
- }
- return 0;
-}
-#define coff_bfd_reloc_type_lookup coff_sparc_reloc_type_lookup
-
-static reloc_howto_type *
-coff_sparc_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED,
- const char *r_name)
-{
- unsigned int i;
-
- for (i = 0;
- i < (sizeof (coff_sparc_howto_table)
- / sizeof (coff_sparc_howto_table[0]));
- i++)
- if (coff_sparc_howto_table[i].name != NULL
- && strcasecmp (coff_sparc_howto_table[i].name, r_name) == 0)
- return &coff_sparc_howto_table[i];
-
- return NULL;
-}
-#define coff_bfd_reloc_name_lookup coff_sparc_reloc_name_lookup
-
-static void
-rtype2howto (arelent *cache_ptr, struct internal_reloc *dst)
-{
- BFD_ASSERT (dst->r_type < (unsigned int) R_SPARC_max);
- cache_ptr->howto = &coff_sparc_howto_table[dst->r_type];
-}
-
-#define RTYPE2HOWTO(internal, relocentry) rtype2howto(internal,relocentry)
-
-#define SWAP_IN_RELOC_OFFSET H_GET_32
-#define SWAP_OUT_RELOC_OFFSET H_PUT_32
-#define CALC_ADDEND(abfd, ptr, reloc, cache_ptr) \
- cache_ptr->addend = reloc.r_offset;
-
-/* Clear the r_spare field in relocs. */
-#define SWAP_OUT_RELOC_EXTRA(abfd,src,dst) \
- do { \
- dst->r_spare[0] = 0; \
- dst->r_spare[1] = 0; \
- } while (0)
-
-#define __A_MAGIC_SET__
-
-/* Enable Sparc-specific hacks in coffcode.h. */
-
-#define COFF_SPARC
-
-#define bfd_pe_print_pdata NULL
-
-#include "coffcode.h"
-
-#ifndef TARGET_SYM
-#define TARGET_SYM sparc_coff_vec
-#endif
-
-#ifndef TARGET_NAME
-#define TARGET_NAME "coff-sparc"
-#endif
-
-CREATE_BIG_COFF_TARGET_VEC (TARGET_SYM, TARGET_NAME, D_PAGED, 0, '_', NULL, COFF_SWAP_TABLE)
mips*-*-lnews* | \
mips*-*-sysv* | mips*-*-riscos* | \
powerpc-*-lynxos* | powerpc-*-windiss* | \
- sparclet-*-aout* | \
- sparc86x-*-aout* | \
- sparc*-*-chorus* | \
- sparc-*-linux*aout* | \
- sparc-*-netbsdaout* | \
- sparc-*-openbsd[0-2].* | sparc-*-openbsd3.[0-1] | \
- sparc64-*-aout* | \
- sparc*-*-coff* | \
null)
if test "x$enable_obsolete" != xyes; then
echo "*** Configuration $targ is obsolete." >&2
maxq-*-coff | \
mips*el-*-rtems* | \
sh*-*-symbianelf* | sh5*-*-* | sh64*-*-* | \
+ sparc*-*-*aout* | \
+ sparc*-*-chorus* | \
+ sparc*-*-coff* | \
sparc-*-lynxos* | \
+ sparc-*-openbsd[0-2].* | sparc-*-openbsd3.[0-1] | \
tahoe-*-* | \
vax-*-bsd* | vax-*-ultrix* | vax-*-vms* | \
w65-*-* | \
targ_selvecs=alpha_vms_lib_txt_vec
want64=true
;;
- sparc64-*-freebsd* | sparc64-*-kfreebsd*-gnu)
- targ_defvec=sparc_elf64_fbsd_vec
- targ_selvecs="sparc_elf64_vec sparc_elf32_vec sparc_aout_sunos_be_vec"
- ;;
- sparc64-*-netbsd* | sparc64-*-openbsd*)
- targ_defvec=sparc_elf64_vec
- targ_selvecs="sparc_elf32_vec sparc_aout_sunos_be_vec"
- want64=true
- ;;
#endif /* BFD64 */
am33_2.0-*-linux*)
targ_underscore=yes
;;
- sparclet-*-aout*)
- targ_defvec=sparc_aout_sunos_be_vec
- targ_selvecs=sparc_aout_le_vec
- targ_underscore=yes
- ;;
- sparc86x-*-aout*)
- targ_defvec=sparc_aout_sunos_be_vec
- targ_underscore=yes
- ;;
- sparclite-*-elf* | sparc86x-*-elf*)
- targ_defvec=sparc_elf32_vec
- ;;
- sparc*-*-chorus*)
- targ_defvec=sparc_elf32_vec
- ;;
- sparc-*-linux*aout*)
- targ_defvec=sparc_aout_linux_vec
- targ_selvecs="sparc_elf32_vec sparc_aout_sunos_be_vec"
- targ_underscore=yes
- ;;
- sparc-*-linux-* | sparcv*-*-linux-*)
- targ_defvec=sparc_elf32_vec
- targ_selvecs="sparc_aout_linux_vec sparc_elf64_vec sparc_aout_sunos_be_vec"
- ;;
- sparc-*-netbsdelf*)
- targ_defvec=sparc_elf32_vec
- targ_selvecs=sparc_aout_nbsd_vec
- ;;
- sparc-*-netbsdaout* | sparc-*-netbsd*)
- targ_defvec=sparc_aout_nbsd_vec
- targ_selvecs=sparc_elf32_vec
- targ_underscore=yes
- ;;
- sparc-*-openbsd[0-2].* | sparc-*-openbsd3.[0-1])
- targ_defvec=sparc_aout_nbsd_vec
- targ_underscore=yes
- ;;
- sparc-*-openbsd*)
- targ_defvec=sparc_elf32_vec
- targ_selvecs=sparc_aout_nbsd_vec
- ;;
- sparc-*-elf*)
- targ_defvec=sparc_elf32_vec
- targ_selvecs=sparc_aout_sunos_be_vec
- ;;
sparc-*-solaris2.[0-6] | sparc-*-solaris2.[0-6].*)
targ_defvec=sparc_elf32_sol2_vec
- targ_selvecs=sparc_aout_sunos_be_vec
;;
#ifdef BFD64
sparc-*-solaris2* | sparcv9-*-solaris2* | sparc64-*-solaris2*)
targ_defvec=sparc_elf32_sol2_vec
- targ_selvecs="sparc_elf64_sol2_vec sparc_aout_sunos_be_vec"
+ targ_selvecs="sparc_elf64_sol2_vec"
want64=true
;;
-#endif
- sparc-*-sysv4*)
- targ_defvec=sparc_elf32_vec
- ;;
- sparc-*-vxworks*)
- targ_defvec=sparc_elf32_vxworks_vec
- targ_selvecs="sparc_elf32_vec sparc_aout_sunos_be_vec"
- ;;
-#ifdef BFD64
- sparc64-*-aout*)
- targ_defvec=sparc_aout_sunos_be_vec
- targ_underscore=yes
- want64=true
- ;;
- sparc64*-*-linux-*)
- targ_defvec=sparc_elf64_vec
- targ_selvecs="sparc_elf32_vec sparc_aout_linux_vec sparc_aout_sunos_be_vec"
- want64=true
+ sparc64-*-freebsd* | sparc64-*-kfreebsd*-gnu)
+ targ_defvec=sparc_elf64_fbsd_vec
+ targ_selvecs="sparc_elf64_vec sparc_elf32_vec"
;;
- sparc64-*-elf* | sparc64-*-rtems* )
+ sparc64*-*-*)
targ_defvec=sparc_elf64_vec
- targ_selvecs=sparc_elf32_vec
+ targ_selvecs="sparc_elf32_vec"
want64=true
;;
-#endif /* BFD64 */
- sparc*-*-coff*)
- targ_defvec=sparc_coff_vec
- ;;
- sparc-*-rtems*)
+#endif
+ sparc-*-linux-* | sparcv*-*-linux-*)
targ_defvec=sparc_elf32_vec
- targ_selvecs="sparc_aout_sunos_be_vec sparc_coff_vec"
+ targ_selvecs="sparc_elf64_vec"
+ ;;
+ sparc-*-vxworks*)
+ targ_defvec=sparc_elf32_vxworks_vec
+ targ_selvecs="sparc_elf32_vec"
;;
sparc*-*-*)
- targ_defvec=sparc_aout_sunos_be_vec
- targ_underscore=yes
+ targ_defvec=sparc_elf32_vec
;;
spu-*-elf)
sh_elf32_vxworks_le_vec) tb="$tb elf32-sh.lo elf-vxworks.lo elf32.lo $elf coff-sh.lo $coff" ;;
sh_pe_le_vec) tb="$tb pe-sh.lo coff-sh.lo peigen.lo $coff" ;;
sh_pei_le_vec) tb="$tb pei-sh.lo coff-sh.lo peigen.lo $coff" ;;
- sparc_aout_le_vec) tb="$tb aout-sparcle.lo aout32.lo" ;;
- sparc_aout_linux_vec) tb="$tb sparclinux.lo aout32.lo" ;;
- sparc_aout_lynx_vec) tb="$tb sparclynx.lo lynx-core.lo aout32.lo" ;;
- sparc_aout_nbsd_vec) tb="$tb sparcnetbsd.lo aout32.lo" ;;
- sparc_aout_sunos_be_vec) tb="$tb sunos.lo aout32.lo" ;;
- sparc_coff_vec) tb="$tb coff-sparc.lo $coffgen" ;;
- sparc_coff_lynx_vec) tb="$tb cf-sparclynx.lo lynx-core.lo $coffgen" ;;
sparc_elf32_vec) tb="$tb elf32-sparc.lo elfxx-sparc.lo elf-vxworks.lo elf32.lo $elf" ;;
sparc_elf32_sol2_vec) tb="$tb elf32-sparc.lo elfxx-sparc.lo elf-vxworks.lo elf32.lo $elf" ;;
sparc_elf32_vxworks_vec) tb="$tb elf32-sparc.lo elfxx-sparc.lo elf-vxworks.lo elf32.lo $elf" ;;
sh_elf32_vxworks_le_vec) tb="$tb elf32-sh.lo elf-vxworks.lo elf32.lo $elf coff-sh.lo $coff" ;;
sh_pe_le_vec) tb="$tb pe-sh.lo coff-sh.lo peigen.lo $coff" ;;
sh_pei_le_vec) tb="$tb pei-sh.lo coff-sh.lo peigen.lo $coff" ;;
- sparc_aout_le_vec) tb="$tb aout-sparcle.lo aout32.lo" ;;
- sparc_aout_linux_vec) tb="$tb sparclinux.lo aout32.lo" ;;
- sparc_aout_lynx_vec) tb="$tb sparclynx.lo lynx-core.lo aout32.lo" ;;
- sparc_aout_nbsd_vec) tb="$tb sparcnetbsd.lo aout32.lo" ;;
- sparc_aout_sunos_be_vec) tb="$tb sunos.lo aout32.lo" ;;
- sparc_coff_vec) tb="$tb coff-sparc.lo $coffgen" ;;
- sparc_coff_lynx_vec) tb="$tb cf-sparclynx.lo lynx-core.lo $coffgen" ;;
sparc_elf32_vec) tb="$tb elf32-sparc.lo elfxx-sparc.lo elf-vxworks.lo elf32.lo $elf" ;;
sparc_elf32_sol2_vec) tb="$tb elf32-sparc.lo elfxx-sparc.lo elf-vxworks.lo elf32.lo $elf" ;;
sparc_elf32_vxworks_vec) tb="$tb elf32-sparc.lo elfxx-sparc.lo elf-vxworks.lo elf32.lo $elf" ;;
+++ /dev/null
-/* BFD backend for demonstration 64-bit a.out binaries.
- Copyright (C) 1990-2018 Free Software Foundation, Inc.
- Written by Cygnus Support.
-
- This file is part of BFD, the Binary File Descriptor library.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
- MA 02110-1301, USA. */
-
-#define ARCH_SIZE 64
-
-/* Do not "beautify" the CONCAT* macro args. Traditional C will not
- remove whitespace added here, and thus will fail to concatenate
- the tokens. */
-#define MY(OP) CONCAT2 (aout64_,OP)
-
-#define TARGETNAME "demo64"
-#include "aoutf1.h"
aout-arm.c
aout-cris.c
aout-ns32k.c
-aout-sparcle.c
aout-target.h
aout-tic30.c
aout32.c
aout64.c
-aoutf1.h
aoutx.h
archive.c
archive64.c
binary.c
cache.c
cf-i386lynx.c
-cf-sparclynx.c
cisco-core.c
coff-alpha.c
coff-arm.c
coff-mips.c
coff-rs6000.c
coff-sh.c
-coff-sparc.c
coff-stgo32.c
coff-tic30.c
coff-tic4x.c
cpu-xtensa.c
cpu-z80.c
cpu-z8k.c
-demo64.c
dwarf1.c
dwarf2.c
ecoff.c
simple.c
som.c
som.h
-sparclinux.c
-sparclynx.c
-sparcnetbsd.c
srec.c
stab-syms.c
stabs.c
-sunos.c
syms.c
targets.c
tekhex.c
+++ /dev/null
-/* BFD back-end for linux flavored sparc a.out binaries.
- Copyright (C) 1992-2018 Free Software Foundation, Inc.
-
- This file is part of BFD, the Binary File Descriptor library.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
- MA 02110-1301, USA. */
-
-#define TARGET_PAGE_SIZE 4096
-#define ZMAGIC_DISK_BLOCK_SIZE 1024
-#define SEGMENT_SIZE TARGET_PAGE_SIZE
-#define TEXT_START_ADDR 0x0
-
-#define MACHTYPE_OK(mtype) ((mtype) == M_SPARC || (mtype) == M_UNKNOWN)
-
-#include "sysdep.h"
-#include "bfd.h"
-#include "libbfd.h"
-#include "aout/aout64.h"
-#include "aout/stab_gnu.h"
-#include "aout/ar.h"
-#include "libaout.h" /* BFD a.out internal data structures */
-
-#define DEFAULT_ARCH bfd_arch_sparc
-/* Do not "beautify" the CONCAT* macro args. Traditional C will not
- remove whitespace added here, and thus will fail to concatenate
- the tokens. */
-#define MY(OP) CONCAT2 (sparc_aout_linux_,OP)
-#define TARGETNAME "a.out-sparc-linux"
-
-extern const bfd_target MY(vec);
-
-/* We always generate QMAGIC files in preference to ZMAGIC files. It
- would be possible to make this a linker option, if that ever
- becomes important. */
-
-static void MY_final_link_callback
- (bfd *, file_ptr *, file_ptr *, file_ptr *);
-
-static bfd_boolean
-sparclinux_bfd_final_link (bfd *abfd, struct bfd_link_info *info)
-{
- obj_aout_subformat (abfd) = q_magic_format;
- return NAME(aout,final_link) (abfd, info, MY_final_link_callback);
-}
-
-#define MY_bfd_final_link sparclinux_bfd_final_link
-
-/* Set the machine type correctly. */
-
-static bfd_boolean
-sparclinux_write_object_contents (bfd *abfd)
-{
- struct external_exec exec_bytes;
- struct internal_exec *execp = exec_hdr (abfd);
-
- N_SET_MACHTYPE (execp, M_SPARC);
-
- obj_reloc_entry_size (abfd) = RELOC_STD_SIZE;
-
- WRITE_HEADERS (abfd, execp);
-
- return TRUE;
-}
-
-#define MY_write_object_contents sparclinux_write_object_contents
-/* Code to link against Linux a.out shared libraries. */
-
-/* See if a symbol name is a reference to the global offset table. */
-
-#ifndef GOT_REF_PREFIX
-#define GOT_REF_PREFIX "__GOT_"
-#endif
-
-#define IS_GOT_SYM(name) (CONST_STRNEQ (name, GOT_REF_PREFIX))
-
-/* See if a symbol name is a reference to the procedure linkage table. */
-
-#ifndef PLT_REF_PREFIX
-#define PLT_REF_PREFIX "__PLT_"
-#endif
-
-#define IS_PLT_SYM(name) (CONST_STRNEQ (name, PLT_REF_PREFIX))
-
-/* This string is used to generate specialized error messages. */
-
-#ifndef NEEDS_SHRLIB
-#define NEEDS_SHRLIB "__NEEDS_SHRLIB_"
-#endif
-
-/* This special symbol is a set vector that contains a list of
- pointers to fixup tables. It will be present in any dynamically
- linked file. The linker generated fixup table should also be added
- to the list, and it should always appear in the second slot (the
- first one is a dummy with a magic number that is defined in
- crt0.o). */
-
-#ifndef SHARABLE_CONFLICTS
-#define SHARABLE_CONFLICTS "__SHARABLE_CONFLICTS__"
-#endif
-
-/* We keep a list of fixups. The terminology is a bit strange, but
- each fixup contains two 32 bit numbers. A regular fixup contains
- an address and a pointer, and at runtime we should store the
- address at the location pointed to by the pointer. A builtin fixup
- contains two pointers, and we should read the address using one
- pointer and store it at the location pointed to by the other
- pointer. Builtin fixups come into play when we have duplicate
- __GOT__ symbols for the same variable. The builtin fixup will copy
- the GOT pointer from one over into the other. */
-
-struct fixup
-{
- struct fixup *next;
- struct linux_link_hash_entry *h;
- bfd_vma value;
-
- /* Nonzero if this is a jump instruction that needs to be fixed,
- zero if this is just a pointer */
- char jump;
-
- char builtin;
-};
-
-/* We don't need a special hash table entry structure, but we do need
- to keep some information between linker passes, so we use a special
- hash table. */
-
-struct linux_link_hash_entry
-{
- struct aout_link_hash_entry root;
-};
-
-struct linux_link_hash_table
-{
- struct aout_link_hash_table root;
-
- /* First dynamic object found in link. */
- bfd *dynobj;
-
- /* Number of fixups. */
- size_t fixup_count;
-
- /* Number of builtin fixups. */
- size_t local_builtins;
-
- /* List of fixups. */
- struct fixup *fixup_list;
-};
-
-
-/* Routine to create an entry in an Linux link hash table. */
-
-static struct bfd_hash_entry *
-linux_link_hash_newfunc (struct bfd_hash_entry *entry,
- struct bfd_hash_table *table,
- const char *string)
-{
- struct linux_link_hash_entry *ret = (struct linux_link_hash_entry *) entry;
-
- /* Allocate the structure if it has not already been allocated by a
- subclass. */
- if (ret == (struct linux_link_hash_entry *) NULL)
- ret = ((struct linux_link_hash_entry *)
- bfd_hash_allocate (table, sizeof (struct linux_link_hash_entry)));
- if (ret == NULL)
- return (struct bfd_hash_entry *) ret;
-
- /* Call the allocation method of the superclass. */
- ret = ((struct linux_link_hash_entry *)
- NAME(aout,link_hash_newfunc) ((struct bfd_hash_entry *) ret,
- table, string));
- if (ret != NULL)
- {
- /* Set local fields; there aren't any. */
- }
-
- return (struct bfd_hash_entry *) ret;
-}
-
-/* Create a Linux link hash table. */
-
-static struct bfd_link_hash_table *
-linux_link_hash_table_create (bfd *abfd)
-{
- struct linux_link_hash_table *ret;
- bfd_size_type amt = sizeof (struct linux_link_hash_table);
-
- ret = (struct linux_link_hash_table *) bfd_zmalloc (amt);
- if (ret == (struct linux_link_hash_table *) NULL)
- return (struct bfd_link_hash_table *) NULL;
- if (!NAME(aout,link_hash_table_init) (&ret->root, abfd,
- linux_link_hash_newfunc,
- sizeof (struct linux_link_hash_entry)))
- {
- free (ret);
- return (struct bfd_link_hash_table *) NULL;
- }
-
- return &ret->root.root;
-}
-
-/* Look up an entry in a Linux link hash table. */
-
-#define linux_link_hash_lookup(table, string, create, copy, follow) \
- ((struct linux_link_hash_entry *) \
- aout_link_hash_lookup (&(table)->root, (string), (create), (copy),\
- (follow)))
-
-/* Traverse a Linux link hash table. */
-
-#define linux_link_hash_traverse(table, func, info) \
- (aout_link_hash_traverse \
- (&(table)->root, \
- (bfd_boolean (*) (struct aout_link_hash_entry *, void *)) (func), \
- (info)))
-
-/* Get the Linux link hash table from the info structure. This is
- just a cast. */
-
-#define linux_hash_table(p) ((struct linux_link_hash_table *) ((p)->hash))
-
-/* Store the information for a new fixup. */
-
-static struct fixup *
-new_fixup (struct bfd_link_info *info,
- struct linux_link_hash_entry *h,
- bfd_vma value,
- int builtin)
-{
- struct fixup *f;
-
- f = (struct fixup *) bfd_hash_allocate (&info->hash->table,
- sizeof (struct fixup));
- if (f == NULL)
- return f;
- f->next = linux_hash_table (info)->fixup_list;
- linux_hash_table (info)->fixup_list = f;
- f->h = h;
- f->value = value;
- f->builtin = builtin;
- f->jump = 0;
- ++linux_hash_table (info)->fixup_count;
- return f;
-}
-
-/* We come here once we realize that we are going to link to a shared
- library. We need to create a special section that contains the
- fixup table, and we ultimately need to add a pointer to this into
- the set vector for SHARABLE_CONFLICTS. At this point we do not
- know the size of the section, but that's OK - we just need to
- create it for now. */
-
-static bfd_boolean
-linux_link_create_dynamic_sections (bfd *abfd,
- struct bfd_link_info *info ATTRIBUTE_UNUSED)
-{
- flagword flags;
- asection *s;
-
- /* Note that we set the SEC_IN_MEMORY flag. */
- flags = SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY;
-
- /* We choose to use the name ".linux-dynamic" for the fixup table.
- Why not? */
- s = bfd_make_section_with_flags (abfd, ".linux-dynamic", flags);
- if (s == NULL
- || ! bfd_set_section_alignment (abfd, s, 2))
- return FALSE;
- s->size = 0;
- s->contents = 0;
-
- return TRUE;
-}
-
-/* Function to add a single symbol to the linker hash table. This is
- a wrapper around _bfd_generic_link_add_one_symbol which handles the
- tweaking needed for dynamic linking support. */
-
-static bfd_boolean
-linux_add_one_symbol (struct bfd_link_info *info,
- bfd *abfd,
- const char *name,
- flagword flags,
- asection *section,
- bfd_vma value,
- const char *string,
- bfd_boolean copy,
- bfd_boolean collect,
- struct bfd_link_hash_entry **hashp)
-{
- struct linux_link_hash_entry *h;
- bfd_boolean insert;
-
- /* Look up and see if we already have this symbol in the hash table.
- If we do, and the defining entry is from a shared library, we
- need to create the dynamic sections.
-
- FIXME: What if abfd->xvec != info->output_bfd->xvec? We may
- want to be able to link Linux a.out and ELF objects together,
- but serious confusion is possible. */
-
- insert = FALSE;
-
- if (! bfd_link_relocatable (info)
- && linux_hash_table (info)->dynobj == NULL
- && strcmp (name, SHARABLE_CONFLICTS) == 0
- && (flags & BSF_CONSTRUCTOR) != 0
- && abfd->xvec == info->output_bfd->xvec)
- {
- if (! linux_link_create_dynamic_sections (abfd, info))
- return FALSE;
- linux_hash_table (info)->dynobj = abfd;
- insert = TRUE;
- }
-
- if (bfd_is_abs_section (section)
- && abfd->xvec == info->output_bfd->xvec)
- {
- h = linux_link_hash_lookup (linux_hash_table (info), name, FALSE,
- FALSE, FALSE);
- if (h != NULL
- && (h->root.root.type == bfd_link_hash_defined
- || h->root.root.type == bfd_link_hash_defweak))
- {
- struct fixup *f;
-
- if (hashp != NULL)
- *hashp = (struct bfd_link_hash_entry *) h;
-
- f = new_fixup (info, h, value, ! IS_PLT_SYM (name));
- if (f == NULL)
- return FALSE;
- f->jump = IS_PLT_SYM (name);
-
- return TRUE;
- }
- }
-
- /* Do the usual procedure for adding a symbol. */
- if (! _bfd_generic_link_add_one_symbol (info, abfd, name, flags, section,
- value, string, copy, collect,
- hashp))
- return FALSE;
-
- /* Insert a pointer to our table in the set vector. The dynamic
- linker requires this information. */
- if (insert)
- {
- asection *s;
-
- /* Here we do our special thing to add the pointer to the
- dynamic section in the SHARABLE_CONFLICTS set vector. */
- s = bfd_get_section_by_name (linux_hash_table (info)->dynobj,
- ".linux-dynamic");
- BFD_ASSERT (s != NULL);
-
- if (! (_bfd_generic_link_add_one_symbol
- (info, linux_hash_table (info)->dynobj, SHARABLE_CONFLICTS,
- BSF_GLOBAL | BSF_CONSTRUCTOR, s, (bfd_vma) 0, NULL,
- FALSE, FALSE, NULL)))
- return FALSE;
- }
-
- return TRUE;
-}
-
-/* We will crawl the hash table and come here for every global symbol.
- We will examine each entry and see if there are indications that we
- need to add a fixup. There are two possible cases - one is where
- you have duplicate definitions of PLT or GOT symbols - these will
- have already been caught and added as "builtin" fixups. If we find
- that the corresponding non PLT/GOT symbol is also present, we
- convert it to a regular fixup instead.
-
- This function is called via linux_link_hash_traverse. */
-
-static bfd_boolean
-linux_tally_symbols (struct linux_link_hash_entry *h, void * data)
-{
- struct bfd_link_info *info = (struct bfd_link_info *) data;
- struct fixup *f, *f1;
- int is_plt;
- struct linux_link_hash_entry *h1, *h2;
- bfd_boolean exists;
-
- if (h->root.root.type == bfd_link_hash_undefined
- && CONST_STRNEQ (h->root.root.root.string, NEEDS_SHRLIB))
- {
- const char *name;
- char *p;
- char *alloc = NULL;
-
- name = h->root.root.root.string + sizeof NEEDS_SHRLIB - 1;
- p = strrchr (name, '_');
- if (p != NULL)
- alloc = (char *) bfd_malloc ((bfd_size_type) strlen (name) + 1);
-
- if (p == NULL || alloc == NULL)
- _bfd_error_handler (_("output file requires shared library `%s'"),
- name);
- else
- {
- strcpy (alloc, name);
- p = strrchr (alloc, '_');
- *p++ = '\0';
- _bfd_error_handler
- /* xgettext:c-format */
- (_("output file requires shared library `%s.so.%s'"),
- alloc, p);
- free (alloc);
- }
-
- abort ();
- }
-
- /* If this symbol is not a PLT/GOT, we do not even need to look at
- it. */
- is_plt = IS_PLT_SYM (h->root.root.root.string);
-
- if (is_plt || IS_GOT_SYM (h->root.root.root.string))
- {
- /* Look up this symbol twice. Once just as a regular lookup,
- and then again following all of the indirect links until we
- reach a real symbol. */
- h1 = linux_link_hash_lookup (linux_hash_table (info),
- (h->root.root.root.string
- + sizeof PLT_REF_PREFIX - 1),
- FALSE, FALSE, TRUE);
- /* h2 does not follow indirect symbols. */
- h2 = linux_link_hash_lookup (linux_hash_table (info),
- (h->root.root.root.string
- + sizeof PLT_REF_PREFIX - 1),
- FALSE, FALSE, FALSE);
-
- /* The real symbol must exist but if it is also an ABS symbol,
- there is no need to have a fixup. This is because they both
- came from the same library. If on the other hand, we had to
- use an indirect symbol to get to the real symbol, we add the
- fixup anyway, since there are cases where these symbols come
- from different shared libraries */
- if (h1 != NULL
- && (((h1->root.root.type == bfd_link_hash_defined
- || h1->root.root.type == bfd_link_hash_defweak)
- && ! bfd_is_abs_section (h1->root.root.u.def.section))
- || h2->root.root.type == bfd_link_hash_indirect))
- {
- /* See if there is a "builtin" fixup already present
- involving this symbol. If so, convert it to a regular
- fixup. In the end, this relaxes some of the requirements
- about the order of performing fixups. */
- exists = FALSE;
- for (f1 = linux_hash_table (info)->fixup_list;
- f1 != NULL;
- f1 = f1->next)
- {
- if ((f1->h != h && f1->h != h1)
- || (! f1->builtin && ! f1->jump))
- continue;
- if (f1->h == h1)
- exists = TRUE;
- if (! exists
- && bfd_is_abs_section (h->root.root.u.def.section))
- {
- f = new_fixup (info, h1, f1->h->root.root.u.def.value, 0);
- f->jump = is_plt;
- }
- f1->h = h1;
- f1->jump = is_plt;
- f1->builtin = 0;
- exists = TRUE;
- }
- if (! exists
- && bfd_is_abs_section (h->root.root.u.def.section))
- {
- f = new_fixup (info, h1, h->root.root.u.def.value, 0);
- if (f == NULL)
- {
- /* FIXME: No way to return error. */
- abort ();
- }
- f->jump = is_plt;
- }
- }
-
- /* Quick and dirty way of stripping these symbols from the
- symtab. */
- if (bfd_is_abs_section (h->root.root.u.def.section))
- h->root.written = TRUE;
- }
-
- return TRUE;
-}
-
-/* This is called to set the size of the .linux-dynamic section is.
- It is called by the Linux linker emulation before_allocation
- routine. We have finished reading all of the input files, and now
- we just scan the hash tables to find out how many additional fixups
- are required. */
-
-bfd_boolean
-bfd_sparclinux_size_dynamic_sections (bfd *output_bfd,
- struct bfd_link_info *info)
-{
- struct fixup *f;
- asection *s;
-
- if (output_bfd->xvec != &MY(vec))
- return TRUE;
-
- /* First find the fixups... */
- linux_link_hash_traverse (linux_hash_table (info),
- linux_tally_symbols,
- info);
-
- /* If there are builtin fixups, leave room for a marker. This is
- used by the dynamic linker so that it knows that all that follow
- are builtin fixups instead of regular fixups. */
- for (f = linux_hash_table (info)->fixup_list; f != NULL; f = f->next)
- {
- if (f->builtin)
- {
- ++linux_hash_table (info)->fixup_count;
- ++linux_hash_table (info)->local_builtins;
- break;
- }
- }
-
- if (linux_hash_table (info)->dynobj == NULL)
- {
- if (linux_hash_table (info)->fixup_count > 0)
- abort ();
- return TRUE;
- }
-
- /* Allocate memory for our fixup table. We will fill it in later. */
- s = bfd_get_section_by_name (linux_hash_table (info)->dynobj,
- ".linux-dynamic");
- if (s != NULL)
- {
- s->size = linux_hash_table (info)->fixup_count + 1;
- s->size *= 8;
- s->contents = (bfd_byte *) bfd_zalloc (output_bfd, s->size);
- if (s->contents == NULL)
- return FALSE;
- }
-
- return TRUE;
-}
-
-/* We come here once we are ready to actually write the fixup table to
- the output file. Scan the fixup tables and so forth and generate
- the stuff we need. */
-
-static bfd_boolean
-linux_finish_dynamic_link (bfd *output_bfd, struct bfd_link_info *info)
-{
- asection *s, *os, *is;
- bfd_byte *fixup_table;
- struct linux_link_hash_entry *h;
- struct fixup *f;
- unsigned int new_addr;
- int section_offset;
- unsigned int fixups_written;
-
- if (linux_hash_table (info)->dynobj == NULL)
- return TRUE;
-
- s = bfd_get_section_by_name (linux_hash_table (info)->dynobj,
- ".linux-dynamic");
- BFD_ASSERT (s != NULL);
- os = s->output_section;
- fixups_written = 0;
-
-#ifdef LINUX_LINK_DEBUG
- printf ("Fixup table file offset: %x VMA: %x\n",
- os->filepos + s->output_offset,
- os->vma + s->output_offset);
-#endif
-
- fixup_table = s->contents;
- bfd_put_32 (output_bfd,
- (bfd_vma) linux_hash_table (info)->fixup_count, fixup_table);
- fixup_table += 4;
-
- /* Fill in fixup table. */
- for (f = linux_hash_table (info)->fixup_list; f != NULL; f = f->next)
- {
- if (f->builtin)
- continue;
-
- if (f->h->root.root.type != bfd_link_hash_defined
- && f->h->root.root.type != bfd_link_hash_defweak)
- {
- _bfd_error_handler
- (_("symbol %s not defined for fixups"),
- f->h->root.root.root.string);
- continue;
- }
-
- is = f->h->root.root.u.def.section;
- section_offset = is->output_section->vma + is->output_offset;
- new_addr = f->h->root.root.u.def.value + section_offset;
-
-#ifdef LINUX_LINK_DEBUG
- printf ("Fixup(%d) %s: %x %x\n",f->jump, f->h->root.root.string,
- new_addr, f->value);
-#endif
-
- if (f->jump)
- {
- /* Relative address */
- new_addr = new_addr - (f->value + 5);
- bfd_put_32 (output_bfd, (bfd_vma) new_addr, fixup_table);
- fixup_table += 4;
- bfd_put_32 (output_bfd, f->value + 1, fixup_table);
- fixup_table += 4;
- }
- else
- {
- bfd_put_32 (output_bfd, (bfd_vma) new_addr, fixup_table);
- fixup_table += 4;
- bfd_put_32 (output_bfd, f->value, fixup_table);
- fixup_table += 4;
- }
- ++fixups_written;
- }
-
- if (linux_hash_table (info)->local_builtins != 0)
- {
- /* Special marker so we know to switch to the other type of fixup */
- bfd_put_32 (output_bfd, (bfd_vma) 0, fixup_table);
- fixup_table += 4;
- bfd_put_32 (output_bfd, (bfd_vma) 0, fixup_table);
- fixup_table += 4;
- ++fixups_written;
- for (f = linux_hash_table (info)->fixup_list; f != NULL; f = f->next)
- {
- if (! f->builtin)
- continue;
-
- if (f->h->root.root.type != bfd_link_hash_defined
- && f->h->root.root.type != bfd_link_hash_defweak)
- {
- _bfd_error_handler
- (_("symbol %s not defined for fixups"),
- f->h->root.root.root.string);
- continue;
- }
-
- is = f->h->root.root.u.def.section;
- section_offset = is->output_section->vma + is->output_offset;
- new_addr = f->h->root.root.u.def.value + section_offset;
-
-#ifdef LINUX_LINK_DEBUG
- printf ("Fixup(B) %s: %x %x\n", f->h->root.root.string,
- new_addr, f->value);
-#endif
-
- bfd_put_32 (output_bfd, (bfd_vma) new_addr, fixup_table);
- fixup_table += 4;
- bfd_put_32 (output_bfd, f->value, fixup_table);
- fixup_table += 4;
- ++fixups_written;
- }
- }
-
- if (linux_hash_table (info)->fixup_count != fixups_written)
- {
- _bfd_error_handler (_("warning: fixup count mismatch"));
- while (linux_hash_table (info)->fixup_count > fixups_written)
- {
- bfd_put_32 (output_bfd, (bfd_vma) 0, fixup_table);
- fixup_table += 4;
- bfd_put_32 (output_bfd, (bfd_vma) 0, fixup_table);
- fixup_table += 4;
- ++fixups_written;
- }
- }
-
- h = linux_link_hash_lookup (linux_hash_table (info),
- "__BUILTIN_FIXUPS__",
- FALSE, FALSE, FALSE);
-
- if (h != NULL
- && (h->root.root.type == bfd_link_hash_defined
- || h->root.root.type == bfd_link_hash_defweak))
- {
- is = h->root.root.u.def.section;
- section_offset = is->output_section->vma + is->output_offset;
- new_addr = h->root.root.u.def.value + section_offset;
-
-#ifdef LINUX_LINK_DEBUG
- printf ("Builtin fixup table at %x\n", new_addr);
-#endif
-
- bfd_put_32 (output_bfd, (bfd_vma) new_addr, fixup_table);
- }
- else
- bfd_put_32 (output_bfd, (bfd_vma) 0, fixup_table);
-
- if (bfd_seek (output_bfd, (file_ptr) (os->filepos + s->output_offset),
- SEEK_SET) != 0)
- return FALSE;
-
- if (bfd_bwrite (s->contents, s->size, output_bfd) != s->size)
- return FALSE;
-
- return TRUE;
-}
-
-#define MY_bfd_link_hash_table_create linux_link_hash_table_create
-#define MY_add_one_symbol linux_add_one_symbol
-#define MY_finish_dynamic_link linux_finish_dynamic_link
-
-#define MY_zmagic_contiguous 1
-
-#include "aout-target.h"
+++ /dev/null
-/* BFD support for Sparc binaries under LynxOS.
- Copyright (C) 1990-2018 Free Software Foundation, Inc.
-
- This file is part of BFD, the Binary File Descriptor library.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
- MA 02110-1301, USA. */
-
-
-/* Do not "beautify" the CONCAT* macro args. Traditional C will not
- remove whitespace added here, and thus will fail to concatenate
- the tokens. */
-#define MY(OP) CONCAT2 (sparc_aout_lynx_,OP)
-#define TARGETNAME "a.out-sparc-lynx"
-
-#include "sysdep.h"
-#include "bfd.h"
-#include "libbfd.h"
-
-#include "aout/sun4.h"
-#include "libaout.h" /* BFD a.out internal data structures */
-
-#include "aout/aout64.h"
-#include "aout/stab_gnu.h"
-#include "aout/ar.h"
-
-void NAME (lynx,set_arch_mach) (bfd *, unsigned long);
-static void choose_reloc_size (bfd *);
-static bfd_boolean NAME (aout,sparclynx_write_object_contents) (bfd *);
-
-/* This is needed to reject a NewsOS file, e.g. in
- gdb/testsuite/gdb.t10/crossload.exp. <kingdon@cygnus.com>
- I needed to add M_UNKNOWN to recognize a 68000 object, so this will
- probably no longer reject a NewsOS object. <ian@cygnus.com>. */
-#define MACHTYPE_OK(mtype) ( (mtype) == M_UNKNOWN \
- || (mtype) == M_68010 \
- || (mtype) == M_68020 \
- || (mtype) == M_SPARC)
-
-/* The file @code{aoutf1.h} contains the code for BFD's
- a.out back end. Control over the generated back end is given by these
- two preprocessor names:
- @table @code
- @item ARCH_SIZE
- This value should be either 32 or 64, depending upon the size of an
- int in the target format. It changes the sizes of the structs which
- perform the memory/disk mapping of structures.
-
- The 64 bit backend may only be used if the host compiler supports 64
- ints (eg long long with gcc), by defining the name @code{BFD_HOST_64_BIT} in @code{bfd.h}.
- With this name defined, @emph{all} bfd operations are performed with 64bit
- arithmetic, not just those to a 64bit target.
-
- @item TARGETNAME
- The name put into the target vector.
- @item
- @end table */
-
-void
-NAME(lynx,set_arch_mach) (bfd *abfd, unsigned long machtype)
-{
- /* Determine the architecture and machine type of the object file. */
- enum bfd_architecture arch;
- unsigned long machine;
-
- switch (machtype)
- {
- case M_UNKNOWN:
- /* Some Sun3s make magic numbers without cpu types in them, so
- we'll default to the 68000. */
- arch = bfd_arch_m68k;
- machine = bfd_mach_m68000;
- break;
-
- case M_68010:
- case M_HP200:
- arch = bfd_arch_m68k;
- machine = bfd_mach_m68010;
- break;
-
- case M_68020:
- case M_HP300:
- arch = bfd_arch_m68k;
- machine = bfd_mach_m68020;
- break;
-
- case M_SPARC:
- arch = bfd_arch_sparc;
- machine = 0;
- break;
-
- case M_386:
- case M_386_DYNIX:
- arch = bfd_arch_i386;
- machine = 0;
- break;
-
- case M_HPUX:
- arch = bfd_arch_m68k;
- machine = 0;
- break;
-
- default:
- arch = bfd_arch_obscure;
- machine = 0;
- break;
- }
- bfd_set_arch_mach (abfd, arch, machine);
-}
-
-#define SET_ARCH_MACH(ABFD, EXECP) \
- NAME(lynx,set_arch_mach) (ABFD, N_MACHTYPE (EXECP)); \
- choose_reloc_size(ABFD);
-
-/* Determine the size of a relocation entry, based on the architecture. */
-
-static void
-choose_reloc_size (bfd *abfd)
-{
- switch (bfd_get_arch (abfd))
- {
- case bfd_arch_sparc:
- obj_reloc_entry_size (abfd) = RELOC_EXT_SIZE;
- break;
- default:
- obj_reloc_entry_size (abfd) = RELOC_STD_SIZE;
- break;
- }
-}
-
-/* Write an object file in LynxOS format.
- Section contents have already been written. We write the
- file header, symbols, and relocation. */
-
-static bfd_boolean
-NAME(aout,sparclynx_write_object_contents) (bfd *abfd)
-{
- struct external_exec exec_bytes;
- struct internal_exec *execp = exec_hdr (abfd);
-
- /* Magic number, maestro, please! */
- switch (bfd_get_arch (abfd))
- {
- case bfd_arch_m68k:
- switch (bfd_get_mach (abfd))
- {
- case bfd_mach_m68010:
- N_SET_MACHTYPE (execp, M_68010);
- break;
- default:
- case bfd_mach_m68020:
- N_SET_MACHTYPE (execp, M_68020);
- break;
- }
- break;
- case bfd_arch_sparc:
- N_SET_MACHTYPE (execp, M_SPARC);
- break;
- case bfd_arch_i386:
- N_SET_MACHTYPE (execp, M_386);
- break;
- default:
- N_SET_MACHTYPE (execp, M_UNKNOWN);
- }
-
- choose_reloc_size (abfd);
-
- N_SET_FLAGS (execp, aout_backend_info (abfd)->exec_hdr_flags);
-
- WRITE_HEADERS (abfd, execp);
-
- return TRUE;
-}
-
-#define MY_set_sizes sparclynx_set_sizes
-static bfd_boolean sparclynx_set_sizes (bfd *);
-
-static bfd_boolean
-sparclynx_set_sizes (bfd *abfd)
-{
- switch (bfd_get_arch (abfd))
- {
- default:
- return FALSE;
- case bfd_arch_sparc:
- adata (abfd).page_size = 0x2000;
- adata (abfd).segment_size = 0x2000;
- adata (abfd).exec_bytes_size = EXEC_BYTES_SIZE;
- return TRUE;
- case bfd_arch_m68k:
- adata (abfd).page_size = 0x2000;
- adata (abfd).segment_size = 0x20000;
- adata (abfd).exec_bytes_size = EXEC_BYTES_SIZE;
- return TRUE;
- }
-}
-
-static const struct aout_backend_data sparclynx_aout_backend =
- {
- 0, 1, 0, 1, 0, sparclynx_set_sizes, 0,
- 0, /* add_dynamic_symbols */
- 0, /* add_one_symbol */
- 0, /* link_dynamic_object */
- 0, /* write_dynamic_symbol */
- 0, /* check_dynamic_reloc */
- 0 /* finish_dynamic_link */
- };
-\f
-
-#define MY_bfd_debug_info_start _bfd_void_bfd
-#define MY_bfd_debug_info_end _bfd_void_bfd
-#define MY_bfd_debug_info_accumulate _bfd_void_bfd_asection
-
-#define MY_write_object_contents NAME(aout,sparclynx_write_object_contents)
-#define MY_backend_data &sparclynx_aout_backend
-
-#define TARGET_IS_BIG_ENDIAN_P
-
-#ifdef LYNX_CORE
-
-char * lynx_core_file_failing_command ();
-int lynx_core_file_failing_signal ();
-bfd_boolean lynx_core_file_matches_executable_p ();
-const bfd_target * lynx_core_file_p ();
-
-#define MY_core_file_failing_command lynx_core_file_failing_command
-#define MY_core_file_failing_signal lynx_core_file_failing_signal
-#define MY_core_file_matches_executable_p lynx_core_file_matches_executable_p
-#define MY_core_file_p lynx_core_file_p
-
-#endif /* LYNX_CORE */
-
-#include "aout-target.h"
+++ /dev/null
-/* BFD back-end for NetBSD/sparc a.out-ish binaries.
- Copyright (C) 1990-2018 Free Software Foundation, Inc.
-
- This file is part of BFD, the Binary File Descriptor library.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
- MA 02110-1301, USA. */
-
-
-#define TARGET_IS_BIG_ENDIAN_P
-
-/* SPARC chips use either 4K or 8K pages, but object files always
- assume 8K page alignment so they will work on either one. */
-#define TARGET_PAGE_SIZE 0x2000
-
-#define DEFAULT_ARCH bfd_arch_sparc
-#define DEFAULT_MID M_SPARC_NETBSD
-
-/* Do not "beautify" the CONCAT* macro args. Traditional C will not
- remove whitespace added here, and thus will fail to concatenate
- the tokens. */
-#define MY(OP) CONCAT2 (sparc_aout_nbsd_,OP)
-
-/* This needs to start with a.out so GDB knows it is an a.out variant. */
-#define TARGETNAME "a.out-sparc-netbsd"
-
-#include "netbsd.h"
+++ /dev/null
-/* BFD backend for SunOS binaries.
- Copyright (C) 1990-2018 Free Software Foundation, Inc.
- Written by Cygnus Support.
-
- This file is part of BFD, the Binary File Descriptor library.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
- MA 02110-1301, USA. */
-
-#define TARGETNAME "a.out-sunos-big"
-
-/* Do not "beautify" the CONCAT* macro args. Traditional C will not
- remove whitespace added here, and thus will fail to concatenate
- the tokens. */
-#define MY(OP) CONCAT2 (sparc_aout_sunos_be_,OP)
-
-#include "sysdep.h"
-#include "bfd.h"
-#include "bfdlink.h"
-#include "libaout.h"
-
-/* ??? Where should this go? */
-#define MACHTYPE_OK(mtype) \
- (((mtype) == M_SPARC && bfd_lookup_arch (bfd_arch_sparc, 0) != NULL) \
- || ((mtype) == M_SPARCLET \
- && bfd_lookup_arch (bfd_arch_sparc, bfd_mach_sparc_sparclet) != NULL) \
- || ((mtype) == M_SPARCLITE_LE \
- && bfd_lookup_arch (bfd_arch_sparc, bfd_mach_sparc_sparclet) != NULL) \
- || (((mtype) == M_UNKNOWN || (mtype) == M_68010 || (mtype) == M_68020) \
- && bfd_lookup_arch (bfd_arch_m68k, 0) != NULL))
-
-#define MY_get_dynamic_symtab_upper_bound sunos_get_dynamic_symtab_upper_bound
-#define MY_canonicalize_dynamic_symtab sunos_canonicalize_dynamic_symtab
-#define MY_get_synthetic_symtab _bfd_nodynamic_get_synthetic_symtab
-#define MY_get_dynamic_reloc_upper_bound sunos_get_dynamic_reloc_upper_bound
-#define MY_canonicalize_dynamic_reloc sunos_canonicalize_dynamic_reloc
-#define MY_bfd_link_hash_table_create sunos_link_hash_table_create
-#define MY_add_dynamic_symbols sunos_add_dynamic_symbols
-#define MY_add_one_symbol sunos_add_one_symbol
-#define MY_link_dynamic_object sunos_link_dynamic_object
-#define MY_write_dynamic_symbol sunos_write_dynamic_symbol
-#define MY_check_dynamic_reloc sunos_check_dynamic_reloc
-#define MY_finish_dynamic_link sunos_finish_dynamic_link
-
-static bfd_boolean sunos_add_dynamic_symbols (bfd *, struct bfd_link_info *, struct external_nlist **, bfd_size_type *, char **);
-static bfd_boolean sunos_add_one_symbol (struct bfd_link_info *, bfd *, const char *, flagword, asection *, bfd_vma, const char *, bfd_boolean, bfd_boolean, struct bfd_link_hash_entry **);
-static bfd_boolean sunos_link_dynamic_object (struct bfd_link_info *, bfd *);
-static bfd_boolean sunos_write_dynamic_symbol (bfd *, struct bfd_link_info *, struct aout_link_hash_entry *);
-static bfd_boolean sunos_check_dynamic_reloc (struct bfd_link_info *, bfd *, asection *, struct aout_link_hash_entry *, void *, bfd_byte *, bfd_boolean *, bfd_vma *);
-static bfd_boolean sunos_finish_dynamic_link (bfd *, struct bfd_link_info *);
-static struct bfd_link_hash_table *sunos_link_hash_table_create (bfd *);
-static long sunos_get_dynamic_symtab_upper_bound (bfd *);
-static long sunos_canonicalize_dynamic_symtab (bfd *, asymbol **);
-static long sunos_get_dynamic_reloc_upper_bound (bfd *);
-static long sunos_canonicalize_dynamic_reloc (bfd *, arelent **, asymbol **);
-
-/* Include the usual a.out support. */
-#include "aoutf1.h"
-
-/* The SunOS 4.1.4 /usr/include/locale.h defines valid as a macro. */
-#undef valid
-
-/* SunOS shared library support. We store a pointer to this structure
- in obj_aout_dynamic_info (abfd). */
-
-struct sunos_dynamic_info
-{
- /* Whether we found any dynamic information. */
- bfd_boolean valid;
- /* Dynamic information. */
- struct internal_sun4_dynamic_link dyninfo;
- /* Number of dynamic symbols. */
- unsigned long dynsym_count;
- /* Read in nlists for dynamic symbols. */
- struct external_nlist *dynsym;
- /* asymbol structures for dynamic symbols. */
- aout_symbol_type *canonical_dynsym;
- /* Read in dynamic string table. */
- char *dynstr;
- /* Number of dynamic relocs. */
- unsigned long dynrel_count;
- /* Read in dynamic relocs. This may be reloc_std_external or
- reloc_ext_external. */
- void * dynrel;
- /* arelent structures for dynamic relocs. */
- arelent *canonical_dynrel;
-};
-
-/* The hash table of dynamic symbols is composed of two word entries.
- See include/aout/sun4.h for details. */
-
-#define HASH_ENTRY_SIZE (2 * BYTES_IN_WORD)
-
-/* Read in the basic dynamic information. This locates the __DYNAMIC
- structure and uses it to find the dynamic_link structure. It
- creates and saves a sunos_dynamic_info structure. If it can't find
- __DYNAMIC, it sets the valid field of the sunos_dynamic_info
- structure to FALSE to avoid doing this work again. */
-
-static bfd_boolean
-sunos_read_dynamic_info (bfd *abfd)
-{
- struct sunos_dynamic_info *info;
- asection *dynsec;
- bfd_vma dynoff;
- struct external_sun4_dynamic dyninfo;
- unsigned long dynver;
- struct external_sun4_dynamic_link linkinfo;
- bfd_size_type amt;
-
- if (obj_aout_dynamic_info (abfd) != NULL)
- return TRUE;
-
- if ((abfd->flags & DYNAMIC) == 0)
- {
- bfd_set_error (bfd_error_invalid_operation);
- return FALSE;
- }
-
- amt = sizeof (struct sunos_dynamic_info);
- info = bfd_zalloc (abfd, amt);
- if (!info)
- return FALSE;
- info->valid = FALSE;
- info->dynsym = NULL;
- info->dynstr = NULL;
- info->canonical_dynsym = NULL;
- info->dynrel = NULL;
- info->canonical_dynrel = NULL;
- obj_aout_dynamic_info (abfd) = (void *) info;
-
- /* This code used to look for the __DYNAMIC symbol to locate the dynamic
- linking information.
- However this inhibits recovering the dynamic symbols from a
- stripped object file, so blindly assume that the dynamic linking
- information is located at the start of the data section.
- We could verify this assumption later by looking through the dynamic
- symbols for the __DYNAMIC symbol. */
- if ((abfd->flags & DYNAMIC) == 0)
- return TRUE;
- if (! bfd_get_section_contents (abfd, obj_datasec (abfd), (void *) &dyninfo,
- (file_ptr) 0,
- (bfd_size_type) sizeof dyninfo))
- return TRUE;
-
- dynver = GET_WORD (abfd, dyninfo.ld_version);
- if (dynver != 2 && dynver != 3)
- return TRUE;
-
- dynoff = GET_WORD (abfd, dyninfo.ld);
-
- /* dynoff is a virtual address. It is probably always in the .data
- section, but this code should work even if it moves. */
- if (dynoff < bfd_get_section_vma (abfd, obj_datasec (abfd)))
- dynsec = obj_textsec (abfd);
- else
- dynsec = obj_datasec (abfd);
- dynoff -= bfd_get_section_vma (abfd, dynsec);
- if (dynoff > dynsec->size)
- return TRUE;
-
- /* This executable appears to be dynamically linked in a way that we
- can understand. */
- if (! bfd_get_section_contents (abfd, dynsec, (void *) &linkinfo,
- (file_ptr) dynoff,
- (bfd_size_type) sizeof linkinfo))
- return TRUE;
-
- /* Swap in the dynamic link information. */
- info->dyninfo.ld_loaded = GET_WORD (abfd, linkinfo.ld_loaded);
- info->dyninfo.ld_need = GET_WORD (abfd, linkinfo.ld_need);
- info->dyninfo.ld_rules = GET_WORD (abfd, linkinfo.ld_rules);
- info->dyninfo.ld_got = GET_WORD (abfd, linkinfo.ld_got);
- info->dyninfo.ld_plt = GET_WORD (abfd, linkinfo.ld_plt);
- info->dyninfo.ld_rel = GET_WORD (abfd, linkinfo.ld_rel);
- info->dyninfo.ld_hash = GET_WORD (abfd, linkinfo.ld_hash);
- info->dyninfo.ld_stab = GET_WORD (abfd, linkinfo.ld_stab);
- info->dyninfo.ld_stab_hash = GET_WORD (abfd, linkinfo.ld_stab_hash);
- info->dyninfo.ld_buckets = GET_WORD (abfd, linkinfo.ld_buckets);
- info->dyninfo.ld_symbols = GET_WORD (abfd, linkinfo.ld_symbols);
- info->dyninfo.ld_symb_size = GET_WORD (abfd, linkinfo.ld_symb_size);
- info->dyninfo.ld_text = GET_WORD (abfd, linkinfo.ld_text);
- info->dyninfo.ld_plt_sz = GET_WORD (abfd, linkinfo.ld_plt_sz);
-
- /* Reportedly the addresses need to be offset by the size of the
- exec header in an NMAGIC file. */
- if (adata (abfd).magic == n_magic)
- {
- unsigned long exec_bytes_size = adata (abfd).exec_bytes_size;
-
- info->dyninfo.ld_need += exec_bytes_size;
- info->dyninfo.ld_rules += exec_bytes_size;
- info->dyninfo.ld_rel += exec_bytes_size;
- info->dyninfo.ld_hash += exec_bytes_size;
- info->dyninfo.ld_stab += exec_bytes_size;
- info->dyninfo.ld_symbols += exec_bytes_size;
- }
-
- /* The only way to get the size of the symbol information appears to
- be to determine the distance between it and the string table. */
- info->dynsym_count = ((info->dyninfo.ld_symbols - info->dyninfo.ld_stab)
- / EXTERNAL_NLIST_SIZE);
- BFD_ASSERT (info->dynsym_count * EXTERNAL_NLIST_SIZE
- == (unsigned long) (info->dyninfo.ld_symbols
- - info->dyninfo.ld_stab));
-
- /* Similarly, the relocs end at the hash table. */
- info->dynrel_count = ((info->dyninfo.ld_hash - info->dyninfo.ld_rel)
- / obj_reloc_entry_size (abfd));
- BFD_ASSERT (info->dynrel_count * obj_reloc_entry_size (abfd)
- == (unsigned long) (info->dyninfo.ld_hash
- - info->dyninfo.ld_rel));
-
- info->valid = TRUE;
-
- return TRUE;
-}
-
-/* Return the amount of memory required for the dynamic symbols. */
-
-static long
-sunos_get_dynamic_symtab_upper_bound (bfd *abfd)
-{
- struct sunos_dynamic_info *info;
-
- if (! sunos_read_dynamic_info (abfd))
- return -1;
-
- info = (struct sunos_dynamic_info *) obj_aout_dynamic_info (abfd);
- if (! info->valid)
- {
- bfd_set_error (bfd_error_no_symbols);
- return -1;
- }
-
- return (info->dynsym_count + 1) * sizeof (asymbol *);
-}
-
-/* Read the external dynamic symbols. */
-
-static bfd_boolean
-sunos_slurp_dynamic_symtab (bfd *abfd)
-{
- struct sunos_dynamic_info *info;
- bfd_size_type amt;
-
- /* Get the general dynamic information. */
- if (obj_aout_dynamic_info (abfd) == NULL)
- {
- if (! sunos_read_dynamic_info (abfd))
- return FALSE;
- }
-
- info = (struct sunos_dynamic_info *) obj_aout_dynamic_info (abfd);
- if (! info->valid)
- {
- bfd_set_error (bfd_error_no_symbols);
- return FALSE;
- }
-
- /* Get the dynamic nlist structures. */
- if (info->dynsym == NULL)
- {
- amt = (bfd_size_type) info->dynsym_count * EXTERNAL_NLIST_SIZE;
- info->dynsym = bfd_alloc (abfd, amt);
- if (info->dynsym == NULL && info->dynsym_count != 0)
- return FALSE;
- if (bfd_seek (abfd, (file_ptr) info->dyninfo.ld_stab, SEEK_SET) != 0
- || bfd_bread ((void *) info->dynsym, amt, abfd) != amt)
- {
- if (info->dynsym != NULL)
- {
- bfd_release (abfd, info->dynsym);
- info->dynsym = NULL;
- }
- return FALSE;
- }
- }
-
- /* Get the dynamic strings. */
- if (info->dynstr == NULL)
- {
- amt = info->dyninfo.ld_symb_size;
- info->dynstr = bfd_alloc (abfd, amt);
- if (info->dynstr == NULL && info->dyninfo.ld_symb_size != 0)
- return FALSE;
- if (bfd_seek (abfd, (file_ptr) info->dyninfo.ld_symbols, SEEK_SET) != 0
- || bfd_bread ((void *) info->dynstr, amt, abfd) != amt)
- {
- if (info->dynstr != NULL)
- {
- bfd_release (abfd, info->dynstr);
- info->dynstr = NULL;
- }
- return FALSE;
- }
- }
-
- return TRUE;
-}
-
-/* Read in the dynamic symbols. */
-
-static long
-sunos_canonicalize_dynamic_symtab (bfd *abfd, asymbol **storage)
-{
- struct sunos_dynamic_info *info;
- unsigned long i;
-
- if (! sunos_slurp_dynamic_symtab (abfd))
- return -1;
-
- info = (struct sunos_dynamic_info *) obj_aout_dynamic_info (abfd);
-
-#ifdef CHECK_DYNAMIC_HASH
- /* Check my understanding of the dynamic hash table by making sure
- that each symbol can be located in the hash table. */
- {
- bfd_size_type table_size;
- bfd_byte *table;
- bfd_size_type i;
-
- if (info->dyninfo.ld_buckets > info->dynsym_count)
- abort ();
- table_size = info->dyninfo.ld_stab - info->dyninfo.ld_hash;
- table = bfd_malloc (table_size);
- if (table == NULL && table_size != 0)
- abort ();
- if (bfd_seek (abfd, (file_ptr) info->dyninfo.ld_hash, SEEK_SET) != 0
- || bfd_bread ((void *) table, table_size, abfd) != table_size)
- abort ();
- for (i = 0; i < info->dynsym_count; i++)
- {
- unsigned char *name;
- unsigned long hash;
-
- name = ((unsigned char *) info->dynstr
- + GET_WORD (abfd, info->dynsym[i].e_strx));
- hash = 0;
- while (*name != '\0')
- hash = (hash << 1) + *name++;
- hash &= 0x7fffffff;
- hash %= info->dyninfo.ld_buckets;
- while (GET_WORD (abfd, table + hash * HASH_ENTRY_SIZE) != i)
- {
- hash = GET_WORD (abfd,
- table + hash * HASH_ENTRY_SIZE + BYTES_IN_WORD);
- if (hash == 0 || hash >= table_size / HASH_ENTRY_SIZE)
- abort ();
- }
- }
- free (table);
- }
-#endif /* CHECK_DYNAMIC_HASH */
-
- /* Get the asymbol structures corresponding to the dynamic nlist
- structures. */
- if (info->canonical_dynsym == NULL)
- {
- bfd_size_type size;
- bfd_size_type strsize = info->dyninfo.ld_symb_size;
-
- size = (bfd_size_type) info->dynsym_count * sizeof (aout_symbol_type);
- info->canonical_dynsym = bfd_alloc (abfd, size);
- if (info->canonical_dynsym == NULL && info->dynsym_count != 0)
- return -1;
-
- if (! aout_32_translate_symbol_table (abfd, info->canonical_dynsym,
- info->dynsym,
- (bfd_size_type) info->dynsym_count,
- info->dynstr, strsize, TRUE))
- {
- if (info->canonical_dynsym != NULL)
- {
- bfd_release (abfd, info->canonical_dynsym);
- info->canonical_dynsym = NULL;
- }
- return -1;
- }
- }
-
- /* Return pointers to the dynamic asymbol structures. */
- for (i = 0; i < info->dynsym_count; i++)
- *storage++ = (asymbol *) (info->canonical_dynsym + i);
- *storage = NULL;
-
- return info->dynsym_count;
-}
-
-/* Return the amount of memory required for the dynamic relocs. */
-
-static long
-sunos_get_dynamic_reloc_upper_bound (bfd *abfd)
-{
- struct sunos_dynamic_info *info;
-
- if (! sunos_read_dynamic_info (abfd))
- return -1;
-
- info = (struct sunos_dynamic_info *) obj_aout_dynamic_info (abfd);
- if (! info->valid)
- {
- bfd_set_error (bfd_error_no_symbols);
- return -1;
- }
-
- return (info->dynrel_count + 1) * sizeof (arelent *);
-}
-
-/* Read in the dynamic relocs. */
-
-static long
-sunos_canonicalize_dynamic_reloc (bfd *abfd, arelent **storage, asymbol **syms)
-{
- struct sunos_dynamic_info *info;
- unsigned long i;
- bfd_size_type size;
-
- /* Get the general dynamic information. */
- if (obj_aout_dynamic_info (abfd) == NULL)
- {
- if (! sunos_read_dynamic_info (abfd))
- return -1;
- }
-
- info = (struct sunos_dynamic_info *) obj_aout_dynamic_info (abfd);
- if (! info->valid)
- {
- bfd_set_error (bfd_error_no_symbols);
- return -1;
- }
-
- /* Get the dynamic reloc information. */
- if (info->dynrel == NULL)
- {
- size = (bfd_size_type) info->dynrel_count * obj_reloc_entry_size (abfd);
- info->dynrel = bfd_alloc (abfd, size);
- if (info->dynrel == NULL && size != 0)
- return -1;
- if (bfd_seek (abfd, (file_ptr) info->dyninfo.ld_rel, SEEK_SET) != 0
- || bfd_bread ((void *) info->dynrel, size, abfd) != size)
- {
- if (info->dynrel != NULL)
- {
- bfd_release (abfd, info->dynrel);
- info->dynrel = NULL;
- }
- return -1;
- }
- }
-
- /* Get the arelent structures corresponding to the dynamic reloc
- information. */
- if (info->canonical_dynrel == NULL)
- {
- arelent *to;
-
- size = (bfd_size_type) info->dynrel_count * sizeof (arelent);
- info->canonical_dynrel = bfd_alloc (abfd, size);
- if (info->canonical_dynrel == NULL && info->dynrel_count != 0)
- return -1;
-
- to = info->canonical_dynrel;
-
- if (obj_reloc_entry_size (abfd) == RELOC_EXT_SIZE)
- {
- struct reloc_ext_external *p;
- struct reloc_ext_external *pend;
-
- p = (struct reloc_ext_external *) info->dynrel;
- pend = p + info->dynrel_count;
- for (; p < pend; p++, to++)
- NAME (aout, swap_ext_reloc_in) (abfd, p, to, syms,
- (bfd_size_type) info->dynsym_count);
- }
- else
- {
- struct reloc_std_external *p;
- struct reloc_std_external *pend;
-
- p = (struct reloc_std_external *) info->dynrel;
- pend = p + info->dynrel_count;
- for (; p < pend; p++, to++)
- NAME (aout, swap_std_reloc_in) (abfd, p, to, syms,
- (bfd_size_type) info->dynsym_count);
- }
- }
-
- /* Return pointers to the dynamic arelent structures. */
- for (i = 0; i < info->dynrel_count; i++)
- *storage++ = info->canonical_dynrel + i;
- *storage = NULL;
-
- return info->dynrel_count;
-}
-\f
-/* Code to handle linking of SunOS shared libraries. */
-
-/* A SPARC procedure linkage table entry is 12 bytes. The first entry
- in the table is a jump which is filled in by the runtime linker.
- The remaining entries are branches back to the first entry,
- followed by an index into the relocation table encoded to look like
- a sethi of %g0. */
-
-#define SPARC_PLT_ENTRY_SIZE (12)
-
-static const bfd_byte sparc_plt_first_entry[SPARC_PLT_ENTRY_SIZE] =
-{
- /* sethi %hi(0),%g1; address filled in by runtime linker. */
- 0x3, 0, 0, 0,
- /* jmp %g1; offset filled in by runtime linker. */
- 0x81, 0xc0, 0x60, 0,
- /* nop */
- 0x1, 0, 0, 0
-};
-
-/* save %sp, -96, %sp */
-#define SPARC_PLT_ENTRY_WORD0 ((bfd_vma) 0x9de3bfa0)
-/* call; address filled in later. */
-#define SPARC_PLT_ENTRY_WORD1 ((bfd_vma) 0x40000000)
-/* sethi; reloc index filled in later. */
-#define SPARC_PLT_ENTRY_WORD2 ((bfd_vma) 0x01000000)
-
-/* This sequence is used when for the jump table entry to a defined
- symbol in a complete executable. It is used when linking PIC
- compiled code which is not being put into a shared library. */
-/* sethi <address to be filled in later>, %g1 */
-#define SPARC_PLT_PIC_WORD0 ((bfd_vma) 0x03000000)
-/* jmp %g1 + <address to be filled in later> */
-#define SPARC_PLT_PIC_WORD1 ((bfd_vma) 0x81c06000)
-/* nop */
-#define SPARC_PLT_PIC_WORD2 ((bfd_vma) 0x01000000)
-
-/* An m68k procedure linkage table entry is 8 bytes. The first entry
- in the table is a jump which is filled in the by the runtime
- linker. The remaining entries are branches back to the first
- entry, followed by a two byte index into the relocation table. */
-
-#define M68K_PLT_ENTRY_SIZE (8)
-
-static const bfd_byte m68k_plt_first_entry[M68K_PLT_ENTRY_SIZE] =
-{
- /* jmps @# */
- 0x4e, 0xf9,
- /* Filled in by runtime linker with a magic address. */
- 0, 0, 0, 0,
- /* Not used? */
- 0, 0
-};
-
-/* bsrl */
-#define M68K_PLT_ENTRY_WORD0 ((bfd_vma) 0x61ff)
-/* Remaining words filled in later. */
-
-/* An entry in the SunOS linker hash table. */
-
-struct sunos_link_hash_entry
-{
- struct aout_link_hash_entry root;
-
- /* If this is a dynamic symbol, this is its index into the dynamic
- symbol table. This is initialized to -1. As the linker looks at
- the input files, it changes this to -2 if it will be added to the
- dynamic symbol table. After all the input files have been seen,
- the linker will know whether to build a dynamic symbol table; if
- it does build one, this becomes the index into the table. */
- long dynindx;
-
- /* If this is a dynamic symbol, this is the index of the name in the
- dynamic symbol string table. */
- long dynstr_index;
-
- /* The offset into the global offset table used for this symbol. If
- the symbol does not require a GOT entry, this is 0. */
- bfd_vma got_offset;
-
- /* The offset into the procedure linkage table used for this symbol.
- If the symbol does not require a PLT entry, this is 0. */
- bfd_vma plt_offset;
-
- /* Some linker flags. */
- unsigned char flags;
- /* Symbol is referenced by a regular object. */
-#define SUNOS_REF_REGULAR 01
- /* Symbol is defined by a regular object. */
-#define SUNOS_DEF_REGULAR 02
- /* Symbol is referenced by a dynamic object. */
-#define SUNOS_REF_DYNAMIC 04
- /* Symbol is defined by a dynamic object. */
-#define SUNOS_DEF_DYNAMIC 010
- /* Symbol is a constructor symbol in a regular object. */
-#define SUNOS_CONSTRUCTOR 020
-};
-
-/* The SunOS linker hash table. */
-
-struct sunos_link_hash_table
-{
- struct aout_link_hash_table root;
-
- /* The object which holds the dynamic sections. */
- bfd *dynobj;
-
- /* Whether we have created the dynamic sections. */
- bfd_boolean dynamic_sections_created;
-
- /* Whether we need the dynamic sections. */
- bfd_boolean dynamic_sections_needed;
-
- /* Whether we need the .got table. */
- bfd_boolean got_needed;
-
- /* The number of dynamic symbols. */
- size_t dynsymcount;
-
- /* The number of buckets in the hash table. */
- size_t bucketcount;
-
- /* The list of dynamic objects needed by dynamic objects included in
- the link. */
- struct bfd_link_needed_list *needed;
-
- /* The offset of __GLOBAL_OFFSET_TABLE_ into the .got section. */
- bfd_vma got_base;
-};
-
-/* Routine to create an entry in an SunOS link hash table. */
-
-static struct bfd_hash_entry *
-sunos_link_hash_newfunc (struct bfd_hash_entry *entry,
- struct bfd_hash_table *table,
- const char *string)
-{
- struct sunos_link_hash_entry *ret = (struct sunos_link_hash_entry *) entry;
-
- /* Allocate the structure if it has not already been allocated by a
- subclass. */
- if (ret == NULL)
- ret = bfd_hash_allocate (table, sizeof (* ret));
- if (ret == NULL)
- return NULL;
-
- /* Call the allocation method of the superclass. */
- ret = ((struct sunos_link_hash_entry *)
- NAME (aout, link_hash_newfunc) ((struct bfd_hash_entry *) ret,
- table, string));
- if (ret != NULL)
- {
- /* Set local fields. */
- ret->dynindx = -1;
- ret->dynstr_index = -1;
- ret->got_offset = 0;
- ret->plt_offset = 0;
- ret->flags = 0;
- }
-
- return (struct bfd_hash_entry *) ret;
-}
-
-/* Create a SunOS link hash table. */
-
-static struct bfd_link_hash_table *
-sunos_link_hash_table_create (bfd *abfd)
-{
- struct sunos_link_hash_table *ret;
- bfd_size_type amt = sizeof (struct sunos_link_hash_table);
-
- ret = bfd_zmalloc (amt);
- if (ret == NULL)
- return NULL;
- if (!NAME (aout, link_hash_table_init) (&ret->root, abfd,
- sunos_link_hash_newfunc,
- sizeof (struct sunos_link_hash_entry)))
- {
- free (ret);
- return NULL;
- }
-
- return &ret->root.root;
-}
-
-/* Look up an entry in an SunOS link hash table. */
-
-#define sunos_link_hash_lookup(table, string, create, copy, follow) \
- ((struct sunos_link_hash_entry *) \
- aout_link_hash_lookup (&(table)->root, (string), (create), (copy),\
- (follow)))
-
-/* Traverse a SunOS link hash table. */
-
-#define sunos_link_hash_traverse(table, func, info) \
- (aout_link_hash_traverse \
- (&(table)->root, \
- (bfd_boolean (*) (struct aout_link_hash_entry *, void *)) (func), \
- (info)))
-
-/* Get the SunOS link hash table from the info structure. This is
- just a cast. */
-
-#define sunos_hash_table(p) ((struct sunos_link_hash_table *) ((p)->hash))
-
-/* Create the dynamic sections needed if we are linking against a
- dynamic object, or if we are linking PIC compiled code. ABFD is a
- bfd we can attach the dynamic sections to. The linker script will
- look for these special sections names and put them in the right
- place in the output file. See include/aout/sun4.h for more details
- of the dynamic linking information. */
-
-static bfd_boolean
-sunos_create_dynamic_sections (bfd *abfd,
- struct bfd_link_info *info,
- bfd_boolean needed)
-{
- asection *s;
-
- if (! sunos_hash_table (info)->dynamic_sections_created)
- {
- flagword flags;
-
- sunos_hash_table (info)->dynobj = abfd;
-
- flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY
- | SEC_LINKER_CREATED);
-
- /* The .dynamic section holds the basic dynamic information: the
- sun4_dynamic structure, the dynamic debugger information, and
- the sun4_dynamic_link structure. */
- s = bfd_make_section_anyway_with_flags (abfd, ".dynamic", flags);
- if (s == NULL
- || ! bfd_set_section_alignment (abfd, s, 2))
- return FALSE;
-
- /* The .got section holds the global offset table. The address
- is put in the ld_got field. */
- s = bfd_make_section_anyway_with_flags (abfd, ".got", flags);
- if (s == NULL
- || ! bfd_set_section_alignment (abfd, s, 2))
- return FALSE;
-
- /* The .plt section holds the procedure linkage table. The
- address is put in the ld_plt field. */
- s = bfd_make_section_anyway_with_flags (abfd, ".plt", flags | SEC_CODE);
- if (s == NULL
- || ! bfd_set_section_alignment (abfd, s, 2))
- return FALSE;
-
- /* The .dynrel section holds the dynamic relocs. The address is
- put in the ld_rel field. */
- s = bfd_make_section_anyway_with_flags (abfd, ".dynrel",
- flags | SEC_READONLY);
- if (s == NULL
- || ! bfd_set_section_alignment (abfd, s, 2))
- return FALSE;
-
- /* The .hash section holds the dynamic hash table. The address
- is put in the ld_hash field. */
- s = bfd_make_section_anyway_with_flags (abfd, ".hash",
- flags | SEC_READONLY);
- if (s == NULL
- || ! bfd_set_section_alignment (abfd, s, 2))
- return FALSE;
-
- /* The .dynsym section holds the dynamic symbols. The address
- is put in the ld_stab field. */
- s = bfd_make_section_anyway_with_flags (abfd, ".dynsym",
- flags | SEC_READONLY);
- if (s == NULL
- || ! bfd_set_section_alignment (abfd, s, 2))
- return FALSE;
-
- /* The .dynstr section holds the dynamic symbol string table.
- The address is put in the ld_symbols field. */
- s = bfd_make_section_anyway_with_flags (abfd, ".dynstr",
- flags | SEC_READONLY);
- if (s == NULL
- || ! bfd_set_section_alignment (abfd, s, 2))
- return FALSE;
-
- sunos_hash_table (info)->dynamic_sections_created = TRUE;
- }
-
- if ((needed && ! sunos_hash_table (info)->dynamic_sections_needed)
- || bfd_link_pic (info))
- {
- bfd *dynobj;
-
- dynobj = sunos_hash_table (info)->dynobj;
-
- s = bfd_get_linker_section (dynobj, ".got");
- if (s->size == 0)
- s->size = BYTES_IN_WORD;
-
- sunos_hash_table (info)->dynamic_sections_needed = TRUE;
- sunos_hash_table (info)->got_needed = TRUE;
- }
-
- return TRUE;
-}
-
-/* Add dynamic symbols during a link. This is called by the a.out
- backend linker for each object it encounters. */
-
-static bfd_boolean
-sunos_add_dynamic_symbols (bfd *abfd,
- struct bfd_link_info *info,
- struct external_nlist **symsp,
- bfd_size_type *sym_countp,
- char **stringsp)
-{
- bfd *dynobj;
- struct sunos_dynamic_info *dinfo;
- unsigned long need;
-
- /* Make sure we have all the required sections. */
- if (info->output_bfd->xvec == abfd->xvec)
- {
- if (! sunos_create_dynamic_sections (abfd, info,
- ((abfd->flags & DYNAMIC) != 0
- && !bfd_link_relocatable (info))))
- return FALSE;
- }
-
- /* There is nothing else to do for a normal object. */
- if ((abfd->flags & DYNAMIC) == 0)
- return TRUE;
-
- dynobj = sunos_hash_table (info)->dynobj;
-
- /* We do not want to include the sections in a dynamic object in the
- output file. We hack by simply clobbering the list of sections
- in the BFD. This could be handled more cleanly by, say, a new
- section flag; the existing SEC_NEVER_LOAD flag is not the one we
- want, because that one still implies that the section takes up
- space in the output file. If this is the first object we have
- seen, we must preserve the dynamic sections we just created. */
- if (abfd != dynobj)
- abfd->sections = NULL;
- else
- {
- asection *s;
-
- for (s = abfd->sections; s != NULL; s = s->next)
- {
- if ((s->flags & SEC_LINKER_CREATED) == 0)
- bfd_section_list_remove (abfd, s);
- }
- }
-
- /* The native linker seems to just ignore dynamic objects when -r is
- used. */
- if (bfd_link_relocatable (info))
- return TRUE;
-
- /* There's no hope of using a dynamic object which does not exactly
- match the format of the output file. */
- if (info->output_bfd->xvec != abfd->xvec)
- {
- bfd_set_error (bfd_error_invalid_operation);
- return FALSE;
- }
-
- /* Make sure we have a .need and a .rules sections. These are only
- needed if there really is a dynamic object in the link, so they
- are not added by sunos_create_dynamic_sections. */
- if (bfd_get_section_by_name (dynobj, ".need") == NULL)
- {
- /* The .need section holds the list of names of shared objets
- which must be included at runtime. The address of this
- section is put in the ld_need field. */
- flagword flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS
- | SEC_IN_MEMORY | SEC_READONLY);
- asection *s = bfd_make_section_with_flags (dynobj, ".need", flags);
- if (s == NULL
- || ! bfd_set_section_alignment (dynobj, s, 2))
- return FALSE;
- }
-
- if (bfd_get_section_by_name (dynobj, ".rules") == NULL)
- {
- /* The .rules section holds the path to search for shared
- objects. The address of this section is put in the ld_rules
- field. */
- flagword flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS
- | SEC_IN_MEMORY | SEC_READONLY);
- asection *s = bfd_make_section_with_flags (dynobj, ".rules", flags);
- if (s == NULL
- || ! bfd_set_section_alignment (dynobj, s, 2))
- return FALSE;
- }
-
- /* Pick up the dynamic symbols and return them to the caller. */
- if (! sunos_slurp_dynamic_symtab (abfd))
- return FALSE;
-
- dinfo = (struct sunos_dynamic_info *) obj_aout_dynamic_info (abfd);
- *symsp = dinfo->dynsym;
- *sym_countp = dinfo->dynsym_count;
- *stringsp = dinfo->dynstr;
-
- /* Record information about any other objects needed by this one. */
- need = dinfo->dyninfo.ld_need;
- while (need != 0)
- {
- bfd_byte buf[16];
- unsigned long name, flags;
- unsigned short major_vno, minor_vno;
- struct bfd_link_needed_list *needed, **pp;
- char *namebuf, *p;
- bfd_size_type alc;
- bfd_byte b;
- char *namecopy;
-
- if (bfd_seek (abfd, (file_ptr) need, SEEK_SET) != 0
- || bfd_bread (buf, (bfd_size_type) 16, abfd) != 16)
- return FALSE;
-
- /* For the format of an ld_need entry, see aout/sun4.h. We
- should probably define structs for this manipulation. */
- name = bfd_get_32 (abfd, buf);
- flags = bfd_get_32 (abfd, buf + 4);
- major_vno = (unsigned short) bfd_get_16 (abfd, buf + 8);
- minor_vno = (unsigned short) bfd_get_16 (abfd, buf + 10);
- need = bfd_get_32 (abfd, buf + 12);
-
- alc = sizeof (struct bfd_link_needed_list);
- needed = bfd_alloc (abfd, alc);
- if (needed == NULL)
- return FALSE;
- needed->by = abfd;
-
- /* We return the name as [-l]name[.maj][.min]. */
- alc = 30;
- namebuf = bfd_malloc (alc + 1);
- if (namebuf == NULL)
- return FALSE;
- p = namebuf;
-
- if ((flags & 0x80000000) != 0)
- {
- *p++ = '-';
- *p++ = 'l';
- }
- if (bfd_seek (abfd, (file_ptr) name, SEEK_SET) != 0)
- {
- free (namebuf);
- return FALSE;
- }
-
- do
- {
- if (bfd_bread (&b, (bfd_size_type) 1, abfd) != 1)
- {
- free (namebuf);
- return FALSE;
- }
-
- if ((bfd_size_type) (p - namebuf) >= alc)
- {
- char *n;
-
- alc *= 2;
- n = bfd_realloc (namebuf, alc + 1);
- if (n == NULL)
- {
- free (namebuf);
- return FALSE;
- }
- p = n + (p - namebuf);
- namebuf = n;
- }
-
- *p++ = b;
- }
- while (b != '\0');
-
- if (major_vno == 0)
- *p = '\0';
- else
- {
- char majbuf[30];
- char minbuf[30];
-
- sprintf (majbuf, ".%d", major_vno);
- if (minor_vno == 0)
- minbuf[0] = '\0';
- else
- sprintf (minbuf, ".%d", minor_vno);
-
- if ((p - namebuf) + strlen (majbuf) + strlen (minbuf) >= alc)
- {
- char *n;
-
- alc = (p - namebuf) + strlen (majbuf) + strlen (minbuf);
- n = bfd_realloc (namebuf, alc + 1);
- if (n == NULL)
- {
- free (namebuf);
- return FALSE;
- }
- p = n + (p - namebuf);
- namebuf = n;
- }
-
- strcpy (p, majbuf);
- strcat (p, minbuf);
- }
-
- namecopy = bfd_alloc (abfd, (bfd_size_type) strlen (namebuf) + 1);
- if (namecopy == NULL)
- {
- free (namebuf);
- return FALSE;
- }
- strcpy (namecopy, namebuf);
- free (namebuf);
- needed->name = namecopy;
-
- needed->next = NULL;
-
- for (pp = &sunos_hash_table (info)->needed;
- *pp != NULL;
- pp = &(*pp)->next)
- ;
- *pp = needed;
- }
-
- return TRUE;
-}
-
-/* Function to add a single symbol to the linker hash table. This is
- a wrapper around _bfd_generic_link_add_one_symbol which handles the
- tweaking needed for dynamic linking support. */
-
-static bfd_boolean
-sunos_add_one_symbol (struct bfd_link_info *info,
- bfd *abfd,
- const char *name,
- flagword flags,
- asection *section,
- bfd_vma value,
- const char *string,
- bfd_boolean copy,
- bfd_boolean collect,
- struct bfd_link_hash_entry **hashp)
-{
- struct sunos_link_hash_entry *h;
- int new_flag;
-
- if ((flags & (BSF_INDIRECT | BSF_WARNING | BSF_CONSTRUCTOR)) != 0
- || ! bfd_is_und_section (section))
- h = sunos_link_hash_lookup (sunos_hash_table (info), name, TRUE, copy,
- FALSE);
- else
- h = ((struct sunos_link_hash_entry *)
- bfd_wrapped_link_hash_lookup (abfd, info, name, TRUE, copy, FALSE));
- if (h == NULL)
- return FALSE;
-
- if (hashp != NULL)
- *hashp = (struct bfd_link_hash_entry *) h;
-
- /* Treat a common symbol in a dynamic object as defined in the .bss
- section of the dynamic object. We don't want to allocate space
- for it in our process image. */
- if ((abfd->flags & DYNAMIC) != 0
- && bfd_is_com_section (section))
- section = obj_bsssec (abfd);
-
- if (! bfd_is_und_section (section)
- && h->root.root.type != bfd_link_hash_new
- && h->root.root.type != bfd_link_hash_undefined
- && h->root.root.type != bfd_link_hash_defweak)
- {
- /* We are defining the symbol, and it is already defined. This
- is a potential multiple definition error. */
- if ((abfd->flags & DYNAMIC) != 0)
- {
- /* The definition we are adding is from a dynamic object.
- We do not want this new definition to override the
- existing definition, so we pretend it is just a
- reference. */
- section = bfd_und_section_ptr;
- }
- else if (h->root.root.type == bfd_link_hash_defined
- && h->root.root.u.def.section->owner != NULL
- && (h->root.root.u.def.section->owner->flags & DYNAMIC) != 0)
- {
- /* The existing definition is from a dynamic object. We
- want to override it with the definition we just found.
- Clobber the existing definition. */
- h->root.root.type = bfd_link_hash_undefined;
- h->root.root.u.undef.abfd = h->root.root.u.def.section->owner;
- }
- else if (h->root.root.type == bfd_link_hash_common
- && (h->root.root.u.c.p->section->owner->flags & DYNAMIC) != 0)
- {
- /* The existing definition is from a dynamic object. We
- want to override it with the definition we just found.
- Clobber the existing definition. We can't set it to new,
- because it is on the undefined list. */
- h->root.root.type = bfd_link_hash_undefined;
- h->root.root.u.undef.abfd = h->root.root.u.c.p->section->owner;
- }
- }
-
- if ((abfd->flags & DYNAMIC) != 0
- && abfd->xvec == info->output_bfd->xvec
- && (h->flags & SUNOS_CONSTRUCTOR) != 0)
- /* The existing symbol is a constructor symbol, and this symbol
- is from a dynamic object. A constructor symbol is actually a
- definition, although the type will be bfd_link_hash_undefined
- at this point. We want to ignore the definition from the
- dynamic object. */
- section = bfd_und_section_ptr;
- else if ((flags & BSF_CONSTRUCTOR) != 0
- && (abfd->flags & DYNAMIC) == 0
- && h->root.root.type == bfd_link_hash_defined
- && h->root.root.u.def.section->owner != NULL
- && (h->root.root.u.def.section->owner->flags & DYNAMIC) != 0)
- /* The existing symbol is defined by a dynamic object, and this
- is a constructor symbol. As above, we want to force the use
- of the constructor symbol from the regular object. */
- h->root.root.type = bfd_link_hash_new;
-
- /* Do the usual procedure for adding a symbol. */
- if (! _bfd_generic_link_add_one_symbol (info, abfd, name, flags, section,
- value, string, copy, collect,
- hashp))
- return FALSE;
-
- if (abfd->xvec == info->output_bfd->xvec)
- {
- /* Set a flag in the hash table entry indicating the type of
- reference or definition we just found. Keep a count of the
- number of dynamic symbols we find. A dynamic symbol is one
- which is referenced or defined by both a regular object and a
- shared object. */
- if ((abfd->flags & DYNAMIC) == 0)
- {
- if (bfd_is_und_section (section))
- new_flag = SUNOS_REF_REGULAR;
- else
- new_flag = SUNOS_DEF_REGULAR;
- }
- else
- {
- if (bfd_is_und_section (section))
- new_flag = SUNOS_REF_DYNAMIC;
- else
- new_flag = SUNOS_DEF_DYNAMIC;
- }
- h->flags |= new_flag;
-
- if (h->dynindx == -1
- && (h->flags & (SUNOS_DEF_REGULAR | SUNOS_REF_REGULAR)) != 0)
- {
- ++sunos_hash_table (info)->dynsymcount;
- h->dynindx = -2;
- }
-
- if ((flags & BSF_CONSTRUCTOR) != 0
- && (abfd->flags & DYNAMIC) == 0)
- h->flags |= SUNOS_CONSTRUCTOR;
- }
-
- return TRUE;
-}
-
-extern const bfd_target MY (vec);
-
-/* Return the list of objects needed by BFD. */
-
-struct bfd_link_needed_list *
-bfd_sunos_get_needed_list (bfd *abfd ATTRIBUTE_UNUSED,
- struct bfd_link_info *info)
-{
- if (info->output_bfd->xvec != &MY (vec))
- return NULL;
- return sunos_hash_table (info)->needed;
-}
-
-/* Record an assignment made to a symbol by a linker script. We need
- this in case some dynamic object refers to this symbol. */
-
-bfd_boolean
-bfd_sunos_record_link_assignment (bfd *output_bfd,
- struct bfd_link_info *info,
- const char *name)
-{
- struct sunos_link_hash_entry *h;
-
- if (output_bfd->xvec != &MY(vec))
- return TRUE;
-
- /* This is called after we have examined all the input objects. If
- the symbol does not exist, it merely means that no object refers
- to it, and we can just ignore it at this point. */
- h = sunos_link_hash_lookup (sunos_hash_table (info), name,
- FALSE, FALSE, FALSE);
- if (h == NULL)
- return TRUE;
-
- /* In a shared library, the __DYNAMIC symbol does not appear in the
- dynamic symbol table. */
- if (! bfd_link_pic (info) || strcmp (name, "__DYNAMIC") != 0)
- {
- h->flags |= SUNOS_DEF_REGULAR;
-
- if (h->dynindx == -1)
- {
- ++sunos_hash_table (info)->dynsymcount;
- h->dynindx = -2;
- }
- }
-
- return TRUE;
-}
-
-/* Scan the relocs for an input section using standard relocs. We
- need to figure out what to do for each reloc against a dynamic
- symbol. If the symbol is in the .text section, an entry is made in
- the procedure linkage table. Note that this will do the wrong
- thing if the symbol is actually data; I don't think the Sun 3
- native linker handles this case correctly either. If the symbol is
- not in the .text section, we must preserve the reloc as a dynamic
- reloc. FIXME: We should also handle the PIC relocs here by
- building global offset table entries. */
-
-static bfd_boolean
-sunos_scan_std_relocs (struct bfd_link_info *info,
- bfd *abfd,
- asection *sec ATTRIBUTE_UNUSED,
- const struct reloc_std_external *relocs,
- bfd_size_type rel_size)
-{
- bfd *dynobj;
- asection *splt = NULL;
- asection *srel = NULL;
- struct sunos_link_hash_entry **sym_hashes;
- const struct reloc_std_external *rel, *relend;
-
- /* We only know how to handle m68k plt entries. */
- if (bfd_get_arch (abfd) != bfd_arch_m68k)
- {
- bfd_set_error (bfd_error_invalid_target);
- return FALSE;
- }
-
- dynobj = NULL;
-
- sym_hashes = (struct sunos_link_hash_entry **) obj_aout_sym_hashes (abfd);
-
- relend = relocs + rel_size / RELOC_STD_SIZE;
- for (rel = relocs; rel < relend; rel++)
- {
- int r_index;
- struct sunos_link_hash_entry *h;
-
- /* We only want relocs against external symbols. */
- if (bfd_header_big_endian (abfd))
- {
- if ((rel->r_type[0] & RELOC_STD_BITS_EXTERN_BIG) == 0)
- continue;
- }
- else
- {
- if ((rel->r_type[0] & RELOC_STD_BITS_EXTERN_LITTLE) == 0)
- continue;
- }
-
- /* Get the symbol index. */
- if (bfd_header_big_endian (abfd))
- r_index = ((rel->r_index[0] << 16)
- | (rel->r_index[1] << 8)
- | rel->r_index[2]);
- else
- r_index = ((rel->r_index[2] << 16)
- | (rel->r_index[1] << 8)
- | rel->r_index[0]);
-
- /* Get the hash table entry. */
- h = sym_hashes[r_index];
- if (h == NULL)
- /* This should not normally happen, but it will in any case
- be caught in the relocation phase. */
- continue;
-
- /* At this point common symbols have already been allocated, so
- we don't have to worry about them. We need to consider that
- we may have already seen this symbol and marked it undefined;
- if the symbol is really undefined, then SUNOS_DEF_DYNAMIC
- will be zero. */
- if (h->root.root.type != bfd_link_hash_defined
- && h->root.root.type != bfd_link_hash_defweak
- && h->root.root.type != bfd_link_hash_undefined)
- continue;
-
- if ((h->flags & SUNOS_DEF_DYNAMIC) == 0
- || (h->flags & SUNOS_DEF_REGULAR) != 0)
- continue;
-
- if (dynobj == NULL)
- {
- asection *sgot;
-
- if (! sunos_create_dynamic_sections (abfd, info, FALSE))
- return FALSE;
- dynobj = sunos_hash_table (info)->dynobj;
- splt = bfd_get_linker_section (dynobj, ".plt");
- srel = bfd_get_linker_section (dynobj, ".dynrel");
- BFD_ASSERT (splt != NULL && srel != NULL);
-
- sgot = bfd_get_linker_section (dynobj, ".got");
- BFD_ASSERT (sgot != NULL);
- if (sgot->size == 0)
- sgot->size = BYTES_IN_WORD;
- sunos_hash_table (info)->got_needed = TRUE;
- }
-
- BFD_ASSERT ((h->flags & SUNOS_REF_REGULAR) != 0);
- BFD_ASSERT (h->plt_offset != 0
- || ((h->root.root.type == bfd_link_hash_defined
- || h->root.root.type == bfd_link_hash_defweak)
- ? (h->root.root.u.def.section->owner->flags
- & DYNAMIC) != 0
- : (h->root.root.u.undef.abfd->flags & DYNAMIC) != 0));
-
- /* This reloc is against a symbol defined only by a dynamic
- object. */
- if (h->root.root.type == bfd_link_hash_undefined)
- /* Presumably this symbol was marked as being undefined by
- an earlier reloc. */
- srel->size += RELOC_STD_SIZE;
- else if ((h->root.root.u.def.section->flags & SEC_CODE) == 0)
- {
- bfd *sub;
-
- /* This reloc is not in the .text section. It must be
- copied into the dynamic relocs. We mark the symbol as
- being undefined. */
- srel->size += RELOC_STD_SIZE;
- sub = h->root.root.u.def.section->owner;
- h->root.root.type = bfd_link_hash_undefined;
- h->root.root.u.undef.abfd = sub;
- }
- else
- {
- /* This symbol is in the .text section. We must give it an
- entry in the procedure linkage table, if we have not
- already done so. We change the definition of the symbol
- to the .plt section; this will cause relocs against it to
- be handled correctly. */
- if (h->plt_offset == 0)
- {
- if (splt->size == 0)
- splt->size = M68K_PLT_ENTRY_SIZE;
- h->plt_offset = splt->size;
-
- if ((h->flags & SUNOS_DEF_REGULAR) == 0)
- {
- h->root.root.u.def.section = splt;
- h->root.root.u.def.value = splt->size;
- }
-
- splt->size += M68K_PLT_ENTRY_SIZE;
-
- /* We may also need a dynamic reloc entry. */
- if ((h->flags & SUNOS_DEF_REGULAR) == 0)
- srel->size += RELOC_STD_SIZE;
- }
- }
- }
-
- return TRUE;
-}
-
-/* Scan the relocs for an input section using extended relocs. We
- need to figure out what to do for each reloc against a dynamic
- symbol. If the reloc is a WDISP30, and the symbol is in the .text
- section, an entry is made in the procedure linkage table.
- Otherwise, we must preserve the reloc as a dynamic reloc. */
-
-static bfd_boolean
-sunos_scan_ext_relocs (struct bfd_link_info *info,
- bfd *abfd,
- asection *sec ATTRIBUTE_UNUSED,
- const struct reloc_ext_external *relocs,
- bfd_size_type rel_size)
-{
- bfd *dynobj;
- struct sunos_link_hash_entry **sym_hashes;
- const struct reloc_ext_external *rel, *relend;
- asection *splt = NULL;
- asection *sgot = NULL;
- asection *srel = NULL;
- bfd_size_type amt;
-
- /* We only know how to handle SPARC plt entries. */
- if (bfd_get_arch (abfd) != bfd_arch_sparc)
- {
- bfd_set_error (bfd_error_invalid_target);
- return FALSE;
- }
-
- dynobj = NULL;
-
- sym_hashes = (struct sunos_link_hash_entry **) obj_aout_sym_hashes (abfd);
-
- relend = relocs + rel_size / RELOC_EXT_SIZE;
- for (rel = relocs; rel < relend; rel++)
- {
- unsigned int r_index;
- int r_extern;
- int r_type;
- struct sunos_link_hash_entry *h = NULL;
-
- /* Swap in the reloc information. */
- if (bfd_header_big_endian (abfd))
- {
- r_index = ((rel->r_index[0] << 16)
- | (rel->r_index[1] << 8)
- | rel->r_index[2]);
- r_extern = (0 != (rel->r_type[0] & RELOC_EXT_BITS_EXTERN_BIG));
- r_type = ((rel->r_type[0] & RELOC_EXT_BITS_TYPE_BIG)
- >> RELOC_EXT_BITS_TYPE_SH_BIG);
- }
- else
- {
- r_index = ((rel->r_index[2] << 16)
- | (rel->r_index[1] << 8)
- | rel->r_index[0]);
- r_extern = (0 != (rel->r_type[0] & RELOC_EXT_BITS_EXTERN_LITTLE));
- r_type = ((rel->r_type[0] & RELOC_EXT_BITS_TYPE_LITTLE)
- >> RELOC_EXT_BITS_TYPE_SH_LITTLE);
- }
-
- if (r_extern)
- {
- h = sym_hashes[r_index];
- if (h == NULL)
- {
- /* This should not normally happen, but it will in any
- case be caught in the relocation phase. */
- continue;
- }
- }
-
- /* If this is a base relative reloc, we need to make an entry in
- the .got section. */
- if (r_type == RELOC_BASE10
- || r_type == RELOC_BASE13
- || r_type == RELOC_BASE22)
- {
- if (dynobj == NULL)
- {
- if (! sunos_create_dynamic_sections (abfd, info, FALSE))
- return FALSE;
- dynobj = sunos_hash_table (info)->dynobj;
- splt = bfd_get_linker_section (dynobj, ".plt");
- sgot = bfd_get_linker_section (dynobj, ".got");
- srel = bfd_get_linker_section (dynobj, ".dynrel");
- BFD_ASSERT (splt != NULL && sgot != NULL && srel != NULL);
-
- /* Make sure we have an initial entry in the .got table. */
- if (sgot->size == 0)
- sgot->size = BYTES_IN_WORD;
- sunos_hash_table (info)->got_needed = TRUE;
- }
-
- if (r_extern)
- {
- if (h->got_offset != 0)
- continue;
-
- h->got_offset = sgot->size;
- }
- else
- {
- if (r_index >= bfd_get_symcount (abfd))
- /* This is abnormal, but should be caught in the
- relocation phase. */
- continue;
-
- if (adata (abfd).local_got_offsets == NULL)
- {
- amt = bfd_get_symcount (abfd);
- amt *= sizeof (bfd_vma);
- adata (abfd).local_got_offsets = bfd_zalloc (abfd, amt);
- if (adata (abfd).local_got_offsets == NULL)
- return FALSE;
- }
-
- if (adata (abfd).local_got_offsets[r_index] != 0)
- continue;
-
- adata (abfd).local_got_offsets[r_index] = sgot->size;
- }
-
- sgot->size += BYTES_IN_WORD;
-
- /* If we are making a shared library, or if the symbol is
- defined by a dynamic object, we will need a dynamic reloc
- entry. */
- if (bfd_link_pic (info)
- || (h != NULL
- && (h->flags & SUNOS_DEF_DYNAMIC) != 0
- && (h->flags & SUNOS_DEF_REGULAR) == 0))
- srel->size += RELOC_EXT_SIZE;
-
- continue;
- }
-
- /* Otherwise, we are only interested in relocs against symbols
- defined in dynamic objects but not in regular objects. We
- only need to consider relocs against external symbols. */
- if (! r_extern)
- {
- /* But, if we are creating a shared library, we need to
- generate an absolute reloc. */
- if (bfd_link_pic (info))
- {
- if (dynobj == NULL)
- {
- if (! sunos_create_dynamic_sections (abfd, info, TRUE))
- return FALSE;
- dynobj = sunos_hash_table (info)->dynobj;
- splt = bfd_get_linker_section (dynobj, ".plt");
- sgot = bfd_get_linker_section (dynobj, ".got");
- srel = bfd_get_linker_section (dynobj, ".dynrel");
- BFD_ASSERT (splt != NULL && sgot != NULL && srel != NULL);
- }
-
- srel->size += RELOC_EXT_SIZE;
- }
-
- continue;
- }
-
- /* At this point common symbols have already been allocated, so
- we don't have to worry about them. We need to consider that
- we may have already seen this symbol and marked it undefined;
- if the symbol is really undefined, then SUNOS_DEF_DYNAMIC
- will be zero. */
- if (h->root.root.type != bfd_link_hash_defined
- && h->root.root.type != bfd_link_hash_defweak
- && h->root.root.type != bfd_link_hash_undefined)
- continue;
-
- if (r_type != RELOC_JMP_TBL
- && ! bfd_link_pic (info)
- && ((h->flags & SUNOS_DEF_DYNAMIC) == 0
- || (h->flags & SUNOS_DEF_REGULAR) != 0))
- continue;
-
- if (r_type == RELOC_JMP_TBL
- && ! bfd_link_pic (info)
- && (h->flags & SUNOS_DEF_DYNAMIC) == 0
- && (h->flags & SUNOS_DEF_REGULAR) == 0)
- {
- /* This symbol is apparently undefined. Don't do anything
- here; just let the relocation routine report an undefined
- symbol. */
- continue;
- }
-
- if (strcmp (h->root.root.root.string, "__GLOBAL_OFFSET_TABLE_") == 0)
- continue;
-
- if (dynobj == NULL)
- {
- if (! sunos_create_dynamic_sections (abfd, info, FALSE))
- return FALSE;
- dynobj = sunos_hash_table (info)->dynobj;
- splt = bfd_get_linker_section (dynobj, ".plt");
- sgot = bfd_get_linker_section (dynobj, ".got");
- srel = bfd_get_linker_section (dynobj, ".dynrel");
- BFD_ASSERT (splt != NULL && sgot != NULL && srel != NULL);
-
- /* Make sure we have an initial entry in the .got table. */
- if (sgot->size == 0)
- sgot->size = BYTES_IN_WORD;
- sunos_hash_table (info)->got_needed = TRUE;
- }
-
- BFD_ASSERT (r_type == RELOC_JMP_TBL
- || bfd_link_pic (info)
- || (h->flags & SUNOS_REF_REGULAR) != 0);
- BFD_ASSERT (r_type == RELOC_JMP_TBL
- || bfd_link_pic (info)
- || h->plt_offset != 0
- || ((h->root.root.type == bfd_link_hash_defined
- || h->root.root.type == bfd_link_hash_defweak)
- ? (h->root.root.u.def.section->owner->flags
- & DYNAMIC) != 0
- : (h->root.root.u.undef.abfd->flags & DYNAMIC) != 0));
-
- /* This reloc is against a symbol defined only by a dynamic
- object, or it is a jump table reloc from PIC compiled code. */
-
- if (r_type != RELOC_JMP_TBL
- && h->root.root.type == bfd_link_hash_undefined)
- /* Presumably this symbol was marked as being undefined by
- an earlier reloc. */
- srel->size += RELOC_EXT_SIZE;
-
- else if (r_type != RELOC_JMP_TBL
- && (h->root.root.u.def.section->flags & SEC_CODE) == 0)
- {
- bfd *sub;
-
- /* This reloc is not in the .text section. It must be
- copied into the dynamic relocs. We mark the symbol as
- being undefined. */
- srel->size += RELOC_EXT_SIZE;
- if ((h->flags & SUNOS_DEF_REGULAR) == 0)
- {
- sub = h->root.root.u.def.section->owner;
- h->root.root.type = bfd_link_hash_undefined;
- h->root.root.u.undef.abfd = sub;
- }
- }
- else
- {
- /* This symbol is in the .text section. We must give it an
- entry in the procedure linkage table, if we have not
- already done so. We change the definition of the symbol
- to the .plt section; this will cause relocs against it to
- be handled correctly. */
- if (h->plt_offset == 0)
- {
- if (splt->size == 0)
- splt->size = SPARC_PLT_ENTRY_SIZE;
- h->plt_offset = splt->size;
-
- if ((h->flags & SUNOS_DEF_REGULAR) == 0)
- {
- if (h->root.root.type == bfd_link_hash_undefined)
- h->root.root.type = bfd_link_hash_defined;
- h->root.root.u.def.section = splt;
- h->root.root.u.def.value = splt->size;
- }
-
- splt->size += SPARC_PLT_ENTRY_SIZE;
-
- /* We will also need a dynamic reloc entry, unless this
- is a JMP_TBL reloc produced by linking PIC compiled
- code, and we are not making a shared library. */
- if (bfd_link_pic (info) || (h->flags & SUNOS_DEF_REGULAR) == 0)
- srel->size += RELOC_EXT_SIZE;
- }
-
- /* If we are creating a shared library, we need to copy over
- any reloc other than a jump table reloc. */
- if (bfd_link_pic (info) && r_type != RELOC_JMP_TBL)
- srel->size += RELOC_EXT_SIZE;
- }
- }
-
- return TRUE;
-}
-
-/* Scan the relocs for an input section. */
-
-static bfd_boolean
-sunos_scan_relocs (struct bfd_link_info *info,
- bfd *abfd,
- asection *sec,
- bfd_size_type rel_size)
-{
- void * relocs;
- void * free_relocs = NULL;
-
- if (rel_size == 0)
- return TRUE;
-
- if (! info->keep_memory)
- relocs = free_relocs = bfd_malloc (rel_size);
- else
- {
- struct aout_section_data_struct *n;
- bfd_size_type amt = sizeof (struct aout_section_data_struct);
-
- n = bfd_alloc (abfd, amt);
- if (n == NULL)
- relocs = NULL;
- else
- {
- set_aout_section_data (sec, n);
- relocs = bfd_malloc (rel_size);
- aout_section_data (sec)->relocs = relocs;
- }
- }
- if (relocs == NULL)
- return FALSE;
-
- if (bfd_seek (abfd, sec->rel_filepos, SEEK_SET) != 0
- || bfd_bread (relocs, rel_size, abfd) != rel_size)
- goto error_return;
-
- if (obj_reloc_entry_size (abfd) == RELOC_STD_SIZE)
- {
- if (! sunos_scan_std_relocs (info, abfd, sec,
- (struct reloc_std_external *) relocs,
- rel_size))
- goto error_return;
- }
- else
- {
- if (! sunos_scan_ext_relocs (info, abfd, sec,
- (struct reloc_ext_external *) relocs,
- rel_size))
- goto error_return;
- }
-
- if (free_relocs != NULL)
- free (free_relocs);
-
- return TRUE;
-
- error_return:
- if (free_relocs != NULL)
- free (free_relocs);
- return FALSE;
-}
-
-/* Build the hash table of dynamic symbols, and to mark as written all
- symbols from dynamic objects which we do not plan to write out. */
-
-static bfd_boolean
-sunos_scan_dynamic_symbol (struct sunos_link_hash_entry *h, void * data)
-{
- struct bfd_link_info *info = (struct bfd_link_info *) data;
-
- /* Set the written flag for symbols we do not want to write out as
- part of the regular symbol table. This is all symbols which are
- not defined in a regular object file. For some reason symbols
- which are referenced by a regular object and defined by a dynamic
- object do not seem to show up in the regular symbol table. It is
- possible for a symbol to have only SUNOS_REF_REGULAR set here, it
- is an undefined symbol which was turned into a common symbol
- because it was found in an archive object which was not included
- in the link. */
- if ((h->flags & SUNOS_DEF_REGULAR) == 0
- && (h->flags & SUNOS_DEF_DYNAMIC) != 0
- && strcmp (h->root.root.root.string, "__DYNAMIC") != 0)
- h->root.written = TRUE;
-
- /* If this symbol is defined by a dynamic object and referenced by a
- regular object, see whether we gave it a reasonable value while
- scanning the relocs. */
- if ((h->flags & SUNOS_DEF_REGULAR) == 0
- && (h->flags & SUNOS_DEF_DYNAMIC) != 0
- && (h->flags & SUNOS_REF_REGULAR) != 0)
- {
- if ((h->root.root.type == bfd_link_hash_defined
- || h->root.root.type == bfd_link_hash_defweak)
- && ((h->root.root.u.def.section->owner->flags & DYNAMIC) != 0)
- && h->root.root.u.def.section->output_section == NULL)
- {
- bfd *sub;
-
- /* This symbol is currently defined in a dynamic section
- which is not being put into the output file. This
- implies that there is no reloc against the symbol. I'm
- not sure why this case would ever occur. In any case, we
- change the symbol to be undefined. */
- sub = h->root.root.u.def.section->owner;
- h->root.root.type = bfd_link_hash_undefined;
- h->root.root.u.undef.abfd = sub;
- }
- }
-
- /* If this symbol is defined or referenced by a regular file, add it
- to the dynamic symbols. */
- if ((h->flags & (SUNOS_DEF_REGULAR | SUNOS_REF_REGULAR)) != 0)
- {
- asection *s;
- size_t len;
- bfd_byte *contents;
- unsigned char *name;
- unsigned long hash;
- bfd *dynobj;
-
- BFD_ASSERT (h->dynindx == -2);
-
- dynobj = sunos_hash_table (info)->dynobj;
-
- h->dynindx = sunos_hash_table (info)->dynsymcount;
- ++sunos_hash_table (info)->dynsymcount;
-
- len = strlen (h->root.root.root.string);
-
- /* We don't bother to construct a BFD hash table for the strings
- which are the names of the dynamic symbols. Using a hash
- table for the regular symbols is beneficial, because the
- regular symbols includes the debugging symbols, which have
- long names and are often duplicated in several object files.
- There are no debugging symbols in the dynamic symbols. */
- s = bfd_get_linker_section (dynobj, ".dynstr");
- BFD_ASSERT (s != NULL);
- contents = bfd_realloc (s->contents, s->size + len + 1);
- if (contents == NULL)
- return FALSE;
- s->contents = contents;
-
- h->dynstr_index = s->size;
- strcpy ((char *) contents + s->size, h->root.root.root.string);
- s->size += len + 1;
-
- /* Add it to the dynamic hash table. */
- name = (unsigned char *) h->root.root.root.string;
- hash = 0;
- while (*name != '\0')
- hash = (hash << 1) + *name++;
- hash &= 0x7fffffff;
- hash %= sunos_hash_table (info)->bucketcount;
-
- s = bfd_get_linker_section (dynobj, ".hash");
- BFD_ASSERT (s != NULL);
-
- if (GET_SWORD (dynobj, s->contents + hash * HASH_ENTRY_SIZE) == -1)
- PUT_WORD (dynobj, h->dynindx, s->contents + hash * HASH_ENTRY_SIZE);
- else
- {
- bfd_vma next;
-
- next = GET_WORD (dynobj,
- (s->contents
- + hash * HASH_ENTRY_SIZE
- + BYTES_IN_WORD));
- PUT_WORD (dynobj, s->size / HASH_ENTRY_SIZE,
- s->contents + hash * HASH_ENTRY_SIZE + BYTES_IN_WORD);
- PUT_WORD (dynobj, h->dynindx, s->contents + s->size);
- PUT_WORD (dynobj, next, s->contents + s->size + BYTES_IN_WORD);
- s->size += HASH_ENTRY_SIZE;
- }
- }
-
- return TRUE;
-}
-
-/* Set up the sizes and contents of the dynamic sections created in
- sunos_add_dynamic_symbols. This is called by the SunOS linker
- emulation before_allocation routine. We must set the sizes of the
- sections before the linker sets the addresses of the various
- sections. This unfortunately requires reading all the relocs so
- that we can work out which ones need to become dynamic relocs. If
- info->keep_memory is TRUE, we keep the relocs in memory; otherwise,
- we discard them, and will read them again later. */
-
-bfd_boolean
-bfd_sunos_size_dynamic_sections (bfd *output_bfd,
- struct bfd_link_info *info,
- asection **sdynptr,
- asection **sneedptr,
- asection **srulesptr)
-{
- bfd *dynobj;
- bfd_size_type dynsymcount;
- struct sunos_link_hash_entry *h;
- asection *s;
- size_t bucketcount;
- bfd_size_type hashalloc;
- size_t i;
- bfd *sub;
-
- *sdynptr = NULL;
- *sneedptr = NULL;
- *srulesptr = NULL;
-
- if (bfd_link_relocatable (info))
- return TRUE;
-
- if (output_bfd->xvec != &MY(vec))
- return TRUE;
-
- /* Look through all the input BFD's and read their relocs. It would
- be better if we didn't have to do this, but there is no other way
- to determine the number of dynamic relocs we need, and, more
- importantly, there is no other way to know which symbols should
- get an entry in the procedure linkage table. */
- for (sub = info->input_bfds; sub != NULL; sub = sub->link.next)
- {
- if ((sub->flags & DYNAMIC) == 0
- && sub->xvec == output_bfd->xvec)
- {
- if (! sunos_scan_relocs (info, sub, obj_textsec (sub),
- exec_hdr (sub)->a_trsize)
- || ! sunos_scan_relocs (info, sub, obj_datasec (sub),
- exec_hdr (sub)->a_drsize))
- return FALSE;
- }
- }
-
- dynobj = sunos_hash_table (info)->dynobj;
- dynsymcount = sunos_hash_table (info)->dynsymcount;
-
- /* If there were no dynamic objects in the link, and we don't need
- to build a global offset table, there is nothing to do here. */
- if (! sunos_hash_table (info)->dynamic_sections_needed
- && ! sunos_hash_table (info)->got_needed)
- return TRUE;
-
- /* If __GLOBAL_OFFSET_TABLE_ was mentioned, define it. */
- h = sunos_link_hash_lookup (sunos_hash_table (info),
- "__GLOBAL_OFFSET_TABLE_", FALSE, FALSE, FALSE);
- if (h != NULL && (h->flags & SUNOS_REF_REGULAR) != 0)
- {
- h->flags |= SUNOS_DEF_REGULAR;
- if (h->dynindx == -1)
- {
- ++sunos_hash_table (info)->dynsymcount;
- h->dynindx = -2;
- }
- s = bfd_get_linker_section (dynobj, ".got");
- BFD_ASSERT (s != NULL);
- h->root.root.type = bfd_link_hash_defined;
- h->root.root.u.def.section = s;
-
- /* If the .got section is more than 0x1000 bytes, we set
- __GLOBAL_OFFSET_TABLE_ to be 0x1000 bytes into the section,
- so that 13 bit relocations have a greater chance of working. */
- if (s->size >= 0x1000)
- h->root.root.u.def.value = 0x1000;
- else
- h->root.root.u.def.value = 0;
-
- sunos_hash_table (info)->got_base = h->root.root.u.def.value;
- }
-
- /* If there are any shared objects in the link, then we need to set
- up the dynamic linking information. */
- if (sunos_hash_table (info)->dynamic_sections_needed)
- {
- *sdynptr = bfd_get_linker_section (dynobj, ".dynamic");
-
- /* The .dynamic section is always the same size. */
- s = *sdynptr;
- BFD_ASSERT (s != NULL);
- s->size = (sizeof (struct external_sun4_dynamic)
- + EXTERNAL_SUN4_DYNAMIC_DEBUGGER_SIZE
- + sizeof (struct external_sun4_dynamic_link));
-
- /* Set the size of the .dynsym and .hash sections. We counted
- the number of dynamic symbols as we read the input files. We
- will build the dynamic symbol table (.dynsym) and the hash
- table (.hash) when we build the final symbol table, because
- until then we do not know the correct value to give the
- symbols. We build the dynamic symbol string table (.dynstr)
- in a traversal of the symbol table using
- sunos_scan_dynamic_symbol. */
- s = bfd_get_linker_section (dynobj, ".dynsym");
- BFD_ASSERT (s != NULL);
- s->size = dynsymcount * sizeof (struct external_nlist);
- s->contents = bfd_alloc (output_bfd, s->size);
- if (s->contents == NULL && s->size != 0)
- return FALSE;
-
- /* The number of buckets is just the number of symbols divided
- by four. To compute the final size of the hash table, we
- must actually compute the hash table. Normally we need
- exactly as many entries in the hash table as there are
- dynamic symbols, but if some of the buckets are not used we
- will need additional entries. In the worst case, every
- symbol will hash to the same bucket, and we will need
- BUCKETCOUNT - 1 extra entries. */
- if (dynsymcount >= 4)
- bucketcount = dynsymcount / 4;
- else if (dynsymcount > 0)
- bucketcount = dynsymcount;
- else
- bucketcount = 1;
- s = bfd_get_linker_section (dynobj, ".hash");
- BFD_ASSERT (s != NULL);
- hashalloc = (dynsymcount + bucketcount - 1) * HASH_ENTRY_SIZE;
- s->contents = bfd_zalloc (dynobj, hashalloc);
- if (s->contents == NULL && dynsymcount > 0)
- return FALSE;
- for (i = 0; i < bucketcount; i++)
- PUT_WORD (output_bfd, (bfd_vma) -1, s->contents + i * HASH_ENTRY_SIZE);
- s->size = bucketcount * HASH_ENTRY_SIZE;
-
- sunos_hash_table (info)->bucketcount = bucketcount;
-
- /* Scan all the symbols, place them in the dynamic symbol table,
- and build the dynamic hash table. We reuse dynsymcount as a
- counter for the number of symbols we have added so far. */
- sunos_hash_table (info)->dynsymcount = 0;
- sunos_link_hash_traverse (sunos_hash_table (info),
- sunos_scan_dynamic_symbol,
- (void *) info);
- BFD_ASSERT (sunos_hash_table (info)->dynsymcount == dynsymcount);
-
- /* The SunOS native linker seems to align the total size of the
- symbol strings to a multiple of 8. I don't know if this is
- important, but it can't hurt much. */
- s = bfd_get_linker_section (dynobj, ".dynstr");
- BFD_ASSERT (s != NULL);
- if ((s->size & 7) != 0)
- {
- bfd_size_type add;
- bfd_byte *contents;
-
- add = 8 - (s->size & 7);
- contents = bfd_realloc (s->contents, s->size + add);
- if (contents == NULL)
- return FALSE;
- memset (contents + s->size, 0, (size_t) add);
- s->contents = contents;
- s->size += add;
- }
- }
-
- /* Now that we have worked out the sizes of the procedure linkage
- table and the dynamic relocs, allocate storage for them. */
- s = bfd_get_linker_section (dynobj, ".plt");
- BFD_ASSERT (s != NULL);
- if (s->size != 0)
- {
- s->contents = bfd_alloc (dynobj, s->size);
- if (s->contents == NULL)
- return FALSE;
-
- /* Fill in the first entry in the table. */
- switch (bfd_get_arch (dynobj))
- {
- case bfd_arch_sparc:
- memcpy (s->contents, sparc_plt_first_entry, SPARC_PLT_ENTRY_SIZE);
- break;
-
- case bfd_arch_m68k:
- memcpy (s->contents, m68k_plt_first_entry, M68K_PLT_ENTRY_SIZE);
- break;
-
- default:
- abort ();
- }
- }
-
- s = bfd_get_linker_section (dynobj, ".dynrel");
- if (s->size != 0)
- {
- s->contents = bfd_alloc (dynobj, s->size);
- if (s->contents == NULL)
- return FALSE;
- }
- /* We use the reloc_count field to keep track of how many of the
- relocs we have output so far. */
- s->reloc_count = 0;
-
- /* Make space for the global offset table. */
- s = bfd_get_linker_section (dynobj, ".got");
- s->contents = bfd_alloc (dynobj, s->size);
- if (s->contents == NULL)
- return FALSE;
-
- *sneedptr = bfd_get_section_by_name (dynobj, ".need");
- *srulesptr = bfd_get_section_by_name (dynobj, ".rules");
-
- return TRUE;
-}
-
-/* Link a dynamic object. We actually don't have anything to do at
- this point. This entry point exists to prevent the regular linker
- code from doing anything with the object. */
-
-static bfd_boolean
-sunos_link_dynamic_object (struct bfd_link_info *info ATTRIBUTE_UNUSED,
- bfd *abfd ATTRIBUTE_UNUSED)
-{
- return TRUE;
-}
-
-/* Write out a dynamic symbol. This is called by the final traversal
- over the symbol table. */
-
-static bfd_boolean
-sunos_write_dynamic_symbol (bfd *output_bfd,
- struct bfd_link_info *info,
- struct aout_link_hash_entry *harg)
-{
- struct sunos_link_hash_entry *h = (struct sunos_link_hash_entry *) harg;
- int type;
- bfd_vma val;
- asection *s;
- struct external_nlist *outsym;
-
- /* If this symbol is in the procedure linkage table, fill in the
- table entry. */
- if (h->plt_offset != 0)
- {
- bfd *dynobj;
- asection *splt;
- bfd_byte *p;
- bfd_vma r_address;
-
- dynobj = sunos_hash_table (info)->dynobj;
- splt = bfd_get_linker_section (dynobj, ".plt");
- p = splt->contents + h->plt_offset;
-
- s = bfd_get_linker_section (dynobj, ".dynrel");
-
- r_address = (splt->output_section->vma
- + splt->output_offset
- + h->plt_offset);
-
- switch (bfd_get_arch (output_bfd))
- {
- case bfd_arch_sparc:
- if (bfd_link_pic (info) || (h->flags & SUNOS_DEF_REGULAR) == 0)
- {
- bfd_put_32 (output_bfd, SPARC_PLT_ENTRY_WORD0, p);
- bfd_put_32 (output_bfd,
- (SPARC_PLT_ENTRY_WORD1
- + (((- (h->plt_offset + 4) >> 2)
- & 0x3fffffff))),
- p + 4);
- bfd_put_32 (output_bfd, SPARC_PLT_ENTRY_WORD2 + s->reloc_count,
- p + 8);
- }
- else
- {
- val = (h->root.root.u.def.section->output_section->vma
- + h->root.root.u.def.section->output_offset
- + h->root.root.u.def.value);
- bfd_put_32 (output_bfd,
- SPARC_PLT_PIC_WORD0 + ((val >> 10) & 0x3fffff),
- p);
- bfd_put_32 (output_bfd,
- SPARC_PLT_PIC_WORD1 + (val & 0x3ff),
- p + 4);
- bfd_put_32 (output_bfd, SPARC_PLT_PIC_WORD2, p + 8);
- }
- break;
-
- case bfd_arch_m68k:
- if (! bfd_link_pic (info) && (h->flags & SUNOS_DEF_REGULAR) != 0)
- abort ();
- bfd_put_16 (output_bfd, M68K_PLT_ENTRY_WORD0, p);
- bfd_put_32 (output_bfd, (- (h->plt_offset + 2)), p + 2);
- bfd_put_16 (output_bfd, (bfd_vma) s->reloc_count, p + 6);
- r_address += 2;
- break;
-
- default:
- abort ();
- }
-
- /* We also need to add a jump table reloc, unless this is the
- result of a JMP_TBL reloc from PIC compiled code. */
- if (bfd_link_pic (info) || (h->flags & SUNOS_DEF_REGULAR) == 0)
- {
- BFD_ASSERT (h->dynindx >= 0);
- BFD_ASSERT (s->reloc_count * obj_reloc_entry_size (dynobj)
- < s->size);
- p = s->contents + s->reloc_count * obj_reloc_entry_size (output_bfd);
- if (obj_reloc_entry_size (output_bfd) == RELOC_STD_SIZE)
- {
- struct reloc_std_external *srel;
-
- srel = (struct reloc_std_external *) p;
- PUT_WORD (output_bfd, r_address, srel->r_address);
- if (bfd_header_big_endian (output_bfd))
- {
- srel->r_index[0] = (bfd_byte) (h->dynindx >> 16);
- srel->r_index[1] = (bfd_byte) (h->dynindx >> 8);
- srel->r_index[2] = (bfd_byte) (h->dynindx);
- srel->r_type[0] = (RELOC_STD_BITS_EXTERN_BIG
- | RELOC_STD_BITS_JMPTABLE_BIG);
- }
- else
- {
- srel->r_index[2] = (bfd_byte) (h->dynindx >> 16);
- srel->r_index[1] = (bfd_byte) (h->dynindx >> 8);
- srel->r_index[0] = (bfd_byte)h->dynindx;
- srel->r_type[0] = (RELOC_STD_BITS_EXTERN_LITTLE
- | RELOC_STD_BITS_JMPTABLE_LITTLE);
- }
- }
- else
- {
- struct reloc_ext_external *erel;
-
- erel = (struct reloc_ext_external *) p;
- PUT_WORD (output_bfd, r_address, erel->r_address);
- if (bfd_header_big_endian (output_bfd))
- {
- erel->r_index[0] = (bfd_byte) (h->dynindx >> 16);
- erel->r_index[1] = (bfd_byte) (h->dynindx >> 8);
- erel->r_index[2] = (bfd_byte)h->dynindx;
- erel->r_type[0] =
- (RELOC_EXT_BITS_EXTERN_BIG
- | (RELOC_JMP_SLOT << RELOC_EXT_BITS_TYPE_SH_BIG));
- }
- else
- {
- erel->r_index[2] = (bfd_byte) (h->dynindx >> 16);
- erel->r_index[1] = (bfd_byte) (h->dynindx >> 8);
- erel->r_index[0] = (bfd_byte)h->dynindx;
- erel->r_type[0] =
- (RELOC_EXT_BITS_EXTERN_LITTLE
- | (RELOC_JMP_SLOT << RELOC_EXT_BITS_TYPE_SH_LITTLE));
- }
- PUT_WORD (output_bfd, (bfd_vma) 0, erel->r_addend);
- }
-
- ++s->reloc_count;
- }
- }
-
- /* If this is not a dynamic symbol, we don't have to do anything
- else. We only check this after handling the PLT entry, because
- we can have a PLT entry for a nondynamic symbol when linking PIC
- compiled code from a regular object. */
- if (h->dynindx < 0)
- return TRUE;
-
- switch (h->root.root.type)
- {
- default:
- case bfd_link_hash_new:
- abort ();
- /* Avoid variable not initialized warnings. */
- return TRUE;
- case bfd_link_hash_undefined:
- type = N_UNDF | N_EXT;
- val = 0;
- break;
- case bfd_link_hash_defined:
- case bfd_link_hash_defweak:
- {
- asection *sec;
- asection *output_section;
-
- sec = h->root.root.u.def.section;
- output_section = sec->output_section;
- BFD_ASSERT (bfd_is_abs_section (output_section)
- || output_section->owner == output_bfd);
- if (h->plt_offset != 0
- && (h->flags & SUNOS_DEF_REGULAR) == 0)
- {
- type = N_UNDF | N_EXT;
- val = 0;
- }
- else
- {
- if (output_section == obj_textsec (output_bfd))
- type = (h->root.root.type == bfd_link_hash_defined
- ? N_TEXT
- : N_WEAKT);
- else if (output_section == obj_datasec (output_bfd))
- type = (h->root.root.type == bfd_link_hash_defined
- ? N_DATA
- : N_WEAKD);
- else if (output_section == obj_bsssec (output_bfd))
- type = (h->root.root.type == bfd_link_hash_defined
- ? N_BSS
- : N_WEAKB);
- else
- type = (h->root.root.type == bfd_link_hash_defined
- ? N_ABS
- : N_WEAKA);
- type |= N_EXT;
- val = (h->root.root.u.def.value
- + output_section->vma
- + sec->output_offset);
- }
- }
- break;
- case bfd_link_hash_common:
- type = N_UNDF | N_EXT;
- val = h->root.root.u.c.size;
- break;
- case bfd_link_hash_undefweak:
- type = N_WEAKU;
- val = 0;
- break;
- case bfd_link_hash_indirect:
- case bfd_link_hash_warning:
- /* FIXME: Ignore these for now. The circumstances under which
- they should be written out are not clear to me. */
- return TRUE;
- }
-
- s = bfd_get_linker_section (sunos_hash_table (info)->dynobj, ".dynsym");
- BFD_ASSERT (s != NULL);
- outsym = ((struct external_nlist *)
- (s->contents + h->dynindx * EXTERNAL_NLIST_SIZE));
-
- H_PUT_8 (output_bfd, type, outsym->e_type);
- H_PUT_8 (output_bfd, 0, outsym->e_other);
-
- /* FIXME: The native linker doesn't use 0 for desc. It seems to use
- one less than the desc value in the shared library, although that
- seems unlikely. */
- H_PUT_16 (output_bfd, 0, outsym->e_desc);
-
- PUT_WORD (output_bfd, h->dynstr_index, outsym->e_strx);
- PUT_WORD (output_bfd, val, outsym->e_value);
-
- return TRUE;
-}
-
-/* This is called for each reloc against an external symbol. If this
- is a reloc which are going to copy as a dynamic reloc, then
- copy it over, and tell the caller to not bother processing this
- reloc. */
-
-static bfd_boolean
-sunos_check_dynamic_reloc (struct bfd_link_info *info,
- bfd *input_bfd,
- asection *input_section,
- struct aout_link_hash_entry *harg,
- void * reloc,
- bfd_byte *contents ATTRIBUTE_UNUSED,
- bfd_boolean *skip,
- bfd_vma *relocationp)
-{
- struct sunos_link_hash_entry *h = (struct sunos_link_hash_entry *) harg;
- bfd *dynobj;
- bfd_boolean baserel;
- bfd_boolean jmptbl;
- bfd_boolean pcrel;
- asection *s;
- bfd_byte *p;
- long indx;
-
- *skip = FALSE;
-
- dynobj = sunos_hash_table (info)->dynobj;
-
- if (h != NULL
- && h->plt_offset != 0
- && (bfd_link_pic (info)
- || (h->flags & SUNOS_DEF_REGULAR) == 0))
- {
- asection *splt;
-
- /* Redirect the relocation to the PLT entry. */
- splt = bfd_get_linker_section (dynobj, ".plt");
- *relocationp = (splt->output_section->vma
- + splt->output_offset
- + h->plt_offset);
- }
-
- if (obj_reloc_entry_size (input_bfd) == RELOC_STD_SIZE)
- {
- struct reloc_std_external *srel;
-
- srel = (struct reloc_std_external *) reloc;
- if (bfd_header_big_endian (input_bfd))
- {
- baserel = (0 != (srel->r_type[0] & RELOC_STD_BITS_BASEREL_BIG));
- jmptbl = (0 != (srel->r_type[0] & RELOC_STD_BITS_JMPTABLE_BIG));
- pcrel = (0 != (srel->r_type[0] & RELOC_STD_BITS_PCREL_BIG));
- }
- else
- {
- baserel = (0 != (srel->r_type[0] & RELOC_STD_BITS_BASEREL_LITTLE));
- jmptbl = (0 != (srel->r_type[0] & RELOC_STD_BITS_JMPTABLE_LITTLE));
- pcrel = (0 != (srel->r_type[0] & RELOC_STD_BITS_PCREL_LITTLE));
- }
- }
- else
- {
- struct reloc_ext_external *erel;
- int r_type;
-
- erel = (struct reloc_ext_external *) reloc;
- if (bfd_header_big_endian (input_bfd))
- r_type = ((erel->r_type[0] & RELOC_EXT_BITS_TYPE_BIG)
- >> RELOC_EXT_BITS_TYPE_SH_BIG);
- else
- r_type = ((erel->r_type[0] & RELOC_EXT_BITS_TYPE_LITTLE)
- >> RELOC_EXT_BITS_TYPE_SH_LITTLE);
- baserel = (r_type == RELOC_BASE10
- || r_type == RELOC_BASE13
- || r_type == RELOC_BASE22);
- jmptbl = r_type == RELOC_JMP_TBL;
- pcrel = (r_type == RELOC_DISP8
- || r_type == RELOC_DISP16
- || r_type == RELOC_DISP32
- || r_type == RELOC_WDISP30
- || r_type == RELOC_WDISP22);
- /* We don't consider the PC10 and PC22 types to be PC relative,
- because they are pcrel_offset. */
- }
-
- if (baserel)
- {
- bfd_vma *got_offsetp;
- asection *sgot;
-
- if (h != NULL)
- got_offsetp = &h->got_offset;
- else if (adata (input_bfd).local_got_offsets == NULL)
- got_offsetp = NULL;
- else
- {
- struct reloc_std_external *srel;
- int r_index;
-
- srel = (struct reloc_std_external *) reloc;
- if (obj_reloc_entry_size (input_bfd) == RELOC_STD_SIZE)
- {
- if (bfd_header_big_endian (input_bfd))
- r_index = ((srel->r_index[0] << 16)
- | (srel->r_index[1] << 8)
- | srel->r_index[2]);
- else
- r_index = ((srel->r_index[2] << 16)
- | (srel->r_index[1] << 8)
- | srel->r_index[0]);
- }
- else
- {
- struct reloc_ext_external *erel;
-
- erel = (struct reloc_ext_external *) reloc;
- if (bfd_header_big_endian (input_bfd))
- r_index = ((erel->r_index[0] << 16)
- | (erel->r_index[1] << 8)
- | erel->r_index[2]);
- else
- r_index = ((erel->r_index[2] << 16)
- | (erel->r_index[1] << 8)
- | erel->r_index[0]);
- }
-
- got_offsetp = adata (input_bfd).local_got_offsets + r_index;
- }
-
- BFD_ASSERT (got_offsetp != NULL && *got_offsetp != 0);
-
- sgot = bfd_get_linker_section (dynobj, ".got");
-
- /* We set the least significant bit to indicate whether we have
- already initialized the GOT entry. */
- if ((*got_offsetp & 1) == 0)
- {
- if (h == NULL
- || (! bfd_link_pic (info)
- && ((h->flags & SUNOS_DEF_DYNAMIC) == 0
- || (h->flags & SUNOS_DEF_REGULAR) != 0)))
- PUT_WORD (dynobj, *relocationp, sgot->contents + *got_offsetp);
- else
- PUT_WORD (dynobj, 0, sgot->contents + *got_offsetp);
-
- if (bfd_link_pic (info)
- || (h != NULL
- && (h->flags & SUNOS_DEF_DYNAMIC) != 0
- && (h->flags & SUNOS_DEF_REGULAR) == 0))
- {
- /* We need to create a GLOB_DAT or 32 reloc to tell the
- dynamic linker to fill in this entry in the table. */
-
- s = bfd_get_linker_section (dynobj, ".dynrel");
- BFD_ASSERT (s != NULL);
- BFD_ASSERT (s->reloc_count * obj_reloc_entry_size (dynobj)
- < s->size);
-
- p = (s->contents
- + s->reloc_count * obj_reloc_entry_size (dynobj));
-
- if (h != NULL)
- indx = h->dynindx;
- else
- indx = 0;
-
- if (obj_reloc_entry_size (dynobj) == RELOC_STD_SIZE)
- {
- struct reloc_std_external *srel;
-
- srel = (struct reloc_std_external *) p;
- PUT_WORD (dynobj,
- (*got_offsetp
- + sgot->output_section->vma
- + sgot->output_offset),
- srel->r_address);
- if (bfd_header_big_endian (dynobj))
- {
- srel->r_index[0] = (bfd_byte) (indx >> 16);
- srel->r_index[1] = (bfd_byte) (indx >> 8);
- srel->r_index[2] = (bfd_byte)indx;
- if (h == NULL)
- srel->r_type[0] = 2 << RELOC_STD_BITS_LENGTH_SH_BIG;
- else
- srel->r_type[0] =
- (RELOC_STD_BITS_EXTERN_BIG
- | RELOC_STD_BITS_BASEREL_BIG
- | RELOC_STD_BITS_RELATIVE_BIG
- | (2 << RELOC_STD_BITS_LENGTH_SH_BIG));
- }
- else
- {
- srel->r_index[2] = (bfd_byte) (indx >> 16);
- srel->r_index[1] = (bfd_byte) (indx >> 8);
- srel->r_index[0] = (bfd_byte)indx;
- if (h == NULL)
- srel->r_type[0] = 2 << RELOC_STD_BITS_LENGTH_SH_LITTLE;
- else
- srel->r_type[0] =
- (RELOC_STD_BITS_EXTERN_LITTLE
- | RELOC_STD_BITS_BASEREL_LITTLE
- | RELOC_STD_BITS_RELATIVE_LITTLE
- | (2 << RELOC_STD_BITS_LENGTH_SH_LITTLE));
- }
- }
- else
- {
- struct reloc_ext_external *erel;
-
- erel = (struct reloc_ext_external *) p;
- PUT_WORD (dynobj,
- (*got_offsetp
- + sgot->output_section->vma
- + sgot->output_offset),
- erel->r_address);
- if (bfd_header_big_endian (dynobj))
- {
- erel->r_index[0] = (bfd_byte) (indx >> 16);
- erel->r_index[1] = (bfd_byte) (indx >> 8);
- erel->r_index[2] = (bfd_byte)indx;
- if (h == NULL)
- erel->r_type[0] =
- RELOC_32 << RELOC_EXT_BITS_TYPE_SH_BIG;
- else
- erel->r_type[0] =
- (RELOC_EXT_BITS_EXTERN_BIG
- | (RELOC_GLOB_DAT << RELOC_EXT_BITS_TYPE_SH_BIG));
- }
- else
- {
- erel->r_index[2] = (bfd_byte) (indx >> 16);
- erel->r_index[1] = (bfd_byte) (indx >> 8);
- erel->r_index[0] = (bfd_byte)indx;
- if (h == NULL)
- erel->r_type[0] =
- RELOC_32 << RELOC_EXT_BITS_TYPE_SH_LITTLE;
- else
- erel->r_type[0] =
- (RELOC_EXT_BITS_EXTERN_LITTLE
- | (RELOC_GLOB_DAT
- << RELOC_EXT_BITS_TYPE_SH_LITTLE));
- }
- PUT_WORD (dynobj, 0, erel->r_addend);
- }
-
- ++s->reloc_count;
- }
-
- *got_offsetp |= 1;
- }
-
- *relocationp = (sgot->vma
- + (*got_offsetp &~ (bfd_vma) 1)
- - sunos_hash_table (info)->got_base);
-
- /* There is nothing else to do for a base relative reloc. */
- return TRUE;
- }
-
- if (! sunos_hash_table (info)->dynamic_sections_needed)
- return TRUE;
- if (! bfd_link_pic (info))
- {
- if (h == NULL
- || h->dynindx == -1
- || h->root.root.type != bfd_link_hash_undefined
- || (h->flags & SUNOS_DEF_REGULAR) != 0
- || (h->flags & SUNOS_DEF_DYNAMIC) == 0
- || (h->root.root.u.undef.abfd->flags & DYNAMIC) == 0)
- return TRUE;
- }
- else
- {
- if (h != NULL
- && (h->dynindx == -1
- || jmptbl
- || strcmp (h->root.root.root.string,
- "__GLOBAL_OFFSET_TABLE_") == 0))
- return TRUE;
- }
-
- /* It looks like this is a reloc we are supposed to copy. */
-
- s = bfd_get_linker_section (dynobj, ".dynrel");
- BFD_ASSERT (s != NULL);
- BFD_ASSERT (s->reloc_count * obj_reloc_entry_size (dynobj) < s->size);
-
- p = s->contents + s->reloc_count * obj_reloc_entry_size (dynobj);
-
- /* Copy the reloc over. */
- memcpy (p, reloc, obj_reloc_entry_size (dynobj));
-
- if (h != NULL)
- indx = h->dynindx;
- else
- indx = 0;
-
- /* Adjust the address and symbol index. */
- if (obj_reloc_entry_size (dynobj) == RELOC_STD_SIZE)
- {
- struct reloc_std_external *srel;
-
- srel = (struct reloc_std_external *) p;
- PUT_WORD (dynobj,
- (GET_WORD (dynobj, srel->r_address)
- + input_section->output_section->vma
- + input_section->output_offset),
- srel->r_address);
- if (bfd_header_big_endian (dynobj))
- {
- srel->r_index[0] = (bfd_byte) (indx >> 16);
- srel->r_index[1] = (bfd_byte) (indx >> 8);
- srel->r_index[2] = (bfd_byte)indx;
- }
- else
- {
- srel->r_index[2] = (bfd_byte) (indx >> 16);
- srel->r_index[1] = (bfd_byte) (indx >> 8);
- srel->r_index[0] = (bfd_byte)indx;
- }
- /* FIXME: We may have to change the addend for a PC relative
- reloc. */
- }
- else
- {
- struct reloc_ext_external *erel;
-
- erel = (struct reloc_ext_external *) p;
- PUT_WORD (dynobj,
- (GET_WORD (dynobj, erel->r_address)
- + input_section->output_section->vma
- + input_section->output_offset),
- erel->r_address);
- if (bfd_header_big_endian (dynobj))
- {
- erel->r_index[0] = (bfd_byte) (indx >> 16);
- erel->r_index[1] = (bfd_byte) (indx >> 8);
- erel->r_index[2] = (bfd_byte)indx;
- }
- else
- {
- erel->r_index[2] = (bfd_byte) (indx >> 16);
- erel->r_index[1] = (bfd_byte) (indx >> 8);
- erel->r_index[0] = (bfd_byte)indx;
- }
- if (pcrel && h != NULL)
- {
- /* Adjust the addend for the change in address. */
- PUT_WORD (dynobj,
- (GET_WORD (dynobj, erel->r_addend)
- - (input_section->output_section->vma
- + input_section->output_offset
- - input_section->vma)),
- erel->r_addend);
- }
- }
-
- ++s->reloc_count;
-
- if (h != NULL)
- *skip = TRUE;
-
- return TRUE;
-}
-
-/* Finish up the dynamic linking information. */
-
-static bfd_boolean
-sunos_finish_dynamic_link (bfd *abfd, struct bfd_link_info *info)
-{
- bfd *dynobj;
- asection *o;
- asection *s;
- asection *sdyn;
-
- if (! sunos_hash_table (info)->dynamic_sections_needed
- && ! sunos_hash_table (info)->got_needed)
- return TRUE;
-
- dynobj = sunos_hash_table (info)->dynobj;
-
- sdyn = bfd_get_linker_section (dynobj, ".dynamic");
- BFD_ASSERT (sdyn != NULL);
-
- /* Finish up the .need section. The linker emulation code filled it
- in, but with offsets from the start of the section instead of
- real addresses. Now that we know the section location, we can
- fill in the final values. */
- s = bfd_get_section_by_name (dynobj, ".need");
- if (s != NULL && s->size != 0)
- {
- file_ptr filepos;
- bfd_byte *p;
-
- filepos = s->output_section->filepos + s->output_offset;
- p = s->contents;
- while (1)
- {
- bfd_vma val;
-
- PUT_WORD (dynobj, GET_WORD (dynobj, p) + filepos, p);
- val = GET_WORD (dynobj, p + 12);
- if (val == 0)
- break;
- PUT_WORD (dynobj, val + filepos, p + 12);
- p += 16;
- }
- }
-
- /* The first entry in the .got section is the address of the
- dynamic information, unless this is a shared library. */
- s = bfd_get_linker_section (dynobj, ".got");
- BFD_ASSERT (s != NULL);
- if (bfd_link_pic (info) || sdyn->size == 0)
- PUT_WORD (dynobj, 0, s->contents);
- else
- PUT_WORD (dynobj, sdyn->output_section->vma + sdyn->output_offset,
- s->contents);
-
- for (o = dynobj->sections; o != NULL; o = o->next)
- {
- if ((o->flags & SEC_HAS_CONTENTS) != 0
- && o->contents != NULL)
- {
- BFD_ASSERT (o->output_section != NULL
- && o->output_section->owner == abfd);
- if (! bfd_set_section_contents (abfd, o->output_section,
- o->contents,
- (file_ptr) o->output_offset,
- o->size))
- return FALSE;
- }
- }
-
- if (sdyn->size > 0)
- {
- struct external_sun4_dynamic esd;
- struct external_sun4_dynamic_link esdl;
- file_ptr pos;
-
- /* Finish up the dynamic link information. */
- PUT_WORD (dynobj, (bfd_vma) 3, esd.ld_version);
- PUT_WORD (dynobj,
- sdyn->output_section->vma + sdyn->output_offset + sizeof esd,
- esd.ldd);
- PUT_WORD (dynobj,
- (sdyn->output_section->vma
- + sdyn->output_offset
- + sizeof esd
- + EXTERNAL_SUN4_DYNAMIC_DEBUGGER_SIZE),
- esd.ld);
-
- if (! bfd_set_section_contents (abfd, sdyn->output_section, &esd,
- (file_ptr) sdyn->output_offset,
- (bfd_size_type) sizeof esd))
- return FALSE;
-
- PUT_WORD (dynobj, (bfd_vma) 0, esdl.ld_loaded);
-
- s = bfd_get_section_by_name (dynobj, ".need");
- if (s == NULL || s->size == 0)
- PUT_WORD (dynobj, (bfd_vma) 0, esdl.ld_need);
- else
- PUT_WORD (dynobj, s->output_section->filepos + s->output_offset,
- esdl.ld_need);
-
- s = bfd_get_section_by_name (dynobj, ".rules");
- if (s == NULL || s->size == 0)
- PUT_WORD (dynobj, (bfd_vma) 0, esdl.ld_rules);
- else
- PUT_WORD (dynobj, s->output_section->filepos + s->output_offset,
- esdl.ld_rules);
-
- s = bfd_get_linker_section (dynobj, ".got");
- BFD_ASSERT (s != NULL);
- PUT_WORD (dynobj, s->output_section->vma + s->output_offset,
- esdl.ld_got);
-
- s = bfd_get_linker_section (dynobj, ".plt");
- BFD_ASSERT (s != NULL);
- PUT_WORD (dynobj, s->output_section->vma + s->output_offset,
- esdl.ld_plt);
- PUT_WORD (dynobj, s->size, esdl.ld_plt_sz);
-
- s = bfd_get_linker_section (dynobj, ".dynrel");
- BFD_ASSERT (s != NULL);
- BFD_ASSERT (s->reloc_count * obj_reloc_entry_size (dynobj)
- == s->size);
- PUT_WORD (dynobj, s->output_section->filepos + s->output_offset,
- esdl.ld_rel);
-
- s = bfd_get_linker_section (dynobj, ".hash");
- BFD_ASSERT (s != NULL);
- PUT_WORD (dynobj, s->output_section->filepos + s->output_offset,
- esdl.ld_hash);
-
- s = bfd_get_linker_section (dynobj, ".dynsym");
- BFD_ASSERT (s != NULL);
- PUT_WORD (dynobj, s->output_section->filepos + s->output_offset,
- esdl.ld_stab);
-
- PUT_WORD (dynobj, (bfd_vma) 0, esdl.ld_stab_hash);
-
- PUT_WORD (dynobj, (bfd_vma) sunos_hash_table (info)->bucketcount,
- esdl.ld_buckets);
-
- s = bfd_get_linker_section (dynobj, ".dynstr");
- BFD_ASSERT (s != NULL);
- PUT_WORD (dynobj, s->output_section->filepos + s->output_offset,
- esdl.ld_symbols);
- PUT_WORD (dynobj, s->size, esdl.ld_symb_size);
-
- /* The size of the text area is the size of the .text section
- rounded up to a page boundary. FIXME: Should the page size be
- conditional on something? */
- PUT_WORD (dynobj,
- BFD_ALIGN (obj_textsec (abfd)->size, 0x2000),
- esdl.ld_text);
-
- pos = sdyn->output_offset;
- pos += sizeof esd + EXTERNAL_SUN4_DYNAMIC_DEBUGGER_SIZE;
- if (! bfd_set_section_contents (abfd, sdyn->output_section, &esdl,
- pos, (bfd_size_type) sizeof esdl))
- return FALSE;
-
- abfd->flags |= DYNAMIC;
- }
-
- return TRUE;
-}
extern const bfd_target alpha_vms_vec;
extern const bfd_target alpha_vms_lib_txt_vec;
extern const bfd_target am33_elf32_linux_vec;
-extern const bfd_target aout64_vec;
extern const bfd_target aout_vec;
extern const bfd_target arc_elf32_be_vec;
extern const bfd_target arc_elf32_le_vec;
extern const bfd_target sh_elf32_vxworks_le_vec;
extern const bfd_target sh_pe_le_vec;
extern const bfd_target sh_pei_le_vec;
-extern const bfd_target sparc_aout_le_vec;
-extern const bfd_target sparc_aout_linux_vec;
-extern const bfd_target sparc_aout_lynx_vec;
-extern const bfd_target sparc_aout_nbsd_vec;
-extern const bfd_target sparc_aout_sunos_be_vec;
-extern const bfd_target sparc_coff_vec;
-extern const bfd_target sparc_coff_lynx_vec;
extern const bfd_target sparc_elf32_vec;
extern const bfd_target sparc_elf32_sol2_vec;
extern const bfd_target sparc_elf32_vxworks_vec;
&am33_elf32_linux_vec,
-#ifdef BFD64
- &aout64_vec, /* Only compiled if host has long-long support. */
-#endif
#if 0
/* Since a.out files lack decent magic numbers, no way to recognize
which kind of a.out file it is. */
&sh_pe_le_vec,
&sh_pei_le_vec,
- &sparc_aout_le_vec,
- &sparc_aout_linux_vec,
- &sparc_aout_lynx_vec,
- &sparc_aout_nbsd_vec,
- &sparc_aout_sunos_be_vec,
- &sparc_coff_vec,
- &sparc_coff_lynx_vec,
&sparc_elf32_vec,
&sparc_elf32_sol2_vec,
&sparc_elf32_vxworks_vec,
+2018-04-16 Alan Modra <amodra@gmail.com>
+
+ * testsuite/lib/binutils-common.exp: Remove sparc-aout and
+ sparc-coff support.
+
2018-04-16 Alan Modra <amodra@gmail.com>
* testsuite/binutils-all/copy-2.d: Remove m68k-aout and m68k-coff
&& ( [istarget *-*-netbsd*aout*]
|| [istarget *-*-netbsdpe*]
|| [istarget arm*-*-netbsd*]
- || [istarget sparc-*-netbsd*]
|| [istarget i*86-*-netbsd*]
|| [istarget vax-*-netbsd*]
|| [istarget ns32k-*-netbsd*]) } {
|| [istarget i386-*-openbsd\[0-2\].*]
|| [istarget i386-*-openbsd3.\[0-2\]]
|| [istarget ns32k-*-openbsd*]
- || [istarget sparc-*-openbsd\[0-2\].*]
- || [istarget sparc-*-openbsd3.\[0-1\]]
|| [istarget vax-*-openbsd*] } {
return 0
}
# True if the object format is known to be a.out.
#
proc is_aout_format {} {
- if { [istarget *-*-netbsdelf]
- || [istarget sparc64-*-netbsd*]
- || [istarget sparc64-*-openbsd*] } {
- return 0
- }
if { [istarget *-*-*\[ab\]out*]
|| [istarget *-*-linux*oldld*]
|| [istarget *-*-bsd*]
|| [istarget i?86-*-mach*]
|| [istarget ns32k-*-*]
|| [istarget pdp11-*-*]
- || [istarget sparc*-*-sunos4*]
- || [istarget sparc*-*-netbsd*]
- || [istarget sparc*-*-openbsd\[0-2\]*]
- || [istarget sparc*-*-openbsd3.\[0-1\]*]
- || [istarget sparc*-fujitsu-none]
|| [istarget vax-dec-ultrix*]
|| [istarget vax-*-netbsd] } {
return 1
+2018-04-16 Alan Modra <amodra@gmail.com>
+
+ * Makefile.am: Remove sparc-aout and sparc-coff support.
+ * config/obj-coff.h: Likewise.
+ * config/tc-sparc.c: Likewise.
+ * config/tc-sparc.h: Likewise.
+ * configure.tgt: Likewise.
+ * config/te-sparcaout.h: Delete.
+ * testsuite/gas/sun4/addend.d: Delete.
+ * testsuite/gas/sun4/addend.exp: Delete.
+ * testsuite/gas/sun4/addend.s: Delete.
+ * Makefile.in: Regenerate.
+ * po/POTFILES.in: Regenerate.
+
2018-04-16 Alan Modra <amodra@gmail.com>
* Makefile.am: Remove m68k-aout and m68k-coff support.
config/te-pe.h \
config/te-riscix.h \
config/te-solaris.h \
- config/te-sparcaout.h \
config/te-svr4.h \
config/te-symbian.h \
config/te-tmips.h \
config/te-pe.h \
config/te-riscix.h \
config/te-solaris.h \
- config/te-sparcaout.h \
config/te-svr4.h \
config/te-symbian.h \
config/te-tmips.h \
#endif
#endif
-#ifdef TC_SPARC
-#include "coff/sparc.h"
-#endif
-
#ifdef TC_I386
#ifdef TE_PEP
#include "coff/x86_64.h"
#include "opcode/sparc.h"
#include "dw2gencfi.h"
-#ifdef OBJ_ELF
#include "elf/sparc.h"
#include "dwarf2dbg.h"
-#endif
/* Some ancient Sun C compilers would not take such hex constants as
unsigned, and would end up sign-extending them to form an offsetT,
changes the value before md_show_usage is called. */
static int default_arch_size;
-#ifdef OBJ_ELF
/* The currently selected v9 memory model. Currently only used for
ELF. */
static enum { MM_TSO, MM_PSO, MM_RMO } sparc_memory_model = MM_RMO;
GNU attributes section with hwcap information. */
static bfd_uint64_t hwcap_seen;
#endif
-#endif
static bfd_uint64_t hwcap_allowed;
static void s_empty (int);
static void s_uacons (int);
static void s_ncons (int);
-#ifdef OBJ_ELF
static void s_register (int);
-#endif
const pseudo_typeS md_pseudo_table[] =
{
{"uahalf", s_uacons, 2},
{"uaword", s_uacons, 4},
{"uaxword", s_uacons, 8},
-#ifdef OBJ_ELF
/* These are specific to sparc/svr4. */
{"2byte", s_uacons, 2},
{"4byte", s_uacons, 4},
{"8byte", s_uacons, 8},
{"register", s_register, 0},
-#endif
{NULL, 0, 0},
};
if (! default_init_p)
init_default_arch ();
-#ifdef OBJ_AOUT
-#ifdef TE_NetBSD
- return "a.out-sparc-netbsd";
-#else
-#ifdef TE_SPARCAOUT
- if (target_big_endian)
- return "a.out-sunos-big";
- else if (default_arch_type == sparc86x && target_little_endian_data)
- return "a.out-sunos-big";
- else
- return "a.out-sparc-little";
-#else
- return "a.out-sunos-big";
-#endif
-#endif
-#endif
-
-#ifdef OBJ_COFF
-#ifdef TE_LYNX
- return "coff-sparc-lynx";
-#else
- return "coff-sparc";
-#endif
-#endif
-
#ifdef TE_VXWORKS
return "elf32-sparc-vxworks";
#endif
-#ifdef OBJ_ELF
return sparc_arch_size == 64 ? ELF64_TARGET_FORMAT : ELF_TARGET_FORMAT;
-#endif
-
- abort ();
}
\f
/* md_parse_option
* error. For example, from sparclite to v9.
*/
-#ifdef OBJ_ELF
const char *md_shortopts = "A:K:VQ:sq";
-#else
-#ifdef OBJ_AOUT
-const char *md_shortopts = "A:k";
-#else
-const char *md_shortopts = "A:";
-#endif
-#endif
struct option md_longopts[] = {
#define OPTION_BUMP (OPTION_MD_BASE)
{"bump", no_argument, NULL, OPTION_BUMP},
{"sparc", no_argument, NULL, OPTION_SPARC},
#define OPTION_XARCH (OPTION_MD_BASE + 2)
{"xarch", required_argument, NULL, OPTION_XARCH},
-#ifdef OBJ_ELF
#define OPTION_32 (OPTION_MD_BASE + 3)
{"32", no_argument, NULL, OPTION_32},
#define OPTION_64 (OPTION_MD_BASE + 4)
{"PSO", no_argument, NULL, OPTION_PSO},
#define OPTION_RMO (OPTION_MD_BASE + 7)
{"RMO", no_argument, NULL, OPTION_RMO},
-#endif
#ifdef SPARC_BIENDIAN
#define OPTION_LITTLE_ENDIAN (OPTION_MD_BASE + 8)
{"EL", no_argument, NULL, OPTION_LITTLE_ENDIAN},
{"enforce-aligned-data", no_argument, NULL, OPTION_ENFORCE_ALIGNED_DATA},
#define OPTION_LITTLE_ENDIAN_DATA (OPTION_MD_BASE + 11)
{"little-endian-data", no_argument, NULL, OPTION_LITTLE_ENDIAN_DATA},
-#ifdef OBJ_ELF
#define OPTION_NO_UNDECLARED_REGS (OPTION_MD_BASE + 12)
{"no-undeclared-regs", no_argument, NULL, OPTION_NO_UNDECLARED_REGS},
#define OPTION_UNDECLARED_REGS (OPTION_MD_BASE + 13)
{"undeclared-regs", no_argument, NULL, OPTION_UNDECLARED_REGS},
-#endif
#define OPTION_RELAX (OPTION_MD_BASE + 14)
{"relax", no_argument, NULL, OPTION_RELAX},
#define OPTION_NO_RELAX (OPTION_MD_BASE + 15)
break;
case OPTION_XARCH:
-#ifdef OBJ_ELF
if (!strncmp (arg, "v9", 2))
md_parse_option (OPTION_64, NULL);
else
|| !strcmp (arg, "sparc86x"))
md_parse_option (OPTION_32, NULL);
}
-#endif
/* Fall through. */
case 'A':
break;
#endif
-#ifdef OBJ_AOUT
- case 'k':
- sparc_pic_code = 1;
- break;
-#endif
-
-#ifdef OBJ_ELF
case OPTION_32:
case OPTION_64:
{
case OPTION_UNDECLARED_REGS:
no_undeclared_regs = 0;
break;
-#endif
case OPTION_RELAX:
sparc_relax = 1;
--enforce-aligned-data force .long, etc., to be aligned correctly\n\
-relax relax jumps and branches (default)\n\
-no-relax avoid changing any jumps and branches\n"));
-#ifdef OBJ_AOUT
- fprintf (stream, _("\
--k generate PIC\n"));
-#endif
-#ifdef OBJ_ELF
fprintf (stream, _("\
-32 create 32 bit object file\n\
-64 create 64 bit object file\n"));
-q ignored\n\
-Qy, -Qn ignored\n\
-s ignored\n"));
-#endif
#ifdef SPARC_BIENDIAN
fprintf (stream, _("\
-EL generate code for a little endian machine\n\
sparc_md_end (void)
{
unsigned long mach;
-#if defined(OBJ_ELF) && !defined(TE_SOLARIS)
+#ifndef TE_SOLARIS
int hwcaps, hwcaps2;
#endif
}
bfd_set_arch_mach (stdoutput, bfd_arch_sparc, mach);
-#if defined(OBJ_ELF) && !defined(TE_SOLARIS)
+#ifndef TE_SOLARIS
hwcaps = hwcap_seen & U0xffffffff;
hwcaps2 = hwcap_seen >> 32;
bfd_uint64_t hwcaps
= (((bfd_uint64_t) insn->hwcaps2) << 32) | insn->hwcaps;
-#if defined(OBJ_ELF) && !defined(TE_SOLARIS)
+#ifndef TE_SOLARIS
if (hwcaps)
hwcap_seen |= hwcaps;
#endif
last_insn = insn;
last_opcode = theinsn->opcode;
-#ifdef OBJ_ELF
dwarf2_emit_insn (4);
-#endif
}
\f
const char *
fixP->fx_addnumber = val; /* Remember value for emit_reloc. */
-#ifdef OBJ_ELF
/* SPARC ELF relocations don't use an addend in the data field. */
if (fixP->fx_addsy != NULL)
{
return;
}
-#endif
/* This is a hack. There should be a better way to
handle this. Probably in terms of howto fields, once
if (fixP->fx_r_type == BFD_RELOC_32_PCREL_S2 && fixP->fx_addsy)
val += fixP->fx_where + fixP->fx_frag->fr_address;
-#ifdef OBJ_AOUT
- /* FIXME: More ridiculous gas reloc hacking. If we are going to
- generate a reloc, then we just want to let the reloc addend set
- the value. We do not want to also stuff the addend into the
- object file. Including the addend in the object file works when
- doing a static link, because the linker will ignore the object
- file contents. However, the dynamic linker does not ignore the
- object file contents. */
- if (fixP->fx_addsy != NULL
- && fixP->fx_r_type != BFD_RELOC_32_PCREL_S2)
- val = 0;
-
- /* When generating PIC code, we do not want an addend for a reloc
- against a local symbol. We adjust fx_addnumber to cancel out the
- value already included in val, and to also cancel out the
- adjustment which bfd_install_relocation will create. */
- if (sparc_pic_code
- && fixP->fx_r_type != BFD_RELOC_32_PCREL_S2
- && fixP->fx_addsy != NULL
- && ! S_IS_COMMON (fixP->fx_addsy)
- && symbol_section_p (fixP->fx_addsy))
- fixP->fx_addnumber -= 2 * S_GET_VALUE (fixP->fx_addsy);
-
- /* When generating PIC code, we need to fiddle to get
- bfd_install_relocation to do the right thing for a PC relative
- reloc against a local symbol which we are going to keep. */
- if (sparc_pic_code
- && fixP->fx_r_type == BFD_RELOC_32_PCREL_S2
- && fixP->fx_addsy != NULL
- && (S_IS_EXTERNAL (fixP->fx_addsy)
- || S_IS_WEAK (fixP->fx_addsy))
- && S_IS_DEFINED (fixP->fx_addsy)
- && ! S_IS_COMMON (fixP->fx_addsy))
- {
- val = 0;
- fixP->fx_addnumber -= 2 * S_GET_VALUE (fixP->fx_addsy);
- }
-#endif
-
/* If this is a data relocation, just output VAL. */
if (fixP->fx_r_type == BFD_RELOC_8)
return NULL;
}
-#if defined (OBJ_ELF) || defined (OBJ_AOUT)
/* If we are generating PIC code, we need to generate a different
set of relocs. */
-#ifdef OBJ_ELF
#define GOT_NAME "_GLOBAL_OFFSET_TABLE_"
-#else
-#define GOT_NAME "__GLOBAL_OFFSET_TABLE_"
-#endif
#ifdef TE_VXWORKS
#define GOTT_BASE "__GOTT_BASE__"
#define GOTT_INDEX "__GOTT_INDEX__"
#endif
- /* This code must be parallel to the OBJ_ELF tc_fix_adjustable. */
+ /* This code must be parallel to tc_fix_adjustable. */
if (sparc_pic_code)
{
break;
}
}
-#endif /* defined (OBJ_ELF) || defined (OBJ_AOUT) */
/* Nothing is aligned in DWARF debugging sections. */
if (bfd_get_section_flags (stdoutput, section) & SEC_DEBUGGING)
}
/* @@ Why fx_addnumber sometimes and fx_offset other times? */
-#ifdef OBJ_AOUT
-
- if (reloc->howto->pc_relative == 0
- || code == BFD_RELOC_SPARC_PC10
- || code == BFD_RELOC_SPARC_PC22)
- reloc->addend = fixp->fx_addnumber;
- else if (sparc_pic_code
- && fixp->fx_r_type == BFD_RELOC_32_PCREL_S2
- && fixp->fx_addsy != NULL
- && (S_IS_EXTERNAL (fixp->fx_addsy)
- || S_IS_WEAK (fixp->fx_addsy))
- && S_IS_DEFINED (fixp->fx_addsy)
- && ! S_IS_COMMON (fixp->fx_addsy))
- reloc->addend = fixp->fx_addnumber;
- else
- reloc->addend = fixp->fx_offset - reloc->address;
-
-#else /* elf or coff */
-
if (code != BFD_RELOC_32_PCREL_S2
&& code != BFD_RELOC_SPARC_WDISP22
&& code != BFD_RELOC_SPARC_WDISP16
+ md_pcrel_from (fixp));
else
reloc->addend = fixp->fx_offset;
-#endif
/* We expand R_SPARC_OLO10 to R_SPARC_LO10 and R_SPARC_13
on the same location. */
valueT
md_section_align (segT segment ATTRIBUTE_UNUSED, valueT size)
{
-#ifndef OBJ_ELF
- /* This is not right for ELF; a.out wants it, and COFF will force
- the alignment anyways. */
- valueT align = ((valueT) 1
- << (valueT) bfd_get_section_alignment (stdoutput, segment));
- valueT newsize;
-
- /* Turn alignment value into a mask. */
- align--;
- newsize = (size + align) & ~align;
- return newsize;
-#else
return size;
-#endif
}
/* Exactly what point is a PC-relative offset relative TO?
/* Sort of like s_lcomm. */
-#ifndef OBJ_ELF
-static int max_alignment = 15;
-#endif
-
static void
s_reserve (int ignore ATTRIBUTE_UNUSED)
{
align = (int) get_absolute_expression ();
-#ifndef OBJ_ELF
- if (align > max_alignment)
- {
- align = max_alignment;
- as_warn (_("alignment too large; assuming %d"), align);
- }
-#endif
-
if (align < 0)
{
as_bad (_("negative alignment"));
else
align = 0;
- if (!S_IS_DEFINED (symbolP)
-#ifdef OBJ_AOUT
- && S_GET_OTHER (symbolP) == 0
- && S_GET_DESC (symbolP) == 0
-#endif
- )
+ if (!S_IS_DEFINED (symbolP))
{
if (! need_pass_2)
{
subseg_set (current_seg, current_subseg);
-#ifdef OBJ_ELF
S_SET_SIZE (symbolP, size);
-#endif
}
}
else
S_GET_NAME (symbolP), (long) S_GET_VALUE (symbolP), (long) size);
}
}
- else
- {
-#ifndef OBJ_ELF
- S_SET_VALUE (symbolP, (valueT) size);
- S_SET_EXTERNAL (symbolP);
-#endif
- }
know (symbol_get_frag (symbolP) == &zero_address_frag);
if (*input_line_pointer != ',')
{
{
temp = get_absolute_expression ();
-#ifndef OBJ_ELF
- if (temp > max_alignment)
- {
- temp = max_alignment;
- as_warn (_("alignment too large; assuming %ld"), (long) temp);
- }
-#endif
-
if (temp < 0)
{
as_bad (_("negative alignment"));
return;
}
-#ifdef OBJ_ELF
if (symbol_get_obj (symbolP)->local)
{
segT old_sec;
subseg_set (old_sec, old_subsec);
}
else
-#endif /* OBJ_ELF */
{
allocate_common:
S_SET_VALUE (symbolP, (valueT) size);
-#ifdef OBJ_ELF
S_SET_ALIGN (symbolP, temp);
S_SET_SIZE (symbolP, size);
-#endif
S_SET_EXTERNAL (symbolP);
S_SET_SEGMENT (symbolP, bfd_com_section_ptr);
}
cons (sparc_arch_size == 32 ? 4 : 8);
}
-#ifdef OBJ_ELF
/* Handle the SPARC ELF .register pseudo-op. This sets the binding of a
global register.
The syntax is:
S_SET_SEGMENT (sym, undefined_section);
}
}
-#endif
/* If the --enforce-aligned-data option is used, we require .word,
et. al., to be aligned correctly. We do it by setting up an
}
}
-#ifdef OBJ_ELF
/* Some special processing for a Sparc ELF file. */
void
return sparc_cons_special_reloc;
}
-#endif
-
/* This is called by emit_expr via TC_CONS_FIX_NEW when creating a
reloc for a cons. We could use the definition there, except that
we want to handle little endian relocs specially. */
#define DIFF_EXPR_OK /* foo-. gets turned into PC relative relocs */
-/* I know that "call 0" fails in sparc-coff if this doesn't return 1. I
- don't know about other relocation types, or other formats, yet. */
-#ifdef OBJ_COFF
-#define TC_FORCE_RELOCATION_ABS(FIX) \
- ((FIX)->fx_r_type == BFD_RELOC_32_PCREL_S2 \
- || TC_FORCE_RELOCATION (FIX))
-
-#define RELOC_REQUIRES_SYMBOL
-#endif
-
-#ifdef OBJ_AOUT
-/* This expression evaluates to true if the relocation is for a local
- object for which we still want to do the relocation at runtime.
- False if we are willing to perform this relocation while building
- the .o file. */
-
-#define TC_FORCE_RELOCATION_LOCAL(FIX) \
- (GENERIC_FORCE_RELOCATION_LOCAL (FIX) \
- || (sparc_pic_code \
- && S_IS_EXTERNAL ((FIX)->fx_addsy)))
-#endif
-
-#ifdef OBJ_ELF
/* Don't turn certain relocs into relocations against sections. This
is required for the dynamic linker to operate properly. When
generating PIC, we need to keep any non PC relative reloc. The PIC
|| (FIX)->fx_r_type == BFD_RELOC_32 \
|| (FIX)->fx_r_type == BFD_RELOC_16 \
|| (FIX)->fx_r_type == BFD_RELOC_8))
-#endif
-
-#ifdef OBJ_AOUT
-/* When generating PIC code, we must not adjust any reloc which will
- turn into a reloc against the global offset table, nor any reloc
- which we will need if a symbol is overridden. */
-#define tc_fix_adjustable(FIX) \
- (! sparc_pic_code \
- || ((FIX)->fx_pcrel \
- && ((FIX)->fx_addsy == NULL \
- || (! S_IS_EXTERNAL ((FIX)->fx_addsy) \
- && ! S_IS_WEAK ((FIX)->fx_addsy)))) \
- || (FIX)->fx_r_type == BFD_RELOC_16 \
- || (FIX)->fx_r_type == BFD_RELOC_32)
-#endif
#define elf_tc_final_processing sparc_elf_final_processing
extern void sparc_elf_final_processing (void);
extern void sparc_md_end (void);
#define md_end() sparc_md_end ()
-#endif
-
#define TC_PARSE_CONS_RETURN_TYPE const char *
#define TC_PARSE_CONS_RETURN_NONE NULL
-#ifdef OBJ_ELF
#define TC_PARSE_CONS_EXPRESSION(EXP, NBYTES) sparc_cons (EXP, NBYTES)
extern const char *sparc_cons (expressionS *, int);
-#endif
#define TC_CONS_FIX_NEW cons_fix_new_sparc
extern void cons_fix_new_sparc
this, BFD_RELOC_32_PCREL will be emitted directly instead. */
#define CFI_DIFF_EXPR_OK 0
-/* end of tc-sparc.h */
+#endif
+++ /dev/null
-/* te-sparcaout.h -- embedded sparc-aout target environment declarations.
- Copyright (C) 1996-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_SPARCAOUT 1
-#include "obj-format.h"
sh-*-kaos*) fmt=elf ;;
shle*-*-kaos*) fmt=elf ;;
- sparc-*-sunos4*) fmt=aout em=sun3 ;;
- sparc-*-aout) fmt=aout em=sparcaout ;;
- sparc-*-coff) fmt=coff ;;
- sparc-*-linux*aout*) fmt=aout em=linux ;;
sparc-*-linux-*) fmt=elf em=linux ;;
- sparc-fujitsu-none) fmt=aout ;;
- sparc-*-elf) fmt=elf ;;
- sparc-*-sysv4*) fmt=elf ;;
sparc-*-solaris*) fmt=elf em=solaris ;;
- sparc-*-netbsdelf*) fmt=elf em=nbsd ;;
- sparc-*-netbsd*)
- case ${cpu} in
- sparc64) fmt=elf em=nbsd ;;
- *) fmt=aout em=nbsd ;;
- esac ;;
- sparc-*-openbsd[0-2].* | \
- sparc-*-openbsd3.[0-1])
- case ${cpu} in
- sparc64) fmt=elf em=nbsd ;;
- *) fmt=aout em=nbsd ;;
- esac ;;
- sparc-*-openbsd*) fmt=elf em=nbsd ;;
+ sparc-*-*bsd*) fmt=elf em=nbsd ;;
spu-*-elf) fmt=elf ;;
config/te-pe.h
config/te-riscix.h
config/te-solaris.h
-config/te-sparcaout.h
config/te-svr4.h
config/te-symbian.h
config/te-tmips.h
+++ /dev/null
-#objdump: -r
-# name : addends
-.*: +file format a.out-sunos-big
-
-RELOCATION RECORDS FOR \[.text\]:
-OFFSET TYPE +VALUE
-0+08 WDISP22 +foo1\+0xf+fc
-0+0c WDISP22 +foo1\+0xf+f8
-0+10 WDISP22 +foo1\+0xf+f0
-0+14 WDISP22 +foo1\+0xf+ec
-0+1c 32 +foo1
-0+20 32 +foo1\+0x0+4
-#0+20 32 +foo1\+0x0+4
+++ /dev/null
-# Copyright (C) 2012-2018 Free Software Foundation, Inc.
-
-# 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.
-
-#
-# SunOS4 on SPARC tests
-#
-
-if [istarget sparc-*-sunos4*] then {
- run_dump_test "addend"
-}
+++ /dev/null
- .global foo
-foo:
- nop
- nop
- ba foo1+0x4
- ba foo1+0x4
- ba foo1
- ba foo1
- nop
- .word foo1
- .word foo1+4
+2018-04-16 Alan Modra <amodra@gmail.com>
+
+ * Makefile.am: Remove sparc-aout and sparc-coff support.
+ * configure.tgt: Likewise.
+ * testsuite/ld-elfvers/vers.exp: Likewise.
+ * testsuite/ld-elfvsb/elfvsb.exp: Likewise.
+ * testsuite/ld-elfweak/elfweak.exp: Likewise.
+ * testsuite/ld-shared/shared.exp: Likewise.
+ * emulparams/coff_sparc.sh: Delete.
+ * emulparams/sparcaout.sh: Delete.
+ * emulparams/sparclinux.sh: Delete.
+ * emulparams/sparcnbsd.sh: Delete.
+ * emulparams/sun4.sh: Delete.
+ * scripttempl/sparccoff.sc: Delete.
+ * Makefile.in: Regenerate.
+ * po/BLD-POTFILES.in: Regenerate.
+
2018-04-16 Alan Modra <amodra@gmail.com>
* Makefile.am: Remove m68k-aout and m68k-coff support.
eavrxmega6.c \
eavrxmega7.c \
eavrtiny.c \
- ecoff_sparc.c \
ecrisaout.c \
ecriself.c \
ecrislinux.c \
eshlelf_nto.c \
eshlelf_vxworks.c \
eshpe.c \
- esparcaout.c \
- esparclinux.c \
- esparcnbsd.c \
- esun4.c \
etic30aout.c \
etic30coff.c \
etic3xcoff.c \
$(srcdir)/emultempl/avrelf.em $(ELF_DEPS) $(srcdir)/scripttempl/avr.sc \
${GEN_DEPENDS}
-ecoff_sparc.c: $(srcdir)/emulparams/coff_sparc.sh \
- $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/sparccoff.sc ${GEN_DEPENDS}
-
ecrisaout.c: $(srcdir)/emulparams/crisaout.sh \
$(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/crisaout.sc ${GEN_DEPENDS}
eshpe.c: $(srcdir)/emulparams/shpe.sh \
$(srcdir)/emultempl/pe.em $(srcdir)/scripttempl/pe.sc ${GEN_DEPENDS}
-esparcaout.c: $(srcdir)/emulparams/sparcaout.sh \
- $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS}
-
-esparclinux.c: $(srcdir)/emulparams/sparclinux.sh \
- $(srcdir)/emultempl/linux.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS}
-
-esparcnbsd.c: $(srcdir)/emulparams/sparcnbsd.sh \
- $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS}
-
-esun4.c: $(srcdir)/emulparams/sun4.sh \
- $(srcdir)/emultempl/sunos.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS}
-
etic30aout.c: $(srcdir)/emulparams/tic30aout.sh \
$(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/tic30aout.sc ${GEN_DEPENDS}
eavrxmega6.c \
eavrxmega7.c \
eavrtiny.c \
- ecoff_sparc.c \
ecrisaout.c \
ecriself.c \
ecrislinux.c \
eshlelf_nto.c \
eshlelf_vxworks.c \
eshpe.c \
- esparcaout.c \
- esparclinux.c \
- esparcnbsd.c \
- esun4.c \
etic30aout.c \
etic30coff.c \
etic3xcoff.c \
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eavrxmega5.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eavrxmega6.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eavrxmega7.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecoff_sparc.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecrisaout.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecriself.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecrislinux.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eshlelf_nto.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eshlelf_vxworks.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eshpe.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/esparcaout.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/esparclinux.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/esparcnbsd.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/esun4.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/etic30aout.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/etic30coff.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/etic3xcoff.Po@am__quote@
$(srcdir)/emultempl/avrelf.em $(ELF_DEPS) $(srcdir)/scripttempl/avr.sc \
${GEN_DEPENDS}
-ecoff_sparc.c: $(srcdir)/emulparams/coff_sparc.sh \
- $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/sparccoff.sc ${GEN_DEPENDS}
-
ecrisaout.c: $(srcdir)/emulparams/crisaout.sh \
$(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/crisaout.sc ${GEN_DEPENDS}
eshpe.c: $(srcdir)/emulparams/shpe.sh \
$(srcdir)/emultempl/pe.em $(srcdir)/scripttempl/pe.sc ${GEN_DEPENDS}
-esparcaout.c: $(srcdir)/emulparams/sparcaout.sh \
- $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS}
-
-esparclinux.c: $(srcdir)/emulparams/sparclinux.sh \
- $(srcdir)/emultempl/linux.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS}
-
-esparcnbsd.c: $(srcdir)/emulparams/sparcnbsd.sh \
- $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS}
-
-esun4.c: $(srcdir)/emulparams/sun4.sh \
- $(srcdir)/emultempl/sunos.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS}
-
etic30aout.c: $(srcdir)/emulparams/tic30aout.sh \
$(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/tic30aout.sc ${GEN_DEPENDS}
sh-*-pe) targ_emul=shpe ;
targ_extra_ofiles="deffilep.o pe-dll.o" ;;
sh-*-*) targ_emul=sh; targ_extra_emuls=shl ;;
-sparc64-*-aout*) targ_emul=sparcaout ;;
-sparc64-*-elf* | sparc64-*-rtems*)
- targ_emul=elf64_sparc ;;
-sparc-sun-sunos4*) targ_emul=sun4 ;;
-sparclite*-*-elf) targ_emul=elf32_sparc ;;
-sparclite*-*-coff) targ_emul=coff_sparc ;;
-sparclite*-fujitsu-*) targ_emul=sparcaout ;;
-sparc*-*-aout) targ_emul=sparcaout ;;
-sparc*-*-coff) targ_emul=coff_sparc ;;
-sparc*-*-elf | sparc-*-rtems*)
- targ_emul=elf32_sparc ;;
-sparc*-*-sysv4*) targ_emul=elf32_sparc ;;
-sparc*-*-vxworks*) targ_emul=elf32_sparc_vxworks ;;
sparc64-*-freebsd* | sparcv9-*-freebsd* | sparc64-*-kfreebsd*-gnu | sparcv9-*-kfreebsd*-gnu)
targ_emul=elf64_sparc_fbsd
targ_extra_emuls="elf64_sparc elf32_sparc"
targ_extra_libpath=$targ_extra_emuls
tdir_elf32_sparc=`echo ${targ_alias} | sed -e 's/64//'` ;;
-sparc*-*-linux*aout*) targ_emul=sparclinux
- targ_extra_emuls="elf32_sparc sun4"
- tdir_elf32_sparc=`echo ${targ_alias} | sed -e 's/aout//'`
- tdir_sun4=sparc-sun-sunos4 ;;
sparc64-*-linux-*) targ_emul=elf64_sparc
- targ_extra_emuls="elf32_sparc sparclinux sun4"
+ targ_extra_emuls="elf32_sparc"
targ_extra_libpath=elf32_sparc
- tdir_elf32_sparc=`echo ${targ_alias} | sed -e 's/64//'`
- tdir_sparclinux=${tdir_elf32_sparc}aout
- tdir_sun4=sparc-sun-sunos4 ;;
+ tdir_elf32_sparc=`echo ${targ_alias} | sed -e 's/64//'` ;;
+sparc64-*-*bsd*) targ_emul=elf64_sparc
+ targ_extra_emuls="elf32_sparc" ;;
+sparc64-*-solaris2* | sparcv9-*-solaris2*)
+ targ_emul=elf64_sparc_sol2
+ targ_extra_emuls="elf64_sparc elf32_sparc_sol2 elf32_sparc"
+ targ_extra_libpath=$targ_extra_emuls
+ tdir_elf32_sparc=`echo ${targ_alias} | sed -e 's/64//'` ;;
+sparc64-*-*) targ_emul=elf64_sparc ;;
sparc*-*-linux-*) targ_emul=elf32_sparc
- targ_extra_emuls="sparclinux elf64_sparc sun4"
+ targ_extra_emuls="elf64_sparc"
targ_extra_libpath=elf64_sparc
- tdir_sparclinux=${targ_alias}aout
- tdir_elf64_sparc=`echo ${targ_alias} | sed -e 's/32//'`
- tdir_sun4=sparc-sun-sunos4 ;;
-sparc64-*-netbsd* | sparc64-*-openbsd*)
- targ_emul=elf64_sparc
- targ_extra_emuls="elf32_sparc" ;;
-sparc*-*-netbsd*elf*) targ_emul=elf32_sparc ;;
-sparc*-*-netbsd*) targ_emul=sparcnbsd ;;
+ tdir_elf64_sparc=`echo ${targ_alias} | sed -e 's/32//'` ;;
sparc-*-solaris2.[0-6] | sparc-*-solaris2.[0-6].*)
targ_emul=elf32_sparc_sol2
targ_extra_emuls=elf32_sparc ;;
targ_extra_emuls="elf32_sparc elf64_sparc_sol2 elf64_sparc"
targ_extra_libpath=$targ_extra_emuls
tdir_elf64_sparc=`echo ${targ_alias} | sed -e 's/32//'` ;;
-sparcv9-*-solaris2* | sparc64-*-solaris2*)
- targ_emul=elf64_sparc_sol2
- targ_extra_emuls="elf64_sparc elf32_sparc_sol2 elf32_sparc"
- targ_extra_libpath=$targ_extra_emuls
- tdir_elf32_sparc=`echo ${targ_alias} | sed -e 's/64//'` ;;
-sparc*-*-solaris2*) targ_emul=elf32_sparc ;;
-sparc*-wrs-vxworks*) targ_emul=sparcaout ;;
+sparc*-*-vxworks*) targ_emul=elf32_sparc_vxworks ;;
+sparc*-*-*) targ_emul=elf32_sparc ;;
spu-*-elf*) targ_emul=elf32_spu ;;
tic30-*-*aout*) targ_emul=tic30aout ;;
tic30-*-*coff*) targ_emul=tic30coff ;;
+++ /dev/null
-SCRIPT_NAME=sparccoff
-OUTPUT_FORMAT="coff-sparc"
-# following are dubious (borrowed from sparc lynx)
-TARGET_PAGE_SIZE=0x1000
-TEXT_START_ADDR=0
-case ${LD_FLAG} in
- n|N) TEXT_START_ADDR=0x1000 ;;
-esac
-ARCH=sparc
+++ /dev/null
-SCRIPT_NAME=aout
-OUTPUT_FORMAT="a.out-sunos-big"
-BIG_OUTPUT_FORMAT="a.out-sunos-big"
-LITTLE_OUTPUT_FORMAT="a.out-sparc-little"
-TEXT_START_ADDR=0x2020
-case ${LD_FLAG} in
- n|N) TEXT_START_ADDR=0x2000 ;;
-esac
-TARGET_PAGE_SIZE=0x2000
-ARCH=sparc
+++ /dev/null
-SCRIPT_NAME=aout
-OUTPUT_FORMAT="a.out-sparc-linux"
-TARGET_PAGE_SIZE=0x1000
-TEXT_START_ADDR=0x1020
-case ${LD_FLAG} in
- n|N) TEXT_START_ADDR=0 ;;
-esac
-ARCH=sparc
-TEMPLATE_NAME=linux
+++ /dev/null
-SCRIPT_NAME=aout
-TEXT_START_ADDR=0x1020
-OUTPUT_FORMAT="a.out-sparc-netbsd"
-TARGET_PAGE_SIZE=0x1000
-ARCH=sparc
+++ /dev/null
-SCRIPT_NAME=aout
-OUTPUT_FORMAT="a.out-sunos-big"
-TEXT_START_ADDR=0x2020
-TARGET_PAGE_SIZE=0x2000
-ALIGNMENT=8
-ARCH=sparc
-TEMPLATE_NAME=sunos
eavrxmega5.c
eavrxmega6.c
eavrxmega7.c
-ecoff_sparc.c
ecrisaout.c
ecriself.c
ecrislinux.c
eshlelf_nto.c
eshlelf_vxworks.c
eshpe.c
-esparcaout.c
-esparclinux.c
-esparcnbsd.c
-esun4.c
etic30aout.c
etic30coff.c
etic3xcoff.c
+++ /dev/null
-# Linker script for Sparc COFF.
-# Based on i386coff.sc by Ian Taylor <ian@cygnus.com>.
-#
-# 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.
-
-test -z "$ENTRY" && ENTRY=_start
-
-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}")
-${LIB_SEARCH_DIRS}
-
-${RELOCATING+ENTRY (${ENTRY})}
-
-SECTIONS
-{
- .text ${RELOCATING+ SIZEOF_HEADERS} : {
- *(.init)
- *(.text)
- ${RELOCATING+ etext = .;}
- ${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__ = .;}
- *(.fini)
- ${RELOCATING+ etext = .};
- }
- .data ${RELOCATING+ 0x400000 + (. & 0xffc00fff)} : {
- *(.data)
- ${RELOCATING+ edata = .};
- }
- .bss ${RELOCATING+ SIZEOF(.data) + ADDR(.data)} :
- {
- *(.bss)
- *(COMMON)
- ${RELOCATING+ end = .};
- }
- .stab 0 ${RELOCATING+(NOLOAD)} :
- {
- [ .stab ]
- }
- .stabstr 0 ${RELOCATING+(NOLOAD)} :
- {
- [ .stabstr ]
- }
-}
-EOF
|| [string match "*option ignored*" $exec_output]
|| [string match "*unrecognized option*" $exec_output]
|| [string match "*passed to ld*" $exec_output] } {
- if [istarget *-*-sunos4*] {
- set picflag "-pic"
- } else {
- set picflag "-KPIC"
- }
+ set picflag "-KPIC"
}
}
if [ string match $support_protected "no" ] {
setup_xfail $target_triplet
}
- } else {
- setup_xfail "*-*-sunos4*"
}
# Non-pic code uses name binding rules for applications to
if [ string match $support_protected "no" ] {
setup_xfail $target_triplet
}
- } else {
- setup_xfail "*-*-sunos4*"
- setup_xfail "*-*-linux*libc1"
}
if { [ string match $visibility "hidden_normal" ]
|| [ string match $visibility "hidden_weak" ]
setup_xfail $target_triplet
}
}
- # SunOS can not compare function pointers correctly
- if [istarget "*-*-sunos4*"] {
- visibility_test $visibility vp "visibility ($visibility)" mainnp.o sh1p.o sh2p.o sun4
- } else { if { [istarget rs6000*-*-aix*] || [istarget powerpc*-*-aix*] } {
+ if { [istarget rs6000*-*-aix*] || [istarget powerpc*-*-aix*] } {
visibility_test $visibility vp "visibility ($visibility)" mainnp.o sh1p.o sh2p.o xcoff
} else {
visibility_test $visibility vp "visibility ($visibility)" mainnp.o sh1p.o sh2p.o elfvsb $COMPRESS_LDFLAG
- } }
+ }
}
}}
if [ string match $support_protected "no" ] {
setup_xfail $target_triplet
}
- } else {
- setup_xfail "*-*-sunos4*"
}
if { ![ string match $visibility "hidden_undef" ]
&& ![ string match $visibility "protected_undef" ] } {
|| [string match "*option ignored*" $exec_output] \
|| [string match "*unrecognized option*" $exec_output] \
|| [string match "*passed to ld*" $exec_output] } {
- if [istarget *-*-sunos4*] {
- set picflag "-pic"
- } else {
- set picflag "-KPIC"
- }
+ set picflag "-KPIC"
}
}
verbose "Using $picflag to compile PIC code"
|| [string match "*option ignored*" $exec_output]
|| [string match "*unrecognized option*" $exec_output]
|| [string match "*passed to ld*" $exec_output] } {
- if [istarget *-*-sunos4*] {
- set picflag "-pic"
- } else {
- set picflag "-KPIC"
- }
+ set picflag "-KPIC"
}
}
verbose "Using $picflag to compile PIC code"
&& ![istarget powerpc*-*-sysv4*] \
&& ![istarget sparc*-*-elf] \
&& ![istarget sparc*-*-solaris2*] \
- && ![istarget sparc*-*-sunos4*] \
&& ![istarget sparc*-*-linux*] \
&& ![istarget arm*-*-linux*] \
&& ![istarget alpha*-*-linux*] \
|| [string match "*option ignored*" $exec_output] \
|| [string match "*unrecognized option*" $exec_output] \
|| [string match "*passed to ld*" $exec_output] } {
- if [istarget *-*-sunos4*] {
- set picflag "-pic"
- } else {
- set picflag "-KPIC"
- }
+ set picflag "-KPIC"
}
}
verbose "Using $picflag to compile PIC code"
} else {
# SunOS non PIC shared libraries don't permit some cases of
# overriding.
- setup_xfail "*-*-sunos4*"
setup_xfail "ia64-*-linux*"
setup_xfail "alpha*-*-linux*"
setup_xfail "powerpc64*-*-*"
# address for the library. Near as I can tell, the R_*_RELATIVE
# relocations for various targets are broken in the case where
# the load address is not zero (which is the default).
- setup_xfail "*-*-sunos4*"
setup_xfail "*-*-linux*libc1"
setup_xfail "powerpc*-*-linux*"
setup_xfail "ia64-*-linux*"
|| ![ld_compile "$CC $CFLAGS $SHCFLAG $picflag" $srcdir/$subdir/sh2.c $tmpdir/sh2p.o] } {
unresolved "shared"
} else {
- # SunOS can not compare function pointers correctly
- if [istarget "*-*-sunos4*"] {
- shared_test shp "shared" mainnp.o sh1p.o sh2p.o sun4
- } else { if { [istarget rs6000*-*-aix*] || [istarget powerpc*-*-aix*] } {
+ if { [istarget rs6000*-*-aix*] || [istarget powerpc*-*-aix*] } {
shared_test shp "shared" mainnp.o sh1p.o sh2p.o xcoff
} else {
shared_test shp "shared" mainnp.o sh1p.o sh2p.o shared
shared_test shp "shared -Bsymbolic" mainnp.o sh1p.o sh2p.o symbolic "-Bsymbolic"
ld_compile "$CC $CFLAGS $SHCFLAG" $srcdir/$subdir/main.c $tmpdir/mainnp.o
ld_compile "$CC $CFLAGS $SHCFLAG $picflag" $srcdir/$subdir/sh1.c $tmpdir/sh1p.o
- } }
+ }
}
}
} else {
# SunOS non PIC shared libraries don't permit some cases of
# overriding.
- setup_xfail "*-*-sunos4*"
setup_xfail "ia64-*-linux*"
setup_xfail "alpha*-*-linux*"
setup_xfail "powerpc64*-*-*"