From f9e6bfa8dc4c36c9fb0550eecfad6cbcfc4916a9 Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Tue, 18 Feb 2003 06:05:07 +0000 Subject: [PATCH] * emultempl/ppc32elf.em: New file. * emulparams/elf32ppc.sh (EXTRA_EM_FILE): Define. * Makefile.am (eelf32lppc.c): Depend on emultempl/ppc32elf.em. (eelf32lppcnto.c): Likewise. (eelf32lppcsim.c): Likewise. (eelf32ppcnto.c): Likewise. (eelf32ppc.c): Likewise. (eelf32ppc_fbsd.c): Likewise. (eelf32ppcsim.c): Likewise. (eelf32ppclinux.c): Likewise. --- ld/ChangeLog | 14 +++++++ ld/Makefile.am | 15 +++---- ld/Makefile.in | 25 ++++++------ ld/emulparams/elf32ppc.sh | 1 + ld/emultempl/ppc32elf.em | 84 +++++++++++++++++++++++++++++++++++++++ 5 files changed, 120 insertions(+), 19 deletions(-) create mode 100644 ld/emultempl/ppc32elf.em diff --git a/ld/ChangeLog b/ld/ChangeLog index bd11d0d459..eab0eed713 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,17 @@ +2003-02-18 Alan Modra + + * emultempl/ppc32elf.em: New file. + * emulparams/elf32ppc.sh (EXTRA_EM_FILE): Define. + * Makefile.am (eelf32lppc.c): Depend on emultempl/ppc32elf.em. + (eelf32lppcnto.c): Likewise. + (eelf32lppcsim.c): Likewise. + (eelf32ppcnto.c): Likewise. + (eelf32ppc.c): Likewise. + (eelf32ppc_fbsd.c): Likewise. + (eelf32ppcsim.c): Likewise. + (eelf32ppclinux.c): Likewise. + * Makefile.in: Regenerate. + 2003-02-18 Alan Modra * ld.texinfo: Remove spaces between @samp and opening brace. diff --git a/ld/Makefile.am b/ld/Makefile.am index 9339091c13..49efe9c688 100644 --- a/ld/Makefile.am +++ b/ld/Makefile.am @@ -654,19 +654,20 @@ eelf32lmip.c: $(srcdir)/emulparams/elf32lmip.sh \ $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} ${GENSCRIPTS} elf32lmip "$(tdir_elf32lmip)" eelf32lppc.c: $(srcdir)/emulparams/elf32lppc.sh \ - $(srcdir)/emulparams/elf32ppc.sh \ + $(srcdir)/emulparams/elf32ppc.sh $(srcdir)/emultempl/ppc32elf.em \ $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} ${GENSCRIPTS} elf32lppc "$(tdir_elf32lppc)" eelf32lppcnto.c: $(srcdir)/emulparams/elf32lppcnto.sh \ - $(srcdir)/emulparams/elf32ppc.sh \ + $(srcdir)/emulparams/elf32ppc.sh $(srcdir)/emultempl/ppc32elf.em \ $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} ${GENSCRIPTS} elf32lppcnto "$(tdir_elf32lppcnto)" eelf32lppcsim.c: $(srcdir)/emulparams/elf32lppcsim.sh \ $(srcdir)/emulparams/elf32lppc.sh $(srcdir)/emulparams/elf32ppc.sh \ + $(srcdir)/emultempl/ppc32elf.em \ $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} ${GENSCRIPTS} elf32lppcsim "$(tdir_elf32lppcsim)" eelf32ppcnto.c: $(srcdir)/emulparams/elf32ppcnto.sh \ - $(srcdir)/emulparams/elf32ppc.sh \ + $(srcdir)/emulparams/elf32ppc.sh $(srcdir)/emultempl/ppc32elf.em \ $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} ${GENSCRIPTS} elf32ppcnto "$(tdir_elf32ppcnto)" eelf32ppcwindiss.c: $(srcdir)/emulparams/elf32ppcwindiss.sh \ @@ -679,19 +680,19 @@ eelf32lsmip.c: $(srcdir)/emulparams/elf32lsmip.sh \ eelf32openrisc.c: $(srcdir)/emulparams/elf32openrisc.sh \ $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} ${GENSCRIPTS} elf32openrisc "$(tdir_openrisc)" -eelf32ppc.c: $(srcdir)/emulparams/elf32ppc.sh \ +eelf32ppc.c: $(srcdir)/emulparams/elf32ppc.sh $(srcdir)/emultempl/ppc32elf.em \ $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} ${GENSCRIPTS} elf32ppc "$(tdir_elf32ppc)" eelf32ppc_fbsd.c: $(srcdir)/emulparams/elf32ppc_fbsd.sh \ - $(srcdir)/emulparams/elf32ppc.sh \ + $(srcdir)/emulparams/elf32ppc.sh $(srcdir)/emultempl/ppc32elf.em \ $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} ${GENSCRIPTS} elf32ppc_fbsd "$(tdir_elf32ppc_fbsd)" eelf32ppcsim.c: $(srcdir)/emulparams/elf32ppcsim.sh \ - $(srcdir)/emulparams/elf32ppc.sh \ + $(srcdir)/emulparams/elf32ppc.sh $(srcdir)/emultempl/ppc32elf.em \ $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} ${GENSCRIPTS} elf32ppcsim "$(tdir_elf32ppcsim)" eelf32ppclinux.c: $(srcdir)/emulparams/elf32ppclinux.sh \ - $(srcdir)/emulparams/elf32ppc.sh \ + $(srcdir)/emulparams/elf32ppc.sh $(srcdir)/emultempl/ppc32elf.em \ $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} ${GENSCRIPTS} elf32ppclinux "$(tdir_elf32ppclinux)" eelf64ppc.c: $(srcdir)/emulparams/elf64ppc.sh $(srcdir)/emultempl/ppc64elf.em \ diff --git a/ld/Makefile.in b/ld/Makefile.in index 8875db2a93..94af6574ae 100644 --- a/ld/Makefile.in +++ b/ld/Makefile.in @@ -1,6 +1,6 @@ -# Makefile.in generated automatically by automake 1.4 from Makefile.am +# Makefile.in generated automatically by automake 1.4-p6 from Makefile.am -# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc. +# Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -771,7 +771,7 @@ uninstall-info: else ii=; fi; \ list='$(INFO_DEPS)'; \ for file in $$list; do \ - test -z "$ii" \ + test -z "$$ii" \ || install-info --info-dir=$(DESTDIR)$(infodir) --remove $$file; \ done @$(NORMAL_UNINSTALL) @@ -884,7 +884,7 @@ maintainer-clean-recursive: dot_seen=no; \ rev=''; list='$(SUBDIRS)'; for subdir in $$list; do \ rev="$$subdir $$rev"; \ - test "$$subdir" = "." && dot_seen=yes; \ + test "$$subdir" != "." || dot_seen=yes; \ done; \ test "$$dot_seen" = "no" && rev=". $$rev"; \ target=`echo $@ | sed s/-recursive//`; \ @@ -1065,7 +1065,7 @@ distclean-generic: -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) maintainer-clean-generic: - -test -z "ldlexldeffilephdeffilepcldgramhldgramc$(MAINTAINERCLEANFILES)" || rm -f ldlexl deffileph deffilepc ldgramh ldgramc $(MAINTAINERCLEANFILES) + -test -z "ldlex.cdeffilep.hdeffilep.cldgram.hldgram.c$(MAINTAINERCLEANFILES)" || rm -f ldlex.c deffilep.h deffilep.c ldgram.h ldgram.c $(MAINTAINERCLEANFILES) mostlyclean-am: mostlyclean-hdr mostlyclean-noinstPROGRAMS \ mostlyclean-compile mostlyclean-libtool \ mostlyclean-aminfo mostlyclean-tags mostlyclean-generic \ @@ -1380,19 +1380,20 @@ eelf32lmip.c: $(srcdir)/emulparams/elf32lmip.sh \ $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} ${GENSCRIPTS} elf32lmip "$(tdir_elf32lmip)" eelf32lppc.c: $(srcdir)/emulparams/elf32lppc.sh \ - $(srcdir)/emulparams/elf32ppc.sh \ + $(srcdir)/emulparams/elf32ppc.sh $(srcdir)/emultempl/ppc32elf.em \ $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} ${GENSCRIPTS} elf32lppc "$(tdir_elf32lppc)" eelf32lppcnto.c: $(srcdir)/emulparams/elf32lppcnto.sh \ - $(srcdir)/emulparams/elf32ppc.sh \ + $(srcdir)/emulparams/elf32ppc.sh $(srcdir)/emultempl/ppc32elf.em \ $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} ${GENSCRIPTS} elf32lppcnto "$(tdir_elf32lppcnto)" eelf32lppcsim.c: $(srcdir)/emulparams/elf32lppcsim.sh \ $(srcdir)/emulparams/elf32lppc.sh $(srcdir)/emulparams/elf32ppc.sh \ + $(srcdir)/emultempl/ppc32elf.em \ $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} ${GENSCRIPTS} elf32lppcsim "$(tdir_elf32lppcsim)" eelf32ppcnto.c: $(srcdir)/emulparams/elf32ppcnto.sh \ - $(srcdir)/emulparams/elf32ppc.sh \ + $(srcdir)/emulparams/elf32ppc.sh $(srcdir)/emultempl/ppc32elf.em \ $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} ${GENSCRIPTS} elf32ppcnto "$(tdir_elf32ppcnto)" eelf32ppcwindiss.c: $(srcdir)/emulparams/elf32ppcwindiss.sh \ @@ -1405,19 +1406,19 @@ eelf32lsmip.c: $(srcdir)/emulparams/elf32lsmip.sh \ eelf32openrisc.c: $(srcdir)/emulparams/elf32openrisc.sh \ $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} ${GENSCRIPTS} elf32openrisc "$(tdir_openrisc)" -eelf32ppc.c: $(srcdir)/emulparams/elf32ppc.sh \ +eelf32ppc.c: $(srcdir)/emulparams/elf32ppc.sh $(srcdir)/emultempl/ppc32elf.em \ $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} ${GENSCRIPTS} elf32ppc "$(tdir_elf32ppc)" eelf32ppc_fbsd.c: $(srcdir)/emulparams/elf32ppc_fbsd.sh \ - $(srcdir)/emulparams/elf32ppc.sh \ + $(srcdir)/emulparams/elf32ppc.sh $(srcdir)/emultempl/ppc32elf.em \ $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} ${GENSCRIPTS} elf32ppc_fbsd "$(tdir_elf32ppc_fbsd)" eelf32ppcsim.c: $(srcdir)/emulparams/elf32ppcsim.sh \ - $(srcdir)/emulparams/elf32ppc.sh \ + $(srcdir)/emulparams/elf32ppc.sh $(srcdir)/emultempl/ppc32elf.em \ $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} ${GENSCRIPTS} elf32ppcsim "$(tdir_elf32ppcsim)" eelf32ppclinux.c: $(srcdir)/emulparams/elf32ppclinux.sh \ - $(srcdir)/emulparams/elf32ppc.sh \ + $(srcdir)/emulparams/elf32ppc.sh $(srcdir)/emultempl/ppc32elf.em \ $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} ${GENSCRIPTS} elf32ppclinux "$(tdir_elf32ppclinux)" eelf64ppc.c: $(srcdir)/emulparams/elf64ppc.sh $(srcdir)/emultempl/ppc64elf.em \ diff --git a/ld/emulparams/elf32ppc.sh b/ld/emulparams/elf32ppc.sh index f0fb0050dd..d2d704135a 100644 --- a/ld/emulparams/elf32ppc.sh +++ b/ld/emulparams/elf32ppc.sh @@ -2,6 +2,7 @@ # elf32lppc.sh elf32ppclinux.sh elf32ppcsim.sh TEMPLATE_NAME=elf32 +EXTRA_EM_FILE=ppc32elf GENERATE_SHLIB_SCRIPT=yes SCRIPT_NAME=elf OUTPUT_FORMAT="elf32-powerpc" diff --git a/ld/emultempl/ppc32elf.em b/ld/emultempl/ppc32elf.em new file mode 100644 index 0000000000..5629f286c1 --- /dev/null +++ b/ld/emultempl/ppc32elf.em @@ -0,0 +1,84 @@ +# This shell script emits a C file. -*- C -*- +# Copyright 2003 Free Software Foundation, Inc. +# +# This file is part of GLD, the Gnu Linker. +# +# 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# + +# This file is sourced from elf32.em, and defines extra powerpc64-elf +# specific routines. +# +cat >>e${EMULATION_NAME}.c <creator == &bfd_elf32_powerpc_vec + || link_info.hash->creator == &bfd_elf32_powerpcle_vec) + { + if (ppc_elf_tls_setup (output_bfd, &link_info) && !notlsopt) + { + if (!ppc_elf_tls_optimize (output_bfd, &link_info)) + { + einfo ("%X%P: TLS problem %E\n"); + return; + } + } + } + gld${EMULATION_NAME}_before_allocation (); +} + +EOF + +# Define some shell vars to insert bits of code into the standard elf +# parse_args and list_options functions. +# +PARSE_AND_LIST_PROLOGUE=' +#define OPTION_NO_TLS_OPT 301 +' + +# The options are repeated below so that no abbreviations are allowed. +PARSE_AND_LIST_LONGOPTS=' + { "no-tls-optimize", no_argument, NULL, OPTION_NO_TLS_OPT }, + { "no-tls-optimize", no_argument, NULL, OPTION_NO_TLS_OPT }, +' + +PARSE_AND_LIST_OPTIONS=' + fprintf (file, _("\ + --no-tls-optimize Don'\''t try to optimize TLS accesses.\n" + )); +' + +PARSE_AND_LIST_ARGS_CASES=' + case OPTION_NO_TLS_OPT: + notlsopt = 1; + break; +' + +# Put these extra ppc64elf routines in ld_${EMULATION_NAME}_emulation +# +LDEMUL_BEFORE_ALLOCATION=ppc_before_allocation