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

Message ID 20180601184357.10746-1-hjl.tools@gmail.com
Headers show
Series
  • Define _edata, __bss_start, and _end only for executables
Related show

Message

H.J. Lu June 1, 2018, 6:43 p.m.
_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.

Since _edata, __bss_start, and _end are no longer defined in shared
libraries, I updated linker tests and 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 (13):
  ld: Define _edata, __bss_start, and _end only for executables
  ld: Update tests for _edata, __bss_start, and _end changes
  ld/aarch64: Update tests for _edata, __bss_start, and _end changes
  ld/mips: Update tests for _edata, __bss_start, and _end changes
  ld/alpha: Update tests for _edata, __bss_start, and _end changes
  ld/frv: Update tests for _edata, __bss_start, and _end changes
  ld/ia64: Update tests for _edata, __bss_start, and _end changes
  ld/m68k: Update tests for _edata, __bss_start, and _end changes
  ld/powerpc: Update tests for _edata, __bss_start, and _end changes
  ld/s390: Update tests for _edata, __bss_start, and _end changes
  ld/sh: Update tests for _edata, __bss_start, and _end changes
  ld/sparc: Update tests for _edata, __bss_start, and _end changes
  ld/cris: Update tests for _edata, __bss_start, and _end changes

 ld/scripttempl/elf.sc                         | 14 ++--
 ld/testsuite/ld-aarch64/ifunc-1-local.d       |  2 +-
 ld/testsuite/ld-aarch64/ifunc-1.d             |  2 +-
 ld/testsuite/ld-aarch64/ifunc-2-local.d       |  4 +-
 ld/testsuite/ld-aarch64/ifunc-2.d             |  4 +-
 ld/testsuite/ld-aarch64/ifunc-21.d            |  6 +-
 ld/testsuite/ld-aarch64/ifunc-3a.d            |  2 +-
 ld/testsuite/ld-alpha/tlsbin.rd               |  3 -
 ld/testsuite/ld-alpha/tlsbin.sd               |  2 +-
 ld/testsuite/ld-alpha/tlsbinr.rd              |  5 +-
 ld/testsuite/ld-alpha/tlspic.rd               |  6 --
 ld/testsuite/ld-alpha/tlspic.sd               |  2 +-
 ld/testsuite/ld-cris/dso-pltdis1.d            | 62 ++++++++--------
 ld/testsuite/ld-cris/dso-pltdis2.d            | 66 ++++++++---------
 ld/testsuite/ld-cris/dso12-pltdis.d           | 70 +++++++++---------
 ld/testsuite/ld-cris/gotplt1.d                | 38 +++++-----
 ld/testsuite/ld-cris/gotplt2.d                | 24 +++----
 ld/testsuite/ld-cris/gotplt3.d                | 26 +++----
 ld/testsuite/ld-cris/hiddef1.d                |  4 +-
 ld/testsuite/ld-cris/libdso-1.d               |  2 +-
 ld/testsuite/ld-cris/libdso-10.d              | 24 +++----
 ld/testsuite/ld-cris/libdso-11.d              | 18 ++---
 ld/testsuite/ld-cris/libdso-12.d              | 52 +++++++-------
 ld/testsuite/ld-cris/libdso-12b.d             | 52 +++++++-------
 ld/testsuite/ld-cris/libdso-12c.d             | 36 +++++-----
 ld/testsuite/ld-cris/libdso-13.d              |  4 +-
 ld/testsuite/ld-cris/libdso-13b.d             |  2 +-
 ld/testsuite/ld-cris/libdso-14.d              |  8 +--
 ld/testsuite/ld-cris/libdso-15.d              | 14 ++--
 ld/testsuite/ld-cris/libdso-15b.d             | 20 +++---
 ld/testsuite/ld-cris/libdso-1c.d              | 20 +++---
 ld/testsuite/ld-cris/libdso-1d.d              | 26 +++----
 ld/testsuite/ld-cris/libdso-2.d               | 13 ++--
 ld/testsuite/ld-cris/pic-gc-72.d              |  8 +--
 ld/testsuite/ld-cris/pic-gc-73.d              |  6 +-
 ld/testsuite/ld-cris/pr16044.d                | 11 ++-
 ld/testsuite/ld-cris/pv32-1.d                 | 35 +++++----
 ld/testsuite/ld-cris/tls-dso-dtpoffd2.d       |  8 +--
 ld/testsuite/ld-cris/tls-dso-dtpoffd4.d       |  8 +--
 ld/testsuite/ld-cris/tls-dso-tpoffgotcomm1.d  | 18 ++---
 ld/testsuite/ld-cris/tls-gc-71.d              | 13 ++--
 ld/testsuite/ld-cris/tls-gd-1.d               | 24 +++----
 ld/testsuite/ld-cris/tls-gd-1h.d              | 24 +++----
 ld/testsuite/ld-cris/tls-gd-2.d               | 24 +++----
 ld/testsuite/ld-cris/tls-gd-2h.d              | 24 +++----
 ld/testsuite/ld-cris/tls-ie-10.d              | 22 +++---
 ld/testsuite/ld-cris/tls-ie-11.d              | 26 +++----
 ld/testsuite/ld-cris/tls-ie-78.d              |  6 +-
 ld/testsuite/ld-cris/tls-ie-8.d               | 22 +++---
 ld/testsuite/ld-cris/tls-ie-9.d               | 26 +++----
 ld/testsuite/ld-cris/tls-js1.d                | 14 ++--
 ld/testsuite/ld-cris/tls-ld-4.d               | 24 +++----
 ld/testsuite/ld-cris/tls-ld-5.d               | 24 +++----
 ld/testsuite/ld-cris/tls-ld-6.d               | 24 +++----
 ld/testsuite/ld-cris/tls-ld-7.d               | 24 +++----
 ld/testsuite/ld-cris/tls-ldgd-14.d            | 30 ++++----
 ld/testsuite/ld-cris/tls-ldgd-15.d            | 32 ++++-----
 ld/testsuite/ld-cris/tls-ldgdex-14.d          | 14 ++--
 ld/testsuite/ld-cris/tls-ldgdex-15.d          | 14 ++--
 ld/testsuite/ld-cris/tls-ldgdx-14.d           | 14 ++--
 ld/testsuite/ld-cris/tls-ldgdx-15.d           | 16 ++---
 ld/testsuite/ld-cris/tls-legdx-16.d           | 12 ++--
 ld/testsuite/ld-cris/tls-legdx-17.d           | 12 ++--
 ld/testsuite/ld-cris/tls-local-54.d           |  8 +--
 ld/testsuite/ld-cris/tls-local-60.d           | 12 ++--
 ld/testsuite/ld-cris/tls-local-61.d           | 12 ++--
 ld/testsuite/ld-cris/tls-local-63.d           | 12 ++--
 ld/testsuite/ld-cris/tls-local-64.d           | 16 ++---
 ld/testsuite/ld-cris/tls-ok-30.d              | 18 ++---
 ld/testsuite/ld-cris/tls-ok-32.d              | 12 ++--
 ld/testsuite/ld-cris/tls-ok-34.d              | 16 ++---
 ld/testsuite/ld-cris/tls-und-38.d             |  6 +-
 ld/testsuite/ld-cris/tls-und-42.d             |  4 +-
 ld/testsuite/ld-cris/tls-und-46.d             |  6 +-
 ld/testsuite/ld-cris/tls-und-50.d             |  4 +-
 ld/testsuite/ld-cris/weakhiddso.d             | 13 ++--
 ld/testsuite/ld-cris/weakref2.d               |  2 +-
 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-frv/fdpic-shared-2.d          |  8 +--
 ld/testsuite/ld-frv/fdpic-shared-5.d          |  8 +--
 ld/testsuite/ld-frv/tls-dynamic-2.d           | 18 ++---
 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-ia64/merge1.d                 |  2 +-
 ld/testsuite/ld-ia64/merge2.d                 |  2 +-
 ld/testsuite/ld-ia64/merge3.d                 |  2 +-
 ld/testsuite/ld-ia64/merge4.d                 |  2 +-
 ld/testsuite/ld-ia64/merge5.d                 |  2 +-
 ld/testsuite/ld-ia64/tlsbin.rd                |  3 -
 ld/testsuite/ld-ia64/tlspic.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-m68k/tls-def-1.d              |  3 -
 ld/testsuite/ld-m68k/tls-gd-1.d2              |  3 -
 ld/testsuite/ld-mips-elf/rel32-n32.d          |  6 +-
 ld/testsuite/ld-mips-elf/rel32-o32.d          |  6 +-
 ld/testsuite/ld-mips-elf/rel64.d              |  6 +-
 ld/testsuite/ld-powerpc/ambiguousv1.d         |  2 +-
 ld/testsuite/ld-powerpc/ambiguousv1b.d        |  2 +-
 ld/testsuite/ld-powerpc/ambiguousv2.d         |  3 +-
 ld/testsuite/ld-powerpc/ambiguousv2b.d        |  2 +-
 ld/testsuite/ld-powerpc/tlsexe.d              |  4 +-
 ld/testsuite/ld-powerpc/tlsexe.r              |  3 -
 ld/testsuite/ld-powerpc/tlsexe32.d            |  8 +--
 ld/testsuite/ld-powerpc/tlsexe32.g            |  2 +-
 ld/testsuite/ld-powerpc/tlsexe32.r            |  4 --
 ld/testsuite/ld-powerpc/tlsexetoc.d           |  4 +-
 ld/testsuite/ld-powerpc/tlsexetoc.r           |  3 -
 ld/testsuite/ld-powerpc/tlsso.d               |  4 +-
 ld/testsuite/ld-powerpc/tlsso.r               |  8 +--
 ld/testsuite/ld-powerpc/tlsso32.g             |  2 +-
 ld/testsuite/ld-powerpc/tlsso32.r             | 14 +---
 ld/testsuite/ld-powerpc/tlstocso.d            |  4 +-
 ld/testsuite/ld-powerpc/tlstocso.g            |  2 +-
 ld/testsuite/ld-powerpc/tlstocso.r            | 10 +--
 ld/testsuite/ld-s390/gotreloc_31-1.dd         |  6 +-
 ld/testsuite/ld-s390/tlsbin.dd                |  2 +-
 ld/testsuite/ld-s390/tlsbin.rd                |  3 -
 ld/testsuite/ld-s390/tlsbin_64.dd             |  2 +-
 ld/testsuite/ld-s390/tlsbin_64.rd             |  3 -
 ld/testsuite/ld-s390/tlspic.rd                |  6 --
 ld/testsuite/ld-s390/tlspic_64.rd             |  6 --
 ld/testsuite/ld-sh/tlsbin-2.d                 |  2 -
 ld/testsuite/ld-sh/tlspic-2.d                 |  2 -
 ld/testsuite/ld-sparc/gotop32.rd              |  6 --
 ld/testsuite/ld-sparc/gotop64.rd              |  6 --
 ld/testsuite/ld-sparc/tlssunbin32.rd          |  3 -
 ld/testsuite/ld-sparc/tlssunbin64.rd          |  3 -
 ld/testsuite/ld-sparc/tlssunnopic32.rd        |  6 --
 ld/testsuite/ld-sparc/tlssunnopic64.rd        |  6 --
 ld/testsuite/ld-sparc/tlssunpic32.rd          |  6 --
 ld/testsuite/ld-sparc/tlssunpic64.rd          |  6 --
 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 --
 234 files changed, 1807 insertions(+), 2004 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.0