Go to file
H.J. Lu 2f83249c13 elf: Remove the 1-page gap before the RELRO segment
The existing RELRO scheme may leave a 1-page gap before the RELRO segment
and align the end of the RELRO segment to the page size:

  [18] .eh_frame    PROGBITS    408fa0 008fa0 005e80 00   A  0   0  8
  [19] .init_array  INIT_ARRAY  410de0 00fde0 000008 08  WA  0   0  8
  [20] .fini_array  FINI_ARRAY  410de8 00fde8 000008 08  WA  0   0  8
  [21] .dynamic     DYNAMIC     410df0 00fdf0 000200 10  WA  7   0  8
  [22] .got         PROGBITS    410ff0 00fff0 000010 08  WA  0   0  8
  [23] .got.plt     PROGBITS    411000 010000 000048 08  WA  0   0  8

Instead, we can remove the 1-page gap if the maximum page size >= the
maximum section alignment:

  [18] .eh_frame    PROGBITS    408fa0 008fa0 005e80 00   A  0   0  8
  [19] .init_array  INIT_ARRAY  40fde0 00fde0 000008 08  WA  0   0  8
  [20] .fini_array  FINI_ARRAY  40fde8 00fde8 000008 08  WA  0   0  8
  [21] .dynamic     DYNAMIC     40fdf0 00fdf0 000200 10  WA  7   0  8
  [22] .got         PROGBITS    40fff0 00fff0 000010 08  WA  0   0  8
  [23] .got.plt     PROGBITS    410000 010000 000048 08  WA  0   0  8

Because the end of the RELRO segment is always aligned to the page size
and may not be moved, the RELRO segment size may be increased:

  [ 3] .dynstr      STRTAB      000148 000148 000001 00   A  0   0  1
  [ 4] .eh_frame    PROGBITS    000150 000150 000000 00   A  0   0  8
  [ 5] .init_array  INIT_ARRAY  200150 000150 000010 08  WA  0   0  1
  [ 6] .fini_array  FINI_ARRAY  200160 000160 000010 08  WA  0   0  1
  [ 7] .jcr         PROGBITS    200170 000170 000008 00  WA  0   0  1
  [ 8] .data.rel.ro PROGBITS    200180 000180 000020 00  WA  0   0 16
  [ 9] .dynamic     DYNAMIC     2001a0 0001a0 0001c0 10  WA  3   0  8
  [10] .got         PROGBITS    200360 000360 0002a8 00  WA  0   0  8
  [11] .bss         NOBITS      201000 000608 000840 00  WA  0   0  1

vs the old section layout:

  [ 3] .dynstr      STRTAB      000148 000148 000001 00   A  0   0  1
  [ 4] .eh_frame    PROGBITS    000150 000150 000000 00   A  0   0  8
  [ 5] .init_array  INIT_ARRAY  200b48 000b48 000010 08  WA  0   0  1
  [ 6] .fini_array  FINI_ARRAY  200b58 000b58 000010 08  WA  0   0  1
  [ 7] .jcr         PROGBITS    200b68 000b68 000008 00  WA  0   0  1
  [ 8] .data.rel.ro PROGBITS    200b70 000b70 000020 00  WA  0   0 16
  [ 9] .dynamic     DYNAMIC     200b90 000b90 0001c0 10  WA  3   0  8
  [10] .got         PROGBITS    200d50 000d50 0002a8 00  WA  0   0  8
  [11] .bss         NOBITS      201000 000ff8 000840 00  WA  0   0  1

But there is no 1-page gap.

	PR ld/28743
	* ldlang.c (lang_size_relro_segment_1): Remove the 1-page gap
	before the RELRO segment if the maximum page size >= the maximum
	section alignment.
	* testsuite/ld-i386/pr20830.d: Adjusted.
	* testsuite/ld-s390/gotreloc_64-relro-1.dd: Likewise.
	* testsuite/ld-x86-64/pr14207.d: Likewise.
	* testsuite/ld-x86-64/pr18176.d: Likewise.
	* testsuite/ld-x86-64/pr20830a-now.d: Likewise.
	* testsuite/ld-x86-64/pr20830a.d: Likewise.
	* testsuite/ld-x86-64/pr20830b-now.d: Likewise.
	* testsuite/ld-x86-64/pr20830b.d: Likewise.
	* testsuite/ld-x86-64/pr21038a-now.d: Likewise.
	* testsuite/ld-x86-64/pr21038a.d: Likewise.
	* testsuite/ld-x86-64/pr21038b-now.d: Likewise.
	* testsuite/ld-x86-64/pr21038c-now.d: Likewise.
	* testsuite/ld-x86-64/pr21038c.d: Likewise.
2022-01-13 05:20:51 -08:00
bfd Re: gas: add visibility support using GNU syntax on XCOFF 2022-01-13 16:50:15 +10:30
binutils testsuite supports_dt_relr 2022-01-13 14:12:43 +10:30
config unify 64-bit bfd checks 2022-01-01 12:49:07 -05:00
contrib
cpu
elfcpp Update year range in copyright notice of binutils files 2022-01-02 12:04:28 +10:30
etc Update year range in copyright notice of binutils files 2022-01-02 12:04:28 +10:30
gas Re: gas: add visibility support using GNU syntax on XCOFF 2022-01-13 16:50:15 +10:30
gdb gdb: don't use -Wmissing-prototypes with g++ 2022-01-13 10:25:45 +00:00
gdbserver gdb: don't use -Wmissing-prototypes with g++ 2022-01-13 10:25:45 +00:00
gdbsupport gdb: don't use -Wmissing-prototypes with g++ 2022-01-13 10:25:45 +00:00
gnulib
gold infinite recursion detected in gold testcase 2022-01-05 16:55:57 +10:30
gprof Update year range in copyright notice of binutils files 2022-01-02 12:04:28 +10:30
include Synchronize binutils libiberty sources with gcc version. 2022-01-13 12:25:34 +00:00
intl
ld elf: Remove the 1-page gap before the RELRO segment 2022-01-13 05:20:51 -08:00
libbacktrace
libctf Update year range in copyright notice of binutils files 2022-01-02 12:04:28 +10:30
libdecnumber
libiberty Synchronize binutils libiberty sources with gcc version. 2022-01-13 12:25:34 +00:00
opcodes aarch64: Add support for new SME instructions 2022-01-06 16:22:54 +00:00
readline
sim sim: ppc: migrate to standard uintXX_t types 2022-01-06 01:17:39 -05:00
texinfo
zlib
.cvsignore
.gitattributes
.gitignore
ar-lib
ChangeLog
compile
config-ml.in
config.guess
config.rpath
config.sub
configure
configure.ac
COPYING
COPYING3
COPYING3.LIB
COPYING.LIB
COPYING.LIBGLOSS
COPYING.NEWLIB
depcomp
djunpack.bat
install-sh
libtool.m4
lt~obsolete.m4
ltgcc.m4
ltmain.sh
ltoptions.m4
ltsugar.m4
ltversion.m4
MAINTAINERS
Makefile.def
Makefile.in
Makefile.tpl
makefile.vms
missing
mkdep
mkinstalldirs
move-if-change
multilib.am
README
README-maintainer-mode
setup.com
src-release.sh
symlink-tree
test-driver
ylwrap

		   README for GNU development tools

This directory contains various GNU compilers, assemblers, linkers, 
debuggers, etc., plus their support routines, definitions, and documentation.

If you are receiving this as part of a GDB release, see the file gdb/README.
If with a binutils release, see binutils/README;  if with a libg++ release,
see libg++/README, etc.  That'll give you info about this
package -- supported targets, how to use it, how to report bugs, etc.

It is now possible to automatically configure and build a variety of
tools with one command.  To build all of the tools contained herein,
run the ``configure'' script here, e.g.:

	./configure 
	make

To install them (by default in /usr/local/bin, /usr/local/lib, etc),
then do:
	make install

(If the configure script can't determine your type of computer, give it
the name as an argument, for instance ``./configure sun4''.  You can
use the script ``config.sub'' to test whether a name is recognized; if
it is, config.sub translates it to a triplet specifying CPU, vendor,
and OS.)

If you have more than one compiler on your system, it is often best to
explicitly set CC in the environment before running configure, and to
also set CC when running make.  For example (assuming sh/bash/ksh):

	CC=gcc ./configure
	make

A similar example using csh:

	setenv CC gcc
	./configure
	make

Much of the code and documentation enclosed is copyright by
the Free Software Foundation, Inc.  See the file COPYING or
COPYING.LIB in the various directories, for a description of the
GNU General Public License terms under which you can copy the files.

REPORTING BUGS: Again, see gdb/README, binutils/README, etc., for info
on where and how to report problems.