Blame elf/tst-dlopen-nodelete-reloc-mod2.c

Packit Service 723c1e
/* Test propagation of NODELETE to an already-loaded object via relocation.
Packit Service 723c1e
   NODELETE helper module.
Packit Service 723c1e
   Copyright (C) 2019 Free Software Foundation, Inc.
Packit Service 723c1e
   This file is part of the GNU C Library.
Packit Service 723c1e
Packit Service 723c1e
   The GNU C Library is free software; you can redistribute it and/or
Packit Service 723c1e
   modify it under the terms of the GNU Lesser General Public
Packit Service 723c1e
   License as published by the Free Software Foundation; either
Packit Service 723c1e
   version 2.1 of the License, or (at your option) any later version.
Packit Service 723c1e
Packit Service 723c1e
   The GNU C Library is distributed in the hope that it will be useful,
Packit Service 723c1e
   but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit Service 723c1e
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit Service 723c1e
   Lesser General Public License for more details.
Packit Service 723c1e
Packit Service 723c1e
   You should have received a copy of the GNU Lesser General Public
Packit Service 723c1e
   License along with the GNU C Library; if not, see
Packit Service 723c1e
   <https://www.gnu.org/licenses/>.  */
Packit Service 723c1e
Packit Service 723c1e
#include <stdbool.h>
Packit Service 723c1e
#include <stdio.h>
Packit Service 723c1e
#include <unistd.h>
Packit Service 723c1e
Packit Service 723c1e
/* Defined in tst-dlopen-nodelete-reloc-mod1.so.  This dependency is
Packit Service 723c1e
   not expressed via DT_NEEDED, so this reference marks the other
Packit Service 723c1e
   object as NODELETE dynamically, during initially relocation.  */
Packit Service 723c1e
extern bool may_finalize_mod1;
Packit Service 723c1e
Packit Service 723c1e
static void __attribute__ ((destructor))
Packit Service 723c1e
fini (void)
Packit Service 723c1e
{
Packit Service 723c1e
  if (!may_finalize_mod1)
Packit Service 723c1e
    {
Packit Service 723c1e
      puts ("error: tst-dlopen-nodelete-reloc-mod2.so destructor"
Packit Service 723c1e
            " called too early");
Packit Service 723c1e
      _exit (1);
Packit Service 723c1e
    }
Packit Service 723c1e
}