/* tc-nds32.h -- Header file for tc-nds32.c.
- Copyright (C) 2012-2013 Free Software Foundation, Inc.
+ Copyright (C) 2012-2020 Free Software Foundation, Inc.
Contributed by Andes Technology Corporation.
This file is part of GAS.
#include "bfd_stdint.h"
+/* Enum mapping symbol. */
+enum mstate
+{
+ MAP_UNDEFINED = 0, /* Must be zero, for seginfo in new sections. */
+ MAP_DATA,
+ MAP_CODE,
+};
+#define TC_SEGMENT_INFO_TYPE struct nds32_segment_info_type
+
+/* For mapping symbol. */
+struct nds32_segment_info_type
+{
+ enum mstate mapstate;
+};
+
#define LISTING_HEADER \
(target_big_endian ? "NDS32 GAS" : "NDS32 GAS Little Endian")
#define TARGET_BYTES_BIG_ENDIAN 1
#endif
-/* This is used to construct expressions out of @GOTOFF, @PLT and @GOT
- symbols. The relocation type is stored in X_md. */
-#define O_PIC_reloc O_md1
-
/* as.c. */
/* Extend GAS command line option handling capability. */
-extern int nds32_parse_option (int, char *);
+extern int nds32_parse_option (int, const char *);
extern void nds32_after_parse_args (void);
/* The endianness of the target format may change based on command
line arguments. */
/* For DIFF relocations. The default behavior is inconsistent with the
asm internal document. */
#define TC_FORCE_RELOCATION_SUB_SAME(FIX, SEC) \
- (! SEG_NORMAL (SEC) || TC_FORCE_RELOCATION (FIX))
+ (GENERIC_FORCE_RELOCATION_SUB_SAME (FIX, SEC) \
+ || TC_FORCE_RELOCATION (FIX))
#define TC_FORCE_RELOCATION(fix) nds32_force_relocation (fix)
#define TC_VALIDATE_FIX_SUB(FIX,SEG) nds32_validate_fix_sub (FIX,SEG)
#define SET_SECTION_RELOCS(sec, relocs, n) nds32_set_section_relocs (sec, relocs, n)
#define md_macro_start() nds32_macro_start ()
#define md_macro_end() nds32_macro_end ()
#define md_macro_info(args) nds32_macro_info (args)
-#define TC_START_LABEL(C, S, STR) (C == ':' && nds32_start_label (0, 0))
+#define TC_START_LABEL(STR, NUL_CHAR, NEXT_CHAR) \
+ (NEXT_CHAR == ':' && nds32_start_label (0, 0))
#define tc_check_label(label) nds32_check_label (label)
#define tc_frob_label(label) nds32_frob_label (label)
#define md_end md_end
#define LOCAL_LABELS_FB 1 /* Permit temporary numeric labels. */
/* frags.c. */
+
+enum FRAG_ATTR
+{
+ NDS32_FRAG_RELAXABLE = 0x1,
+ NDS32_FRAG_RELAXED = 0x2,
+ NDS32_FRAG_BRANCH = 0x4,
+ NDS32_FRAG_LABEL = 0x8,
+ NDS32_FRAG_FINAL = 0x10,
+ NDS32_FRAG_RELAXABLE_BRANCH = 0x20,
+ NDS32_FRAG_ALIGN = 0x40
+};
+
struct nds32_frag_type
{
relax_substateT flag;
struct nds32_opcode *opcode;
uint32_t insn;
- /* To Save previos label fixup if existence. */
+ /* To Save previous label fixup if existence. */
struct fix *fixup;
};
extern void nds32_frag_init (fragS *);
#define TC_FRAG_TYPE struct nds32_frag_type
-#define TC_FRAG_INIT(fragP) nds32_frag_init (fragP)
+#define TC_FRAG_INIT(fragP, max_bytes) nds32_frag_init (fragP)
/* CFI directive. */
extern void nds32_elf_frame_initial_instructions (void);
enum nds32_ramp
{
- NDS32_CREATE_LABLE = 1,
- NDS32_RELAX = 2,
- NDS32_ORIGIN = 4,
- NDS32_CONVERT = 8
+ NDS32_CREATE_LABEL = 1,
+ NDS32_RELAX = (1 << 1), /* Obsolete in the future. */
+ NDS32_ORIGIN = (1 << 2),
+ NDS32_INSN16 = (1 << 3),
+ NDS32_PTR = (1 << 4),
+ NDS32_ABS = (1 << 5),
+ NDS32_HINT = (1 << 6),
+ NDS32_FIX = (1 << 7),
+ NDS32_ADDEND = (1 << 8),
+ NDS32_SYM = (1 << 9),
+ NDS32_PCREL = (1 << 10),
+ NDS32_PTR_PATTERN = (1 << 11),
+ NDS32_PTR_MULTIPLE = (1 << 12),
+ NDS32_GROUP = (1 << 13),
+ NDS32_SYM_DESC_MEM = (1 << 14)
};
typedef struct nds32_relax_fixup_info
int offset;
int bitpos; /* Register position. */
int bitmask; /* Number of register bits. */
+ bfd_boolean signed_extend;
} nds32_cond_field_t;
/* The max relaxation pattern is 20-bytes including the nop. */
#define NDS32_MAXCHAR 20
-/* In current, the max entend number of instruction for one pseudo instruction
- is 4, but its number of relocation may be 5. */
-#define MAX_RELAX_NUM 8
+/* In current, the max extended number of instruction for one pseudo instruction
+ is 6, but its number of relocation may be 12. */
+#define MAX_RELAX_NUM 6
+#define MAX_RELAX_FIX 12
typedef struct nds32_relax_info
{
/* Code sequences for different branch range. */
uint32_t relax_code_seq[BR_RANGE_NUM][MAX_RELAX_NUM];
nds32_cond_field_t relax_code_condition[BR_RANGE_NUM][MAX_RELAX_NUM];
- int relax_code_size[BR_RANGE_NUM];
+ unsigned int relax_code_size[BR_RANGE_NUM];
int relax_branch_isize[BR_RANGE_NUM];
- nds32_relax_fixup_info_t relax_fixup[BR_RANGE_NUM][MAX_RELAX_NUM];
+ nds32_relax_fixup_info_t relax_fixup[BR_RANGE_NUM][MAX_RELAX_FIX];
} relax_info_t;
-/* Relocation table. */
-struct nds32_relocation_map
+enum nds32_relax_hint_type
+{
+ NDS32_RELAX_HINT_NONE = 0,
+ NDS32_RELAX_HINT_LA_FLSI,
+ NDS32_RELAX_HINT_LALS,
+ NDS32_RELAX_HINT_LA_PLT,
+ NDS32_RELAX_HINT_LA_GOT,
+ NDS32_RELAX_HINT_LA_GOTOFF,
+ NDS32_RELAX_HINT_TLS_START = 0x100,
+ NDS32_RELAX_HINT_TLS_LE_LS,
+ NDS32_RELAX_HINT_TLS_IE_LS,
+ NDS32_RELAX_HINT_TLS_IE_LA,
+ NDS32_RELAX_HINT_TLS_IEGP_LA,
+ NDS32_RELAX_HINT_TLS_DESC_LS,
+};
+
+struct nds32_relax_hint_table
{
- unsigned int main_type;
- /* Number of instructions, {relocations type, instruction type}. */
- unsigned int reloc_insn[6][6][3];
+ enum nds32_relax_hint_type main_type;
+ unsigned int relax_code_size;
+ uint32_t relax_code_seq[MAX_RELAX_NUM];
+ nds32_relax_fixup_info_t relax_fixup[MAX_RELAX_FIX];
};
#endif /* TC_NDS32 */