/* tc-riscv.h -- header file for tc-riscv.c.
- Copyright 2011-2016 Free Software Foundation, Inc.
+ Copyright (C) 2011-2019 Free Software Foundation, Inc.
Contributed by Andrew Waterman (andrew@sifive.com).
Based on MIPS target.
/* Symbols named FAKE_LABEL_NAME are emitted when generating DWARF, so make
sure FAKE_LABEL_NAME is printable. It still must be distinct from any
real label name. So, append a space, which other labels can't contain. */
-#define FAKE_LABEL_NAME ".L0 "
+#define FAKE_LABEL_NAME RISCV_FAKE_LABEL_NAME
+/* Changing the special character in FAKE_LABEL_NAME requires changing
+ FAKE_LABEL_CHAR too. */
+#define FAKE_LABEL_CHAR RISCV_FAKE_LABEL_CHAR
#define md_relax_frag(segment, fragp, stretch) \
riscv_relax_frag (segment, fragp, stretch)
#define md_undefined_symbol(name) (0)
#define md_operand(x)
-/* FIXME: it is unclear if this is used, or if it is even correct. */
-#define MAX_MEM_FOR_RS_ALIGN_CODE (1 + 2)
+extern bfd_boolean riscv_frag_align_code (int);
+#define md_do_align(N, FILL, LEN, MAX, LABEL) \
+ if ((N) != 0 && !(FILL) && !need_pass_2 && subseg_text_p (now_seg)) \
+ { \
+ if (riscv_frag_align_code (N)) \
+ goto LABEL; \
+ }
+
+extern void riscv_handle_align (fragS *);
+#define HANDLE_ALIGN riscv_handle_align
+
+#define MAX_MEM_FOR_RS_ALIGN_CODE (3 + 4)
/* The ISA of the target may change based on command-line arguments. */
#define TARGET_FORMAT riscv_target_format()
/* Postpone text-section label subtraction calculation until linking, since
linker relaxations might change the deltas. */
-#define TC_FORCE_RELOCATION_SUB_SAME(FIX, SEG) ((SEG)->flags & SEC_CODE)
+#define TC_FORCE_RELOCATION_SUB_SAME(FIX, SEG) \
+ (GENERIC_FORCE_RELOCATION_SUB_SAME (FIX, SEG) \
+ || ((SEG)->flags & SEC_CODE) != 0)
#define TC_FORCE_RELOCATION_SUB_LOCAL(FIX, SEG) 1
#define TC_VALIDATE_FIX_SUB(FIX, SEG) 1
#define TC_FORCE_RELOCATION_LOCAL(FIX) 1
#define elf_tc_final_processing riscv_elf_final_processing
extern void riscv_elf_final_processing (void);
+/* Adjust debug_line after relaxation. */
+#define DWARF2_USE_FIXED_ADVANCE_PC 1
+
#endif /* TC_RISCV */