|
Packit Service |
82fcde |
/* Resolve conflicts against already prelinked libraries.
|
|
Packit Service |
82fcde |
Copyright (C) 2001-2018 Free Software Foundation, Inc.
|
|
Packit Service |
82fcde |
This file is part of the GNU C Library.
|
|
Packit Service |
82fcde |
Contributed by Jakub Jelinek <jakub@redhat.com>, 2001.
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
The GNU C Library is free software; you can redistribute it and/or
|
|
Packit Service |
82fcde |
modify it under the terms of the GNU Lesser General Public License as
|
|
Packit Service |
82fcde |
published by the Free Software Foundation; either version 2.1 of the
|
|
Packit Service |
82fcde |
License, or (at your option) any later version.
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
The GNU C Library is distributed in the hope that it will be useful,
|
|
Packit Service |
82fcde |
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit Service |
82fcde |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Packit Service |
82fcde |
Lesser General Public License for more details.
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
You should have received a copy of the GNU Lesser General Public
|
|
Packit Service |
82fcde |
License along with the GNU C Library; see the file COPYING.LIB. If
|
|
Packit Service |
82fcde |
not, see <http://www.gnu.org/licenses/>. */
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
#include <errno.h>
|
|
Packit Service |
82fcde |
#include <libintl.h>
|
|
Packit Service |
82fcde |
#include <stdlib.h>
|
|
Packit Service |
82fcde |
#include <unistd.h>
|
|
Packit Service |
82fcde |
#include <ldsodefs.h>
|
|
Packit Service |
82fcde |
#include <sys/mman.h>
|
|
Packit Service |
82fcde |
#include <sys/param.h>
|
|
Packit Service |
82fcde |
#include <sys/types.h>
|
|
Packit Service |
82fcde |
#include "dynamic-link.h"
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
void
|
|
Packit Service |
82fcde |
_dl_resolve_conflicts (struct link_map *l, ElfW(Rela) *conflict,
|
|
Packit Service |
82fcde |
ElfW(Rela) *conflictend)
|
|
Packit Service |
82fcde |
{
|
|
Packit Service |
82fcde |
#if ! ELF_MACHINE_NO_RELA
|
|
Packit Service |
82fcde |
if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_RELOC))
|
|
Packit Service |
82fcde |
_dl_debug_printf ("\nconflict processing: %s\n", DSO_FILENAME (l->l_name));
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
{
|
|
Packit Service |
82fcde |
/* Do the conflict relocation of the object and library GOT and other
|
|
Packit Service |
82fcde |
data. */
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
/* This macro is used as a callback from the ELF_DYNAMIC_RELOCATE code. */
|
|
Packit Service |
82fcde |
#define RESOLVE_MAP(ref, version, flags) (*ref = NULL, NULL)
|
|
Packit Service |
82fcde |
#define RESOLVE(ref, version, flags) (*ref = NULL, 0)
|
|
Packit Service |
82fcde |
#define RESOLVE_CONFLICT_FIND_MAP(map, r_offset) \
|
|
Packit Service |
82fcde |
do { \
|
|
Packit Service |
82fcde |
while ((resolve_conflict_map->l_map_end < (ElfW(Addr)) (r_offset)) \
|
|
Packit Service |
82fcde |
|| (resolve_conflict_map->l_map_start > (ElfW(Addr)) (r_offset))) \
|
|
Packit Service |
82fcde |
resolve_conflict_map = resolve_conflict_map->l_next; \
|
|
Packit Service |
82fcde |
\
|
|
Packit Service |
82fcde |
(map) = resolve_conflict_map; \
|
|
Packit Service |
82fcde |
} while (0)
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
/* Prelinking makes no sense for anything but the main namespace. */
|
|
Packit Service |
82fcde |
assert (l->l_ns == LM_ID_BASE);
|
|
Packit Service |
82fcde |
struct link_map *resolve_conflict_map __attribute__ ((__unused__))
|
|
Packit Service |
82fcde |
= GL(dl_ns)[LM_ID_BASE]._ns_loaded;
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
#include "dynamic-link.h"
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
/* Override these, defined in dynamic-link.h. */
|
|
Packit Service |
82fcde |
#undef CHECK_STATIC_TLS
|
|
Packit Service |
82fcde |
#define CHECK_STATIC_TLS(ref_map, sym_map) ((void) 0)
|
|
Packit Service |
82fcde |
#undef TRY_STATIC_TLS
|
|
Packit Service |
82fcde |
#define TRY_STATIC_TLS(ref_map, sym_map) (0)
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
GL(dl_num_cache_relocations) += conflictend - conflict;
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
for (; conflict < conflictend; ++conflict)
|
|
Packit Service |
82fcde |
elf_machine_rela (l, conflict, NULL, NULL, (void *) conflict->r_offset,
|
|
Packit Service |
82fcde |
0);
|
|
Packit Service |
82fcde |
}
|
|
Packit Service |
82fcde |
#endif
|
|
Packit Service |
82fcde |
}
|