148ec288d40d272e6fe5e68c4c0a9778b55e24f8aDimitry Ivanov/* 248ec288d40d272e6fe5e68c4c0a9778b55e24f8aDimitry Ivanov * Copyright (C) 2016 The Android Open Source Project 348ec288d40d272e6fe5e68c4c0a9778b55e24f8aDimitry Ivanov * All rights reserved. 448ec288d40d272e6fe5e68c4c0a9778b55e24f8aDimitry Ivanov * 548ec288d40d272e6fe5e68c4c0a9778b55e24f8aDimitry Ivanov * Redistribution and use in source and binary forms, with or without 648ec288d40d272e6fe5e68c4c0a9778b55e24f8aDimitry Ivanov * modification, are permitted provided that the following conditions 748ec288d40d272e6fe5e68c4c0a9778b55e24f8aDimitry Ivanov * are met: 848ec288d40d272e6fe5e68c4c0a9778b55e24f8aDimitry Ivanov * * Redistributions of source code must retain the above copyright 948ec288d40d272e6fe5e68c4c0a9778b55e24f8aDimitry Ivanov * notice, this list of conditions and the following disclaimer. 1048ec288d40d272e6fe5e68c4c0a9778b55e24f8aDimitry Ivanov * * Redistributions in binary form must reproduce the above copyright 1148ec288d40d272e6fe5e68c4c0a9778b55e24f8aDimitry Ivanov * notice, this list of conditions and the following disclaimer in 1248ec288d40d272e6fe5e68c4c0a9778b55e24f8aDimitry Ivanov * the documentation and/or other materials provided with the 1348ec288d40d272e6fe5e68c4c0a9778b55e24f8aDimitry Ivanov * distribution. 1448ec288d40d272e6fe5e68c4c0a9778b55e24f8aDimitry Ivanov * 1548ec288d40d272e6fe5e68c4c0a9778b55e24f8aDimitry Ivanov * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 1648ec288d40d272e6fe5e68c4c0a9778b55e24f8aDimitry Ivanov * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 1748ec288d40d272e6fe5e68c4c0a9778b55e24f8aDimitry Ivanov * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 1848ec288d40d272e6fe5e68c4c0a9778b55e24f8aDimitry Ivanov * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 1948ec288d40d272e6fe5e68c4c0a9778b55e24f8aDimitry Ivanov * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 2048ec288d40d272e6fe5e68c4c0a9778b55e24f8aDimitry Ivanov * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 2148ec288d40d272e6fe5e68c4c0a9778b55e24f8aDimitry Ivanov * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS 2248ec288d40d272e6fe5e68c4c0a9778b55e24f8aDimitry Ivanov * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 2348ec288d40d272e6fe5e68c4c0a9778b55e24f8aDimitry Ivanov * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 2448ec288d40d272e6fe5e68c4c0a9778b55e24f8aDimitry Ivanov * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 2548ec288d40d272e6fe5e68c4c0a9778b55e24f8aDimitry Ivanov * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 2648ec288d40d272e6fe5e68c4c0a9778b55e24f8aDimitry Ivanov * SUCH DAMAGE. 2748ec288d40d272e6fe5e68c4c0a9778b55e24f8aDimitry Ivanov */ 2848ec288d40d272e6fe5e68c4c0a9778b55e24f8aDimitry Ivanov 2948ec288d40d272e6fe5e68c4c0a9778b55e24f8aDimitry Ivanov 3048ec288d40d272e6fe5e68c4c0a9778b55e24f8aDimitry Ivanov#include "linker_globals.h" 3148ec288d40d272e6fe5e68c4c0a9778b55e24f8aDimitry Ivanov#include "linker_namespaces.h" 3248ec288d40d272e6fe5e68c4c0a9778b55e24f8aDimitry Ivanov 3348ec288d40d272e6fe5e68c4c0a9778b55e24f8aDimitry Ivanovint g_argc = 0; 3448ec288d40d272e6fe5e68c4c0a9778b55e24f8aDimitry Ivanovchar** g_argv = nullptr; 3548ec288d40d272e6fe5e68c4c0a9778b55e24f8aDimitry Ivanovchar** g_envp = nullptr; 3648ec288d40d272e6fe5e68c4c0a9778b55e24f8aDimitry Ivanov 3748ec288d40d272e6fe5e68c4c0a9778b55e24f8aDimitry Ivanovandroid_namespace_t g_default_namespace; 3848ec288d40d272e6fe5e68c4c0a9778b55e24f8aDimitry Ivanov 3948ec288d40d272e6fe5e68c4c0a9778b55e24f8aDimitry Ivanovstd::unordered_map<uintptr_t, soinfo*> g_soinfo_handles_map; 4048ec288d40d272e6fe5e68c4c0a9778b55e24f8aDimitry Ivanov 4148ec288d40d272e6fe5e68c4c0a9778b55e24f8aDimitry Ivanovstatic char __linker_dl_err_buf[768]; 4248ec288d40d272e6fe5e68c4c0a9778b55e24f8aDimitry Ivanov 4348ec288d40d272e6fe5e68c4c0a9778b55e24f8aDimitry Ivanovchar* linker_get_error_buffer() { 4448ec288d40d272e6fe5e68c4c0a9778b55e24f8aDimitry Ivanov return &__linker_dl_err_buf[0]; 4548ec288d40d272e6fe5e68c4c0a9778b55e24f8aDimitry Ivanov} 4648ec288d40d272e6fe5e68c4c0a9778b55e24f8aDimitry Ivanov 4748ec288d40d272e6fe5e68c4c0a9778b55e24f8aDimitry Ivanovsize_t linker_get_error_buffer_size() { 4848ec288d40d272e6fe5e68c4c0a9778b55e24f8aDimitry Ivanov return sizeof(__linker_dl_err_buf); 4948ec288d40d272e6fe5e68c4c0a9778b55e24f8aDimitry Ivanov} 5048ec288d40d272e6fe5e68c4c0a9778b55e24f8aDimitry Ivanov 51