-#define INITIAL_STATE \
- /* initialize as per DWARF2.0 standard: */ \
- 0, /* address */ \
- 1, /* file */ \
- 1, /* line */ \
- 0, /* column */ \
- DWARF2_LINE_DEFAULT_IS_STMT, /* is_stmt */ \
- 0, /* basic_block */ \
- 1 /* empty_sequence */
-
-static struct
- {
- /* state machine state as per DWARF2 manual: */
- struct dwarf2_sm
- {
- addressT addr;
- unsigned int filenum;
- unsigned int line;
- unsigned int column;
- unsigned int
- is_stmt : 1,
- basic_block : 1,
- empty_sequence : 1; /* current code sequence has no DWARF2 directives? */
- }
- sm;
-
- unsigned int
- any_dwarf2_directives : 1; /* did we emit any DWARF2 line debug directives? */
-
- segT text_seg; /* text segment "addr" is relative to */
- subsegT text_subseg;
- segT line_seg; /* ".debug_line" segment */
- int last_filename; /* index of last filename that was used */
- int num_filenames; /* index of last filename in use */
- int filename_len; /* length of the filename array */
- struct
- {
- int dir; /* valid after gen_dir_list() only */
- char *name; /* full path before gen_dir_list(), filename afterwards */
- }
- *file;
-
- struct dwarf2_line_info current; /* current source info: */
-
- /* counters for statistical purposes: */
- unsigned int num_line_entries;
- unsigned int opcode_hist[256]; /* histogram of opcode frequencies */
- }
-ls =
- {
- {
- INITIAL_STATE
- },
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- NULL,
- { NULL, 0, 0, 0, 0 },
- 0,
- {
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- }
- };
-
-
-/* Function prototypes: */
-static void out_uleb128 PARAMS ((addressT));
-static void out_sleb128 PARAMS ((offsetT));
-static void gen_addr_line PARAMS ((int, addressT));
-static void reset_state_machine PARAMS ((void));
-static void out_set_addr PARAMS ((addressT));
-static void out_end_sequence PARAMS ((void));
-static int get_filenum PARAMS ((int, char *));
-static void gen_dir_list PARAMS ((void));
-static void gen_file_list PARAMS ((void));
-static void print_stats PARAMS ((unsigned long));
-
-
-#define out_byte(byte) FRAG_APPEND_1_CHAR(byte)
-#define out_opcode(opc) (out_byte ((opc)), ++ls.opcode_hist[(opc) & 0xff])
-
-/* Output an unsigned "little-endian base 128" number. */
+struct line_entry {
+ struct line_entry *next;
+ fragS *frag;
+ addressT frag_ofs;
+ struct dwarf2_line_info loc;
+};
+
+struct line_subseg {
+ struct line_subseg *next;
+ subsegT subseg;
+ struct line_entry *head;
+ struct line_entry **ptail;
+};
+
+struct line_seg {
+ struct line_seg *next;
+ segT seg;
+ struct line_subseg *head;
+ symbolS *text_start;
+ symbolS *text_end;
+};
+
+/* Collects data for all line table entries during assembly. */
+static struct line_seg *all_segs;
+
+struct file_entry {
+ const char *filename;
+ unsigned int dir;
+};
+
+/* Table of files used by .debug_line. */
+static struct file_entry *files;
+static unsigned int files_in_use;
+static unsigned int files_allocated;
+
+/* Table of directories used by .debug_line. */
+static char **dirs;
+static unsigned int dirs_in_use;
+static unsigned int dirs_allocated;
+
+/* TRUE when we've seen a .loc directive recently. Used to avoid
+ doing work when there's nothing to do. */
+static bfd_boolean loc_directive_seen;
+
+/* Current location as indicated by the most recent .loc directive. */
+static struct dwarf2_line_info current;
+
+/* The size of an address on the target. */
+static unsigned int sizeof_address;
+\f
+static struct line_subseg *get_line_subseg (segT, subsegT);
+static unsigned int get_filenum (const char *, unsigned int);
+static struct frag *first_frag_for_seg (segT);
+static struct frag *last_frag_for_seg (segT);
+static void out_byte (int);
+static void out_opcode (int);
+static void out_two (int);
+static void out_four (int);
+static void out_abbrev (int, int);
+static void out_uleb128 (addressT);
+static offsetT get_frag_fix (fragS *);
+static void out_set_addr (segT, fragS *, addressT);
+static int size_inc_line_addr (int, addressT);
+static void emit_inc_line_addr (int, addressT, char *, int);
+static void out_inc_line_addr (int, addressT);
+static void relax_inc_line_addr (int, segT, fragS *, addressT,
+ fragS *, addressT);
+static void process_entries (segT, struct line_entry *);
+static void out_file_list (void);
+static void out_debug_line (segT);
+static void out_debug_aranges (segT, segT);
+static void out_debug_abbrev (segT);
+static void out_debug_info (segT, segT, segT);
+\f
+#ifndef TC_DWARF2_EMIT_OFFSET
+# define TC_DWARF2_EMIT_OFFSET generic_dwarf2_emit_offset
+static void generic_dwarf2_emit_offset (symbolS *, unsigned int);
+
+/* Create an offset to .dwarf2_*. */
+