1*56bb7041Schristos /* This file is tc-wasm32.h. 2*56bb7041Schristos Copyright (C) 2017-2020 Free Software Foundation, Inc. 3*56bb7041Schristos 4*56bb7041Schristos This file is part of GAS, the GNU Assembler. 5*56bb7041Schristos 6*56bb7041Schristos GAS is free software; you can redistribute it and/or modify 7*56bb7041Schristos it under the terms of the GNU General Public License as published by 8*56bb7041Schristos the Free Software Foundation; either version 3, or (at your option) 9*56bb7041Schristos any later version. 10*56bb7041Schristos 11*56bb7041Schristos GAS is distributed in the hope that it will be useful, 12*56bb7041Schristos but WITHOUT ANY WARRANTY; without even the implied warranty of 13*56bb7041Schristos MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14*56bb7041Schristos GNU General Public License for more details. 15*56bb7041Schristos 16*56bb7041Schristos You should have received a copy of the GNU General Public License 17*56bb7041Schristos along with GAS; see the file COPYING. If not, write to the Free 18*56bb7041Schristos Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA 19*56bb7041Schristos 02110-1301, USA. */ 20*56bb7041Schristos 21*56bb7041Schristos #define TC_WASM32 22*56bb7041Schristos #define TARGET_FORMAT "elf32-wasm32" 23*56bb7041Schristos #define TARGET_ARCH bfd_arch_wasm32 24*56bb7041Schristos #define TARGET_MACH 1 25*56bb7041Schristos 26*56bb7041Schristos /* WebAssembly is strictly little-endian. */ 27*56bb7041Schristos #define TARGET_BYTES_BIG_ENDIAN 0 28*56bb7041Schristos #define md_number_to_chars number_to_chars_littleendian 29*56bb7041Schristos 30*56bb7041Schristos #define DIFF_EXPR_OK 31*56bb7041Schristos 32*56bb7041Schristos /* No machine-dependent operand expressions. */ 33*56bb7041Schristos #define md_operand(x) 34*56bb7041Schristos 35*56bb7041Schristos /* No broken word processing. */ 36*56bb7041Schristos #define WORKING_DOT_WORD 37*56bb7041Schristos 38*56bb7041Schristos /* Force some relocations. */ 39*56bb7041Schristos #define EXTERN_FORCE_RELOC 1 40*56bb7041Schristos extern int wasm32_force_relocation (struct fix *); 41*56bb7041Schristos #define TC_FORCE_RELOCATION(fix) wasm32_force_relocation (fix) 42*56bb7041Schristos #define TC_FORCE_RELOCATION_LOCAL(fix) 1 43*56bb7041Schristos #define TC_FORCE_RELOCATION_SUB_SAME(fix,seg) wasm32_force_relocation (fix) 44*56bb7041Schristos #define TC_FORCE_RELOCATION_SUB_ABS(fix,seg) wasm32_force_relocation (fix) 45*56bb7041Schristos #define TC_FORCE_RELOCATION_SUB_LOCAL(fix,seg) wasm32_force_relocation (fix) 46*56bb7041Schristos #define TC_VALIDATE_FIX_SUB(fix,seg) wasm32_force_relocation (fix) 47*56bb7041Schristos 48*56bb7041Schristos /* This is ELF, values passed to md_apply_fix don't include the symbol 49*56bb7041Schristos value. */ 50*56bb7041Schristos #define MD_APPLY_SYM_VALUE(FIX) 0 51*56bb7041Schristos 52*56bb7041Schristos /* PC-relative relocations are relative to the relocation offset. */ 53*56bb7041Schristos #define MD_PCREL_FROM_SECTION(FIX, SEC) 0 54*56bb7041Schristos 55*56bb7041Schristos #define DWARF2_LINE_MIN_INSN_LENGTH 1 56*56bb7041Schristos 57*56bb7041Schristos /* WebAssembly uses 32-bit addresses. */ 58*56bb7041Schristos #define TC_ADDRESS_BYTES() 4 59*56bb7041Schristos #define DWARF2_ADDR_SIZE(bfd) 4 60*56bb7041Schristos 61*56bb7041Schristos /* Enable cfi directives. */ 62*56bb7041Schristos #define TARGET_USE_CFIPOP 1 63*56bb7041Schristos 64*56bb7041Schristos /* The stack grows down, and there is no harm in claiming it is only 65*56bb7041Schristos byte aligned. */ 66*56bb7041Schristos #define DWARF2_CIE_DATA_ALIGNMENT -1 67*56bb7041Schristos 68*56bb7041Schristos /* Define the column that represents the PC. FIXME: this depends on 69*56bb7041Schristos the ABI. */ 70*56bb7041Schristos #define DWARF2_DEFAULT_RETURN_COLUMN 36 71*56bb7041Schristos 72*56bb7041Schristos /* Define a hook to setup initial CFI state. */ 73*56bb7041Schristos #define tc_cfi_frame_initial_instructions() do { } while (0) 74*56bb7041Schristos 75*56bb7041Schristos #define elf_tc_final_processing() 76*56bb7041Schristos #define md_post_relax_hook 77*56bb7041Schristos #define md_start_line_hook() 78*56bb7041Schristos #define HANDLE_ALIGN(fragP) 79*56bb7041Schristos 80*56bb7041Schristos 81*56bb7041Schristos extern bfd_boolean wasm32_fix_adjustable (struct fix *); 82*56bb7041Schristos #define tc_fix_adjustable(FIX) wasm32_fix_adjustable (FIX) 83*56bb7041Schristos 84*56bb7041Schristos /* Type names for blocks and signatures. */ 85*56bb7041Schristos #define BLOCK_TYPE_NONE 0x40 86*56bb7041Schristos #define BLOCK_TYPE_I32 0x7f 87*56bb7041Schristos #define BLOCK_TYPE_I64 0x7e 88*56bb7041Schristos #define BLOCK_TYPE_F32 0x7d 89*56bb7041Schristos #define BLOCK_TYPE_F64 0x7c 90