diff options
author | H.J. Lu <hjl.tools@gmail.com> | 2021-09-23 09:06:49 -0700 |
---|---|---|
committer | H.J. Lu <hjl.tools@gmail.com> | 2021-10-19 06:40:38 -0700 |
commit | 2ec99d8c42b2ff1a1231e4df462a0910a9b7fdef (patch) | |
tree | b67493baf7fcb5c424a1e77e79c8e7b1f9a1ca5d /sysdeps/generic | |
parent | 1d550265a75b412cea4889a50b101395f6a8e025 (diff) | |
download | glibc-2ec99d8c42b2ff1a1231e4df462a0910a9b7fdef.zip glibc-2ec99d8c42b2ff1a1231e4df462a0910a9b7fdef.tar.gz glibc-2ec99d8c42b2ff1a1231e4df462a0910a9b7fdef.tar.bz2 |
ld.so: Initialize bootstrap_map.l_ld_readonly [BZ #28340]
1. Define DL_RO_DYN_SECTION to initalize bootstrap_map.l_ld_readonly
before calling elf_get_dynamic_info to get dynamic info in bootstrap_map,
2. Define a single
static inline bool
dl_relocate_ld (const struct link_map *l)
{
/* Don't relocate dynamic section if it is readonly */
return !(l->l_ld_readonly || DL_RO_DYN_SECTION);
}
This updates BZ #28340 fix.
Diffstat (limited to 'sysdeps/generic')
-rw-r--r-- | sysdeps/generic/dl-relocate-ld.h | 11 | ||||
-rw-r--r-- | sysdeps/generic/ldsodefs.h | 10 |
2 files changed, 12 insertions, 9 deletions
diff --git a/sysdeps/generic/dl-relocate-ld.h b/sysdeps/generic/dl-relocate-ld.h index 5fae206..cfb86c2 100644 --- a/sysdeps/generic/dl-relocate-ld.h +++ b/sysdeps/generic/dl-relocate-ld.h @@ -19,14 +19,7 @@ #ifndef _DL_RELOCATE_LD_H #define _DL_RELOCATE_LD_H -/* Return true if dynamic section in the shared library L should be - relocated. */ - -static inline bool -dl_relocate_ld (const struct link_map *l) -{ - /* Don't relocate dynamic section if it is readonly */ - return !l->l_ld_readonly; -} +/* The dynamic section is writable. */ +#define DL_RO_DYN_SECTION 0 #endif /* _DL_RELOCATE_LD_H */ diff --git a/sysdeps/generic/ldsodefs.h b/sysdeps/generic/ldsodefs.h index 9ec1511..0410f77 100644 --- a/sysdeps/generic/ldsodefs.h +++ b/sysdeps/generic/ldsodefs.h @@ -69,6 +69,16 @@ __BEGIN_DECLS `ElfW(TYPE)' is used in place of `Elf32_TYPE' or `Elf64_TYPE'. */ #define ELFW(type) _ElfW (ELF, __ELF_NATIVE_CLASS, type) +/* Return true if dynamic section in the shared library L should be + relocated. */ + +static inline bool +dl_relocate_ld (const struct link_map *l) +{ + /* Don't relocate dynamic section if it is readonly */ + return !(l->l_ld_readonly || DL_RO_DYN_SECTION); +} + /* All references to the value of l_info[DT_PLTGOT], l_info[DT_STRTAB], l_info[DT_SYMTAB], l_info[DT_RELA], l_info[DT_REL], l_info[DT_JMPREL], and l_info[VERSYMIDX (DT_VERSYM)] |