glibc/sysdeps/alpha
Maciej W. Rozycki 10a446ddcc elf: Unify symbol address run-time calculation [BZ #19818]
Wrap symbol address run-time calculation into a macro and use it
throughout, replacing inline calculations.

There are a couple of variants, most of them different in a functionally
insignificant way.  Most calculations are right following RESOLVE_MAP,
at which point either the map or the symbol returned can be checked for
validity as the macro sets either both or neither.  In some places both
the symbol and the map has to be checked however.

My initial implementation therefore always checked both, however that
resulted in code larger by as much as 0.3%, as many places know from
elsewhere that no check is needed.  I have decided the size growth was
unacceptable.

Having looked closer I realized that it's the map that is the culprit.
Therefore I have modified LOOKUP_VALUE_ADDRESS to accept an additional
boolean argument telling it to access the map without checking it for
validity.  This in turn has brought quite nice results, with new code
actually being smaller for i686, and MIPS o32, n32 and little-endian n64
targets, unchanged in size for x86-64 and, unusually, marginally larger
for big-endian MIPS n64, as follows:

i686:
   text    data     bss     dec     hex filename
 152255    4052     192  156499   26353 ld-2.27.9000-base.so
 152159    4052     192  156403   262f3 ld-2.27.9000-elf-symbol-value.so
MIPS/o32/el:
   text    data     bss     dec     hex filename
 142906    4396     260  147562   2406a ld-2.27.9000-base.so
 142890    4396     260  147546   2405a ld-2.27.9000-elf-symbol-value.so
MIPS/n32/el:
   text    data     bss     dec     hex filename
 142267    4404     260  146931   23df3 ld-2.27.9000-base.so
 142171    4404     260  146835   23d93 ld-2.27.9000-elf-symbol-value.so
MIPS/n64/el:
   text    data     bss     dec     hex filename
 149835    7376     408  157619   267b3 ld-2.27.9000-base.so
 149787    7376     408  157571   26783 ld-2.27.9000-elf-symbol-value.so
MIPS/o32/eb:
   text    data     bss     dec     hex filename
 142870    4396     260  147526   24046 ld-2.27.9000-base.so
 142854    4396     260  147510   24036 ld-2.27.9000-elf-symbol-value.so
MIPS/n32/eb:
   text    data     bss     dec     hex filename
 142019    4404     260  146683   23cfb ld-2.27.9000-base.so
 141923    4404     260  146587   23c9b ld-2.27.9000-elf-symbol-value.so
MIPS/n64/eb:
   text    data     bss     dec     hex filename
 149763    7376     408  157547   2676b ld-2.27.9000-base.so
 149779    7376     408  157563   2677b ld-2.27.9000-elf-symbol-value.so
x86-64:
   text    data     bss     dec     hex filename
 148462    6452     400  155314   25eb2 ld-2.27.9000-base.so
 148462    6452     400  155314   25eb2 ld-2.27.9000-elf-symbol-value.so

	[BZ #19818]
	* sysdeps/generic/ldsodefs.h (LOOKUP_VALUE_ADDRESS): Add `set'
	parameter.
	(SYMBOL_ADDRESS): New macro.
	[!ELF_FUNCTION_PTR_IS_SPECIAL] (DL_SYMBOL_ADDRESS): Use
	SYMBOL_ADDRESS for symbol address calculation.
	* elf/dl-runtime.c (_dl_fixup): Likewise.
	(_dl_profile_fixup): Likewise.
	* elf/dl-symaddr.c (_dl_symbol_address): Likewise.
	* elf/rtld.c (dl_main): Likewise.
	* sysdeps/aarch64/dl-machine.h (elf_machine_rela): Likewise.
	* sysdeps/alpha/dl-machine.h (elf_machine_rela): Likewise.
	* sysdeps/arm/dl-machine.h (elf_machine_rel): Likewise.
	(elf_machine_rela): Likewise.
	* sysdeps/hppa/dl-machine.h (elf_machine_rela): Likewise.
	* sysdeps/hppa/dl-symaddr.c (_dl_symbol_address): Likewise.
	* sysdeps/i386/dl-machine.h (elf_machine_rel): Likewise.
	(elf_machine_rela): Likewise.
	* sysdeps/ia64/dl-machine.h (elf_machine_rela): Likewise.
	* sysdeps/m68k/dl-machine.h (elf_machine_rela): Likewise.
	* sysdeps/microblaze/dl-machine.h (elf_machine_rela): Likewise.
	* sysdeps/mips/dl-machine.h (ELF_MACHINE_BEFORE_RTLD_RELOC):
	Likewise.
	(elf_machine_reloc): Likewise.
	(elf_machine_got_rel): Likewise.
	* sysdeps/mips/dl-trampoline.c (__dl_runtime_resolve): Likewise.
	* sysdeps/nios2/dl-machine.h (elf_machine_rela): Likewise.
	* sysdeps/powerpc/powerpc32/dl-machine.h (elf_machine_rela):
	Likewise.
	* sysdeps/powerpc/powerpc64/dl-machine.h (elf_machine_rela):
	Likewise.
	* sysdeps/riscv/dl-machine.h (elf_machine_rela): Likewise.
	* sysdeps/s390/s390-32/dl-machine.h (elf_machine_rela):
	Likewise.
	* sysdeps/s390/s390-64/dl-machine.h (elf_machine_rela):
	Likewise.
	* sysdeps/sh/dl-machine.h (elf_machine_rela): Likewise.
	* sysdeps/sparc/sparc32/dl-machine.h (elf_machine_rela):
	Likewise.
	* sysdeps/sparc/sparc64/dl-machine.h (elf_machine_rela):
	Likewise.
	* sysdeps/tile/dl-machine.h (elf_machine_rela): Likewise.
	* sysdeps/x86_64/dl-machine.h (elf_machine_rela): Likewise.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2018-04-04 23:09:37 +01:00
..
alphaev5 Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
alphaev6 Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
alphaev67 Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
bits Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
fpu Remove all target specific __ieee754_sqrt(f/l) inlines 2018-03-15 19:21:36 +00:00
nptl hurd: add gscope support 2018-03-11 13:06:33 +01:00
soft-fp Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
Implies Relocate alpha from ports to libc 2014-02-12 07:00:06 -08:00
Makefile Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
Subdirs Relocate alpha from ports to libc 2014-02-12 07:00:06 -08:00
Versions Relocate alpha from ports to libc 2014-02-12 07:00:06 -08:00
__longjmp.S Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
_mcount.S Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
add_n.S Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
addmul_1.S Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
atomic-machine.h Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
bsd-_setjmp.S Relocate alpha from ports to libc 2014-02-12 07:00:06 -08:00
bsd-setjmp.S Relocate alpha from ports to libc 2014-02-12 07:00:06 -08:00
bzero.S Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
configure Require autoconf 2.69 2014-09-29 07:53:36 -07:00
configure.ac Require autoconf 2.69 2014-09-29 07:53:36 -07:00
crti.S Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
crtn.S Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
div.S Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
div_libc.h Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
divl.S Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
divlu.S Relocate alpha from ports to libc 2014-02-12 07:00:06 -08:00
divq.S Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
divqu.S Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
dl-dtprocnum.h Relocate alpha from ports to libc 2014-02-12 07:00:06 -08:00
dl-machine.h elf: Unify symbol address run-time calculation [BZ #19818] 2018-04-04 23:09:37 +01:00
dl-procinfo.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
dl-procinfo.h Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
dl-sysdep.h Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
dl-tls.h Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
dl-trampoline.S Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
ffs.S Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
ffsll.S Relocate alpha from ports to libc 2014-02-12 07:00:06 -08:00
gccframe.h Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
hp-timing.h Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
htonl.S Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
htons.S Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
jmpbuf-offsets.h Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
jmpbuf-unwind.h Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
ldiv.S Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
ldsodefs.h Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
libc-tls.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
lldiv.S Relocate alpha from ports to libc 2014-02-12 07:00:06 -08:00
lshift.S Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
machine-gmon.h Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
memchr.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
memset.S Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
memusage.h Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
mul_1.S Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
nscd-types.h Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
preconfigure Remove relro configure test. 2014-06-27 16:51:22 +00:00
rawmemchr.S Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
reml.S Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
remlu.S Relocate alpha from ports to libc 2014-02-12 07:00:06 -08:00
remq.S Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
remqu.S Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
rshift.S Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
setjmp.S Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
sotruss-lib.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
stackinfo.h Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
start.S Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
stpcpy.S Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
stpncpy.S Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
strcat.S Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
strchr.S Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
strcmp.S Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
strcpy.S Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
strlen.S Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
strncat.S Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
strncmp.S Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
strncpy.S Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
strrchr.S Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
stxcpy.S Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
stxncpy.S Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
sub_n.S Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
submul_1.S Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
tininess.h Relocate alpha from ports to libc 2014-02-12 07:00:06 -08:00
tls-macros.h Relocate alpha from ports to libc 2014-02-12 07:00:06 -08:00
tst-audit.h Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
udiv_qrnnd.S Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00