12ad451b6Smatt /*- 22ad451b6Smatt * Copyright (c) 2013 The NetBSD Foundation, Inc. 32ad451b6Smatt * All rights reserved. 42ad451b6Smatt * 52ad451b6Smatt * This code is derived from software contributed to The NetBSD Foundation 62ad451b6Smatt * by Matt Thomas of 3am Software Foundry. 72ad451b6Smatt * 82ad451b6Smatt * Redistribution and use in source and binary forms, with or without 92ad451b6Smatt * modification, are permitted provided that the following conditions 102ad451b6Smatt * are met: 112ad451b6Smatt * 1. Redistributions of source code must retain the above copyright 122ad451b6Smatt * notice, this list of conditions and the following disclaimer. 132ad451b6Smatt * 2. Redistributions in binary form must reproduce the above copyright 142ad451b6Smatt * notice, this list of conditions and the following disclaimer in the 152ad451b6Smatt * documentation and/or other materials provided with the distribution. 162ad451b6Smatt * 172ad451b6Smatt * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 182ad451b6Smatt * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 192ad451b6Smatt * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 202ad451b6Smatt * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 212ad451b6Smatt * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 222ad451b6Smatt * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 232ad451b6Smatt * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 242ad451b6Smatt * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 252ad451b6Smatt * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 262ad451b6Smatt * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 272ad451b6Smatt * POSSIBILITY OF SUCH DAMAGE. 282ad451b6Smatt */ 292ad451b6Smatt 302ad451b6Smatt __asm( "\n\t" 312ad451b6Smatt ".pushsection .init, \"ax\", @progbits" "\n\t" 3247068b9cSmatt #ifdef __mips_o32 3347068b9cSmatt ".set noreorder" "\n\t" 3447068b9cSmatt ".set nomacro" "\n\t" 35*1729cd5bSmatt "move $28,$16" "\n\t" 3647068b9cSmatt "lw $25,%got(__do_global_ctors_aux)($28)" "\n\t" 3747068b9cSmatt "nop" "\n\t" 3847068b9cSmatt "addiu $25,$25,%lo(__do_global_ctors_aux)" "\n\t" 3947068b9cSmatt ".reloc 1f,R_MIPS_JALR,__do_global_ctors_aux" "\n\t" 4047068b9cSmatt "1: jalr $25" "\n\t" 4147068b9cSmatt "nop" "\n\t" 4247068b9cSmatt ".set macro" "\n\t" 4347068b9cSmatt ".set reorder" "\n\t" 4447068b9cSmatt #else 452ad451b6Smatt "jal __do_global_ctors_aux" "\n\t" 4647068b9cSmatt #endif 472ad451b6Smatt ".popsection"); 4847068b9cSmatt 492ad451b6Smatt __asm( "\n\t" 502ad451b6Smatt ".pushsection .fini, \"ax\", @progbits" "\n\t" 5147068b9cSmatt #ifdef __mips_o32 5247068b9cSmatt ".set noreorder" "\n\t" 5347068b9cSmatt ".set nomacro" "\n\t" 54*1729cd5bSmatt "move $28,$16" "\n\t" 5547068b9cSmatt "lw $25,%got(__do_global_dtors_aux)($28)" "\n\t" 5647068b9cSmatt "nop" "\n\t" 5747068b9cSmatt "addiu $25,$25,%lo(__do_global_dtors_aux)" "\n\t" 5847068b9cSmatt ".reloc 1f,R_MIPS_JALR,__do_global_dtors_aux" "\n\t" 5947068b9cSmatt "1: jalr $25" "\n\t" 6047068b9cSmatt "nop" "\n\t" 6147068b9cSmatt ".set macro" "\n\t" 6247068b9cSmatt ".set reorder" "\n\t" 6347068b9cSmatt #else 642ad451b6Smatt "jal __do_global_dtors_aux" "\n\t" 6547068b9cSmatt #endif 662ad451b6Smatt ".popsection"); 67