From 971a609bb09b299439e343f52fe090634cb74beb Mon Sep 17 00:00:00 2001 From: GNU Libc Maintainers Date: Wed, 29 Nov 2017 03:00:21 +0000 Subject: [PATCH] local-dlfptr Gbp-Pq: Topic any Gbp-Pq: Name local-dlfptr.diff --- elf/dl-fptr.c | 16 ++++++++++++++++ sysdeps/generic/dl-fptr.h | 3 +++ 2 files changed, 19 insertions(+) diff --git a/elf/dl-fptr.c b/elf/dl-fptr.c index bf8ae43b5..0c52cc828 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 b28b72842..c36548f4f 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)); -- 2.30.2