1/* tc-loongarch.h -- Header file for tc-loongarch.c. 2 Copyright (C) 2021-2022 Free Software Foundation, Inc. 3 Contributed by Loongson Ltd. 4 5 This file is part of GAS. 6 7 GAS is free software; you can redistribute it and/or modify 8 it under the terms of the GNU General Public License as published by 9 the Free Software Foundation; either version 3 of the license, or 10 (at your option) any later version. 11 12 GAS is distributed in the hope that it will be useful, 13 but WITHOUT ANY WARRANTY; without even the implied warranty of 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 GNU General Public License for more details. 16 17 You should have received a copy of the GNU General Public License 18 along with this program; see the file COPYING3. If not, 19 see <http://www.gnu.org/licenses/>. */ 20 21#ifndef TC_LOONGARCH 22#define TC_LOONGARCH 23 24#define TARGET_BYTES_BIG_ENDIAN 0 25#define TARGET_ARCH bfd_arch_loongarch 26 27#define TARGET_MACH (loongarch_mach ()) 28extern unsigned long loongarch_mach (void); 29 30#define WORKING_DOT_WORD 1 31#define REPEAT_CONS_EXPRESSIONS 32 33/* Early than md_begin. */ 34#define md_after_parse_args loongarch_after_parse_args 35extern void loongarch_after_parse_args (void); 36 37extern void loongarch_pop_insert (void); 38#define md_pop_insert() loongarch_pop_insert () 39 40#define TARGET_FORMAT loongarch_target_format () 41extern const char *loongarch_target_format (void); 42 43#define md_relax_frag(segment, fragp, stretch) \ 44 loongarch_relax_frag (segment, fragp, stretch) 45extern int loongarch_relax_frag (asection *, struct frag *, long); 46#define md_section_align(seg, size) (size) 47#define md_undefined_symbol(name) (0) 48#define md_operand(x) 49 50/* This is called to see whether a reloc against a defined symbol 51 should be converted into a reloc against a section. */ 52#define tc_fix_adjustable(fixp) 0 53 54/* Values passed to md_apply_fix don't include symbol values. */ 55#define TC_FORCE_RELOCATION_SUB_LOCAL(FIX, SEG) 1 56#define TC_VALIDATE_FIX_SUB(FIX, SEG) 1 57#define DIFF_EXPR_OK 1 58 59#define TARGET_USE_CFIPOP 1 60#define DWARF2_DEFAULT_RETURN_COLUMN 1 /* $ra. */ 61#define DWARF2_CIE_DATA_ALIGNMENT -4 62extern int loongarch_dwarf2_addr_size (void); 63#define DWARF2_FDE_RELOC_SIZE loongarch_dwarf2_addr_size () 64#define DWARF2_ADDR_SIZE(bfd) loongarch_dwarf2_addr_size () 65#define CFI_DIFF_EXPR_OK 0 66 67#define tc_cfi_frame_initial_instructions \ 68 loongarch_cfi_frame_initial_instructions 69extern void loongarch_cfi_frame_initial_instructions (void); 70 71#define tc_parse_to_dw2regnum tc_loongarch_parse_to_dw2regnum 72extern void tc_loongarch_parse_to_dw2regnum (expressionS *); 73 74/* A enumerated values to specific how to deal with align in '.text'. 75 Now we want to fill 'andi $r0,$r0,0x0'. 76 Here is the type 0, will fill andi insn later. */ 77#define NOP_OPCODE (0x00) 78 79#define HANDLE_ALIGN(fragp) loongarch_handle_align (fragp) 80extern void loongarch_handle_align (struct frag *); 81#define MAX_MEM_FOR_RS_ALIGN_CODE (3 + 4) 82 83#define elf_tc_final_processing loongarch_elf_final_processing 84extern void loongarch_elf_final_processing (void); 85 86#define MAX_RELOC_NUMBER_A_INSN 20 87 88struct reloc_info 89{ 90 bfd_reloc_code_real_type type; 91 expressionS value; 92}; 93 94#endif 95