1 /* Resolve conflicts against already prelinked libraries.
2 Copyright (C) 2001 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4 Contributed by Jakub Jelinek <jakub@redhat.com>, 2001.
6 The GNU C Library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Library General Public License as
8 published by the Free Software Foundation; either version 2 of the
9 License, or (at your option) any later version.
11 The GNU C Library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Library General Public License for more details.
16 You should have received a copy of the GNU Library General Public
17 License along with the GNU C Library; see the file COPYING.LIB. If not,
18 write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA. */
27 #include <sys/types.h>
28 #include "dynamic-link.h"
30 extern unsigned long int _dl_num_cache_relocations
; /* in dl-lookup.c */
33 _dl_resolve_conflicts (struct link_map
*l
, ElfW(Rela
) *conflict
,
34 ElfW(Rela
) *conflictend
)
36 if (__builtin_expect (_dl_debug_mask
& DL_DEBUG_RELOC
, 0))
37 _dl_printf ("\nconflict processing: %s\n",
38 l
->l_name
[0] ? l
->l_name
: _dl_argv
[0]);
41 /* Do the conflict relocation of the object and library GOT and other
44 /* This macro is used as a callback from the ELF_DYNAMIC_RELOCATE code. */
45 #define RESOLVE_MAP(ref, version, flags) (*ref = NULL, 0)
46 #define RESOLVE(ref, version, flags) (*ref = NULL, 0)
47 #define RESOLVE_CONFLICT_FIND_MAP(map, r_offset) \
50 while (resolve_conflict_map->l_map_end < (r_offset) \
51 || resolve_conflict_map->l_map_start > (r_offset)) \
52 resolve_conflict_map \
53 = resolve_conflict_map->l_next; \
54 (map) = resolve_conflict_map; \
57 struct link_map
*resolve_conflict_map
= _dl_loaded
;
59 #include "dynamic-link.h"
61 _dl_num_cache_relocations
+= conflictend
- conflict
;
63 for (; conflict
< conflictend
; ++conflict
)
64 elf_machine_rela (l
, conflict
, NULL
, NULL
, (void *) conflict
->r_offset
);