aboutsummaryrefslogtreecommitdiff
path: root/ld
diff options
context:
space:
mode:
Diffstat (limited to 'ld')
-rw-r--r--ld/Makefile.in1
-rw-r--r--ld/emulparams/elf64_s390.sh1
-rw-r--r--ld/emultempl/s390.em64
-rw-r--r--ld/gen-doc.texi1
-rw-r--r--ld/ld.texinfo31
5 files changed, 98 insertions, 0 deletions
diff --git a/ld/Makefile.in b/ld/Makefile.in
index 5e66e02..ba25177 100644
--- a/ld/Makefile.in
+++ b/ld/Makefile.in
@@ -3502,6 +3502,7 @@ eelf64_ia64_vms.c: $(srcdir)/emulparams/elf64_ia64_vms.sh \
$(srcdir)/scripttempl/ia64vms.sc ${GEN_DEPENDS}
eelf64_s390.c: $(srcdir)/emulparams/elf64_s390.sh \
+ $(srcdir)/emultempl/s390.em \
$(ELF_DEPS) $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
eelf64_sparc.c: $(srcdir)/emulparams/elf64_sparc.sh \
diff --git a/ld/emulparams/elf64_s390.sh b/ld/emulparams/elf64_s390.sh
index fc9f06a..5309774 100644
--- a/ld/emulparams/elf64_s390.sh
+++ b/ld/emulparams/elf64_s390.sh
@@ -12,6 +12,7 @@ TEMPLATE_NAME=elf32
GENERATE_SHLIB_SCRIPT=yes
GENERATE_PIE_SCRIPT=yes
NO_SMALL_DATA=yes
+EXTRA_EM_FILE=s390
IREL_IN_PLT=
# Treat a host that matches the target with the possible exception of "x"
diff --git a/ld/emultempl/s390.em b/ld/emultempl/s390.em
new file mode 100644
index 0000000..536104e
--- /dev/null
+++ b/ld/emultempl/s390.em
@@ -0,0 +1,64 @@
+# This shell script emits a C file. -*- C -*-
+# Copyright (C) 2017 Free Software Foundation, Inc.
+#
+# This file is part of the GNU Binutils.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the license, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; see the file COPYING3. If not,
+# see <http://www.gnu.org/licenses/>.
+#
+
+# This file is sourced from elf-generic.em, and defines S/390
+# specific routines.
+#
+fragment <<EOF
+
+#include "ldctor.h"
+#include "elf-s390.h"
+
+static struct s390_elf_params params = { 0 };
+
+/* This is a convenient point to tell BFD about target specific flags.
+ After the output has been created, but before inputs are read. */
+static void
+s390_elf_create_output_section_statements (void)
+{
+ if (!bfd_elf_s390_set_options (&link_info, &params))
+ einfo ("%F%P: can not init BFD: %E\n");
+}
+
+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_PGSTE 301
+'
+
+PARSE_AND_LIST_LONGOPTS='
+ { "s390-pgste", no_argument, NULL, OPTION_PGSTE},
+'
+
+PARSE_AND_LIST_OPTIONS='
+ fprintf (file, _(" --s390-pgste Tell the kernel to "
+ "allocate 4k page tables\n"));
+'
+
+PARSE_AND_LIST_ARGS_CASES='
+ case OPTION_PGSTE:
+ params.pgste = 1;
+ break;
+'
+
+LDEMUL_CREATE_OUTPUT_SECTION_STATEMENTS=s390_elf_create_output_section_statements
diff --git a/ld/gen-doc.texi b/ld/gen-doc.texi
index 27b8198..6b31a6b 100644
--- a/ld/gen-doc.texi
+++ b/ld/gen-doc.texi
@@ -21,6 +21,7 @@
@set POWERPC
@set POWERPC64
@set Renesas
+@set S/390
@set SPU
@set TICOFF
@set WIN32
diff --git a/ld/ld.texinfo b/ld/ld.texinfo
index 77b5d3e..bb5f719 100644
--- a/ld/ld.texinfo
+++ b/ld/ld.texinfo
@@ -34,6 +34,7 @@
@set POWERPC
@set POWERPC64
@set Renesas
+@set S/390
@set SPU
@set TICOFF
@set WIN32
@@ -158,6 +159,9 @@ in the section entitled ``GNU Free Documentation License''.
@ifset POWERPC64
* PowerPC64 ELF64:: ld and PowerPC64 64-bit ELF Support
@end ifset
+@ifset S/390
+* S/390 ELF:: ld and S/390 ELF Support
+@end ifset
@ifset SPU
* SPU ELF:: ld and SPU ELF Support
@end ifset
@@ -6565,6 +6569,9 @@ functionality are not listed.
@ifset POWERPC64
* PowerPC64 ELF64:: @command{ld} and PowerPC64 64-bit ELF Support
@end ifset
+@ifset S/390
+* S/390 ELF:: @command{ld} and S/390 ELF Support
+@end ifset
@ifset SPU
* SPU ELF:: @command{ld} and SPU ELF Support
@end ifset
@@ -7600,6 +7607,30 @@ default behaviour.
@end ifclear
@end ifset
+@ifset S/390
+@ifclear GENERIC
+@raisesections
+@end ifclear
+
+@node S/390 ELF
+@section @command{ld} and S/390 ELF Support
+
+@cindex S/390 ELF options
+@table @option
+
+@cindex S/390
+@kindex --s390-pgste
+@item --s390-pgste
+This option marks the result file with a @code{PT_S390_PGSTE}
+segment. The Linux kernel is supposed to allocate 4k page tables for
+binaries marked that way.
+@end table
+
+@ifclear GENERIC
+@lowersections
+@end ifclear
+@end ifset
+
@ifset SPU
@ifclear GENERIC
@raisesections