Blame elf/tst-filterobj-dlopen.c

Packit Service 6c06ef
/* Test for BZ#16272, dlopen'ing a filter object.
Packit Service 6c06ef
   Ensure that symbols from the filter object resolve to the filtee.
Packit Service 6c06ef
Packit Service 6c06ef
   Copyright (C) 2020 Free Software Foundation, Inc.
Packit Service 6c06ef
   This file is part of the GNU C Library.
Packit Service 6c06ef
Packit Service 6c06ef
   The GNU C Library is free software; you can redistribute it and/or
Packit Service 6c06ef
   modify it under the terms of the GNU Lesser General Public
Packit Service 6c06ef
   License as published by the Free Software Foundation; either
Packit Service 6c06ef
   version 2.1 of the License, or (at your option) any later version.
Packit Service 6c06ef
Packit Service 6c06ef
   The GNU C Library is distributed in the hope that it will be useful,
Packit Service 6c06ef
   but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit Service 6c06ef
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit Service 6c06ef
   Lesser General Public License for more details.
Packit Service 6c06ef
Packit Service 6c06ef
   You should have received a copy of the GNU Lesser General Public
Packit Service 6c06ef
   License along with the GNU C Library; if not, see
Packit Service 6c06ef
   <https://www.gnu.org/licenses/>.  */
Packit Service 6c06ef
Packit Service 6c06ef
#include <stdio.h>
Packit Service 6c06ef
#include <support/check.h>
Packit Service 6c06ef
#include <support/xdlfcn.h>
Packit Service 6c06ef
Packit Service 6c06ef
static int do_test (void)
Packit Service 6c06ef
{
Packit Service 6c06ef
  void *lib = xdlopen ("tst-filterobj-flt.so", RTLD_LAZY);
Packit Service 6c06ef
  char *(*fn)(void) = xdlsym (lib, "get_text");
Packit Service 6c06ef
  const char* text = fn ();
Packit Service 6c06ef
Packit Service 6c06ef
  printf ("%s\n", text);
Packit Service 6c06ef
Packit Service 6c06ef
  /* Verify the text matches what we expect from the filtee */
Packit Service 6c06ef
  TEST_COMPARE_STRING (text, "Hello from filtee (PASS)");
Packit Service 6c06ef
Packit Service 6c06ef
  return 0;
Packit Service 6c06ef
}
Packit Service 6c06ef
Packit Service 6c06ef
#include <support/test-driver.c>