glibc/sysdeps
Maciej W. Rozycki e7feec374c elf: Correct absolute (SHN_ABS) symbol run-time calculation [BZ #19818]
Do not relocate absolute symbols by the base address.  Such symbols have
SHN_ABS as the section index and their value is not supposed to be
affected by relocation as per the ELF gABI[1]:

"SHN_ABS
    The symbol has an absolute value that will not change because of
    relocation."

The reason for our non-conformance here seems to be an old SysV linker
bug causing symbols like _DYNAMIC to be incorrectly emitted as absolute
symbols[2].  However in a previous discussion it was pointed that this
is seriously flawed by preventing the lone purpose of the existence of
absolute symbols from being used[3]:

"On the contrary, the only interpretation that makes sense to me is that
it will not change because of relocation at link time or at load time.
Absolute symbols, from the days of the earliest linking loaders, have
been used to represent addresses that are outside the address space of
the module (e.g., memory-mapped addresses or kernel gateway pages).
They've even been used to represent true symbolic constants (e.g.,
system entry point numbers, sizes, version numbers).  There's no other
way to represent a true absolute symbol, while the meaning you seek is
easily represented by giving the symbol a non-negative st_shndx value."

and we ought to stop supporting our current broken interpretation.

Update processing for dladdr(3) and dladdr1(3) so that SHN_ABS symbols
are ignored, because under the corrected interpretation they do not
represent addresses within a mapped file and therefore are not supposed
to be considered.

References:

[1] "System V Application Binary Interface - DRAFT - 19 October 2010",
    The SCO Group, Section "Symbol Table",
    <http://www.sco.com/developers/gabi/2012-12-31/ch4.symtab.html>

[2] Alan Modra, "Absolute symbols"
    <https://sourceware.org/ml/binutils/2012-05/msg00019.html>

[3] Cary Coutant, "Re: Absolute symbols"
    <https://sourceware.org/ml/binutils/2012-05/msg00020.html>

	[BZ #19818]
	* sysdeps/generic/ldsodefs.h (SYMBOL_ADDRESS): Handle SHN_ABS
	symbols.
	* elf/dl-addr.c (determine_info): Ignore SHN_ABS symbols.
	* elf/tst-absolute-sym.c: New file.
	* elf/tst-absolute-sym-lib.c: New file.
	* elf/tst-absolute-sym-lib.lds: New file.
	* elf/Makefile (tests): Add `tst-absolute-sym'.
	(modules-names): Add `tst-absolute-sym-lib'.
	(LDLIBS-tst-absolute-sym-lib.so): New variable.
	($(objpfx)tst-absolute-sym-lib.so): New dependency.
	($(objpfx)tst-absolute-sym): New dependency.
2018-04-04 23:09:37 +01:00
..
aarch64 elf: Unify symbol address run-time calculation [BZ #19818] 2018-04-04 23:09:37 +01:00
alpha elf: Unify symbol address run-time calculation [BZ #19818] 2018-04-04 23:09:37 +01:00
arm elf: Unify symbol address run-time calculation [BZ #19818] 2018-04-04 23:09:37 +01:00
generic elf: Correct absolute (SHN_ABS) symbol run-time calculation [BZ #19818] 2018-04-04 23:09:37 +01:00
gnu Fix errno values 2018-03-20 03:10:57 +01:00
hppa elf: Unify symbol address run-time calculation [BZ #19818] 2018-04-04 23:09:37 +01:00
htl hurd: Avoid local PLTs in libpthread. 2018-04-02 18:08:37 +00:00
hurd hurd: Avoid more libc.so PLTs 2018-04-02 23:40:26 +00:00
i386 elf: Unify symbol address run-time calculation [BZ #19818] 2018-04-04 23:09:37 +01:00
ia64 elf: Unify symbol address run-time calculation [BZ #19818] 2018-04-04 23:09:37 +01:00
ieee754 [PATCH 7/7] sin/cos slow paths: refactor sincos implementation 2018-04-03 16:52:18 +01:00
init_array sysdeps/init_array: Add PREINIT_FUNCTION to crti.S 2018-01-29 10:22:26 -08:00
m68k elf: Unify symbol address run-time calculation [BZ #19818] 2018-04-04 23:09:37 +01:00
mach hurd: Fix typo 2018-04-04 02:31:23 +02:00
microblaze elf: Unify symbol address run-time calculation [BZ #19818] 2018-04-04 23:09:37 +01:00
mips elf: Unify symbol address run-time calculation [BZ #19818] 2018-04-04 23:09:37 +01:00
nios2 elf: Unify symbol address run-time calculation [BZ #19818] 2018-04-04 23:09:37 +01:00
nptl Filter out NPTL internal signals (BZ #22391) 2018-04-03 13:30:49 -03:00
posix Filter out NPTL internal signals (BZ #22391) 2018-04-03 13:30:49 -03:00
powerpc elf: Unify symbol address run-time calculation [BZ #19818] 2018-04-04 23:09:37 +01:00
pthread hurd: Avoid some PLTs in libc and librt 2018-04-02 19:07:52 +00:00
riscv elf: Unify symbol address run-time calculation [BZ #19818] 2018-04-04 23:09:37 +01:00
s390 elf: Unify symbol address run-time calculation [BZ #19818] 2018-04-04 23:09:37 +01:00
sh elf: Unify symbol address run-time calculation [BZ #19818] 2018-04-04 23:09:37 +01:00
sparc elf: Unify symbol address run-time calculation [BZ #19818] 2018-04-04 23:09:37 +01:00
tile elf: Unify symbol address run-time calculation [BZ #19818] 2018-04-04 23:09:37 +01:00
unix Update RWF_SUPPORTED for Linux kernel 4.16 [BZ #22947] 2018-04-03 12:19:29 -07:00
wordsize-32 Use libc_hidden_* for strtoumax (bug 15105). 2018-02-28 14:16:21 +00:00
wordsize-64 Use libc_hidden_* for strtoumax (bug 15105). 2018-02-28 14:16:21 +00:00
x86 Remove sysdeps/x86/fpu/bits/mathinline.h __finite inline. 2018-03-16 18:36:53 +00:00
x86_64 elf: Unify symbol address run-time calculation [BZ #19818] 2018-04-04 23:09:37 +01:00