diff options
author | Timothy Wall <twall@alum.mit.edu> | 2001-11-13 14:22:53 +0000 |
---|---|---|
committer | Timothy Wall <twall@alum.mit.edu> | 2001-11-13 14:22:53 +0000 |
commit | 6e9179034707f18294ae1cbebcc7e9714a46951d (patch) | |
tree | 85f85a20b4ea7e4ff949b0703aae7c42bc8ed6b7 /gas | |
parent | 1a78a35acfb696d2262b7c2d707b9e6421c99aaa (diff) | |
download | gdb-6e9179034707f18294ae1cbebcc7e9714a46951d.zip gdb-6e9179034707f18294ae1cbebcc7e9714a46951d.tar.gz gdb-6e9179034707f18294ae1cbebcc7e9714a46951d.tar.bz2 |
Fix tic54x testsuite failures and Lmem disassembly bugs.
Diffstat (limited to 'gas')
-rw-r--r-- | gas/ChangeLog | 8 | ||||
-rw-r--r-- | gas/config/tc-tic54x.c | 339 | ||||
-rw-r--r-- | gas/config/tc-tic54x.h | 18 | ||||
-rw-r--r-- | gas/testsuite/ChangeLog | 16 | ||||
-rw-r--r-- | gas/testsuite/gas/all/gas.exp | 3 | ||||
-rw-r--r-- | gas/testsuite/gas/macros/macros.exp | 2 | ||||
-rw-r--r-- | gas/testsuite/gas/tic54x/align.d | 8 | ||||
-rw-r--r-- | gas/testsuite/gas/tic54x/align.s | 5 | ||||
-rw-r--r-- | gas/testsuite/gas/tic54x/all-opcodes.d | 142 | ||||
-rw-r--r-- | gas/testsuite/gas/tic54x/extaddr.d | 1 | ||||
-rw-r--r-- | gas/testsuite/gas/tic54x/extaddr.s | 90 | ||||
-rw-r--r-- | gas/testsuite/gas/tic54x/labels.s | 110 | ||||
-rw-r--r-- | gas/testsuite/gas/tic54x/sections.d | 18 | ||||
-rw-r--r-- | gas/testsuite/gas/tic54x/sections.s | 145 | ||||
-rw-r--r-- | gas/write.c | 7 |
15 files changed, 431 insertions, 481 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog index fe13be3..adf6e1a 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,11 @@ +2001-11-11 Timothy Wall <twall@alum.mit.edu> + + * write.c (relax_segment): Convert symbol address into an octet + offset prior to adding to the frag address, which is an octet + offset. Add comments to that effect. + * config/tc-tic54x.c: Fix bugs causing tests to fail. + * config/tc-tic54x.h: Ditch PARAMS macro. + 2001-11-13 Alan Modra <amodra@bigpond.net.au> * config/obj-elf.c (obj_elf_version): Ensure terminating NUL is diff --git a/gas/config/tc-tic54x.c b/gas/config/tc-tic54x.c index 3c59a8a..a61e0a6 100644 --- a/gas/config/tc-tic54x.c +++ b/gas/config/tc-tic54x.c @@ -39,7 +39,11 @@ We don't convert '' to '\0' We don't allow strings with .byte/.half/.short/.long Probably details of the subsym stuff are different - TI sets labels to be data type 4 (T_INT); GAS uses T_NULL. */ + TI sets labels to be data type 4 (T_INT); GAS uses T_NULL. + + COFF1 limits section names to 8 characters. + Some of the default behavior changed from COFF1 to COFF2. +*/ #include <stdlib.h> #include <limits.h> @@ -235,8 +239,7 @@ static subsegT stag_saved_subseg; /* Output a single character (upper octect is zero). */ static void -tic54x_emit_char (c) - char c; +tic54x_emit_char (char c) { expressionS exp; @@ -248,9 +251,7 @@ tic54x_emit_char (c) /* Walk backwards in the frag chain. */ static fragS * -frag_prev (frag, seg) - fragS *frag; - segT seg; +frag_prev (fragS *frag, segT seg) { segment_info_type *seginfo = seg_info (seg); fragS *fragp; @@ -263,9 +264,7 @@ frag_prev (frag, seg) } static fragS * -bit_offset_frag (frag, seg) - fragS *frag; - segT seg; +bit_offset_frag (fragS *frag, segT seg) { while (frag != NULL) { @@ -283,9 +282,7 @@ bit_offset_frag (frag, seg) none. .field/.space/.bes may leave words partially allocated. */ static int -frag_bit_offset (frag, seg) - fragS *frag; - segT seg; +frag_bit_offset (fragS *frag, segT seg) { frag = bit_offset_frag (frag, seg); @@ -319,8 +316,7 @@ parse_expression (char *str, expressionS * exp) unsupported. */ static void -tic54x_asg (x) - int x ATTRIBUTE_UNUSED; +tic54x_asg (int x ATTRIBUTE_UNUSED) { int c; char *name; @@ -381,8 +377,7 @@ tic54x_asg (x) table, since that's what works best. */ static void -tic54x_eval (x) - int x ATTRIBUTE_UNUSED; +tic54x_eval (int x ATTRIBUTE_UNUSED) { char c; int value; @@ -458,8 +453,7 @@ tic54x_eval (x) (not yet implemented). */ static void -tic54x_bss (x) - int x ATTRIBUTE_UNUSED; +tic54x_bss (int x ATTRIBUTE_UNUSED) { char c; char *name; @@ -522,7 +516,7 @@ tic54x_bss (x) symbol_set_frag (symbolP, frag_now); p = frag_var (rs_org, 1, 1, (relax_substateT) 0, symbolP, - (offsetT) (words << 1), (char *) 0); + (offsetT) (words * OCTETS_PER_BYTE), (char *) 0); *p = 0; /* Fill char. */ S_SET_SEGMENT (symbolP, bss_section); @@ -548,12 +542,11 @@ tic54x_bss (x) } static void -stag_add_field_symbols (stag, path, base_offset, rootsym, root_stag_name) - struct stag *stag; - const char *path; - bfd_vma base_offset; - symbolS *rootsym; - const char *root_stag_name; +stag_add_field_symbols (struct stag *stag, + const char *path, + bfd_vma base_offset, + symbolS *rootsym, + const char *root_stag_name) { char prefix[strlen (path) + 2]; struct stag_field *field = stag->field; @@ -606,11 +599,10 @@ stag_add_field_symbols (stag, path, base_offset, rootsym, root_stag_name) complete dereferencing symbols to the symbol table. */ static void -stag_add_field (parent, name, offset, stag) - struct stag *parent; - const char *name; - bfd_vma offset; - struct stag *stag; +stag_add_field (struct stag *parent, + const char *name, + bfd_vma offset, + struct stag *stag) { struct stag_field *sfield = xmalloc (sizeof (struct stag_field)); @@ -787,8 +779,7 @@ tic54x_endstruct (int is_union) format on the existing allocated space. */ static void -tic54x_tag (ignore) - int ignore ATTRIBUTE_UNUSED; +tic54x_tag (int ignore ATTRIBUTE_UNUSED) { char *name = input_line_pointer; int c = get_symbol_end (); @@ -1104,8 +1095,7 @@ tic54x_cons (int type) these, so we ignore the type here. */ void -tic54x_global (type) - int type; +tic54x_global (int type) { char *name; int c; @@ -1139,9 +1129,8 @@ tic54x_global (type) /* Remove the symbol from the local label hash lookup. */ static void -tic54x_remove_local_label (key, value) - const char *key; - PTR value ATTRIBUTE_UNUSED; +tic54x_remove_local_label (const char *key, + PTR value ATTRIBUTE_UNUSED) { PTR *elem = hash_delete (local_label_hash[macro_level], key); free (elem); @@ -1150,8 +1139,7 @@ tic54x_remove_local_label (key, value) /* Reset all local labels. */ static void -tic54x_clear_local_labels (ignored) - int ignored ATTRIBUTE_UNUSED; +tic54x_clear_local_labels (int ignored ATTRIBUTE_UNUSED) { hash_traverse (local_label_hash[macro_level], tic54x_remove_local_label); } @@ -1165,7 +1153,9 @@ tic54x_clear_local_labels (ignored) ARG is 't' for text, 'd' for data, or '*' for a named section - For compatibility, '*' sections have SEC_DATA set instead of SEC_CODE. */ + For compatibility, '*' sections are SEC_CODE if instructions are + encountered, or SEC_DATA if not. +*/ static void tic54x_sect (int arg) @@ -1195,11 +1185,13 @@ tic54x_sect (int arg) int c; name = input_line_pointer; c = get_symbol_end (); + len = strlen(name); name = strcpy (xmalloc (len + 10), name); *input_line_pointer = c; demand_empty_rest_of_line (); } - /* Make sure all named initialized sections are SEC_DATA. */ + /* Make sure all named initialized sections flagged properly. If we + encounter instructions, we'll flag it with SEC_CODE as well. */ strcat (name, ",\"w\"\n"); input_scrub_insert_line (name); obj_coff_section (0); @@ -1356,8 +1348,7 @@ tic54x_space (int arg) Has no effect on the current section. */ static void -tic54x_usect (x) - int x ATTRIBUTE_UNUSED; +tic54x_usect (int x ATTRIBUTE_UNUSED) { char c; char *name; @@ -1453,8 +1444,7 @@ tic54x_usect (x) } static enum cpu_version -lookup_version (ver) - const char *ver; +lookup_version (const char *ver) { enum cpu_version version = VNONE; @@ -1475,8 +1465,7 @@ lookup_version (ver) } static void -set_cpu (version) - enum cpu_version version; +set_cpu (enum cpu_version version) { cpu = version; if (version == V545LP || version == V546LP) @@ -1503,8 +1492,7 @@ set_cpu (version) static int cpu_needs_set = 1; static void -tic54x_version (x) - int x ATTRIBUTE_UNUSED; +tic54x_version (int x ATTRIBUTE_UNUSED) { enum cpu_version version = VNONE; enum cpu_version old_version = cpu; @@ -1573,12 +1561,11 @@ tic54x_float_cons (int type) /* The argument is capitalized if it should be zero-terminated 's' is normal string with upper 8-bits zero-filled, 'p' is packed. - Code copied from read.c, and slightly modified so that strings are packed + Code copied from stringer, and slightly modified so that strings are packed and encoded into the correct octets. */ static void -tic54x_stringer (type) - int type; +tic54x_stringer (int type) { register unsigned int c; char *start; @@ -1665,15 +1652,13 @@ tic54x_stringer (type) } static void -tic54x_p2align (arg) - int arg ATTRIBUTE_UNUSED; +tic54x_p2align (int arg ATTRIBUTE_UNUSED) { as_bad (_("p2align not supported on this target")); } static void -tic54x_align_words (arg) - int arg; +tic54x_align_words (int arg) { /* Only ".align" with no argument is allowed within .struct/.union. */ int count = arg; @@ -1705,8 +1690,7 @@ tic54x_align_words (arg) /* Initialize multiple-bit fields withing a single word of memory. */ static void -tic54x_field (ignore) - int ignore ATTRIBUTE_UNUSED; +tic54x_field (int ignore ATTRIBUTE_UNUSED) { expressionS exp; int size = 16; @@ -1826,8 +1810,7 @@ tic54x_field (ignore) available yet. seg_info ()->bss is the next best thing. */ static int -tic54x_initialized_section (seg) - segT seg; +tic54x_initialized_section (segT seg) { return !seg_info (seg)->bss; } @@ -1840,8 +1823,7 @@ tic54x_initialized_section (seg) Name is required for uninitialized sections. */ static void -tic54x_clink (ignored) - int ignored ATTRIBUTE_UNUSED; +tic54x_clink (int ignored ATTRIBUTE_UNUSED) { segT seg = now_seg; @@ -1887,8 +1869,7 @@ tic54x_clink (ignored) set to "." instead. */ static void -tic54x_set_default_include (dot) - int dot; +tic54x_set_default_include (int dot) { char *dir = "."; char *tmp = NULL; @@ -1932,8 +1913,7 @@ tic54x_set_default_include (dot) Entering/exiting included/copied file clears all local labels. */ static void -tic54x_include (ignored) - int ignored ATTRIBUTE_UNUSED; +tic54x_include (int ignored ATTRIBUTE_UNUSED) { char newblock[] = " .newblock\n"; char *filename; @@ -1976,8 +1956,7 @@ tic54x_include (ignored) } static void -tic54x_message (type) - int type; +tic54x_message (int type) { char *msg; char c; @@ -2023,8 +2002,7 @@ tic54x_message (type) run address (vma). */ static void -tic54x_label (ignored) - int ignored ATTRIBUTE_UNUSED; +tic54x_label (int ignored ATTRIBUTE_UNUSED) { char *name = input_line_pointer; symbolS *symbolP; @@ -2045,8 +2023,7 @@ tic54x_label (ignored) absolute local symbols. */ static void -tic54x_mmregs (ignored) - int ignored ATTRIBUTE_UNUSED; +tic54x_mmregs (int ignored ATTRIBUTE_UNUSED) { symbol *sym; @@ -2079,8 +2056,7 @@ tic54x_loop (int count) /* Normally, endloop gets eaten by the preceding loop. */ static void -tic54x_endloop (ignore) - int ignore ATTRIBUTE_UNUSED; +tic54x_endloop (int ignore ATTRIBUTE_UNUSED) { as_bad (_("ENDLOOP without corresponding LOOP")); ignore_rest_of_line (); @@ -2089,8 +2065,7 @@ tic54x_endloop (ignore) /* .break [condition]. */ static void -tic54x_break (ignore) - int ignore ATTRIBUTE_UNUSED; +tic54x_break (int ignore ATTRIBUTE_UNUSED) { int cond = 1; @@ -2105,8 +2080,7 @@ tic54x_break (ignore) } static void -set_address_mode (mode) - int mode; +set_address_mode (int mode) { amode = mode; if (mode == far_mode) @@ -2120,8 +2094,7 @@ set_address_mode (mode) static int address_mode_needs_set = 1; static void -tic54x_address_mode (mode) - int mode; +tic54x_address_mode (int mode) { if (assembly_begun && amode != (unsigned) mode) { @@ -2144,8 +2117,7 @@ tic54x_address_mode (mode) Designate initialized sections for blocking. */ static void -tic54x_sblock (ignore) - int ignore ATTRIBUTE_UNUSED; +tic54x_sblock (int ignore ATTRIBUTE_UNUSED) { int c = ','; @@ -2200,8 +2172,7 @@ tic54x_sblock (ignore) symbols assigned with .set/.equ may not be redefined. */ static void -tic54x_set (ignore) - int ignore ATTRIBUTE_UNUSED; +tic54x_set (int ignore ATTRIBUTE_UNUSED) { symbolS *symbolP; char *name; @@ -2256,8 +2227,7 @@ tic54x_sslist (int show) Define a substitution string to be local to a macro. */ static void -tic54x_var (ignore) - int ignore ATTRIBUTE_UNUSED; +tic54x_var (int ignore ATTRIBUTE_UNUSED) { static char empty[] = ""; char *name; @@ -2305,8 +2275,7 @@ tic54x_var (ignore) FIXME need to try the source file directory as well. */ static void -tic54x_mlib (ignore) - int ignore ATTRIBUTE_UNUSED; +tic54x_mlib (int ignore ATTRIBUTE_UNUSED) { char *filename; char *path; @@ -2408,6 +2377,8 @@ const pseudo_typeS md_pseudo_table[] = { { "algebraic", s_ignore , 0 }, { "align" , tic54x_align_words , 128 }, + { "ascii" , tic54x_stringer , 'p' }, + { "asciz" , tic54x_stringer , 'P' }, { "even" , tic54x_align_words , 2 }, { "asg" , tic54x_asg , 0 }, { "eval" , tic54x_eval , 0 }, @@ -2626,9 +2597,7 @@ tic54x_macro_end () } static int -subsym_symlen (a, ignore) - char *a; - char *ignore ATTRIBUTE_UNUSED; +subsym_symlen (char *a, char *ignore ATTRIBUTE_UNUSED) { return strlen (a); } @@ -2636,9 +2605,7 @@ subsym_symlen (a, ignore) /* Compare symbol A to string B. */ static int -subsym_symcmp (a, b) - char *a; - char *b; +subsym_symcmp (char *a, char *b) { return strcmp (a, b); } @@ -2647,9 +2614,7 @@ subsym_symcmp (a, b) assumes b is an integer char value as a string. Index is one-based. */ static int -subsym_firstch (a, b) - char *a; - char *b; +subsym_firstch (char *a, char *b) { int val = atoi (b); char *tmp = strchr (a, val); @@ -2660,9 +2625,7 @@ subsym_firstch (a, b) /* Similar to firstch, but returns index of last occurrence of B in A. */ static int -subsym_lastch (a, b) - char *a; - char *b; +subsym_lastch (char *a, char *b) { int val = atoi (b); char *tmp = strrchr (a, val); @@ -2674,9 +2637,7 @@ subsym_lastch (a, b) symbol table). */ static int -subsym_isdefed (a, ignore) - char *a; - char *ignore ATTRIBUTE_UNUSED; +subsym_isdefed (char *a, char *ignore ATTRIBUTE_UNUSED) { symbolS *symbolP = symbol_find (a); @@ -2688,9 +2649,7 @@ subsym_isdefed (a, ignore) symbols, unsubstituted. */ static int -subsym_ismember (sym, list) - char *sym; - char *list; +subsym_ismember (char *sym, char *list) { char *elem, *ptr, *listv; @@ -2728,9 +2687,7 @@ subsym_ismember (sym, list) 5 if decimal. */ static int -subsym_iscons (a, ignore) - char *a; - char *ignore ATTRIBUTE_UNUSED; +subsym_iscons (char *a, char *ignore ATTRIBUTE_UNUSED) { expressionS exp; @@ -2769,9 +2726,7 @@ subsym_iscons (a, ignore) /* Return 1 if A is a valid symbol name. Expects string input. */ static int -subsym_isname (a, ignore) - char *a; - char *ignore ATTRIBUTE_UNUSED; +subsym_isname (char *a, char *ignore ATTRIBUTE_UNUSED) { if (!is_name_beginner (*a)) return 0; @@ -2789,9 +2744,7 @@ subsym_isname (a, ignore) Note this does not recognize "A" or "B" accumulators. */ static int -subsym_isreg (a, ignore) - char *a; - char *ignore ATTRIBUTE_UNUSED; +subsym_isreg (char *a, char *ignore ATTRIBUTE_UNUSED) { if (hash_find (reg_hash, a)) return 1; @@ -2803,9 +2756,7 @@ subsym_isreg (a, ignore) /* Return the structrure size, given the stag. */ static int -subsym_structsz (name, ignore) - char *name; - char *ignore ATTRIBUTE_UNUSED; +subsym_structsz (char *name, char *ignore ATTRIBUTE_UNUSED) { struct stag *stag = (struct stag *) hash_find (stag_hash, name); if (stag) @@ -2822,9 +2773,8 @@ subsym_structsz (name, ignore) return zero, we punt and return zero. */ static int -subsym_structacc (stag_name, ignore) - char *stag_name ATTRIBUTE_UNUSED; - char *ignore ATTRIBUTE_UNUSED; +subsym_structacc (char *stag_name ATTRIBUTE_UNUSED, + char *ignore ATTRIBUTE_UNUSED) { return 0; } @@ -3115,8 +3065,7 @@ static const math_proc_entry math_procs[] = void md_begin () { - template *opcode; - partemplate *paropcode; + template *tm; symbol *sym; const subsym_proc_entry *subsym_proc; const math_proc_entry *math_proc; @@ -3143,26 +3092,24 @@ md_begin () } op_hash = hash_new (); - for (opcode = (template *) tic54x_optab; opcode->name; opcode++) + for (tm = (template *) tic54x_optab; tm->name; tm++) { - if (hash_find (op_hash, opcode->name)) + if (hash_find (op_hash, tm->name)) continue; - hash_err = hash_insert (op_hash, opcode->name, (char *) opcode); + hash_err = hash_insert (op_hash, tm->name, (char *) tm); if (hash_err) as_fatal ("Internal Error: Can't hash %s: %s", - opcode->name, hash_err); + tm->name, hash_err); } parop_hash = hash_new (); - for (paropcode = (partemplate *) tic54x_paroptab; - paropcode->name; - paropcode++) + for (tm = (template *) tic54x_paroptab; tm->name; tm++) { - if (hash_find (parop_hash, paropcode->name)) + if (hash_find (parop_hash, tm->name)) continue; - hash_err = hash_insert (parop_hash, paropcode->name, (char *) paropcode); + hash_err = hash_insert (parop_hash, tm->name, (char *) tm); if (hash_err) as_fatal ("Internal Error: Can't hash %s: %s", - paropcode->name, hash_err); + tm->name, hash_err); } reg_hash = hash_new (); for (sym = (symbol *) regs; sym->name; sym++) @@ -3232,7 +3179,6 @@ md_begin () typedef struct _tic54x_insn { const template *tm; /* Opcode template. */ - const partemplate *ptm; /* Parallel opcode template. */ char mnemonic[MAX_LINE]; /* Opcode name/mnemonic. */ char parmnemonic[MAX_LINE]; /* 2nd mnemonic of parallel insn. */ @@ -3268,10 +3214,10 @@ static int encode_dmad (tic54x_insn *, struct opstruct *, int); static int operands_match (tic54x_insn *, struct opstruct *, int, const enum optype *, int, int); static int encode_address (tic54x_insn *, struct opstruct *); +static int is_accumulator (struct opstruct *); static int -is_accumulator (operand) - struct opstruct *operand; +is_accumulator (struct opstruct *operand) { return strcasecmp (operand->buf, "a") == 0 || strcasecmp (operand->buf, "b") == 0; @@ -3282,9 +3228,7 @@ is_accumulator (operand) the next array. */ static int -get_operands (operands, line) - struct opstruct operands[]; - char *line; +get_operands (struct opstruct operands[], char *line) { char *lptr = line; int numexp = 0; @@ -3409,8 +3353,7 @@ get_operands (operands, line) /* Predicates for different operand types. */ static int -is_immediate (operand) - struct opstruct *operand; +is_immediate (struct opstruct *operand) { return *operand->buf == '#'; } @@ -3419,8 +3362,7 @@ is_immediate (operand) and must *not* have the '#' prefix. */ static int -is_absolute (operand) - struct opstruct *operand; +is_absolute (struct opstruct *operand) { return operand->exp.X_op == O_constant && !is_immediate (operand); } @@ -3428,8 +3370,7 @@ is_absolute (operand) /* Is this an indirect operand? */ static int -is_indirect (operand) - struct opstruct *operand; +is_indirect (struct opstruct *operand) { return operand->buf[0] == '*'; } @@ -3437,8 +3378,7 @@ is_indirect (operand) /* Is this a valid dual-memory operand? */ static int -is_dual (operand) - struct opstruct *operand; +is_dual (struct opstruct *operand) { if (is_indirect (operand) && strncasecmp (operand->buf, "*ar", 3) == 0) { @@ -3458,8 +3398,7 @@ is_dual (operand) } static int -is_mmreg (operand) - struct opstruct *operand; +is_mmreg (struct opstruct *operand) { return (is_absolute (operand) || is_immediate (operand) @@ -3467,9 +3406,7 @@ is_mmreg (operand) } static int -is_type (operand, type) - struct opstruct *operand; - enum optype type; +is_type (struct opstruct *operand, enum optype type) { switch (type) { @@ -3727,9 +3664,7 @@ encode_address (insn, operand) } static int -encode_indirect (insn, operand) - tic54x_insn *insn; - struct opstruct *operand; +encode_indirect (tic54x_insn *insn, struct opstruct *operand) { int arf; int mod; @@ -3801,11 +3736,9 @@ encode_indirect (insn, operand) } static int -encode_integer (insn, operand, which, min, max, mask) - tic54x_insn *insn; - struct opstruct *operand; - int which, min, max; - unsigned short mask; +encode_integer (tic54x_insn *insn, + struct opstruct *operand, + int which, int min, int max, unsigned short mask) { long parse, integer; @@ -3860,9 +3793,7 @@ encode_integer (insn, operand, which, min, max, mask) } static int -encode_condition (insn, operand) - tic54x_insn *insn; - struct opstruct *operand; +encode_condition (tic54x_insn *insn, struct opstruct *operand) { symbol *cc = (symbol *) hash_find (cc_hash, operand->buf); if (!cc) @@ -3922,9 +3853,7 @@ encode_condition (insn, operand) } static int -encode_cc3 (insn, operand) - tic54x_insn *insn; - struct opstruct *operand; +encode_cc3 (tic54x_insn *insn, struct opstruct *operand) { symbol *cc3 = (symbol *) hash_find (cc3_hash, operand->buf); int value = cc3 ? cc3->value : operand->exp.X_add_number << 8; @@ -3939,9 +3868,7 @@ encode_cc3 (insn, operand) } static int -encode_arx (insn, operand) - tic54x_insn *insn; - struct opstruct *operand; +encode_arx (tic54x_insn *insn, struct opstruct *operand) { int arf = strlen (operand->buf) >= 3 ? operand->buf[2] - '0' : -1; if (strncasecmp ("ar", operand->buf, 2) || arf < 0 || arf > 7) @@ -3954,9 +3881,7 @@ encode_arx (insn, operand) } static int -encode_cc2 (insn, operand) - tic54x_insn *insn; - struct opstruct *operand; +encode_cc2 (tic54x_insn *insn, struct opstruct *operand) { symbol *cc2 = (symbol *) hash_find (cc2_hash, operand->buf); if (!cc2) @@ -3974,7 +3899,7 @@ encode_operand (insn, type, operand) enum optype type; struct opstruct *operand; { - int ext = insn->tm && ((insn->tm->flags & FL_EXT) != 0); + int ext = (insn->tm->flags & FL_EXT) != 0; if (type == OP_MMR && operand->exp.X_op != O_constant) { @@ -4195,10 +4120,16 @@ encode_operand (insn, type, operand) } static void -emit_insn (insn) - tic54x_insn *insn; +emit_insn (tic54x_insn *insn) { int i; + flagword oldflags = bfd_get_section_flags (stdoutput, now_seg); + flagword flags = oldflags | SEC_CODE; + + if (! bfd_set_section_flags (stdoutput, now_seg, flags)) + as_warn (_("error setting flags for \"%s\": %s"), + bfd_section_name (stdoutput, now_seg), + bfd_errmsg (bfd_get_error ())); for (i = 0; i < insn->words; i++) { @@ -4222,13 +4153,12 @@ emit_insn (insn) return the total number of words used by the instruction. */ static int -build_insn (insn) - tic54x_insn *insn; +build_insn (tic54x_insn *insn) { int i; /* Only non-parallel instructions support lk addressing. */ - if (insn->tm) + if (!(insn->tm->flags & FL_PAR)) { for (i = 0; i < insn->opcount; i++) { @@ -4245,11 +4175,10 @@ build_insn (insn) } } } - insn->words = - (insn->tm ? insn->tm->words : insn->ptm->words) + insn->is_lkaddr; + insn->words = insn->tm->words + insn->is_lkaddr; - insn->opcode[0].word = insn->tm ? insn->tm->opcode : insn->ptm->opcode; - if (insn->tm && (insn->tm->flags & FL_EXT)) + insn->opcode[0].word = insn->tm->opcode; + if (insn->tm->flags & FL_EXT) insn->opcode[1 + insn->is_lkaddr].word = insn->tm->opcode2; for (i = 0; i < insn->opcount; i++) @@ -4258,7 +4187,7 @@ build_insn (insn) if (!encode_operand (insn, type, &insn->operands[i])) return 0; } - if (insn->ptm) + if (insn->tm->flags & FL_PAR) for (i = 0; i < insn->paropcount; i++) { enum optype partype = insn->paroperands[i].type; @@ -4272,8 +4201,7 @@ build_insn (insn) } static int -optimize_insn (insn) - tic54x_insn *insn; +optimize_insn (tic54x_insn *insn) { /* Optimize some instructions, helping out the brain-dead programmer. */ #define is_zero(op) ((op).exp.X_op == O_constant && (op).exp.X_add_number == 0) @@ -4366,9 +4294,7 @@ optimize_insn (insn) /* Find a matching template if possible, and get the operand strings. */ static int -tic54x_parse_insn (insn, line) - tic54x_insn *insn; - char *line; +tic54x_parse_insn (tic54x_insn *insn, char *line) { insn->tm = (template *) hash_find (op_hash, insn->mnemonic); if (!insn->tm) @@ -4415,8 +4341,7 @@ static int parallel_on_next_line_hint = 0; Look for a subsequent line starting with "||". */ static int -next_line_shows_parallel (next_line) - char *next_line; +next_line_shows_parallel (char *next_line) { /* Look for the second half. */ while (ISSPACE (*next_line)) @@ -4427,31 +4352,29 @@ next_line_shows_parallel (next_line) } static int -tic54x_parse_parallel_insn_firstline (insn, line) - tic54x_insn *insn; - char *line; +tic54x_parse_parallel_insn_firstline (tic54x_insn *insn, char *line) { - insn->ptm = (partemplate *) hash_find (parop_hash, insn->mnemonic); - if (!insn->ptm) + insn->tm = (template *) hash_find (parop_hash, insn->mnemonic); + if (!insn->tm) { as_bad (_("Unrecognized parallel instruction \"%s\""), insn->mnemonic); return 0; } - while (insn->ptm->name && strcasecmp (insn->ptm->name, - insn->mnemonic) == 0) + while (insn->tm->name && strcasecmp (insn->tm->name, + insn->mnemonic) == 0) { insn->opcount = get_operands (insn->operands, line); if (insn->opcount < 0) return 0; if (insn->opcount == 2 && operands_match (insn, &insn->operands[0], insn->opcount, - insn->ptm->operand_types, 2, 2)) + insn->tm->operand_types, 2, 2)) { return 1; } - ++(insn->ptm); + ++(insn->tm); } /* Didn't find a matching parallel; try for a normal insn. */ return 0; @@ -4460,30 +4383,28 @@ tic54x_parse_parallel_insn_firstline (insn, line) /* Parse the second line of a two-line parallel instruction. */ static int -tic54x_parse_parallel_insn_lastline (insn, line) - tic54x_insn *insn; - char *line; +tic54x_parse_parallel_insn_lastline (tic54x_insn *insn, char *line) { int valid_mnemonic = 0; insn->paropcount = get_operands (insn->paroperands, line); - while (insn->ptm->name && strcasecmp (insn->ptm->name, + while (insn->tm->name && strcasecmp (insn->tm->name, insn->mnemonic) == 0) { - if (strcasecmp (insn->ptm->parname, insn->parmnemonic) == 0) + if (strcasecmp (insn->tm->parname, insn->parmnemonic) == 0) { valid_mnemonic = 1; - if (insn->paropcount >= insn->ptm->minops - && insn->paropcount <= insn->ptm->maxops + if (insn->paropcount >= insn->tm->minops + && insn->paropcount <= insn->tm->maxops && operands_match (insn, insn->paroperands, insn->paropcount, - insn->ptm->paroperand_types, - insn->ptm->minops, insn->ptm->maxops)) + insn->tm->paroperand_types, + insn->tm->minops, insn->tm->maxops)) { return 1; } } - ++(insn->ptm); + ++(insn->tm); } if (valid_mnemonic) as_bad (_("Invalid operand (s) for parallel instruction \"%s\""), diff --git a/gas/config/tc-tic54x.h b/gas/config/tc-tic54x.h index f239fc9..07b1f67 100644 --- a/gas/config/tc-tic54x.h +++ b/gas/config/tc-tic54x.h @@ -83,26 +83,26 @@ extern void tic54x_cons_fix_new PARAMS((fragS *,int,int,expressionS *)); */ #define md_number_to_chars tic54x_number_to_chars -extern void tic54x_number_to_chars PARAMS((char *, valueT, int)); +extern void tic54x_number_to_chars (char *, valueT, int); #define tc_adjust_symtab() tic54x_adjust_symtab() -extern void tic54x_adjust_symtab PARAMS(()); +extern void tic54x_adjust_symtab (void); #define tc_unrecognized_line(ch) tic54x_unrecognized_line(ch) -extern int tic54x_unrecognized_line PARAMS((int ch)); +extern int tic54x_unrecognized_line (int ch); #define md_parse_name(s,e,c) tic54x_parse_name(s,e) -extern int tic54x_parse_name PARAMS((char *name, expressionS *e)); +extern int tic54x_parse_name (char *name, expressionS *e); #define md_undefined_symbol(s) tic54x_undefined_symbol(s) -extern symbolS *tic54x_undefined_symbol PARAMS((char *name)); +extern symbolS *tic54x_undefined_symbol (char *name); #define md_macro_start() tic54x_macro_start() -extern void tic54x_macro_start (); +extern void tic54x_macro_start (void); #define md_macro_end() tic54x_macro_end() -extern void tic54x_macro_end (); +extern void tic54x_macro_end (void); #define md_macro_info(args) tic54x_macro_info(args) extern void tic54x_macro_info PARAMS((void *macro)); #define tc_frob_label(sym) tic54x_define_label (sym) extern void tic54x_define_label PARAMS((symbolS *)); #define md_start_line_hook() tic54x_start_line_hook() -extern void tic54x_start_line_hook (); +extern void tic54x_start_line_hook (void); #define md_estimate_size_before_relax(f,s) \ tic54x_estimate_size_before_relax(f,s) @@ -125,4 +125,6 @@ extern void tic54x_convert_frag(bfd *, segT, fragS *); /* spruce up the listing output */ #define LISTING_WORD_SIZE 2 +extern void tic54x_global (int); + #endif diff --git a/gas/testsuite/ChangeLog b/gas/testsuite/ChangeLog index c27523e..e888139 100644 --- a/gas/testsuite/ChangeLog +++ b/gas/testsuite/ChangeLog @@ -1,3 +1,18 @@ +2001-11-11 Timothy Wall <twall@alum.mit.edu> + + * gas/tic54x/sections.[sd]: Check for named, initialized sections + defaulting to CODE and DATA. + * gas/tic54x/align.[sd]: While breaking compatibility with TI's + assembler, the difference is not worth the effort to fix. We'd + prefer the assembler *not* fill the section alignment. + * gas/tic54x/all-opcodes.d: Verify Lmem opcodes have proper + length. + * gas/tic54x/labels.s: Document differences from TI tools. + * gas/tic54x/extaddr.d: Match output. + * gas/all/gas.exp: On c54x targets, don't do any tests that use + p2align. + * gas/macros/macros.exp: Expect failure matching use of .ascii. + 2001-11-12 Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de> * gas/mips/mips.exp: Change naming of some conditionals to reflect @@ -60,6 +75,7 @@ * gas/mmix: New testsuite directory. +>>>>>>> 1.244 2001-10-24 Chris Demetriou <cgd@broadcom.com> * gas/mips/ld-empic.d: Remove extra whitespace at beginning of diff --git a/gas/testsuite/gas/all/gas.exp b/gas/testsuite/gas/all/gas.exp index af0b1b0..87d3bac 100644 --- a/gas/testsuite/gas/all/gas.exp +++ b/gas/testsuite/gas/all/gas.exp @@ -155,10 +155,9 @@ proc test_cond {} { # again, p2align doesn't work on c54x target if ![istarget *c54x*-*-*] then { test_cond + run_dump_test incbin } -run_dump_test incbin - # FIXME: this is here cause of a bug in DejaGnu 1.1.1. When it is no longer # in use, then this can be removed. if [info exists errorInfo] then { diff --git a/gas/testsuite/gas/macros/macros.exp b/gas/testsuite/gas/macros/macros.exp index b3b4d57..4a424bd 100644 --- a/gas/testsuite/gas/macros/macros.exp +++ b/gas/testsuite/gas/macros/macros.exp @@ -33,5 +33,7 @@ if { ![istarget hppa*-*-*] || [istarget *-*-linux*]} { setup_xfail sh*-*-* setup_xfail z8k*-*-* setup_xfail h8300*-*-* + # FIXME: Due to difference in what "consecutive octets" means. + setup_xfail *c54x*-*-* run_dump_test strings } diff --git a/gas/testsuite/gas/tic54x/align.d b/gas/testsuite/gas/tic54x/align.d index c130534..9959330 100644 --- a/gas/testsuite/gas/tic54x/align.d +++ b/gas/testsuite/gas/tic54x/align.d @@ -1,12 +1,12 @@ #objdump: -d --headers -#name: c54x align (NOTE: .even is broken on TI tools) +#name: c54x align .*: +file format .*c54x.* Sections: Idx Name Size VMA LMA File off Algn - 0 .text 00000089 00000000 00000000 0000.... 2..7 - CONTENTS, ALLOC, LOAD, CODE + 0 .text 000000c0 00000000 00000000 0000.... 2..7 + CONTENTS, ALLOC, LOAD, .... 1 .data 00000005 00000000 00000000 0000.... 2..1 CONTENTS, ALLOC, LOAD, DATA 2 .bss 00000000 00000000 00000000 0000.... 2..0 @@ -53,4 +53,4 @@ Disassembly of section .text: 86: 0005.* 87: 0006.* 88: 0007.* - + ... diff --git a/gas/testsuite/gas/tic54x/align.s b/gas/testsuite/gas/tic54x/align.s index fea8fa6..16a777c 100644 --- a/gas/testsuite/gas/tic54x/align.s +++ b/gas/testsuite/gas/tic54x/align.s @@ -1,6 +1,10 @@ * alignment directives * .even == .align 1, .even 2 == longword boundary * .align [size] ; size is number of words (value must be a power of 2) +* NOTE: .even is broken on TI tools, so theirs won't align .data +* NOTE: TI defaults text section to DATA until opcodes are seen +* NOTE: GAS will fill a section to its alignment; it should probably not +* in this case. .global even, align2, align8, align128 .field 2, 3 .field 11, 8 @@ -15,6 +19,7 @@ align8 .word 8 .align align128 .byte 4 .word 0,1,2,3,4,5,6,7 +* TI .text section total size is 0x89 words; GAS fills to 0xc0 .data .field 2, 3 .field 11, 8 diff --git a/gas/testsuite/gas/tic54x/all-opcodes.d b/gas/testsuite/gas/tic54x/all-opcodes.d index 3cb52f4..ae37380 100644 --- a/gas/testsuite/gas/tic54x/all-opcodes.d +++ b/gas/testsuite/gas/tic54x/all-opcodes.d @@ -61593,17 +61593,17 @@ Disassembly of section .text: f08f: 53f0.* f090: 1ead.* f091: 50f8.* - f092: 1eae.* + f092: 1eae f093: 51f8.* - f094: 1eaf.* + f094: 1eaf f095: 50f8.* - f096: 1eb0.* + f096: 1eb0 f097: 52f8.* - f098: 1eb1.* + f098: 1eb1 f099: 53f8.* - f09a: 1eb2.* + f09a: 1eb2 f09b: 53f8.* - f09c: 1eb3.* + f09c: 1eb3 f09d: 5081.* f09e: 5181.* f09f: 5081.* @@ -61707,17 +61707,17 @@ Disassembly of section .text: f101: 53f1.* f102: 1ec5.* f103: 50f8.* - f104: 1ec6.* + f104: 1ec6 f105: 51f8.* - f106: 1ec7.* + f106: 1ec7 f107: 50f8.* - f108: 1ec8.* + f108: 1ec8 f109: 52f8.* - f10a: 1ec9.* + f10a: 1ec9 f10b: 53f8.* - f10c: 1eca.* + f10c: 1eca f10d: 53f8.* - f10e: 1ecb.* + f10e: 1ecb f10f: 5082.* f110: 5182.* f111: 5082.* @@ -61821,17 +61821,17 @@ Disassembly of section .text: f173: 53f2.* f174: 1edd.* f175: 50f8.* - f176: 1ede.* + f176: 1ede f177: 51f8.* - f178: 1edf.* + f178: 1edf f179: 50f8.* - f17a: 1ee0.* + f17a: 1ee0 f17b: 52f8.* - f17c: 1ee1.* + f17c: 1ee1 f17d: 53f8.* - f17e: 1ee2.* + f17e: 1ee2 f17f: 53f8.* - f180: 1ee3.* + f180: 1ee3 f181: 5083.* f182: 5183.* f183: 5083.* @@ -61935,17 +61935,17 @@ Disassembly of section .text: f1e5: 53f3.* f1e6: 1ef5.* f1e7: 50f8.* - f1e8: 1ef6.* + f1e8: 1ef6 f1e9: 51f8.* - f1ea: 1ef7.* + f1ea: 1ef7 f1eb: 50f8.* - f1ec: 1ef8.* + f1ec: 1ef8 f1ed: 52f8.* - f1ee: 1ef9.* + f1ee: 1ef9 f1ef: 53f8.* - f1f0: 1efa.* + f1f0: 1efa f1f1: 53f8.* - f1f2: 1efb.* + f1f2: 1efb f1f3: 5084.* f1f4: 5184.* f1f5: 5084.* @@ -62049,17 +62049,17 @@ Disassembly of section .text: f257: 53f4.* f258: 1f0d.* f259: 50f8.* - f25a: 1f0e.* + f25a: 1f0e f25b: 51f8.* - f25c: 1f0f.* + f25c: 1f0f f25d: 50f8.* - f25e: 1f10.* + f25e: 1f10 f25f: 52f8.* - f260: 1f11.* + f260: 1f11 f261: 53f8.* - f262: 1f12.* + f262: 1f12 f263: 53f8.* - f264: 1f13.* + f264: 1f13 f265: 5085.* f266: 5185.* f267: 5085.* @@ -62163,17 +62163,17 @@ Disassembly of section .text: f2c9: 53f5.* f2ca: 1f25.* f2cb: 50f8.* - f2cc: 1f26.* + f2cc: 1f26 f2cd: 51f8.* - f2ce: 1f27.* + f2ce: 1f27 f2cf: 50f8.* - f2d0: 1f28.* + f2d0: 1f28 f2d1: 52f8.* - f2d2: 1f29.* + f2d2: 1f29 f2d3: 53f8.* - f2d4: 1f2a.* + f2d4: 1f2a f2d5: 53f8.* - f2d6: 1f2b.* + f2d6: 1f2b f2d7: 5086.* f2d8: 5186.* f2d9: 5086.* @@ -62277,17 +62277,17 @@ Disassembly of section .text: f33b: 53f6.* f33c: 1f3d.* f33d: 50f8.* - f33e: 1f3e.* + f33e: 1f3e f33f: 51f8.* - f340: 1f3f.* + f340: 1f3f f341: 50f8.* - f342: 1f40.* + f342: 1f40 f343: 52f8.* - f344: 1f41.* + f344: 1f41 f345: 53f8.* - f346: 1f42.* + f346: 1f42 f347: 53f8.* - f348: 1f43.* + f348: 1f43 f349: 5087.* f34a: 5187.* f34b: 5087.* @@ -62391,17 +62391,17 @@ Disassembly of section .text: f3ad: 53f7.* f3ae: 1f55.* f3af: 50f8.* - f3b0: 1f56.* + f3b0: 1f56 f3b1: 51f8.* - f3b2: 1f57.* + f3b2: 1f57 f3b3: 50f8.* - f3b4: 1f58.* + f3b4: 1f58 f3b5: 52f8.* - f3b6: 1f59.* + f3b6: 1f59 f3b7: 53f8.* - f3b8: 1f5a.* + f3b8: 1f5a f3b9: 53f8.* - f3ba: 1f5b.* + f3ba: 1f5b f3bb: 5a63.* f3bc: 5b64.* f3bd: 5a80.* @@ -62439,9 +62439,9 @@ Disassembly of section .text: f3dd: 5bf0.* f3de: 1f61.* f3df: 5af8.* - f3e0: 1f62.* + f3e0: 1f62 f3e1: 5bf8.* - f3e2: 1f63.* + f3e2: 1f63 f3e3: 5a81.* f3e4: 5b81.* f3e5: 5a89.* @@ -62477,9 +62477,9 @@ Disassembly of section .text: f403: 5bf1.* f404: 1f69.* f405: 5af8.* - f406: 1f6a.* + f406: 1f6a f407: 5bf8.* - f408: 1f6b.* + f408: 1f6b f409: 5a82.* f40a: 5b82.* f40b: 5a8a.* @@ -62515,9 +62515,9 @@ Disassembly of section .text: f429: 5bf2.* f42a: 1f71.* f42b: 5af8.* - f42c: 1f72.* + f42c: 1f72 f42d: 5bf8.* - f42e: 1f73.* + f42e: 1f73 f42f: 5a83.* f430: 5b83.* f431: 5a8b.* @@ -62553,9 +62553,9 @@ Disassembly of section .text: f44f: 5bf3.* f450: 1f79.* f451: 5af8.* - f452: 1f7a.* + f452: 1f7a f453: 5bf8.* - f454: 1f7b.* + f454: 1f7b f455: 5a84.* f456: 5b84.* f457: 5a8c.* @@ -62591,9 +62591,9 @@ Disassembly of section .text: f475: 5bf4.* f476: 1f81.* f477: 5af8.* - f478: 1f82.* + f478: 1f82 f479: 5bf8.* - f47a: 1f83.* + f47a: 1f83 f47b: 5a85.* f47c: 5b85.* f47d: 5a8d.* @@ -62629,9 +62629,9 @@ Disassembly of section .text: f49b: 5bf5.* f49c: 1f89.* f49d: 5af8.* - f49e: 1f8a.* + f49e: 1f8a f49f: 5bf8.* - f4a0: 1f8b.* + f4a0: 1f8b f4a1: 5a86.* f4a2: 5b86.* f4a3: 5a8e.* @@ -62667,9 +62667,9 @@ Disassembly of section .text: f4c1: 5bf6.* f4c2: 1f91.* f4c3: 5af8.* - f4c4: 1f92.* + f4c4: 1f92 f4c5: 5bf8.* - f4c6: 1f93.* + f4c6: 1f93 f4c7: 5a87.* f4c8: 5b87.* f4c9: 5a8f.* @@ -62705,9 +62705,9 @@ Disassembly of section .text: f4e7: 5bf7.* f4e8: 1f99.* f4e9: 5af8.* - f4ea: 1f9a.* + f4ea: 1f9a f4eb: 5bf8.* - f4ec: 1f9b.* + f4ec: 1f9b f4ed: 4d65.* f4ee: 4d80.* f4ef: 4d88.* @@ -62727,7 +62727,7 @@ Disassembly of section .text: f4fd: 4df0.* f4fe: 1f9e.* f4ff: 4df8.* - f500: 1f9f.* + f500: 1f9f f501: 4d81.* f502: 4d89.* f503: 4d91.* @@ -62746,7 +62746,7 @@ Disassembly of section .text: f510: 4df1.* f511: 1fa2.* f512: 4df8.* - f513: 1fa3.* + f513: 1fa3 f514: 4d82.* f515: 4d8a.* f516: 4d92.* @@ -63794,13 +63794,13 @@ Disassembly of section .text: f928: 4ed0.* f929: 4ed8.* f92a: 4ee0.* - f92b: 207c.* + f92b: 207c f92c: 4ee8.* - f92d: 207d.* + f92d: 207d f92e: 4ef0.* - f92f: 207e.* - f930: 4ef8.* - f931: 207f.* + f92f: 207e + f930: 4ef8 dst a,\*(.*) + f931: 207f f932: 4e81.* f933: 4e89.* f934: 4e91.* diff --git a/gas/testsuite/gas/tic54x/extaddr.d b/gas/testsuite/gas/tic54x/extaddr.d index ceee627..6c692e0 100644 --- a/gas/testsuite/gas/tic54x/extaddr.d +++ b/gas/testsuite/gas/tic54x/extaddr.d @@ -53,4 +53,5 @@ Disassembly of section .text: 10080: f881.* 10081: 0080.* .*10080: ARELEXT.* + ... diff --git a/gas/testsuite/gas/tic54x/extaddr.s b/gas/testsuite/gas/tic54x/extaddr.s index b39479b..7d6a1ee 100644 --- a/gas/testsuite/gas/tic54x/extaddr.s +++ b/gas/testsuite/gas/tic54x/extaddr.s @@ -1,45 +1,45 @@ -*
-* Extended addressing support
-*
- .version 548
- .far_mode
- .global F1, start, end
- ; LDX pseudo-op
- ldx #F1,16,a ; load upper 8 bits of extended address
- or #F1,a,a ; load remaining bits
- bacc a
- ; extended addressing functions
-start:
- fb end
-
- fbd end
- nop
- nop
-
- fbacc a
- fbaccd a
- nop
- nop
- fcala a
- fcalad b
- nop
- nop
- fcall end
-
- fcalld end
- nop
- nop
-
- fret
- fretd
- nop
- nop
- frete
- freted
- nop
- nop
- .space 16*0xFFFF
- .align 0x80
-end:
- fb end
- .end
+* +* Extended addressing support +* + .version 548 + .far_mode + .global F1, start, end + ; LDX pseudo-op + ldx #F1,16,a ; load upper 8 bits of extended address + or #F1,a,a ; load remaining bits + bacc a + ; extended addressing functions +start: + fb end + + fbd end + nop + nop + + fbacc a + fbaccd a + nop + nop + fcala a + fcalad b + nop + nop + fcall end + + fcalld end + nop + nop + + fret + fretd + nop + nop + frete + freted + nop + nop + .space 16*0xFFFF + .align 0x80 +end: + fb end + .end diff --git a/gas/testsuite/gas/tic54x/labels.s b/gas/testsuite/gas/tic54x/labels.s index ac47213..47c3ea3 100644 --- a/gas/testsuite/gas/tic54x/labels.s +++ b/gas/testsuite/gas/tic54x/labels.s @@ -1,55 +1,55 @@ -* local labels
-* two forms, $[0-9] and label? are allowed
-* Local labels are undefined/reset in one of four ways:
-* .newblock
-* changing sections
-* entering an include file
-* leaving an include file
- .global addra, addrb, addrc
-label1: ld addra,a
- sub addrb,a
- bc $1, alt ; generates frag!
- ld addrb, a
- b $2
-$1: ld addra,a
-$2 add addrc,a
- .newblock
- bc $1,alt
- stl a, addrc
-$1 nop
-
-* #1, First definition of local label 'lab'
- nop
-lab? add #1,a ; reports as line 17?
- b lab?
-* #2, Included file also defines local label 'lab'
- .copy labels.inc
-* #3, Next definition; exit from .copy clears all locals
-lab? add #3,a ; reports as line 22?
- b lab?
-* #4, Next definition is within macro; supersedes previous definition while
-* within the macro
-mac .macro
-lab? add #4,a ; line 31?
- b lab?
- .endm
-* Macro invocation
- mac
-* This reference should resolve to definition #3
-after_macro:
- b lab?
-* Section change clears all definitions
- .sect new_section
- nop
-lab? add #5,a
- nop
- nop
- b lab?
-* Newblock directive clears local labels
- .newblock
-lab? add #6,a
- nop
- nop
- b lab?
- .end
-
+* local labels +* two forms, $[0-9] and label? are allowed +* Local labels are undefined/reset in one of four ways: +* .newblock +* changing sections +* entering an include file +* leaving an include file + .global addra, addrb, addrc +label1: ld addra,a + sub addrb,a + bc $1, alt ; generates frag! + ld addrb, a + b $2 +$1: ld addra,a +$2 add addrc,a + .newblock + bc $1,alt + stl a, addrc +$1 nop + +* #1, First definition of local label 'lab' + nop +lab? add #1,a ; reports as line 17? + b lab? +* #2, Included file also defines local label 'lab' + .copy labels.inc +* #3, Next definition; exit from .copy clears all locals +lab? add #3,a ; reports as line 22? + b lab? +* #4, Next definition is within macro; supersedes previous definition while +* within the macro +mac .macro +lab? add #4,a ; line 31? + b lab? + .endm +* Macro invocation + mac +* This reference should resolve to definition #3 +after_macro: + b lab? +* Section change clears all definitions; TI defaults to CODE section w/o name + .sect new_section + nop +lab? add #5,a + nop + nop + b lab? +* Newblock directive clears local labels + .newblock +lab? add #6,a + nop + nop + b lab? + .end + diff --git a/gas/testsuite/gas/tic54x/sections.d b/gas/testsuite/gas/tic54x/sections.d index b3f1344..4f85b9a 100644 --- a/gas/testsuite/gas/tic54x/sections.d +++ b/gas/testsuite/gas/tic54x/sections.d @@ -16,9 +16,9 @@ Idx Name Size VMA LMA File off Algn 4 vectors 00000002 00000000 00000000 0000.... 2..0 CONTENTS, ALLOC, LOAD, CODE, BLOCK 5 clink 00000002 00000000 00000000 0000.... 2..0 - CONTENTS, ALLOC, LOAD, CODE, CLINK + CONTENTS, ALLOC, LOAD, DATA, CLINK 6 blksect 00000002 00000000 00000000 0000.... 2..0 - CONTENTS, ALLOC, LOAD, CODE, BLOCK + CONTENTS, ALLOC, LOAD, DATA, BLOCK Disassembly of section .text: 00000000 <.text>: @@ -72,15 +72,5 @@ Disassembly of section .text: Disassembly of section vectors: 00000000 <vectors>: - 0: 0011.* - 1: 0033.* -Disassembly of section clink: - -00000000 <clink>: - 0: 0022.* - 1: 0044.* -Disassembly of section blksect: - -00000000 <blksect>: - 0: 1234.* - 1: 4321.* + 0: f495.* + 1: f495.* diff --git a/gas/testsuite/gas/tic54x/sections.s b/gas/testsuite/gas/tic54x/sections.s index dbe42e1..35819d7 100644 --- a/gas/testsuite/gas/tic54x/sections.s +++ b/gas/testsuite/gas/tic54x/sections.s @@ -1,72 +1,73 @@ -*
-* Various sections directives
-* .bss, .data, .sect, .text, .usect
-* .align, .space, .bes
-*
- ; default section (should be .text)
- .word 0x1234 ; this should be put in .text
-
- ; initialized data
- .data
- .global coeff
-coeff .word 011h,022h,033h
-
- ; uninitialized data
- .global B1, buffer
- .bss buffer, 10
-B1: .usect ".bss", 10 ; alocate 10 words
-
- ; more initialized data in .data
- .global ptr
-ptr .word 0123h
-
- ; .text section
- .text
- .global add, aloop
-add: ld 0fh,a
-aloop: sub #1,a
- bc aloop,ageq
-
- ; more initialized data into .data
- .data
- .global ivals
-ivals .word 0aah, 0bbh, 0cch
-
- ; define another section for more variables
- .global var2, inbuf, align2
-var2 .usect "newvars", 1 ; with quotes
-inbuf .usect newvars, 7, 1 ; w/o quotes, block 7 words
-align2 .usect newvars, 15, ,1 ; 15 words aligned
-
- ; more code
- .text
- .global mpy, mloop
-mpy: ld 0ah,b
-mloop: mpy #0ah,b
- bc mloop,bnov
- .global space, bes, spacep, besp
-space: .space 64 ; points to first word of block
-bes: .bes 64 ; points to last word of block
-spacep: .word space
-besp: .word bes
- .global pk1, pk2, pk3, endpk1, endpk2, endpk3
-pk1: .space 20
-endpk1: .space 12
-pk2: .bes 20
-endpk2 .bes 12
-pk3: .space 20
-endpk3: .bes 12
- ; named initialized section (TI assembler marks this as DATA, not CODE)
- .sect "vectors"
- .word 011h, 033h
-
- ; named, initialized section, no quotes (TI assembler marks as DATA)
- .sect clink
- .clink ; mark section clink as STYP_CLINK
- .word 022h, 044h
-
- .sect "blksect" ; (TI assembler marks this as DATA)
- .word 0x1234,0x4321
- .sblock "blksect", vectors ; set block flag on blksect and vectors
-
- .end
+* +* Various sections directives +* .bss, .data, .sect, .text, .usect +* .align, .space, .bes +* + ; default section (should be .text) + .word 0x1234 ; this should be put in .text + + ; initialized data + .data + .global coeff +coeff .word 011h,022h,033h + + ; uninitialized data + .global B1, buffer + .bss buffer, 10 +B1: .usect ".bss", 10 ; alocate 10 words + + ; more initialized data in .data + .global ptr +ptr .word 0123h + + ; .text section + .text + .global add, aloop +add: ld 0fh,a +aloop: sub #1,a + bc aloop,ageq + + ; more initialized data into .data + .data + .global ivals +ivals .word 0aah, 0bbh, 0cch + + ; define another section for more variables + .global var2, inbuf, align2 +var2 .usect "newvars", 1 ; with quotes +inbuf .usect newvars, 7, 1 ; w/o quotes, block 7 words +align2 .usect newvars, 15, ,1 ; 15 words aligned + + ; more code + .text + .global mpy, mloop +mpy: ld 0ah,b +mloop: mpy #0ah,b + bc mloop,bnov + .global space, bes, spacep, besp +space: .space 64 ; points to first word of block +bes: .bes 64 ; points to last word of block +spacep: .word space +besp: .word bes + .global pk1, pk2, pk3, endpk1, endpk2, endpk3 +pk1: .space 20 +endpk1: .space 12 +pk2: .bes 20 +endpk2 .bes 12 +pk3: .space 20 +endpk3: .bes 12 + ; named initialized section (CODE) + .sect "vectors" + nop + nop + + ; named, initialized section, no quotes (DATA) + .sect clink + .clink ; mark section clink as STYP_CLINK + .word 022h, 044h + + .sect "blksect" ; (DATA) + .word 0x1234,0x4321 + .sblock "blksect", vectors ; set block flag on blksect and vectors + + .end diff --git a/gas/write.c b/gas/write.c index 171ad63..7022015 100644 --- a/gas/write.c +++ b/gas/write.c @@ -2430,7 +2430,12 @@ relax_segment (segment_frag_root, segment) know (!(S_GET_SEGMENT (symbolP) == SEG_ABSOLUTE) || (symbolP->sy_frag == &zero_address_frag)); #endif - target += S_GET_VALUE (symbolP); + /* Convert from an actual address to an octet offset + into the section. Here it is assumed that the + section's VMA is zero, and can omit subtracting it + from the symbol's value to get the address offset. */ + know (S_GET_SECTION (symbolP)->vma == 0); + target += S_GET_VALUE (symbolP) * OCTETS_PER_BYTE; } know (fragP->fr_next); |