[PATCH 1/2] Introduce <elf_machine_sym_no_match.h>

H.J. Lu hjl.tools@gmail.com
Thu Mar 26 16:39:09 GMT 2020


On Tue, Dec 17, 2019 at 8:42 AM Florian Weimer <fweimer@redhat.com> wrote:
>
> Rebased, and dropped the false ChangeLog update.
>
> Thanks,
> Florian
>
> 8<------------------------------------------------------------------8<
> MIPS needs to ignore certain existing symbols during symbol lookup.
> The old scheme uses the ELF_MACHINE_SYM_NO_MATCH macro, with an
> inline function, within its own header, with a sysdeps override for
> MIPS.  This allows re-use of the function from another file (without
> having to include <dl-machine.h> or providing the default definition
> for ELF_MACHINE_SYM_NO_MATCH).
>
> Built with build-many-glibcs.py, with manual verification that
> sysdeps/mips/elf_machine_sym_no_match.h is picked up on MIPS.  Tested
> on aarch64-linux-gnu, i686-linux-gnu, powerpc64-linux-gnu,
> s390x-linux-gnu, x86_64-linux-gnu.
>
> -----
>  elf/dl-lookup.c                         | 10 ++------
>  elf/elf_machine_sym_no_match.h          | 34 ++++++++++++++++++++++++++
>  sysdeps/mips/dl-machine.h               | 15 ------------
>  sysdeps/mips/elf_machine_sym_no_match.h | 43 +++++++++++++++++++++++++++++++++
>  4 files changed, 79 insertions(+), 23 deletions(-)
>
> diff --git a/elf/dl-lookup.c b/elf/dl-lookup.c
> index 759b45a2c9..55e521988e 100644
> --- a/elf/dl-lookup.c
> +++ b/elf/dl-lookup.c
> @@ -28,18 +28,12 @@
>  #include <libc-lock.h>
>  #include <tls.h>
>  #include <atomic.h>
> +#include <elf_machine_sym_no_match.h>
>
>  #include <assert.h>
>
> -/* Return nonzero if check_match should consider SYM to fail to match a
> -   symbol reference for some machine-specific reason.  */
> -#ifndef ELF_MACHINE_SYM_NO_MATCH
> -# define ELF_MACHINE_SYM_NO_MATCH(sym) 0
> -#endif
> -
>  #define VERSTAG(tag)   (DT_NUM + DT_THISPROCNUM + DT_VERSIONTAGIDX (tag))
>
> -
>  struct sym_val
>    {
>      const ElfW(Sym) *s;
> @@ -78,7 +72,7 @@ check_match (const char *const undef_name,
>    if (__glibc_unlikely ((sym->st_value == 0 /* No value.  */
>                          && sym->st_shndx != SHN_ABS
>                          && stt != STT_TLS)
> -                       || ELF_MACHINE_SYM_NO_MATCH (sym)
> +                       || elf_machine_sym_no_match (sym)
>                         || (type_class & (sym->st_shndx == SHN_UNDEF))))
>      return NULL;
>
> diff --git a/elf/elf_machine_sym_no_match.h b/elf/elf_machine_sym_no_match.h
> new file mode 100644
> index 0000000000..6e299e5ee8
> --- /dev/null
> +++ b/elf/elf_machine_sym_no_match.h

This should be sysdeps/generic/elf_machine_sym_no_match.h

H.J.


More information about the Libc-alpha mailing list