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