Blame elf/dl-call-libc-early-init.c

Packit Bot 68d549
/* Invoke the early initialization function in libc.so.
Packit Bot 68d549
   Copyright (C) 2020 Free Software Foundation, Inc.
Packit Bot 68d549
   This file is part of the GNU C Library.
Packit Bot 68d549
Packit Bot 68d549
   The GNU C Library is free software; you can redistribute it and/or
Packit Bot 68d549
   modify it under the terms of the GNU Lesser General Public
Packit Bot 68d549
   License as published by the Free Software Foundation; either
Packit Bot 68d549
   version 2.1 of the License, or (at your option) any later version.
Packit Bot 68d549
Packit Bot 68d549
   The GNU C Library is distributed in the hope that it will be useful,
Packit Bot 68d549
   but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit Bot 68d549
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit Bot 68d549
   Lesser General Public License for more details.
Packit Bot 68d549
Packit Bot 68d549
   You should have received a copy of the GNU Lesser General Public
Packit Bot 68d549
   License along with the GNU C Library; if not, see
Packit Bot 68d549
   <https://www.gnu.org/licenses/>.  */
Packit Bot 68d549
Packit Bot 68d549
#include <assert.h>
Packit Bot 68d549
#include <ldsodefs.h>
Packit Bot 68d549
#include <libc-early-init.h>
Packit Bot 68d549
#include <link.h>
Packit Bot 68d549
#include <stddef.h>
Packit Bot 68d549
Packit Bot 68d549
void
Packit Bot 5e05db
_dl_call_libc_early_init (struct link_map *libc_map, _Bool initial)
Packit Bot 68d549
{
Packit Bot 68d549
  /* There is nothing to do if we did not actually load libc.so.  */
Packit Bot 68d549
  if (libc_map == NULL)
Packit Bot 68d549
    return;
Packit Bot 68d549
Packit Bot 68d549
  const ElfW(Sym) *sym
Packit Bot 68d549
    = _dl_lookup_direct (libc_map, "__libc_early_init",
Packit Bot 68d549
                         0x069682ac, /* dl_new_hash output.  */
Packit Bot 68d549
                         "GLIBC_PRIVATE",
Packit Bot 68d549
                         0x0963cf85); /* _dl_elf_hash output.  */
Packit Bot 68d549
  assert (sym != NULL);
Packit Bot 68d549
  __typeof (__libc_early_init) *early_init
Packit Bot 68d549
    = DL_SYMBOL_ADDRESS (libc_map, sym);
Packit Bot 5e05db
  early_init (initial);
Packit Bot 68d549
}