1
/* Copyright (C) 2011 Free Software Foundation, Inc.
2
This file is part of the GNU C Library.
3
Contributed by Chris Metcalf <cmetcalf@tilera.com>, 2011.
5
The GNU C Library is free software; you can redistribute it and/or
6
modify it under the terms of the GNU Lesser General Public
7
License as published by the Free Software Foundation; either
8
version 2.1 of the License, or (at your option) any later version.
10
The GNU C Library is distributed in the hope that it will be useful,
11
but WITHOUT ANY WARRANTY; without even the implied warranty of
12
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
Lesser General Public License for more details.
15
You should have received a copy of the GNU Lesser General Public
16
License along with the GNU C Library; if not, write to the Free
17
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
20
/* Like x86_64, we pass the index of the relocation and not its offset.
21
In _dl_profile_fixup and _dl_call_pltexit we also use the index.
22
Therefore it is wasteful to compute the offset in the trampoline
23
just to reverse the operation immediately afterwards. */
24
#define reloc_offset reloc_arg * sizeof (PLTREL)
25
#define reloc_index reloc_arg
27
#include <elf/dl-runtime.c>
32
/* Support notifying the simulator about new objects. */
33
void internal_function
34
_dl_arch_map_object (struct link_map *l)
38
#define DLPUTC(c) __insn_mtspr(SPR_SIM_CONTROL, \
40
| ((c) << _SIM_CONTROL_OPERATOR_BITS)))
42
/* Write the library address in hex. */
45
for (shift = (int) sizeof (unsigned long) * 8 - 4; shift >= 0; shift -= 4)
46
DLPUTC ("0123456789abcdef"[(l->l_map_start >> shift) & 0xF]);
49
/* Write the library path, including the terminating '\0'. */
50
for (size_t i = 0;; i++)
52
DLPUTC (l->l_name[i]);
53
if (l->l_name[i] == '\0')
59
/* Support notifying the simulator about removed objects prior to munmap(). */
60
void internal_function
61
_dl_unmap (struct link_map *l)
65
#define DLPUTC(c) __insn_mtspr(SPR_SIM_CONTROL, \
66
(SIM_CONTROL_DLCLOSE \
67
| ((c) << _SIM_CONTROL_OPERATOR_BITS)))
69
/* Write the library address in hex. */
72
for (shift = (int) sizeof (unsigned long) * 8 - 4; shift >= 0; shift -= 4)
73
DLPUTC ("0123456789abcdef"[(l->l_map_start >> shift) & 0xF]);
77
__munmap ((void *) l->l_map_start, l->l_map_end - l->l_map_start);
80
#define DL_UNMAP(map) _dl_unmap (map)