[PATCH 0/2] Define _edata, __bss_start, and _end only for executables

H.J. Lu hjl.tools@gmail.com
Tue Jun 5 12:48:00 GMT 2018


_edata, __bss_start, and _end are defined for executables.  FreeBSD's
libc.so uses executable's _end to initialize curbrk.  But there is no
good reason to access values of _edata, __bss_start, and _end defined
in shared libraries.  We should define _edata, __bss_start, and _end
only for executables.  To exclude _edata, __bss_start, _end and end
from shared libraries, EXCLUDE_SHLIB_SYMBOLS should be set.

This series of patches sets EXCLUDE_SHLIB_SYMBOLS for x86 ELF targets.
There are no regressions on

aarch64-linux
alpha-dec-vms
alpha-linux
alpha-linuxecoff
alpha-netbsd
alpha-unknown-freebsd4.7
arc-elf
arc-linux-uclibc
arm-linuxeabi
arm-netbsdelf
arm-nto
arm-pe
arm-symbianelf
arm-vxworks
arm-wince-pe
avr-elf
bfin-elf
cr16-elf
cris-elf
crisv32-linux
crx-elf
d10v-elf
d30v-elf
dlx-elf
fr30-elf
frv-elf
frv-linux
h8300-elf
hppa64-hp-hpux11.23
hppa64-linux
hppa-hp-hpux10
hppa-linux
i386-lynxos
i386-nacl
i586-linux
i686-pc-beos
i686-pc-elf
i686-pe
ia64-elf
ia64-freebsd5
ia64-hpux
ia64-linux
ia64-netbsd
ia64-vms
ip2k-elf
iq2000-elf
lm32-elf
m32c-elf
m32r-elf
m68hc11-elf
m68hc12-elf
m68k-elf
m68k-linux
mcore-elf
mcore-pe
mep-elf
microblaze-elf
mips64-linux
mipsel-linux-gnu
mipsisa32el-linux
mips-linux
mmix
mn10200-elf
mn10300-elf
moxie-elf
ms1-elf
msp430-elf
pj-elf
powerpc64le-linux
powerpc64-linux
powerpc-eabisim
powerpcle-linux
powerpc-linux
powerpc-nto
powerpc-wrs-vxworks
rs6000-aix4.3.3
rs6000-aix5.1
rx-elf
s390-linux
s390x-linux
sh-linux
shl-unknown-netbsdelf
sh-nto
sh-pe
sh-rtems
sparc64-linux
sparc-linux
spu-elf
tic30-unknown-coff
tic4x-coff
tic54x-coff
tic6x-elf
tx39-elf
v850-elf
vax-netbsdelf
x86_64-linux
x86_64-mingw32
x86_64-nacl
xstormy16-elf
xtensa-elf
z8k-coff

H.J. Lu (2):
  ld/x86: Define _edata, __bss_start, and _end only for executables
  ld/x86: Update tests for _edata, __bss_start, and _end changes

 ld/emulparams/elf32_x86_64.sh                 |  1 +
 ld/emulparams/elf_i386.sh                     |  1 +
 ld/emulparams/elf_iamcu.sh                    |  1 +
 ld/emulparams/elf_k1om.sh                     |  1 +
 ld/emulparams/elf_l1om.sh                     |  1 +
 ld/emulparams/elf_x86_64.sh                   |  1 +
 ld/scripttempl/elf.sc                         | 12 +++-
 ld/testsuite/ld-elf/pr23161.map               |  4 ++
 ld/testsuite/ld-elf/pr23161.rd                | 14 ++++
 ld/testsuite/ld-elf/pr23161a.c                |  9 +++
 ld/testsuite/ld-elf/pr23161b.c                | 23 ++++++
 ld/testsuite/ld-elf/pr23162.rd                |  9 +--
 ld/testsuite/ld-elf/shared.exp                | 40 +++++++++++
 ld/testsuite/ld-i386/ibt-plt-1.d              | 20 +++---
 ld/testsuite/ld-i386/ibt-plt-2a.d             | 20 +++---
 ld/testsuite/ld-i386/ibt-plt-2b.d             | 20 +++---
 ld/testsuite/ld-i386/ibt-plt-2c.d             | 20 +++---
 ld/testsuite/ld-i386/ibt-plt-2d.d             | 20 +++---
 ld/testsuite/ld-i386/ibt-plt-3a.d             | 20 +++---
 ld/testsuite/ld-i386/ibt-plt-3b.d             | 20 +++---
 ld/testsuite/ld-i386/ibt-plt-3c.d             | 20 +++---
 ld/testsuite/ld-i386/ibt-plt-3d.d             | 20 +++---
 ld/testsuite/ld-i386/plt2.dd                  | 26 +++----
 ld/testsuite/ld-i386/pr20830.d                | 18 ++---
 ld/testsuite/ld-i386/tlsbin-nacl.rd           |  3 -
 ld/testsuite/ld-i386/tlsbin.rd                |  3 -
 ld/testsuite/ld-i386/tlsbin2-nacl.rd          |  3 -
 ld/testsuite/ld-i386/tlsbin2.rd               |  3 -
 ld/testsuite/ld-i386/tlsbindesc-nacl.rd       |  9 +--
 ld/testsuite/ld-i386/tlsbindesc.rd            |  9 +--
 ld/testsuite/ld-i386/tlsdesc-nacl.rd          |  6 --
 ld/testsuite/ld-i386/tlsdesc.rd               |  6 --
 ld/testsuite/ld-i386/tlsgdesc-nacl.rd         |  6 --
 ld/testsuite/ld-i386/tlsgdesc.rd              |  6 --
 ld/testsuite/ld-i386/tlsnopic-nacl.rd         | 14 ++--
 ld/testsuite/ld-i386/tlsnopic.dd              | 12 ++--
 ld/testsuite/ld-i386/tlsnopic.rd              |  6 --
 ld/testsuite/ld-i386/tlsnopic.sd              |  4 +-
 ld/testsuite/ld-i386/tlspic-nacl.rd           |  6 --
 ld/testsuite/ld-i386/tlspic.rd                |  6 --
 ld/testsuite/ld-i386/tlspic2-nacl.rd          |  6 --
 ld/testsuite/ld-i386/tlspic2.rd               |  6 --
 ld/testsuite/ld-ifunc/ifunc-2-i386-now.d      | 14 ++--
 .../ld-ifunc/ifunc-2-local-i386-now.d         | 14 ++--
 .../ld-ifunc/ifunc-2-local-x86-64-now.d       | 20 +++---
 ld/testsuite/ld-ifunc/ifunc-2-local-x86-64.d  |  4 +-
 ld/testsuite/ld-ifunc/ifunc-2-x86-64-now.d    | 20 +++---
 ld/testsuite/ld-ifunc/ifunc-2-x86-64.d        |  4 +-
 ld/testsuite/ld-ifunc/pr17154-i386-now.d      | 34 ++++-----
 ld/testsuite/ld-ifunc/pr17154-i386.d          | 34 ++++-----
 ld/testsuite/ld-ifunc/pr17154-x86-64-now.d    | 46 ++++++------
 ld/testsuite/ld-ifunc/pr17154-x86-64.d        | 64 ++++++++---------
 ld/testsuite/ld-x86-64/bnd-branch-1-now.d     | 44 ++++++------
 ld/testsuite/ld-x86-64/bnd-ifunc-1-now.d      | 18 ++---
 ld/testsuite/ld-x86-64/bnd-ifunc-2-now.d      | 46 ++++++------
 ld/testsuite/ld-x86-64/bnd-ifunc-2.d          | 46 ++++++------
 ld/testsuite/ld-x86-64/bnd-plt-1-now.d        | 44 ++++++------
 ld/testsuite/ld-x86-64/bnd-plt-1.d            | 44 ++++++------
 ld/testsuite/ld-x86-64/ibt-plt-1-x32.d        | 24 +++----
 ld/testsuite/ld-x86-64/ibt-plt-1.d            | 24 +++----
 ld/testsuite/ld-x86-64/ibt-plt-2a-x32.d       | 24 +++----
 ld/testsuite/ld-x86-64/ibt-plt-2a.d           | 24 +++----
 ld/testsuite/ld-x86-64/ibt-plt-2b-x32.d       | 14 ++--
 ld/testsuite/ld-x86-64/ibt-plt-2b.d           | 14 ++--
 ld/testsuite/ld-x86-64/ibt-plt-2c-x32.d       | 24 +++----
 ld/testsuite/ld-x86-64/ibt-plt-2c.d           | 24 +++----
 ld/testsuite/ld-x86-64/ibt-plt-2d-x32.d       | 14 ++--
 ld/testsuite/ld-x86-64/ibt-plt-2d.d           | 15 ++--
 ld/testsuite/ld-x86-64/ibt-plt-3a-x32.d       | 24 +++----
 ld/testsuite/ld-x86-64/ibt-plt-3a.d           | 24 +++----
 ld/testsuite/ld-x86-64/ibt-plt-3b-x32.d       | 14 ++--
 ld/testsuite/ld-x86-64/ibt-plt-3b.d           | 14 ++--
 ld/testsuite/ld-x86-64/ibt-plt-3c-x32.d       | 24 +++----
 ld/testsuite/ld-x86-64/ibt-plt-3c.d           | 24 +++----
 ld/testsuite/ld-x86-64/ibt-plt-3d-x32.d       | 14 ++--
 ld/testsuite/ld-x86-64/ibt-plt-3d.d           | 14 ++--
 ld/testsuite/ld-x86-64/ilp32-4-nacl.d         | 16 ++---
 ld/testsuite/ld-x86-64/ilp32-4.d              |  8 +--
 ld/testsuite/ld-x86-64/load1c-nacl.d          | 72 +++++++++----------
 ld/testsuite/ld-x86-64/load1c.d               | 72 +++++++++----------
 ld/testsuite/ld-x86-64/load1d-nacl.d          | 72 +++++++++----------
 ld/testsuite/ld-x86-64/load1d.d               | 72 +++++++++----------
 ld/testsuite/ld-x86-64/mpx3n.dd               | 18 ++---
 ld/testsuite/ld-x86-64/mpx4.dd                | 26 +++----
 ld/testsuite/ld-x86-64/mpx4n.dd               | 16 ++---
 ld/testsuite/ld-x86-64/plt2.dd                | 26 +++----
 ld/testsuite/ld-x86-64/pr14207.d              |  4 +-
 ld/testsuite/ld-x86-64/pr19162.d              |  2 +-
 ld/testsuite/ld-x86-64/pr20253-1f.d           | 18 ++---
 ld/testsuite/ld-x86-64/pr20253-1l.d           | 18 ++---
 ld/testsuite/ld-x86-64/pr20830a-now.d         | 26 +++----
 ld/testsuite/ld-x86-64/pr20830a.d             | 26 +++----
 ld/testsuite/ld-x86-64/pr20830b-now.d         | 26 +++----
 ld/testsuite/ld-x86-64/pr20830b.d             | 26 +++----
 ld/testsuite/ld-x86-64/pr21038a-now.d         | 26 +++----
 ld/testsuite/ld-x86-64/pr21038a.d             | 26 +++----
 ld/testsuite/ld-x86-64/pr21038b-now.d         | 26 +++----
 ld/testsuite/ld-x86-64/pr21038b.d             | 26 +++----
 ld/testsuite/ld-x86-64/pr21038c-now.d         | 36 +++++-----
 ld/testsuite/ld-x86-64/pr21038c.d             | 36 +++++-----
 ld/testsuite/ld-x86-64/tlsbin-nacl.rd         | 21 +++---
 ld/testsuite/ld-x86-64/tlsbin.rd              |  3 -
 ld/testsuite/ld-x86-64/tlsbin2-nacl.rd        | 21 +++---
 ld/testsuite/ld-x86-64/tlsbin2.rd             |  3 -
 ld/testsuite/ld-x86-64/tlsbindesc-nacl.rd     | 33 ++++-----
 ld/testsuite/ld-x86-64/tlsbindesc.rd          |  7 +-
 ld/testsuite/ld-x86-64/tlsdesc-nacl.rd        | 54 +++++++-------
 ld/testsuite/ld-x86-64/tlsdesc.rd             | 10 +--
 ld/testsuite/ld-x86-64/tlsgdesc-nacl.rd       | 14 ++--
 ld/testsuite/ld-x86-64/tlsgdesc.rd            | 14 ++--
 ld/testsuite/ld-x86-64/tlspic-nacl.rd         | 24 +++----
 ld/testsuite/ld-x86-64/tlspic.rd              |  6 --
 ld/testsuite/ld-x86-64/tlspic2-nacl.rd        | 24 +++----
 ld/testsuite/ld-x86-64/tlspic2.rd             |  6 --
 114 files changed, 1108 insertions(+), 1156 deletions(-)
 create mode 100644 ld/testsuite/ld-elf/pr23161.map
 create mode 100644 ld/testsuite/ld-elf/pr23161.rd
 create mode 100644 ld/testsuite/ld-elf/pr23161a.c
 create mode 100644 ld/testsuite/ld-elf/pr23161b.c

-- 
2.17.1



More information about the Binutils mailing list