-#
-# Makefile for ld version 2
+# Makefile for the GNU linker ld (version 2)
+# Copyright (C) 1989-1991 Free Software Foundation, Inc.
+
+# This file is part of GNU ld..
+
+# 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.
+
#
# $Id$
#
destdir = /usr/local
version=`$(unsubdir)/../gcc$(subdir)/gcc -dumpversion`
-bindir = $(destdir)/H-$(host_alias)/T-$(target_alias)/bin
-libdir = $(destdir)/H-$(host_alias)/T-$(target_alias)/lib
-libsubdir = $(libdir)/gcc/$(target)/$(version)
+bindir = $(destdir)/bin
+gcclibdir = $(destdir)/lib/gcc/$(target_alias)/$(version)
# Seach path to override the default search path for -lfoo libraries.
# If LIB_PATH is empty, the ones in the script (if any) are left alone.
SCRIPTS = ldgld68k.sc ldgld.sc \
ldlnk960.sc ldlnk960r.sc ldgld960.sc \
- ldm88k.sc ldglda29k.sc news.sc h8300hds.sc ebmon29k.sc
+ i386aout.sc ldm88k.sc ldglda29k.sc news.sc h8300hds.sc ebmon29k.sc
#### target and host dependent Makefile fragments come in here.
###
BFDLIB=$(unsubdir)/../bfd$(subdir)/libbfd.a
LIBIBERTY=$(unsubdir)/../libiberty$(subdir)/libiberty.a
-OFILES= ldgram.o ldlex.o ldlang.o ldmain.o ldwarn.o ldwrite.o ldexp.o ldlnk960.o ldgld68k.o ldindr.o \
+OFILES= ldgram.o ldlex.o ldlang.o ldctor.o ldmain.o \
+ ldwarn.o ldwrite.o ldexp.o ldlnk960.o ldgld68k.o ldindr.o i386aout.o \
ldm88k.o ldglda29k.o news.o h8300hds.o ebmon29k.o \
ldgld.o ldgld960.o ldemul.o ldver.o ldmisc.o ldsym.o ldvanilla.o ldfile.o
-HEADERS=config.h ldmain.h ldmain.h ldwarn.h ldmisc.h ldindr.h ldsym.h ldlang.h ldexp.h \
+HEADERS=config.h ldmain.h ldmain.h ldwarn.h ldmisc.h ldindr.h \
+ ldsym.h ldctor.h ldlang.h ldexp.h \
ldlex.h ldwrite.h ldver.h ldemul.h ldfile.h ldgram.h ld.h
MANSOURCES=ld.tex
-LDCSOURCES=ldlang.c ldindr.c ldmain.c ldwrite.c ldwarn.c ldlnk960.c ldgld.c ldgld68k.c \
- ldm88k.c ldgld29k.c \
+LDCSOURCES=ldlang.c ldctor.c ldindr.c ldmain.c ldwrite.c ldwarn.c ldlnk960.c \
+ ldgld.c ldgld68k.c ldm88k.c ebmon29k.c \
ldgld960.c ldemul.c ldver.c ldmisc.c ldexp.c ldsym.c ldfile.c ldvanilla.c
GENERATED_SOURCES=ldgram.c ldlex.c ldgram.h
sed -e s/"<ldtarget>"/news/g -e s/"<arch>"/m68k/g \
-e s/"<target>"/news/g -e s/"<TARGET>"/NEWS/g <$(srcdir)/ldtemplate >$@
+i386aout.c: $(srcdir)/ldtemplate
+ sed -e s/"<ldtarget>"/i386aout/g -e s/"<arch>"/i386/g \
+ -e s/"<target>"/i386aout/g -e s/"<TARGET>"/I386AOUT/g <$(srcdir)/ldtemplate >$@
+
+
ebmon29k.c: $(srcdir)/ldtemplate
sed -e s/"<ldtarget>"/ebmon29k/g -e s/"<arch>"/a29k/g \
-e s/"gld<target>"/ebmon29k/g -e s/"GLD<TARGET>"/EBMON29K/g \
# The .c files for these are generated from ldtemplete.
ldgld.o: ./mkscript ldgld.x ldgld.xr ldgld.xu ldgld.xn ldgld.xN
news.o: ./mkscript news.x news.xr news.xu news.xn news.xN
+i386aout.o: ./mkscript i386aout.x i386aout.xr i386aout.xu i386aout.xn i386aout.xN
ebmon29k.o: ./mkscript ebmon29k.x ebmon29k.xr ebmon29k.xu \
ebmon29k.xn ebmon29k.xN
ldgld68k.o: ./mkscript ldgld68k.x ldgld68k.xr ldgld68k.xu \
ldm88kr.x:ldm88kr.sc
ldm88k.x:ldm88k.sc
news.x:news.sc
+i386aout.x:i386aout.sc
h8300hds.x:h8300hds.sc
h8300hds.o:h8300hds.c
ldgld68k.x:ldgld68k.sc
objdump:objdump.c
install: $(LD_PROG)
-# $(INSTALL_PROGRAM) ld.new $(libsubdir)/ld
- cp $(LD_PROG) $(bindir)/ld.new
- mv -f $(bindir)/ld.new $(bindir)/ld
+ $(INSTALL_PROGRAM) ld.new $(bindir)/ld
+# Something like the following might make sense for install, but doesn't work
+# - it is too fragile, depending on a gcc binary int the right place.
+# Perhaps using gcc/version.c might work?
+# # If $(gcclibdir) exists, install ld there, and put a link to it
+# # from $(bindir); otherwise put ld in $(bindir).
+# if ([ -x $(unsubdir)/../gcc$(subdir)/gcc -a -d $(gcclibdir) ]); then \
+# $(INSTALL_PROGRAM) ld.new $(gcclibdir)/ld; \
+# cd $(bindir); rm -f ld; ln -s $(gcclibdir)/ld ld; \
+# else \
+# $(INSTALL_PROGRAM) ld.new $(bindir)/ld; \
+# fi
#-----------------------------------------------------------------------------
# 'STANDARD' GNU/960 TARGETS BELOW THIS POINT
/* Copyright (C) 1991 Free Software Foundation, Inc.
+ Written by Steve Chamberlain steve@cygnus.com
This file is part of GLD, the Gnu Linker.
GLD 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 1, or (at your option)
+the Free Software Foundation; either version 2, or (at your option)
any later version.
GLD is distributed in the hope that it will be useful,
the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
/*
- * Written by Steve Chamberlain steve@cygnus.com
- *
* $Id$
*/
multiple_def_count = 0;
commons_pending = 0;
- config.magic_demand_paged = true ;
+ config.magic_demand_paged = true;
+ config.text_read_only = true;
config.make_executable = true;
if (emulation == (char *)NULL) {
emulation= DEFAULT_EMULATION;
info("%P%F: text marked read only, but no text section present");
}
found->flags |= SEC_READONLY;
- output_bfd->flags |= WP_TEXT;
}
- else {
- output_bfd->flags |= WP_TEXT;
- }
-
if (config.relocateable_output) {
- output_bfd->flags &= ~( D_PAGED);
- output_bfd->flags |= EXEC_P;
+ output_bfd->flags &= ~EXEC_P;
ldwrite();
bfd_close(output_bfd);
}
{
ldfile_open_file (entry);
+
#ifdef GNU960
if (gnu960_check_format(entry->the_bfd, bfd_object))
#else
Q_read_entry_symbols (entry->the_bfd, entry);
+
+ /* look through the sections in the file and see if any of them
+ are constructors */
+ ldlang_check_for_constructors (entry);
+
Q_enter_file_symbols (entry);
}
#ifdef GNU960