10fd55ba58eee50c65bc52ce44f7374e91ac83b54Andrew Hsieh/* 20fd55ba58eee50c65bc52ce44f7374e91ac83b54Andrew Hsieh * Copyright (C) 2012 The Android Open Source Project 30fd55ba58eee50c65bc52ce44f7374e91ac83b54Andrew Hsieh * All rights reserved. 40fd55ba58eee50c65bc52ce44f7374e91ac83b54Andrew Hsieh * 50fd55ba58eee50c65bc52ce44f7374e91ac83b54Andrew Hsieh * Redistribution and use in source and binary forms, with or without 60fd55ba58eee50c65bc52ce44f7374e91ac83b54Andrew Hsieh * modification, are permitted provided that the following conditions 70fd55ba58eee50c65bc52ce44f7374e91ac83b54Andrew Hsieh * are met: 80fd55ba58eee50c65bc52ce44f7374e91ac83b54Andrew Hsieh * * Redistributions of source code must retain the above copyright 90fd55ba58eee50c65bc52ce44f7374e91ac83b54Andrew Hsieh * notice, this list of conditions and the following disclaimer. 100fd55ba58eee50c65bc52ce44f7374e91ac83b54Andrew Hsieh * * Redistributions in binary form must reproduce the above copyright 110fd55ba58eee50c65bc52ce44f7374e91ac83b54Andrew Hsieh * notice, this list of conditions and the following disclaimer in 120fd55ba58eee50c65bc52ce44f7374e91ac83b54Andrew Hsieh * the documentation and/or other materials provided with the 130fd55ba58eee50c65bc52ce44f7374e91ac83b54Andrew Hsieh * distribution. 140fd55ba58eee50c65bc52ce44f7374e91ac83b54Andrew Hsieh * 150fd55ba58eee50c65bc52ce44f7374e91ac83b54Andrew Hsieh * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 160fd55ba58eee50c65bc52ce44f7374e91ac83b54Andrew Hsieh * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 170fd55ba58eee50c65bc52ce44f7374e91ac83b54Andrew Hsieh * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 180fd55ba58eee50c65bc52ce44f7374e91ac83b54Andrew Hsieh * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 190fd55ba58eee50c65bc52ce44f7374e91ac83b54Andrew Hsieh * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 200fd55ba58eee50c65bc52ce44f7374e91ac83b54Andrew Hsieh * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 210fd55ba58eee50c65bc52ce44f7374e91ac83b54Andrew Hsieh * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS 220fd55ba58eee50c65bc52ce44f7374e91ac83b54Andrew Hsieh * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 230fd55ba58eee50c65bc52ce44f7374e91ac83b54Andrew Hsieh * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 240fd55ba58eee50c65bc52ce44f7374e91ac83b54Andrew Hsieh * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 250fd55ba58eee50c65bc52ce44f7374e91ac83b54Andrew Hsieh * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 260fd55ba58eee50c65bc52ce44f7374e91ac83b54Andrew Hsieh * SUCH DAMAGE. 270fd55ba58eee50c65bc52ce44f7374e91ac83b54Andrew Hsieh */ 280fd55ba58eee50c65bc52ce44f7374e91ac83b54Andrew Hsieh#ifndef _LINK_H_ 290fd55ba58eee50c65bc52ce44f7374e91ac83b54Andrew Hsieh#define _LINK_H_ 30cd89a9be3397dfc6416835b3f1cbe37b3e5b605bAndrew Hsieh 31cd89a9be3397dfc6416835b3f1cbe37b3e5b605bAndrew Hsieh#include <sys/types.h> 32cd89a9be3397dfc6416835b3f1cbe37b3e5b605bAndrew Hsieh#include <elf.h> 33cd89a9be3397dfc6416835b3f1cbe37b3e5b605bAndrew Hsieh 340fd55ba58eee50c65bc52ce44f7374e91ac83b54Andrew Hsieh__BEGIN_DECLS 350fd55ba58eee50c65bc52ce44f7374e91ac83b54Andrew Hsieh 360fd55ba58eee50c65bc52ce44f7374e91ac83b54Andrew Hsieh/* bionic is currently only 32-bit. */ 370fd55ba58eee50c65bc52ce44f7374e91ac83b54Andrew Hsieh#define ElfW(type) Elf32_##type 380fd55ba58eee50c65bc52ce44f7374e91ac83b54Andrew Hsieh 390fd55ba58eee50c65bc52ce44f7374e91ac83b54Andrew Hsiehstruct dl_phdr_info { 400fd55ba58eee50c65bc52ce44f7374e91ac83b54Andrew Hsieh ElfW(Addr) dlpi_addr; 410fd55ba58eee50c65bc52ce44f7374e91ac83b54Andrew Hsieh const char* dlpi_name; 420fd55ba58eee50c65bc52ce44f7374e91ac83b54Andrew Hsieh const ElfW(Phdr)* dlpi_phdr; 430fd55ba58eee50c65bc52ce44f7374e91ac83b54Andrew Hsieh ElfW(Half) dlpi_phnum; 44cd89a9be3397dfc6416835b3f1cbe37b3e5b605bAndrew Hsieh}; 45cd89a9be3397dfc6416835b3f1cbe37b3e5b605bAndrew Hsieh 460fd55ba58eee50c65bc52ce44f7374e91ac83b54Andrew Hsieh#ifdef __arm__ 470fd55ba58eee50c65bc52ce44f7374e91ac83b54Andrew Hsiehtypedef long unsigned int* _Unwind_Ptr; 480fd55ba58eee50c65bc52ce44f7374e91ac83b54Andrew Hsieh_Unwind_Ptr dl_unwind_find_exidx(_Unwind_Ptr pc, int* pcount); 490fd55ba58eee50c65bc52ce44f7374e91ac83b54Andrew Hsieh#else 500fd55ba58eee50c65bc52ce44f7374e91ac83b54Andrew Hsiehint dl_iterate_phdr(int (*cb)(struct dl_phdr_info*, size_t, void*), void*); 51cd89a9be3397dfc6416835b3f1cbe37b3e5b605bAndrew Hsieh#endif 52cd89a9be3397dfc6416835b3f1cbe37b3e5b605bAndrew Hsieh 530fd55ba58eee50c65bc52ce44f7374e91ac83b54Andrew Hsieh__END_DECLS 540fd55ba58eee50c65bc52ce44f7374e91ac83b54Andrew Hsieh 550fd55ba58eee50c65bc52ce44f7374e91ac83b54Andrew Hsieh#endif /* _LINK_H_ */ 56