# need two copies of the executable, one to download and one for the
# debugger).
BFD_LIBS = \
- archive.o archures.o bfd.o cache.o coffgen.o core.o ctor.o \
+ archive.o archures.o bfd.o cache.o coffgen.o core.o \
format.o init.o libbfd.o opncls.o reloc.o \
section.o syms.o targets.o hash.o linker.o \
elf.o srec.o
coff-u68k.o \
coff-we32k.o \
coff-z8k.o \
+ cofflink.o \
ecoff.o \
ecofflink.o \
elf32-gen.o \
coff-i960.c srec.c tekhex.c oasys.c ieee.c aout0.c \
ecoff.c ecofflink.c coff-m68k.c coff-u68k.c coff-apollo.c \
coff-a29k.c coff-rs6000.c coff-sparc.c coffgen.c format.c \
- section.c core.c syms.c stab-syms.c reloc.c init.c ctor.c \
+ section.c core.c syms.c stab-syms.c reloc.c init.c \
coff-m88k.c coff-mips.c coff-sh.c trad-core.c cisco-core.c newsos3.c \
i386aout.c i386linux.c netbsd386.c i386mach3.c i386os9k.c \
bout.c aout-adobe.c coff-we32k.c \
hp300bsd.c hp300hpux.c \
i386lynx.c cf-i386lynx.c m68klynx.c cf-m68klynx.c \
sparclynx.c cf-sparclynx.c aix386-core.c hpux-core.c \
- irix-core.c lynx-core.c osf-core.c hash.c linker.c
+ irix-core.c lynx-core.c osf-core.c hash.c linker.c cofflink.c
HFILES = aout-target.h aoutf1.h aoutx.h coffcode.h \
coffswap.h ecoffswap.h elf32-hppa.h elf32-target.h elf64-target.h \
cache.o: cache.c
archures.o: archures.c
coff-i386.o: coff-i386.c $(INCDIR)/coff/i386.h $(INCDIR)/coff/internal.h \
- libcoff.h coffcode.h coffswap.h
+ libcoff.h $(INCDIR)/bfdlink.h coffcode.h coffswap.h
coff-go32.o: coff-go32.c $(INCDIR)/coff/i386.h $(INCDIR)/coff/internal.h \
- libcoff.h coffcode.h coffswap.h
+ libcoff.h $(INCDIR)/bfdlink.h coffcode.h coffswap.h
aout64.o: aout64.c aoutx.h $(INCDIR)/bfdlink.h libaout.h \
$(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def \
$(INCDIR)/aout/ar.h
$(INCDIR)/bfdlink.h $(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h \
$(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h aout-target.h
coff-i960.o: coff-i960.c $(INCDIR)/coff/i960.h $(INCDIR)/coff/internal.h \
- libcoff.h coffcode.h coffswap.h
+ libcoff.h $(INCDIR)/bfdlink.h coffcode.h coffswap.h
srec.o: srec.c
tekhex.o: tekhex.c
oasys.o: oasys.c $(INCDIR)/oasys.h liboasys.h
ecofflink.o: ecofflink.c $(INCDIR)/bfdlink.h $(INCDIR)/coff/internal.h \
$(INCDIR)/coff/sym.h $(INCDIR)/coff/symconst.h $(INCDIR)/coff/ecoff.h
coff-m68k.o: coff-m68k.c $(INCDIR)/coff/m68k.h $(INCDIR)/coff/internal.h \
- libcoff.h coffcode.h coffswap.h
+ libcoff.h $(INCDIR)/bfdlink.h coffcode.h coffswap.h
coff-u68k.o: coff-u68k.c coff-m68k.c $(INCDIR)/coff/m68k.h \
- $(INCDIR)/coff/internal.h libcoff.h coffcode.h coffswap.h
+ $(INCDIR)/coff/internal.h libcoff.h $(INCDIR)/bfdlink.h \
+ coffcode.h coffswap.h
coff-apollo.o: coff-apollo.c $(INCDIR)/coff/apollo.h \
- $(INCDIR)/coff/internal.h libcoff.h coffcode.h coffswap.h
+ $(INCDIR)/coff/internal.h libcoff.h $(INCDIR)/bfdlink.h \
+ coffcode.h coffswap.h
coff-a29k.o: coff-a29k.c $(INCDIR)/coff/a29k.h $(INCDIR)/coff/internal.h \
- libcoff.h coffcode.h coffswap.h
+ libcoff.h $(INCDIR)/bfdlink.h coffcode.h coffswap.h
coff-rs6000.o: coff-rs6000.c $(INCDIR)/coff/internal.h \
- $(INCDIR)/coff/rs6000.h libcoff.h coffcode.h coffswap.h
+ $(INCDIR)/coff/rs6000.h libcoff.h $(INCDIR)/bfdlink.h \
+ coffcode.h coffswap.h
coff-sparc.o: coff-sparc.c $(INCDIR)/coff/sparc.h $(INCDIR)/coff/internal.h \
- libcoff.h coffcode.h coffswap.h
-coffgen.o: coffgen.c $(INCDIR)/coff/internal.h libcoff.h
+ libcoff.h $(INCDIR)/bfdlink.h coffcode.h coffswap.h
+coffgen.o: coffgen.c $(INCDIR)/coff/internal.h libcoff.h \
+ $(INCDIR)/bfdlink.h
format.o: format.c
section.o: section.c
core.o: core.c
$(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab.def
reloc.o: reloc.c $(INCDIR)/bfdlink.h
init.o: init.c
-ctor.o: ctor.c
coff-m88k.o: coff-m88k.c $(INCDIR)/coff/m88k.h $(INCDIR)/coff/internal.h \
- libcoff.h coffcode.h coffswap.h
+ libcoff.h $(INCDIR)/bfdlink.h coffcode.h coffswap.h
coff-mips.o: coff-mips.c $(INCDIR)/bfdlink.h $(INCDIR)/coff/internal.h \
$(INCDIR)/coff/sym.h $(INCDIR)/coff/symconst.h $(INCDIR)/coff/ecoff.h \
$(INCDIR)/coff/mips.h libcoff.h libecoff.h coffswap.h \
aout-adobe.o: aout-adobe.c $(INCDIR)/aout/adobe.h $(INCDIR)/aout/stab_gnu.h \
$(INCDIR)/aout/stab.def libaout.h $(INCDIR)/bfdlink.h
coff-we32k.o: coff-we32k.c $(INCDIR)/coff/we32k.h $(INCDIR)/coff/internal.h \
- libcoff.h coffcode.h coffswap.h
+ libcoff.h $(INCDIR)/bfdlink.h coffcode.h coffswap.h
i386bsd.o: i386bsd.c libaout.h $(INCDIR)/bfdlink.h \
aout-target.h $(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h \
$(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h
$(INCDIR)/aout/aout64.h aout-target.h $(INCDIR)/aout/stab_gnu.h \
$(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h
cf-i386lynx.o: cf-i386lynx.c coff-i386.c $(INCDIR)/coff/i386.h \
- $(INCDIR)/coff/internal.h libcoff.h coffcode.h coffswap.h
+ $(INCDIR)/coff/internal.h libcoff.h $(INCDIR)/bfdlink.h \
+ coffcode.h coffswap.h
m68klynx.o: m68klynx.c libaout.h $(INCDIR)/bfdlink.h \
$(INCDIR)/aout/aout64.h aout-target.h $(INCDIR)/aout/stab_gnu.h \
$(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h
cf-m68klynx.o: cf-m68klynx.c coff-m68k.c $(INCDIR)/coff/m68k.h \
- $(INCDIR)/coff/internal.h libcoff.h coffcode.h coffswap.h
+ $(INCDIR)/coff/internal.h libcoff.h $(INCDIR)/bfdlink.h \
+ coffcode.h coffswap.h
sparclynx.o: sparclynx.c $(INCDIR)/aout/sun4.h libaout.h \
$(INCDIR)/bfdlink.h $(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h \
$(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h aout-target.h
cf-sparclynx.o: cf-sparclynx.c coff-sparc.c $(INCDIR)/coff/sparc.h \
- $(INCDIR)/coff/internal.h libcoff.h coffcode.h coffswap.h
+ $(INCDIR)/coff/internal.h libcoff.h $(INCDIR)/bfdlink.h \
+ coffcode.h coffswap.h
aix386-core.o: aix386-core.c $(INCDIR)/coff/i386.h \
- $(INCDIR)/coff/internal.h libcoff.h
+ $(INCDIR)/coff/internal.h libcoff.h $(INCDIR)/bfdlink.h
hpux-core.o: hpux-core.c
irix-core.o: irix-core.c
lynx-core.o: lynx-core.c
osf-core.o: osf-core.c
hash.o: hash.c
linker.o: linker.c $(INCDIR)/bfdlink.h genlink.h
+cofflink.o: cofflink.c $(INCDIR)/bfdlink.h $(INCDIR)/coff/internal.h \
+ libcoff.h
# IF YOU PUT ANYTHING HERE IT WILL GO AWAY
+++ /dev/null
-/* BFD library support routines for constructors
- Copyright (C) 1990, 91, 92, 93, 94 Free Software Foundation, Inc.
-
- Hacked by Steve Chamberlain of Cygnus Support. With some help from
- Judy Chamberlain too.
-
-
-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 2 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., 675 Mass Ave, Cambridge, MA 02139, USA. */
-
-/*
-SECTION
- Constructors
-
- Classes in C++ have @dfn{constructors} and @dfn{destructors}. These
- are functions which are called automatically by the language
- whenever data of a class is created or destroyed. Class data
- which is static may also be have a type which requires
- `construction'; the contructor must be called before the data
- can be referenced, so the contructor must be called before the
- program begins.
-
- The common solution to this problem is for the compiler to
- call a magic function as the first statement before <<main>>.
- This magic function (often called <<__main>>) runs around
- calling the constructors for all the things needing it.
-
- With COFF, the compiler has a bargain with the linker et al.
- All constructors are given strange names; for example,
- <<__GLOBAL__$I$foo>> might be the label of a contructor for
- the class @var{foo}. The solution on unfortunate systems
- (most System V machines) is to perform a partial link on all
- the <<.o>> files, do an <<nm>> on the result, run <<awk>> or some
- such over the result looking for strange <<__GLOBAL__$>>
- symbols, generate a C program from this, compile it, and link
- with the partially linked input. This process is usually
- called <<collect>>.
-
- Some versions of <<a.out>> use something called the
- <<set_vector>> mechanism. The constructor symbols are output
- from the compiler with a special stab code saying that they
- are constructors, and the linker can deal with them directly.
-
- BFD allows applications (i.e., the linker) to deal with
- constructor information independently of their external
- implementation by providing a set of entry points for the
- indiviual object back ends to call to maintain a database
- of the contructor information. The application can
- interrogate the database to find out what it wants. The
- construction data essential for the linker to be able to
- perform its job are:
-
- o asymbol -
- The asymbol of the contructor entry point contains all the
- information necessary to call the function.
-
- o table id -
- The type of symbol, i.e., is it a constructor, a destructor or
- something else someone dreamed up to make our lives difficult.
-
- The constructor module takes this information and builds extra
- sections attached to the BFDs which own the entry points. It
- creates these sections as if they were tables of pointers to
- the entry points, and builds relocation entries to go with
- them so that the tables can be relocated along with the data
- they reference.
-
- These sections are marked with a special bit
- (<<SEC_CONSTRUCTOR>>), which the linker notices and does with
- what it wants.
-
-*/
-
-#include <bfd.h>
-#include <sysdep.h>
-#include <libbfd.h>
-
-
-
-/*
-INTERNAL_FUNCTION
- bfd_constructor_entry
-
-SYNOPSIS
- boolean bfd_constructor_entry(bfd *abfd,
- asymbol **symbol_ptr_ptr,
- CONST char*type);
-
-
-DESCRIPTION
- @var{symbol_ptr_ptr} describes the
- function to be called; @var{type} descibes the xtor type,
- e.g., something like "CTOR" or "DTOR" would be fine. @var{abfd}
- is the BFD which owns the function. Create a section
- called "CTOR" or "DTOR" or whatever if the BFD doesn't already
- have one, and grow a relocation table for the entry points as
- they accumulate.
-
- Return <<true>> if successful, <<false>> if out of memory.
-
-*/
-
-
-boolean
-bfd_constructor_entry (abfd, symbol_ptr_ptr, type)
- bfd *abfd;
- asymbol **symbol_ptr_ptr;
- CONST char *type;
-{
- /* Look up the section we're using to store the table in */
- asection *rel_section = bfd_get_section_by_name (abfd, type);
- if (rel_section == (asection *)NULL) {
- rel_section = bfd_make_section (abfd, type);
- rel_section->flags = SEC_CONSTRUCTOR;
- rel_section->alignment_power = 2;
- }
-
- /* Create a relocation into the section which references the entry
- point */
- {
- arelent_chain *reloc = (arelent_chain *)bfd_alloc(abfd,
- sizeof(arelent_chain));
- if (!reloc)
- {
- bfd_set_error (bfd_error_no_memory);
- return false;
- }
-
-/* reloc->relent.section = (asection *)NULL;*/
- reloc->relent.addend = 0;
-
- reloc->relent.sym_ptr_ptr = symbol_ptr_ptr;
- reloc->next = rel_section->constructor_chain;
- rel_section->constructor_chain = reloc;
- reloc->relent.address = rel_section->_cooked_size;
- /* ask the cpu which howto to use */
- reloc->relent.howto = bfd_reloc_type_lookup(abfd, BFD_RELOC_CTOR);
- rel_section->_cooked_size += sizeof(int *);
- rel_section->reloc_count++;
- }
- return true;
-}