void dwarf2_directive_loc (int dummy ATTRIBUTE_UNUSED) { offsetT filenum, line, column; filenum = get_absolute_expression (); SKIP_WHITESPACE (); line = get_absolute_expression (); SKIP_WHITESPACE (); column = get_absolute_expression (); demand_empty_rest_of_line (); if (filenum < 1) { as_bad (_("file number less than one")); return; } if (filenum >= (int) files_in_use || files[filenum].filename == 0) { as_bad (_("unassigned file number %ld"), (long) filenum); return; } current.filenum = filenum; current.line = line; current.column = column; current.flags = DWARF2_FLAG_BEGIN_STMT; loc_directive_seen = TRUE; #ifndef NO_LISTING if (listing) { if (files[filenum].dir) { size_t dir_len = strlen (dirs[files[filenum].dir]); size_t file_len = strlen (files[filenum].filename); char *cp = (char *) alloca (dir_len + 1 + file_len + 1); memcpy (cp, dirs[files[filenum].dir], dir_len); cp[dir_len] = '/'; memcpy (cp + dir_len + 1, files[filenum].filename, file_len); cp[dir_len + file_len + 1] = '\0'; listing_source_file (cp); } else listing_source_file (files[filenum].filename); listing_source_line (line); } #endif }
static void obj_coff_line (int ignore ATTRIBUTE_UNUSED) { int this_base; if (def_symbol_in_progress == NULL) { /* Probably stabs-style line? */ obj_coff_ln (0); return; } this_base = get_absolute_expression (); if (streq (".bf", S_GET_NAME (def_symbol_in_progress))) coff_line_base = this_base; S_SET_NUMBER_AUXILIARY (def_symbol_in_progress, 1); SA_SET_SYM_LNNO (def_symbol_in_progress, this_base); demand_empty_rest_of_line (); #ifndef NO_LISTING if (streq (".bf", S_GET_NAME (def_symbol_in_progress))) { extern int listing; if (listing) listing_source_line ((unsigned int) this_base); } #endif }
static void s_atmp() { register int temp; if (strncmp(input_line_pointer, "sp", 2) == 0) { input_line_pointer += 2; atmp = 2; } else if (strncmp(input_line_pointer, "fp", 2) == 0) { input_line_pointer += 2; atmp = 3; } else if (strncmp(input_line_pointer, "r", 1) == 0) { input_line_pointer += 1; temp = get_absolute_expression(); if (temp >= 0 && temp <= 31) atmp = temp; else as_warn("Unknown temporary pseudo register"); } else { as_warn("Unknown temporary pseudo register"); } demand_empty_rest_of_line(); return; }
char * dwarf2_directive_file (int dummy ATTRIBUTE_UNUSED) { offsetT num; char *filename; int filename_len; /* Continue to accept a bare string and pass it off. */ SKIP_WHITESPACE (); if (*input_line_pointer == '"') { s_app_file (0); return NULL; } num = get_absolute_expression (); filename = demand_copy_C_string (&filename_len); demand_empty_rest_of_line (); if (num < 1) { as_bad (_("file number less than one")); return NULL; } if (num < (int) files_in_use && files[num].filename != 0) { as_bad (_("file number %ld already allocated"), (long) num); return NULL; } get_filenum (filename, num); return filename; }
static void s_common() { register char *name; register char c; register char *p; register int temp; register symbolS * symbolP; name = input_line_pointer; c = get_symbol_end(); /* just after name is now '\0' */ p = input_line_pointer; *p = c; SKIP_WHITESPACE(); if ( * input_line_pointer != ',' ) { as_warn("Expected comma after symbol-name"); ignore_rest_of_line(); return; } input_line_pointer ++; /* skip ',' */ if ( (temp = get_absolute_expression ()) < 0 ) { as_warn(".COMMon length (%d.) <0! Ignored.", temp); ignore_rest_of_line(); return; } *p = 0; symbolP = symbol_find_or_make (name); *p = c; if ( (symbolP->sy_type & N_TYPE) != N_UNDF || symbolP->sy_other != 0 || symbolP->sy_desc != 0) { as_warn( "Ignoring attempt to re-define symbol"); ignore_rest_of_line(); return; } if (symbolP->sy_value) { if (symbolP->sy_value != temp) { as_warn( "Length of .comm \"%s\" is already %d. Not changed to %d.", symbolP->sy_name, symbolP->sy_value, temp); } } else { symbolP->sy_value = temp; symbolP->sy_type |= N_EXT; } know(symbolP->sy_frag == &zero_address_frag); if (strncmp(input_line_pointer, ",\"bss\"", 6) != 0) { p=input_line_pointer; while(*p && *p!='\n') p++; c= *p; *p='\0'; as_warn("bad .common segment: `%s'", input_line_pointer); *p=c; return; } input_line_pointer += 6; demand_empty_rest_of_line(); return; }
static void obj_coff_bss (int ignore ATTRIBUTE_UNUSED) { if (*input_line_pointer == '\n') subseg_new (".bss", get_absolute_expression ()); else s_lcomm (0); }
static void obj_coff_loc (int ignore ATTRIBUTE_UNUSED) { int lineno; /* FIXME: Why do we need this check? We need it for ECOFF, but why do we need it for COFF? */ if (now_seg != text_section) { as_warn (_(".loc outside of .text")); demand_empty_rest_of_line (); return; } if (def_symbol_in_progress != NULL) { as_warn (_(".loc pseudo-op inside .def/.endef: ignored.")); demand_empty_rest_of_line (); return; } /* Skip the file number. */ SKIP_WHITESPACE (); get_absolute_expression (); SKIP_WHITESPACE (); lineno = get_absolute_expression (); #ifndef NO_LISTING { extern int listing; if (listing) { lineno += coff_line_base - 1; listing_source_line (lineno); } } #endif demand_empty_rest_of_line (); add_lineno (frag_now, frag_now_fix (), lineno); }
static void obj_coff_val (int ignore ATTRIBUTE_UNUSED) { if (def_symbol_in_progress == NULL) { as_warn (_(".val pseudo-op used outside of .def/.endef ignored.")); demand_empty_rest_of_line (); return; } if (is_name_beginner (*input_line_pointer)) { char *symbol_name = input_line_pointer; char name_end = get_symbol_end (); #ifdef tc_canonicalize_symbol_name symbol_name = tc_canonicalize_symbol_name (symbol_name); #endif if (streq (symbol_name, ".")) { /* If the .val is != from the .def (e.g. statics). */ symbol_set_frag (def_symbol_in_progress, frag_now); S_SET_VALUE (def_symbol_in_progress, (valueT) frag_now_fix ()); } else if (! streq (S_GET_NAME (def_symbol_in_progress), symbol_name)) { expressionS exp; exp.X_op = O_symbol; exp.X_add_symbol = symbol_find_or_make (symbol_name); exp.X_op_symbol = NULL; exp.X_add_number = 0; symbol_set_value_expression (def_symbol_in_progress, &exp); /* If the segment is undefined when the forward reference is resolved, then copy the segment id from the forward symbol. */ SF_SET_GET_SEGMENT (def_symbol_in_progress); /* FIXME: gcc can generate address expressions here in unusual cases (search for "obscure" in sdbout.c). We just ignore the offset here, thus generating incorrect debugging information. We ignore the rest of the line just below. */ } /* Otherwise, it is the name of a non debug symbol and its value will be calculated later. */ *input_line_pointer = name_end; } else { S_SET_VALUE (def_symbol_in_progress, get_absolute_expression ()); } demand_empty_rest_of_line (); }
static void obj_coff_scl (int ignore ATTRIBUTE_UNUSED) { if (def_symbol_in_progress == NULL) { as_warn (_(".scl pseudo-op used outside of .def/.endef ignored.")); demand_empty_rest_of_line (); return; } S_SET_STORAGE_CLASS (def_symbol_in_progress, get_absolute_expression ()); demand_empty_rest_of_line (); }
static void s_sparc_align() { register unsigned int temp; register long int temp_fill; unsigned int i; temp = get_absolute_expression (); #define MAX_ALIGNMENT (1 << 15) if ( temp > MAX_ALIGNMENT ) { as_warn("Alignment too large: %d. assumed.", temp = MAX_ALIGNMENT); } /* * For the sparc, `.align (1<<n)' actually means `.align n' * so we have to convert it. */ if (temp != 0) { for (i = 0; (temp & 1) == 0; temp >>= 1, ++i) ; } if (temp != 1) { as_warn("Alignment not a power of 2"); } temp = i; if (*input_line_pointer == ',') { input_line_pointer ++; temp_fill = get_absolute_expression (); } else { temp_fill = 0; } /* Only make a frag if we HAVE to. . . */ if (temp && ! need_pass_2) { frag_align (temp, (int)temp_fill); } demand_empty_rest_of_line(); return; }
/* * sort of like s_lcomm * */ static void s_reserve() { char *name; char c; char *p; int temp; symbolS *symbolP; name = input_line_pointer; c = get_symbol_end(); p = input_line_pointer; *p = c; SKIP_WHITESPACE(); if ( * input_line_pointer != ',' ) { as_warn("Expected comma after name"); ignore_rest_of_line(); return; } input_line_pointer ++; if ((temp = get_absolute_expression()) < 0) { as_warn("BSS length (%d.) <0! Ignored.", temp); ignore_rest_of_line(); return; } *p = 0; symbolP = symbol_find_or_make(name); *p = c; if (strncmp(input_line_pointer, ",\"bss\"", 6) != 0) { as_warn("bad .reserve segment: `%s'", input_line_pointer); return; } input_line_pointer += 6; if (symbolP->sy_other == 0 && symbolP->sy_desc == 0 && ((symbolP->sy_type == N_BSS && symbolP->sy_value == local_bss_counter) || ((symbolP->sy_type & N_TYPE) == N_UNDF && symbolP->sy_value == 0))) { symbolP->sy_value = local_bss_counter; symbolP->sy_type = N_BSS; symbolP->sy_frag = & bss_address_frag; local_bss_counter += temp; } else { as_warn( "Ignoring attempt to re-define symbol from %d. to %d.", symbolP->sy_value, local_bss_counter ); } demand_empty_rest_of_line(); return; }
static void obj_coff_size (int ignore ATTRIBUTE_UNUSED) { if (def_symbol_in_progress == NULL) { as_warn (_(".size pseudo-op used outside of .def/.endef ignored.")); demand_empty_rest_of_line (); return; } S_SET_NUMBER_AUXILIARY (def_symbol_in_progress, 1); SA_SET_SYM_SIZE (def_symbol_in_progress, get_absolute_expression ()); demand_empty_rest_of_line (); }
void dwarf2_directive_loc_mark_labels (int dummy ATTRIBUTE_UNUSED) { offsetT value = get_absolute_expression (); if (value != 0 && value != 1) { as_bad (_("expected 0 or 1")); ignore_rest_of_line (); } else { dwarf2_loc_mark_labels = value != 0; demand_empty_rest_of_line (); } }
static void obj_coff_type (int ignore ATTRIBUTE_UNUSED) { if (def_symbol_in_progress == NULL) { as_warn (_(".type pseudo-op used outside of .def/.endef ignored.")); demand_empty_rest_of_line (); return; } S_SET_DATA_TYPE (def_symbol_in_progress, get_absolute_expression ()); if (ISFCN (S_GET_DATA_TYPE (def_symbol_in_progress)) && S_GET_STORAGE_CLASS (def_symbol_in_progress) != C_TPDEF) SF_SET_FUNCTION (def_symbol_in_progress); demand_empty_rest_of_line (); }
char * dwarf2_directive_file (int dummy ATTRIBUTE_UNUSED) { offsetT num; char *filename; int filename_len; /* Continue to accept a bare string and pass it off. */ SKIP_WHITESPACE (); if (*input_line_pointer == '"') { s_app_file (0); return NULL; } num = get_absolute_expression (); filename = demand_copy_C_string (&filename_len); if (filename == NULL) return NULL; demand_empty_rest_of_line (); if (num < 1) { as_bad (_("file number less than one")); return NULL; } /* A .file directive implies compiler generated debug information is being supplied. Turn off gas generated debug info. */ debug_type = DEBUG_NONE; if (num < (int) files_in_use && files[num].filename != 0) { as_bad (_("file number %ld already allocated"), (long) num); return NULL; } get_filenum (filename, num); return filename; }
static void obj_coff_dim (int ignore ATTRIBUTE_UNUSED) { int dim_index; if (def_symbol_in_progress == NULL) { as_warn (_(".dim pseudo-op used outside of .def/.endef: ignored.")); demand_empty_rest_of_line (); return; } S_SET_NUMBER_AUXILIARY (def_symbol_in_progress, 1); for (dim_index = 0; dim_index < DIMNUM; dim_index++) { SKIP_WHITESPACES (); SA_SET_SYM_DIMEN (def_symbol_in_progress, dim_index, get_absolute_expression ()); switch (*input_line_pointer) { case ',': input_line_pointer++; break; default: as_warn (_("badly formed .dim directive ignored")); /* Fall through. */ case '\n': case ';': dim_index = DIMNUM; break; } } demand_empty_rest_of_line (); }
static void obj_coff_ln (int appline) { int l; if (! appline && def_symbol_in_progress != NULL) { as_warn (_(".ln pseudo-op inside .def/.endef: ignored.")); demand_empty_rest_of_line (); return; } l = get_absolute_expression (); /* If there is no lineno symbol, treat a .ln directive as if it were a .appline directive. */ if (appline || current_lineno_sym == NULL) new_logical_line ((char *) NULL, l - 1); else add_lineno (frag_now, frag_now_fix (), l); #ifndef NO_LISTING { extern int listing; if (listing) { if (! appline) l += coff_line_base - 1; listing_source_line (l); } } #endif demand_empty_rest_of_line (); }
void dwarf2_directive_loc (int dummy ATTRIBUTE_UNUSED) { offsetT filenum, line; /* If we see two .loc directives in a row, force the first one to be output now. */ if (dwarf2_loc_directive_seen) dwarf2_emit_insn (0); filenum = get_absolute_expression (); SKIP_WHITESPACE (); line = get_absolute_expression (); if (filenum < 1) { as_bad (_("file number less than one")); return; } if (filenum >= (int) files_in_use || files[filenum].filename == 0) { as_bad (_("unassigned file number %ld"), (long) filenum); return; } current.filenum = filenum; current.line = line; current.discriminator = 0; #ifndef NO_LISTING if (listing) { if (files[filenum].dir) { size_t dir_len = strlen (dirs[files[filenum].dir]); size_t file_len = strlen (files[filenum].filename); char *cp = (char *) alloca (dir_len + 1 + file_len + 1); memcpy (cp, dirs[files[filenum].dir], dir_len); INSERT_DIR_SEPARATOR (cp, dir_len); memcpy (cp + dir_len + 1, files[filenum].filename, file_len); cp[dir_len + file_len + 1] = '\0'; listing_source_file (cp); } else listing_source_file (files[filenum].filename); listing_source_line (line); } #endif SKIP_WHITESPACE (); if (ISDIGIT (*input_line_pointer)) { current.column = get_absolute_expression (); SKIP_WHITESPACE (); } while (ISALPHA (*input_line_pointer)) { char *p, c; offsetT value; p = input_line_pointer; c = get_symbol_end (); if (strcmp (p, "basic_block") == 0) { current.flags |= DWARF2_FLAG_BASIC_BLOCK; *input_line_pointer = c; } else if (strcmp (p, "prologue_end") == 0) { current.flags |= DWARF2_FLAG_PROLOGUE_END; *input_line_pointer = c; } else if (strcmp (p, "epilogue_begin") == 0) { current.flags |= DWARF2_FLAG_EPILOGUE_BEGIN; *input_line_pointer = c; } else if (strcmp (p, "is_stmt") == 0) { *input_line_pointer = c; value = get_absolute_expression (); if (value == 0) current.flags &= ~DWARF2_FLAG_IS_STMT; else if (value == 1) current.flags |= DWARF2_FLAG_IS_STMT; else { as_bad (_("is_stmt value not 0 or 1")); return; } } else if (strcmp (p, "isa") == 0) { *input_line_pointer = c; value = get_absolute_expression (); if (value >= 0) current.isa = value; else { as_bad (_("isa number less than zero")); return; } } else if (strcmp (p, "discriminator") == 0) { *input_line_pointer = c; value = get_absolute_expression (); if (value >= 0) current.discriminator = value; else { as_bad (_("discriminator less than zero")); return; } } else { as_bad (_("unknown .loc sub-directive `%s'"), p); *input_line_pointer = c; return; } SKIP_WHITESPACE (); } demand_empty_rest_of_line (); dwarf2_loc_directive_seen = TRUE; debug_type = DEBUG_NONE; }
static offsetT cfi_parse_const (void) { return get_absolute_expression (); }
static void dot_cfi_lsda (int ignored ATTRIBUTE_UNUSED) { struct fde_entry *fde; offsetT encoding; if (frchain_now->frch_cfi_data == NULL) { as_bad (_("CFI instruction used without previous .cfi_startproc")); ignore_rest_of_line (); return; } fde = frchain_now->frch_cfi_data->cur_fde_data; encoding = get_absolute_expression (); if (encoding == DW_EH_PE_omit) { demand_empty_rest_of_line (); fde->lsda_encoding = encoding; return; } if ((encoding & 0xff) != encoding || ((encoding & 0x70) != 0 #if defined DIFF_EXPR_OK || defined tc_cfi_emit_pcrel_expr && (encoding & 0x70) != DW_EH_PE_pcrel #endif ) /* leb128 can be handled, but does something actually need it? */ || (encoding & 7) == DW_EH_PE_uleb128 || (encoding & 7) > DW_EH_PE_udata8) { as_bad (_("invalid or unsupported encoding in .cfi_lsda")); ignore_rest_of_line (); return; } if (*input_line_pointer++ != ',') { as_bad (_(".cfi_lsda requires encoding and symbol arguments")); ignore_rest_of_line (); return; } fde->lsda_encoding = encoding; expression_and_evaluate (&fde->lsda); switch (fde->lsda.X_op) { case O_symbol: break; case O_constant: if ((encoding & 0x70) == DW_EH_PE_pcrel) encoding = DW_EH_PE_omit; break; default: encoding = DW_EH_PE_omit; break; } fde->lsda_encoding = encoding; if (encoding == DW_EH_PE_omit) { as_bad (_("wrong second argument to .cfi_lsda")); ignore_rest_of_line (); return; } demand_empty_rest_of_line (); }
static void nemaweaver_s_lcomm (int xxx ATTRIBUTE_UNUSED) { char *name; char c; char *p; offsetT size; symbolS *symbolP; offsetT align; char *pfrag; int align2; segT current_seg = now_seg; subsegT current_subseg = now_subseg; name = input_line_pointer; c = get_symbol_end (); /* Just after name is now '\0'. */ p = input_line_pointer; *p = c; SKIP_WHITESPACE (); if (*input_line_pointer != ',') { as_bad (_("Expected comma after symbol-name: rest of line ignored.")); ignore_rest_of_line (); return; } input_line_pointer++; /* skip ',' */ if ((size = get_absolute_expression ()) < 0) { as_warn (_(".COMMon length (%ld.) <0! Ignored."), (long) size); ignore_rest_of_line (); return; } /* The third argument to .lcomm is the alignment. */ if (*input_line_pointer != ',') align = 8; else { ++input_line_pointer; align = get_absolute_expression (); if (align <= 0) { as_warn (_("ignoring bad alignment")); align = 8; } } *p = 0; symbolP = symbol_find_or_make (name); *p = c; if (S_IS_DEFINED (symbolP) && ! S_IS_COMMON (symbolP)) { as_bad (_("Ignoring attempt to re-define symbol `%s'."), S_GET_NAME (symbolP)); ignore_rest_of_line (); return; } if (S_GET_VALUE (symbolP) && S_GET_VALUE (symbolP) != (valueT) size) { as_bad (_("Length of .lcomm \"%s\" is already %ld. Not changed to %ld."), S_GET_NAME (symbolP), (long) S_GET_VALUE (symbolP), (long) size); ignore_rest_of_line (); return; } /* Allocate_bss. */ if (align) { /* Convert to a power of 2 alignment. */ for (align2 = 0; (align & 1) == 0; align >>= 1, ++align2); if (align != 1) { as_bad (_("Common alignment not a power of 2")); ignore_rest_of_line (); return; } } else