From: GNU Libc Maintainers Date: Sat, 17 Sep 2016 18:00:44 +0000 (+0000) Subject: local-dlfptr X-Git-Tag: archive/raspbian/2.25-3+rpi1~1^2^2^2^2^2^2^2^2^2^2^2^2~15 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=b0fbd9fa75310d136e111a0e38f5f2f0ed4b2e0b;p=glibc.git local-dlfptr Gbp-Pq: Topic any Gbp-Pq: Name local-dlfptr.diff --- diff --git a/elf/dl-fptr.c b/elf/dl-fptr.c index 1eb360faa..a104c07c8 100644 --- a/elf/dl-fptr.c +++ b/elf/dl-fptr.c @@ -56,7 +56,12 @@ static struct local } local = { +#ifndef SHARED .root = &local.boot_table, +#else + /* Address of .boot_table is not known until runtime. */ + .root = 0, +#endif .npages = 2, .boot_table = { @@ -93,6 +98,17 @@ new_fdesc_table (struct local *l, size_t *size) return new_table; } +/* Must call _dl_fptr_init before using any other function. */ +void +_dl_fptr_init (void) +{ + struct local *l; + + ELF_MACHINE_LOAD_ADDRESS (l, local); + /* Initialize root once. */ + if (__builtin_expect (l->root == 0, 0)) + l->root = &l->boot_table; +} static ElfW(Addr) make_fdesc (ElfW(Addr) ip, ElfW(Addr) gp) diff --git a/sysdeps/generic/dl-fptr.h b/sysdeps/generic/dl-fptr.h index df0abba64..21a47fb97 100644 --- a/sysdeps/generic/dl-fptr.h +++ b/sysdeps/generic/dl-fptr.h @@ -39,6 +39,9 @@ struct link_map; extern ElfW(Addr) _dl_boot_fptr_table []; +/* Must be called before any other function. */ +extern void _dl_fptr_init (void); + extern ElfW(Addr) _dl_make_fptr (struct link_map *, const ElfW(Sym) *, ElfW(Addr));