powerpc: Update pow() ULPs
[glibc.git] / elf / dl-reloc-static-pie.c
blobbd2d516e5d75ae76cd8832b7946b178e15f0e328
1 /* Support for relocating static PIE.
2 Copyright (C) 2017-2018 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
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, see
17 <http://www.gnu.org/licenses/>. */
19 #if ENABLE_STATIC_PIE
20 #include <unistd.h>
21 #include <ldsodefs.h>
22 #include "dynamic-link.h"
24 /* Relocate static executable with PIE. */
26 void
27 _dl_relocate_static_pie (void)
29 struct link_map *main_map = _dl_get_dl_main_map ();
31 # define STATIC_PIE_BOOTSTRAP
32 # define BOOTSTRAP_MAP (main_map)
33 # define RESOLVE_MAP(sym, version, flags) BOOTSTRAP_MAP
34 # include "dynamic-link.h"
36 /* Figure out the run-time load address of static PIE. */
37 main_map->l_addr = elf_machine_load_address ();
39 /* Read our own dynamic section and fill in the info array. */
40 main_map->l_ld = ((void *) main_map->l_addr + elf_machine_dynamic ());
41 elf_get_dynamic_info (main_map, NULL);
43 # ifdef ELF_MACHINE_BEFORE_RTLD_RELOC
44 ELF_MACHINE_BEFORE_RTLD_RELOC (main_map->l_info);
45 # endif
47 /* Relocate ourselves so we can do normal function calls and
48 data access using the global offset table. */
49 ELF_DYNAMIC_RELOCATE (main_map, 0, 0, 0);
50 main_map->l_relocated = 1;
52 #endif