Add s390 backend.

elfcpp/
	* s390.h: New file.

gold/
	* s390.cc: New file.
	* Makefile.am (TARGETSOURCES): Add s390.cc.
	(ALL_TARGETOBJS): Add s390.o.
	* Makefile.in: Regenerate.
	* configure.ac: Add s390 support.
	* configure: Regenerate.
	* configure.tgt: Add s390-*-* and s390x-*-*.
	* testsuite/icf_safe_test.sh (arch_specific_safe_fold): Add s390
	support.
This commit is contained in:
Marcin Kościelnicki 2015-10-05 16:57:13 +02:00 committed by Cary Coutant
parent 6f97897dbe
commit e79a4bad70
10 changed files with 4502 additions and 7 deletions

View File

@ -1,3 +1,7 @@
2015-10-28 Marcin Kościelnicki <koriakin@0x04.net>
* s390.h: New file.
2015-10-22 H.J. Lu <hongjiu.lu@intel.com>
* x86_64.h (R_X86_64_GOTPCRELX): New.

118
elfcpp/s390.h Normal file
View File

@ -0,0 +1,118 @@
// s390.h -- ELF definitions specific to EM_S390 -*- C++ -*-
// Copyright (C) 2015 Free Software Foundation, Inc.
// Written by Marcin Kościelnicki <koriakin@0x04.net>.
// This file is part of elfcpp.
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public License
// as published by the Free Software Foundation; either version 2, or
// (at your option) any later version.
// In addition to the permissions in the GNU Library General Public
// License, the Free Software Foundation gives you unlimited
// permission to link the compiled version of this file into
// combinations with other programs, and to distribute those
// combinations without any restriction coming from the use of this
// file. (The Library Public License restrictions do apply in other
// respects; for example, they cover modification of the file, and
/// distribution when not linked into a combined executable.)
// 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
// Library General Public License for more details.
// You should have received a copy of the GNU Library 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.
#ifndef ELFCPP_S390_H
#define ELFCPP_S390_H
namespace elfcpp
{
enum
{
// Original 31-bit ABI.
R_390_NONE = 0, // No reloc.
R_390_8 = 1, // Direct 8 bit.
R_390_12 = 2, // Direct 12 bit.
R_390_16 = 3, // Direct 16 bit.
R_390_32 = 4, // Direct 32 bit.
R_390_PC32 = 5, // PC relative 32 bit.
R_390_GOT12 = 6, // 12 bit GOT offset.
R_390_GOT32 = 7, // 32 bit GOT offset.
R_390_PLT32 = 8, // 32 bit PC relative PLT address.
R_390_COPY = 9, // Copy symbol at runtime.
R_390_GLOB_DAT = 10, // Create GOT entry.
R_390_JMP_SLOT = 11, // Create PLT entry.
R_390_RELATIVE = 12, // Adjust by program base.
R_390_GOTOFF32 = 13, // 32 bit offset to GOT.
R_390_GOTPC = 14, // 32 bit PC relative offset to GOT.
R_390_GOT16 = 15, // 16 bit GOT offset.
R_390_PC16 = 16, // PC relative 16 bit.
R_390_PC16DBL = 17, // PC relative 16 bit shifted by 1.
R_390_PLT16DBL = 18, // 16 bit PC rel. PLT shifted by 1.
// New 64-bit ABI.
R_390_PC32DBL = 19, // PC relative 32 bit shifted by 1.
R_390_PLT32DBL = 20, // 32 bit PC rel. PLT shifted by 1.
R_390_GOTPCDBL = 21, // 32 bit PC rel. GOT shifted by 1.
R_390_64 = 22, // Direct 64 bit.
R_390_PC64 = 23, // PC relative 64 bit.
R_390_GOT64 = 24, // 64 bit GOT offset.
R_390_PLT64 = 25, // 64 bit PC relative PLT address.
R_390_GOTENT = 26, // 32 bit PC rel. to GOT entry >> 1.
// Extensions.
R_390_GOTOFF16 = 27, // 16 bit offset to GOT.
R_390_GOTOFF64 = 28, // 64 bit offset to GOT.
R_390_GOTPLT12 = 29, // 12 bit offset to jump slot.
R_390_GOTPLT16 = 30, // 16 bit offset to jump slot.
R_390_GOTPLT32 = 31, // 32 bit offset to jump slot.
R_390_GOTPLT64 = 32, // 64 bit offset to jump slot.
R_390_GOTPLTENT = 33, // 32 bit rel. offset to jump slot.
R_390_PLTOFF16 = 34, // 16 bit offset from GOT to PLT.
R_390_PLTOFF32 = 35, // 32 bit offset from GOT to PLT.
R_390_PLTOFF64 = 36, // 16 bit offset from GOT to PLT.
// TLS extensions.
R_390_TLS_LOAD = 37, // Tag for load insn in TLS code.
R_390_TLS_GDCALL = 38, // Tag for function call in general dynamic TLS code.
R_390_TLS_LDCALL = 39, // Tag for function call in local dynamic TLS code.
R_390_TLS_GD32 = 40, // Direct 32 bit for general dynamic thread local data.
R_390_TLS_GD64 = 41, // Direct 64 bit for general dynamic thread local data.
R_390_TLS_GOTIE12 = 42, // 12 bit GOT offset for static TLS block offset.
R_390_TLS_GOTIE32 = 43, // 32 bit GOT offset for static TLS block offset.
R_390_TLS_GOTIE64 = 44, // 64 bit GOT offset for static TLS block offset.
R_390_TLS_LDM32 = 45, // Direct 32 bit for local dynamic thread local data in LD code.
R_390_TLS_LDM64 = 46, // Direct 64 bit for local dynamic thread local data in LD code.
R_390_TLS_IE32 = 47, // 32 bit address of GOT entry for negated static TLS block offset.
R_390_TLS_IE64 = 48, // 64 bit address of GOT entry for negated static TLS block offset.
R_390_TLS_IEENT = 49, // 32 bit rel. offset to GOT entry for negated static TLS block offset.
R_390_TLS_LE32 = 50, // 32 bit negated offset relative to static TLS block.
R_390_TLS_LE64 = 51, // 64 bit negated offset relative to static TLS block.
R_390_TLS_LDO32 = 52, // 32 bit offset relative to TLS block.
R_390_TLS_LDO64 = 53, // 64 bit offset relative to TLS block.
R_390_TLS_DTPMOD = 54, // ID of module containing symbol.
R_390_TLS_DTPOFF = 55, // Offset in TLS block.
R_390_TLS_TPOFF = 56, // Negate offset in static TLS block.
// Yet more misc extensions.
R_390_20 = 57, // Direct 20 bit.
R_390_GOT20 = 58, // 20 bit GOT offset.
R_390_GOTPLT20 = 59, // 20 bit offset to jump slot.
R_390_TLS_GOTIE20 = 60, // 20 bit GOT offset for static TLS block offset.
R_390_IRELATIVE = 61, // IFUNC relocation.
R_390_PC12DBL = 62, // PC relative 12 bit shifted by 1.
R_390_PLT12DBL = 63, // 12 bit PC rel. PLT shifted by 1.
R_390_PC24DBL = 64, // PC relative 24 bit shifted by 1.
R_390_PLT24DBL = 65, // 24 bit PC rel. PLT shifted by 1.
// GNU vtable garbage collection extensions.
R_390_GNU_VTINHERIT = 250,
R_390_GNU_VTENTRY = 251,
};
} // End namespace elfcpp.
#endif // !defined(ELFCPP_S390_H)

View File

@ -1,3 +1,15 @@
2015-10-28 Marcin Kościelnicki <koriakin@0x04.net>
* s390.cc: New file.
* Makefile.am (TARGETSOURCES): Add s390.cc.
(ALL_TARGETOBJS): Add s390.o.
* Makefile.in: Regenerate.
* configure.ac: Add s390 support.
* configure: Regenerate.
* configure.tgt: Add s390-*-* and s390x-*-*.
* testsuite/icf_safe_test.sh (arch_specific_safe_fold): Add s390
support.
2015-10-28 Marcin Kościelnicki <koriakin@0x04.net>
* archive.cc (Archive::sym64name): New const.

View File

@ -173,12 +173,13 @@ diststuff: $(EXTRA_DIST)
TARGETSOURCES = \
i386.cc x86_64.cc sparc.cc powerpc.cc arm.cc arm-reloc-property.cc tilegx.cc \
mips.cc aarch64.cc aarch64-reloc-property.cc
mips.cc aarch64.cc aarch64-reloc-property.cc s390.cc
ALL_TARGETOBJS = \
i386.$(OBJEXT) x86_64.$(OBJEXT) sparc.$(OBJEXT) powerpc.$(OBJEXT) \
arm.$(OBJEXT) arm-reloc-property.$(OBJEXT) tilegx.$(OBJEXT) \
mips.$(OBJEXT) aarch64.$(OBJEXT) aarch64-reloc-property.$(OBJEXT)
mips.$(OBJEXT) aarch64.$(OBJEXT) aarch64-reloc-property.$(OBJEXT) \
s390.$(OBJEXT)
libgold_a_SOURCES = $(CCFILES) $(HFILES) $(YFILES) $(DEFFILES)
libgold_a_LIBADD = $(LIBOBJS)

View File

@ -70,8 +70,8 @@ subdir = .
DIST_COMMON = NEWS README ChangeLog $(srcdir)/Makefile.in \
$(srcdir)/Makefile.am $(top_srcdir)/configure \
$(am__configure_deps) $(srcdir)/config.in \
$(srcdir)/../mkinstalldirs $(top_srcdir)/po/Make-in mremap.c \
pread.c ffsll.c ftruncate.c yyscript.h yyscript.c \
$(srcdir)/../mkinstalldirs $(top_srcdir)/po/Make-in pread.c \
ffsll.c ftruncate.c mremap.c yyscript.h yyscript.c \
$(srcdir)/../depcomp $(srcdir)/../ylwrap
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/../config/depstand.m4 \
@ -543,12 +543,13 @@ DEFFILES = arm-reloc.def aarch64-reloc.def
EXTRA_DIST = yyscript.c yyscript.h
TARGETSOURCES = \
i386.cc x86_64.cc sparc.cc powerpc.cc arm.cc arm-reloc-property.cc tilegx.cc \
mips.cc aarch64.cc aarch64-reloc-property.cc
mips.cc aarch64.cc aarch64-reloc-property.cc s390.cc
ALL_TARGETOBJS = \
i386.$(OBJEXT) x86_64.$(OBJEXT) sparc.$(OBJEXT) powerpc.$(OBJEXT) \
arm.$(OBJEXT) arm-reloc-property.$(OBJEXT) tilegx.$(OBJEXT) \
mips.$(OBJEXT) aarch64.$(OBJEXT) aarch64-reloc-property.$(OBJEXT)
mips.$(OBJEXT) aarch64.$(OBJEXT) aarch64-reloc-property.$(OBJEXT) \
s390.$(OBJEXT)
libgold_a_SOURCES = $(CCFILES) $(HFILES) $(YFILES) $(DEFFILES)
libgold_a_LIBADD = $(LIBOBJS)
@ -818,6 +819,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/reduced_debug_output.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/reloc.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/resolve.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/s390.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/script-sections.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/script.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sparc.Po@am__quote@

15
gold/configure vendored
View File

@ -692,6 +692,8 @@ DEFAULT_TARGET_X32_FALSE
DEFAULT_TARGET_X32_TRUE
DEFAULT_TARGET_X86_64_FALSE
DEFAULT_TARGET_X86_64_TRUE
DEFAULT_TARGET_S390_FALSE
DEFAULT_TARGET_S390_TRUE
DEFAULT_TARGET_SPARC_FALSE
DEFAULT_TARGET_SPARC_TRUE
DEFAULT_TARGET_POWERPC_FALSE
@ -3477,6 +3479,14 @@ else
DEFAULT_TARGET_SPARC_FALSE=
fi
if test "$targ_obj" = "s390"; then
DEFAULT_TARGET_S390_TRUE=
DEFAULT_TARGET_S390_FALSE='#'
else
DEFAULT_TARGET_S390_TRUE='#'
DEFAULT_TARGET_S390_FALSE=
fi
target_x86_64=no
target_x32=no
if test "$targ_obj" = "x86_64"; then
@ -6328,6 +6338,7 @@ fi
powerpc*) false;;
x86_64) false;;
sparc64) false;;
s390x) false;;
*) true;;
esac; then
FN_PTRS_IN_SO_WITHOUT_PIC_TRUE=
@ -7755,6 +7766,10 @@ if test -z "${DEFAULT_TARGET_SPARC_TRUE}" && test -z "${DEFAULT_TARGET_SPARC_FAL
as_fn_error "conditional \"DEFAULT_TARGET_SPARC\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
if test -z "${DEFAULT_TARGET_S390_TRUE}" && test -z "${DEFAULT_TARGET_S390_FALSE}"; then
as_fn_error "conditional \"DEFAULT_TARGET_S390\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
if test -z "${DEFAULT_TARGET_X86_64_TRUE}" && test -z "${DEFAULT_TARGET_X86_64_FALSE}"; then
as_fn_error "conditional \"DEFAULT_TARGET_X86_64\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5

View File

@ -204,6 +204,7 @@ for targ in $target $canon_targets; do
AM_CONDITIONAL(DEFAULT_TARGET_I386, test "$targ_obj" = "i386")
AM_CONDITIONAL(DEFAULT_TARGET_POWERPC, test "$targ_obj" = "powerpc")
AM_CONDITIONAL(DEFAULT_TARGET_SPARC, test "$targ_obj" = "sparc")
AM_CONDITIONAL(DEFAULT_TARGET_S390, test "$targ_obj" = "s390")
target_x86_64=no
target_x32=no
if test "$targ_obj" = "x86_64"; then
@ -331,6 +332,7 @@ AM_CONDITIONAL(FN_PTRS_IN_SO_WITHOUT_PIC, [
powerpc*) false;;
x86_64) false;;
sparc64) false;;
s390x) false;;
*) true;;
esac])

View File

@ -167,6 +167,20 @@ mips*-*-*)
targ_big_endian=true
targ_extra_big_endian=false
;;
s390-*-*)
targ_obj=s390
targ_machine=EM_S390
targ_size=32
targ_big_endian=true
targ_extra_big_endian=false
;;
s390x-*-*)
targ_obj=s390
targ_machine=EM_S390
targ_size=64
targ_big_endian=true
targ_extra_big_endian=false
;;
*)
targ_obj=UNKNOWN
;;

4327
gold/s390.cc Normal file

File diff suppressed because it is too large Load Diff

View File

@ -57,7 +57,7 @@ END {
arch_specific_safe_fold()
{
grep_x86=`grep -q -e "Advanced Micro Devices X86-64" -e "Intel 80386" -e "ARM" -e "TILE" -e "PowerPC" -e "AArch64" $2`
grep_x86=`grep -q -e "Advanced Micro Devices X86-64" -e "Intel 80386" -e "ARM" -e "TILE" -e "PowerPC" -e "AArch64" -e "IBM S/390" $2`
if [ $? -eq 0 ];
then
check_fold $3 $4 $5