19fa130bfSJens Wiklander /* 29fa130bfSJens Wiklander * Copyright (c) 2015, Linaro Limited 39fa130bfSJens Wiklander * All rights reserved. 49fa130bfSJens Wiklander * 59fa130bfSJens Wiklander * Redistribution and use in source and binary forms, with or without 69fa130bfSJens Wiklander * modification, are permitted provided that the following conditions are met: 79fa130bfSJens Wiklander * 89fa130bfSJens Wiklander * 1. Redistributions of source code must retain the above copyright notice, 99fa130bfSJens Wiklander * this list of conditions and the following disclaimer. 109fa130bfSJens Wiklander * 119fa130bfSJens Wiklander * 2. Redistributions in binary form must reproduce the above copyright notice, 129fa130bfSJens Wiklander * this list of conditions and the following disclaimer in the documentation 139fa130bfSJens Wiklander * and/or other materials provided with the distribution. 149fa130bfSJens Wiklander * 159fa130bfSJens Wiklander * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 169fa130bfSJens Wiklander * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 179fa130bfSJens Wiklander * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 189fa130bfSJens Wiklander * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 199fa130bfSJens Wiklander * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 209fa130bfSJens Wiklander * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 219fa130bfSJens Wiklander * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 229fa130bfSJens Wiklander * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 239fa130bfSJens Wiklander * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 249fa130bfSJens Wiklander * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 259fa130bfSJens Wiklander * POSSIBILITY OF SUCH DAMAGE. 269fa130bfSJens Wiklander */ 279fa130bfSJens Wiklander #ifndef KEEP_H 289fa130bfSJens Wiklander #define KEEP_H 299fa130bfSJens Wiklander 30*d6e86abcSJerome Forissier #ifdef ASM 31*d6e86abcSJerome Forissier 32*d6e86abcSJerome Forissier .macro KEEP_PAGER sym 33*d6e86abcSJerome Forissier .pushsection __keep_meta_vars_pager 34*d6e86abcSJerome Forissier ___keep_pager_\sym: 35*d6e86abcSJerome Forissier .long \sym 36*d6e86abcSJerome Forissier .popsection 37*d6e86abcSJerome Forissier .endm 38*d6e86abcSJerome Forissier 39*d6e86abcSJerome Forissier .macro KEEP_INIT sym 40*d6e86abcSJerome Forissier .pushsection __keep_meta_vars_init 41*d6e86abcSJerome Forissier ___keep_init_\sym: 42*d6e86abcSJerome Forissier .long \sym 43*d6e86abcSJerome Forissier .popsection 44*d6e86abcSJerome Forissier .endm 45*d6e86abcSJerome Forissier 46*d6e86abcSJerome Forissier #else 47*d6e86abcSJerome Forissier 489fa130bfSJens Wiklander #include <compiler.h> 499fa130bfSJens Wiklander 509fa130bfSJens Wiklander #define KEEP_PAGER(sym) \ 519fa130bfSJens Wiklander const unsigned long ____keep_pager_##sym \ 529fa130bfSJens Wiklander __section("__keep_meta_vars_pager") = (unsigned long)&sym 539fa130bfSJens Wiklander 549fa130bfSJens Wiklander #define KEEP_INIT(sym) \ 559fa130bfSJens Wiklander const unsigned long ____keep_init_##sym \ 569fa130bfSJens Wiklander __section("__keep_meta_vars_init") = (unsigned long)&sym 579fa130bfSJens Wiklander 58*d6e86abcSJerome Forissier #endif /* ASM */ 59*d6e86abcSJerome Forissier 609fa130bfSJens Wiklander #endif /*KEEP_H*/ 61