This is the mail archive of the
glibc-bugs@sourceware.org
mailing list for the glibc project.
[Bug dynamic-link/14979] Incorrect R_386_GLOB_DAT/R_386_JUMP_SLOT handling
- From: "fweimer at redhat dot com" <sourceware-bugzilla at sourceware dot org>
- To: glibc-bugs at sourceware dot org
- Date: Wed, 08 Nov 2017 12:33:42 +0000
- Subject: [Bug dynamic-link/14979] Incorrect R_386_GLOB_DAT/R_386_JUMP_SLOT handling
- Auto-submitted: auto-generated
- References: <bug-14979-131@http.sourceware.org/bugzilla/>
https://sourceware.org/bugzilla/show_bug.cgi?id=14979
Florian Weimer <fweimer at redhat dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |fweimer at redhat dot com
--- Comment #10 from Florian Weimer <fweimer at redhat dot com> ---
There seems to be another source of non-zero addends: external functions whose
address is taken in position-dependent code.
For example, this:
#include <stdio.h>
int
main()
{
printf ("%p\n", &putchar);
}
Results in:
Relocation section [ 9] '.rela.dyn' at offset 0x3b0 contains 2 entries:
Offset Type Value Addend Name
0x0000000000600ff0 X86_64_GLOB_DAT 000000000000000000 +0
__libc_start_main
0x0000000000600ff8 X86_64_GLOB_DAT 000000000000000000 +0 __gmon_start__
Relocation section [10] '.rela.plt' for section [22] '.got.plt' at offset 0x3e0
contains 2 entries:
Offset Type Value Addend Name
0x0000000000601018 X86_64_JUMP_SLOT 0x0000000000400440 +0 putchar
0x0000000000601020 X86_64_JUMP_SLOT 000000000000000000 +0 printf
(With a traditional toolchain without PIE or BIND_NOW.)
This does affect dlsym return values, it seems. With a relocation with a
non-zero addend, dlsym will return the address of putchar@plt in the main
program. With a zero addend, dlsym will return the address of the function in
libc.so.6 instead.
Is this documented anywhere?
--
You are receiving this mail because:
You are on the CC list for the bug.