OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 /* |
| 6 * Copyright (C) 2012 The Android Open Source Project |
| 7 * All rights reserved. |
| 8 * |
| 9 * Redistribution and use in source and binary forms, with or without |
| 10 * modification, are permitted provided that the following conditions |
| 11 * are met: |
| 12 * * Redistributions of source code must retain the above copyright |
| 13 * notice, this list of conditions and the following disclaimer. |
| 14 * * Redistributions in binary form must reproduce the above copyright |
| 15 * notice, this list of conditions and the following disclaimer in |
| 16 * the documentation and/or other materials provided with the |
| 17 * distribution. |
| 18 * |
| 19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 20 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 21 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
| 22 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE |
| 23 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, |
| 24 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
| 25 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS |
| 26 * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED |
| 27 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
| 28 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT |
| 29 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 30 * SUCH DAMAGE. |
| 31 */ |
| 32 #ifndef LINKER_PHDR_H |
| 33 #define LINKER_PHDR_H |
| 34 |
| 35 /* Declarations related to the ELF program header table and segments. |
| 36 * |
| 37 * The design goal is to provide an API that is as close as possible |
| 38 * to the ELF spec, and does not depend on linker-specific data |
| 39 * structures (e.g. the exact layout of struct soinfo). |
| 40 */ |
| 41 |
| 42 #include "elf_traits.h" |
| 43 |
| 44 size_t phdr_table_get_load_size(const ELF::Phdr* phdr_table, |
| 45 size_t phdr_count, |
| 46 ELF::Addr* min_vaddr = NULL, |
| 47 ELF::Addr* max_vaddr = NULL); |
| 48 |
| 49 int phdr_table_protect_segments(const ELF::Phdr* phdr_table, |
| 50 int phdr_count, |
| 51 ELF::Addr load_bias); |
| 52 |
| 53 int phdr_table_unprotect_segments(const ELF::Phdr* phdr_table, |
| 54 int phdr_count, |
| 55 ELF::Addr load_bias); |
| 56 |
| 57 int phdr_table_get_relro_info(const ELF::Phdr* phdr_table, |
| 58 int phdr_count, |
| 59 ELF::Addr load_bias, |
| 60 ELF::Addr* relro_start, |
| 61 ELF::Addr* relro_size); |
| 62 |
| 63 int phdr_table_protect_gnu_relro(const ELF::Phdr* phdr_table, |
| 64 int phdr_count, |
| 65 ELF::Addr load_bias); |
| 66 |
| 67 #ifdef __arm__ |
| 68 int phdr_table_get_arm_exidx(const ELF::Phdr* phdr_table, |
| 69 int phdr_count, |
| 70 ELF::Addr load_bias, |
| 71 ELF::Addr** arm_exidx, |
| 72 unsigned* arm_exidix_count); |
| 73 #endif |
| 74 |
| 75 void phdr_table_get_dynamic_section(const ELF::Phdr* phdr_table, |
| 76 int phdr_count, |
| 77 ELF::Addr load_bias, |
| 78 const ELF::Dyn** dynamic, |
| 79 size_t* dynamic_count, |
| 80 ELF::Word* dynamic_flags); |
| 81 |
| 82 #endif /* LINKER_PHDR_H */ |
OLD | NEW |