binutils-gdb/ld/testsuite
Andreas Krebbel afca762f59 S/390: Improve partial relro support for 64 bit
Currently on S/390 the .got.plt always comes first which prevents the
GNU_RELRO segment from being extended across the non-plt GOT entries.

Just swapping both unfortunately is not that simple since our ABI
requires the _GLOBAL_OFFSET_TABLE_ symbol to point to the very
beginning of the entire GOT. Of the 3 magic GOT entries the first is
accessed via got pointer while second and third are being accessed via
DT_PLTGOT.  In order to keep them together we make DT_PLTGOT to point
to the .got instead of .got.plt.  However, this violates an assumption
in the dynamic linker prelink undo code about the GOTPLT entries
starting at DT_PLTGOT + 3.  We got rid of this requirement with a
Glibc patch already in version 2.24:
https://sourceware.org/ml/libc-alpha/2016-06/msg01302.html

So the S/390 relro GOT layout will look like this with this patch:

      +----------------------------------+
      |got[0]: DYNAMIC                   |   <--- _GLOBAL_OFFSET_TABLE_ == DT_PLTGOT .got
      |got[1]: link_map parm             |
      |got[2]: &_dl_runtime_resolve      |
      +----------------------------------+
      |                                  |   non-plt GOT entries
      |                                  |
      |                                  |
      +----------------------------------+
      |                                  |   <--- .gotplt, PLT GOT entries
      |                                  |
      |                                  |
      |                                  |
      +----------------------------------+

The patch detects the current layout in size_dynamic_section in order
to deal also with linker scripts not generated by this ld version.
With partial relro enabled we pick a linker script where .got and
.got.plt are swapped which then triggers the rest of the logic.

ld/ChangeLog:

2018-07-18  Andreas Krebbel  <krebbel@linux.ibm.com>

	* emulparams/elf64_s390.sh: Define GENERATE_RELRO_SCRIPT and
	SEPARATE_GOTPLT.
	* testsuite/ld-s390/gotreloc_64-relro-1.dd: New test.
	* testsuite/ld-s390/gotreloc_64-norelro-1.dd: Renamed from ...
	* testsuite/ld-s390/gotreloc_64-1.dd: ... this.
	* testsuite/ld-s390/s390.exp: Split the GOT testcase into two.

bfd/ChangeLog:

2018-07-18  Andreas Krebbel  <krebbel@linux.ibm.com>

	* elf-s390-common.c (s390_gotplt_after_got_p): New function.
	(s390_got_pointer): New function.
	(s390_got_offset): New function.
	(s390_gotplt_offset): New function.
	* elf64-s390.c (allocate_dynrelocs): Adjust comment.
	(elf_s390_size_dynamic_sections): Move space for magic GOT entries
	from .got.plt to .got if necessary and pick the right location for
	_GLOBAL_OFFSET_TABLE_.
	(elf_s390_relocate_section): Use the wrapper functions from
	elf-s390-common.c to deal with both possible layouts (either .got
	or .got.plt first).
	(elf_s390_finish_dynamic_sections): Likewise.
	(elf_s390_finish_dynamic_symbol): Make the location of the GOT
	magic entries conditional.
2018-07-18 13:20:06 +02:00
..
config ld: Skip unsupported static executable tests 2018-01-29 04:55:23 -08:00
ld-aarch64 [BFD][AARCH64]Properly truncate no overflow checking relocation value for load/store immediate. 2018-06-20 14:47:37 +01:00
ld-alpha Define various symbols conditionally in shared libraries 2018-06-08 20:17:34 +09:30
ld-arc ld error/warning messages 2018-02-26 10:51:12 +10:30
ld-arm [ARM] Update bfd's Tag_CPU_arch knowledge 2018-07-02 11:22:20 +01:00
ld-auto-import Update year range in copyright notice of binutils files 2018-01-03 17:49:56 +10:30
ld-avr Update year range in copyright notice of binutils files 2018-01-03 17:49:56 +10:30
ld-bootstrap Fix parens in ld bootstrap.exp 2018-06-26 21:28:05 +09:30
ld-cdtest Update year range in copyright notice of binutils files 2018-01-03 17:49:56 +10:30
ld-checks Update year range in copyright notice of binutils files 2018-01-03 17:49:56 +10:30
ld-cris ELF dynsyms 2018-06-14 11:32:01 +09:30
ld-crx Update year range in copyright notice of binutils files 2018-01-03 17:49:56 +10:30
ld-cygwin Update year range in copyright notice of binutils files 2018-01-03 17:49:56 +10:30
ld-d10v Update year range in copyright notice of binutils files 2018-01-03 17:49:56 +10:30
ld-discard xgate testsuite fixes 2018-07-10 23:59:59 +09:30
ld-elf Revise "ld testsuite use of notarget" 2018-07-11 16:39:04 +09:30
ld-elfcomm Remove sh5 and sh64 support 2018-04-16 15:29:39 +09:30
ld-elfvers various i386-aout and i386-coff target removal 2018-04-18 09:34:19 +09:30
ld-elfvsb various i386-aout and i386-coff target removal 2018-04-18 09:34:19 +09:30
ld-elfweak various i386-aout and i386-coff target removal 2018-04-18 09:34:19 +09:30
ld-fastcall Update year range in copyright notice of binutils files 2018-01-03 17:49:56 +10:30
ld-frv Define various symbols conditionally in shared libraries 2018-06-08 20:17:34 +09:30
ld-gc Revise "ld testsuite use of notarget" 2018-07-11 16:39:04 +09:30
ld-h8300 Remove h8300-coff support 2018-04-16 15:17:57 +09:30
ld-i386 x86: Remove x86 ISA properties with empty bits 2018-07-05 09:24:18 -07:00
ld-ia64 Define various symbols conditionally in shared libraries 2018-06-08 20:17:34 +09:30
ld-ifunc ld testsuite use of notarget 2018-07-10 23:58:29 +09:30
ld-libs Update year range in copyright notice of binutils files 2018-01-03 17:49:56 +10:30
ld-linkonce various i386-aout and i386-coff target removal 2018-04-18 09:34:19 +09:30
ld-m68hc11 Update year range in copyright notice of binutils files 2018-01-03 17:49:56 +10:30
ld-m68k Define various symbols conditionally in shared libraries 2018-06-08 20:17:34 +09:30
ld-mep Update year range in copyright notice of binutils files 2018-01-03 17:49:56 +10:30
ld-metag Define various symbols conditionally in shared libraries 2018-06-08 20:17:34 +09:30
ld-mips-elf MIPS/LD/testsuite: Correct mips-elf.exp test ABI/emul/endian arrangement 2018-07-12 20:01:44 +01:00
ld-misc ld testsuite use of notarget 2018-07-10 23:58:29 +09:30
ld-mmix ld error/warning messages 2018-02-26 10:51:12 +10:30
ld-mn10300 Update year range in copyright notice of binutils files 2018-01-03 17:49:56 +10:30
ld-msp430-elf Update year range in copyright notice of binutils files 2018-01-03 17:49:56 +10:30
ld-nds32 Update year range in copyright notice of binutils files 2018-01-03 17:49:56 +10:30
ld-nios2 Run more ld tests when not native 2017-01-02 23:48:08 +10:30
ld-pe ld testsuite use of notarget 2018-07-10 23:58:29 +09:30
ld-pie Update year range in copyright notice of binutils files 2018-01-03 17:49:56 +10:30
ld-plugin ld: Set non_ir_ref_regular for --undefined SYMBOL 2018-07-04 06:29:13 -07:00
ld-powerpc Error for mismatched powerpc ABI tags 2018-07-05 10:21:37 +09:30
ld-pru Fix binary compatibility between GCC and the TI compiler for the PRU target. 2018-05-09 11:39:32 +01:00
ld-riscv-elf RISC-V: Handle out-of-range calls to undefined weak. 2018-06-03 15:42:29 -07:00
ld-s12z Add support for the Freescale s12z processor. 2018-05-18 15:26:18 +01:00
ld-s390 S/390: Improve partial relro support for 64 bit 2018-07-18 13:20:06 +02:00
ld-scripts Revise "ld testsuite use of notarget" 2018-07-11 16:39:04 +09:30
ld-selective Remove sh5 and sh64 support 2018-04-16 15:29:39 +09:30
ld-sh Define various symbols conditionally in shared libraries 2018-06-08 20:17:34 +09:30
ld-shared various i386-aout and i386-coff target removal 2018-04-18 09:34:19 +09:30
ld-size various i386-aout and i386-coff target removal 2018-04-18 09:34:19 +09:30
ld-sparc Define various symbols conditionally in shared libraries 2018-06-08 20:17:34 +09:30
ld-spu Update year range in copyright notice of binutils files 2018-01-03 17:49:56 +10:30
ld-srec Remove sh5 and sh64 support 2018-04-16 15:29:39 +09:30
ld-tic6x ld: Adjust tic6x tests 2018-05-21 20:41:24 -07:00
ld-tilegx Update year range in copyright notice of binutils files 2018-01-03 17:49:56 +10:30
ld-tilepro Update year range in copyright notice of binutils files 2018-01-03 17:49:56 +10:30
ld-undefined [ARM] FDPIC: Update testsuite so that many tests pass with arm*-uclinuxfdpiceabi. 2018-04-25 21:13:14 +00:00
ld-unique ld testsuite use of notarget 2018-07-10 23:58:29 +09:30
ld-v850 Update year range in copyright notice of binutils files 2018-01-03 17:49:56 +10:30
ld-vax-elf Update year range in copyright notice of binutils files 2018-01-03 17:49:56 +10:30
ld-visium Update year range in copyright notice of binutils files 2018-01-03 17:49:56 +10:30
ld-vxworks Update year range in copyright notice of binutils files 2018-01-03 17:49:56 +10:30
ld-x86-64 x86: Remove x86 ISA properties with empty bits 2018-07-05 09:24:18 -07:00
ld-xc16x Update year range in copyright notice of binutils files 2018-01-03 17:49:56 +10:30
ld-xstormy16 Update year range in copyright notice of binutils files 2018-01-03 17:49:56 +10:30
ld-xtensa Update year range in copyright notice of binutils files 2018-01-03 17:49:56 +10:30
ld-z8k Update year range in copyright notice of binutils files 2018-01-03 17:49:56 +10:30
lib xgate testsuite fixes 2018-07-10 23:59:59 +09:30
ChangeLog-2004
ChangeLog-2005
ChangeLog-2006
ChangeLog-2007
ChangeLog-2008
ChangeLog-2009
ChangeLog-2010
ChangeLog-2011
ChangeLog-2012
ChangeLog-2013
ChangeLog-2014
ChangeLog-2015
ChangeLog-9303