diff options
author | Richard Henderson <rth@redhat.com> | 1999-06-05 23:15:34 +0000 |
---|---|---|
committer | Richard Henderson <rth@redhat.com> | 1999-06-05 23:15:34 +0000 |
commit | 9de8d8f1848f870605f4e94ffd9d2f1baa005c93 (patch) | |
tree | 8e6f6a20b2de6c7f1d91784f54b103d69774cffe | |
parent | 9894490542aa133d03f55b98fe59fabbfde335c0 (diff) | |
download | gdb-9de8d8f1848f870605f4e94ffd9d2f1baa005c93.zip gdb-9de8d8f1848f870605f4e94ffd9d2f1baa005c93.tar.gz gdb-9de8d8f1848f870605f4e94ffd9d2f1baa005c93.tar.bz2 |
* dwarf2dbg.c (dwarf2_gen_line_info): Mirror the section symbol
creation logic from obj_elf_create_section.
* config/obj-elf.c (elf_pseudo_tab): Add pushsection/popsection.
(section_stack): New.
(special_sections): Make const.
(obj_elf_section): Gut and rewrite parsing.
(obj_elf_change_section): New function broken out of obj_elf_section.
(obj_elf_parse_section_letters): Likewise.
(obj_elf_section_word): Likewise.
(obj_elf_section_type): Likewise.
(obj_elf_previous): Treat as a toggle.
(obj_elf_popsection): New.
* config/tc-ppc.c (ppc_section_word): Take str+len not ptr_str.
(ppc_section_type): Likewise.
* config/tc-ppc.h: Likewise.
* expr.h (struct expressionS): Don't make X_op a bitfield.
* config/tc-alpha.c: Update for symbol handling changes.
(md_apply_fix) [case GPREL]: Use now_seg instead of absolute_section.
(load_expression, emit_ir_load, emit_loadstore, emit_jsrjmp): Likewise.
-rw-r--r-- | gas/ChangeLog | 24 | ||||
-rw-r--r-- | gas/config/obj-elf.c | 478 | ||||
-rw-r--r-- | gas/config/tc-alpha.c | 32 | ||||
-rw-r--r-- | gas/config/tc-ppc.c | 28 | ||||
-rw-r--r-- | gas/config/tc-ppc.h | 8 | ||||
-rw-r--r-- | gas/dwarf2dbg.c | 8 | ||||
-rw-r--r-- | gas/expr.h | 10 |
7 files changed, 338 insertions, 250 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog index 7b0dae0..5f066c2 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,5 +1,29 @@ 1999-06-05 Richard Henderson <rth@cygnus.com> + * dwarf2dbg.c (dwarf2_gen_line_info): Mirror the section symbol + creation logic from obj_elf_create_section. + + * config/obj-elf.c (elf_pseudo_tab): Add pushsection/popsection. + (section_stack): New. + (special_sections): Make const. + (obj_elf_section): Gut and rewrite parsing. + (obj_elf_change_section): New function broken out of obj_elf_section. + (obj_elf_parse_section_letters): Likewise. + (obj_elf_section_word): Likewise. + (obj_elf_section_type): Likewise. + (obj_elf_previous): Treat as a toggle. + (obj_elf_popsection): New. + * config/tc-ppc.c (ppc_section_word): Take str+len not ptr_str. + (ppc_section_type): Likewise. + * config/tc-ppc.h: Likewise. + + * expr.h (struct expressionS): Don't make X_op a bitfield. + * config/tc-alpha.c: Update for symbol handling changes. + (md_apply_fix) [case GPREL]: Use now_seg instead of absolute_section. + (load_expression, emit_ir_load, emit_loadstore, emit_jsrjmp): Likewise. + +1999-06-05 Richard Henderson <rth@cygnus.com> + * dwarf2dbg.c (*): Convert to K&R + prototypes. (dwarf2_gen_line_info): Kill unused variables. (dwarf2_finish): Likewise. diff --git a/gas/config/obj-elf.c b/gas/config/obj-elf.c index 852cc5b..065e08f 100644 --- a/gas/config/obj-elf.c +++ b/gas/config/obj-elf.c @@ -1,6 +1,5 @@ /* ELF object file format - Copyright (C) 1992, 93, 94, 95, 96, 97, 98, 1999 - Free Software Foundation, Inc. + Copyright (C) 1992, 93-98, 1999 Free Software Foundation, Inc. This file is part of GAS, the GNU Assembler. @@ -73,6 +72,7 @@ static void obj_elf_vtable_entry PARAMS ((int)); static void obj_elf_data PARAMS ((int)); static void obj_elf_text PARAMS ((int)); static void obj_elf_subsection PARAMS ((int)); +static void obj_elf_popsection PARAMS ((int)); static const pseudo_typeS elf_pseudo_table[] = { @@ -85,6 +85,8 @@ static const pseudo_typeS elf_pseudo_table[] = {"section.s", obj_elf_section, 0}, {"sect", obj_elf_section, 0}, {"sect.s", obj_elf_section, 0}, + {"pushsection", obj_elf_section, 1}, + {"popsection", obj_elf_popsection, 0}, {"size", obj_elf_size, 0}, {"type", obj_elf_type, 0}, {"version", obj_elf_version, 0}, @@ -472,6 +474,16 @@ obj_elf_weak (ignore) static segT previous_section; static int previous_subsection; +struct section_stack +{ + struct section_stack *next; + segT seg, prev_seg; + int subseg, prev_subseg; +}; + +static struct section_stack *section_stack; + + /* Handle the .section pseudo-op. This code supports two different syntaxes. @@ -499,7 +511,7 @@ struct special_section int attributes; }; -static struct special_section special_sections[] = +static struct special_section const special_sections[] = { { ".bss", SHT_NOBITS, SHF_ALLOC + SHF_WRITE }, { ".comment", SHT_PROGBITS, 0 }, @@ -538,25 +550,197 @@ static struct special_section special_sections[] = }; void -obj_elf_section (xxx) - int xxx; +obj_elf_change_section (name, type, attr, push) + char *name; + int type, attr, push; { - char *string; int new_sec; segT sec; - int type, attr; - int i; - flagword flags; - symbolS *secsym; #ifdef md_flush_pending_output md_flush_pending_output (); #endif + /* Switch to the section, creating it if necessary. */ + if (push) + { + struct section_stack *elt; + elt = xmalloc (sizeof (struct section_stack)); + elt->next = section_stack; + elt->seg = now_seg; + elt->prev_seg = previous_section; + elt->subseg = now_subseg; + elt->prev_subseg = previous_subsection; + section_stack = elt; + } + previous_section = now_seg; + previous_subsection = now_subseg; + + new_sec = bfd_get_section_by_name (stdoutput, name) == NULL; + sec = subseg_new (name, 0); + + if (new_sec) + { + flagword flags; + symbolS *secsym; + int i; + + /* See if this is one of the special sections. */ + for (i = 0; special_sections[i].name != NULL; i++) + if (strcmp (name, special_sections[i].name) == 0) + { + if (type == SHT_NULL) + type = special_sections[i].type; + else if (type != special_sections[i].type) + as_warn (_("Setting incorrect section type for %s"), name); + + if ((attr &~ special_sections[i].attributes) != 0) + { + /* As a GNU extension, we permit a .note section to be + allocatable. If the linker sees an allocateable .note + section, it will create a PT_NOTE segment in the output + file. */ + if (strcmp (name, ".note") != 0 + || attr != SHF_ALLOC) + as_warn (_("Setting incorrect section attributes for %s"), + name); + } + attr |= special_sections[i].attributes; + break; + } + + /* Convert ELF type and flags to BFD flags. */ + flags = (SEC_RELOC + | ((attr & SHF_WRITE) ? 0 : SEC_READONLY) + | ((attr & SHF_ALLOC) ? SEC_ALLOC : 0) + | (((attr & SHF_ALLOC) && type != SHT_NOBITS) ? SEC_LOAD : 0) + | ((attr & SHF_EXECINSTR) ? SEC_CODE : 0)); +#ifdef md_elf_section_flags + flags = md_elf_section_flags (flags, attr, type); +#endif + + /* Prevent SEC_HAS_CONTENTS from being inadvertently set. */ + if (type == SHT_NOBITS) + seg_info (sec)->bss = 1; + + bfd_set_section_flags (stdoutput, sec, flags); + + /* Add a symbol for this section to the symbol table. */ + secsym = symbol_find (name); + if (secsym != NULL) + symbol_set_bfdsym (secsym, sec->symbol); + else + symbol_table_insert (section_symbol (sec)); + } + +#ifdef md_elf_section_change_hook + md_elf_section_change_hook (); +#endif +} + +int +obj_elf_parse_section_letters (str, len) + char *str; + size_t len; +{ + int attr = 0; + + while (len > 0) + { + switch (*str) + { + case 'a': + attr |= SHF_ALLOC; + break; + case 'w': + attr |= SHF_WRITE; + break; + case 'x': + attr |= SHF_EXECINSTR; + break; + default: + { + char *bad_msg = _("Unrecognized .section attribute: want a,w,x"); +#ifdef md_elf_section_letter + int md_attr = md_elf_section_letter (*str, &bad_msg); + if (md_attr >= 0) + attr |= md_attr; + else +#endif + { + as_warn (bad_msg); + attr = -1; + } + } + break; + } + str++, len--; + } + + return attr; +} + +int +obj_elf_section_word (str, len) + char *str; + size_t len; +{ + if (len == 5 && strncmp (str, "write", 5) == 0) + return SHF_WRITE; + if (len == 5 && strncmp (str, "alloc", 5) == 0) + return SHF_ALLOC; + if (len == 9 && strncmp (str, "execinstr", 9) == 0) + return SHF_EXECINSTR; + +#ifdef md_elf_section_word + { + int md_attr = md_elf_section_word (str, len); + if (md_attr >= 0) + return md_attr; + } +#endif + + as_warn (_("Unrecognized section attribute")); + return 0; +} + +int +obj_elf_section_type (str, len) + char *str; + size_t len; +{ + if (len == 8 && strncmp (str, "progbits", 8) == 0) + return SHT_PROGBITS; + if (len == 6 && strncmp (str, "nobits", 6) == 0) + return SHT_NOBITS; + +#ifdef md_elf_section_type + { + int md_type = md_elf_section_type (str, len); + if (md_type >= 0) + return md_type; + } +#endif + + as_warn (_("Unrecognized section type")); + return 0; +} + +void +obj_elf_section (push) + int push; +{ + char *name, *beg, *end; + int type, attr, dummy; + if (flag_mri) { char mri_type; +#ifdef md_flush_pending_output + md_flush_pending_output (); +#endif + previous_section = now_seg; previous_subsection = now_subseg; @@ -573,8 +757,8 @@ obj_elf_section (xxx) SKIP_WHITESPACE (); if (*input_line_pointer == '"') { - string = demand_copy_C_string (&xxx); - if (string == NULL) + name = demand_copy_C_string (&dummy); + if (name == NULL) { ignore_rest_of_line (); return; @@ -582,46 +766,21 @@ obj_elf_section (xxx) } else { - char *p = input_line_pointer; - char c; - while (0 == strchr ("\n\t,; ", *p)) - p++; - if (p == input_line_pointer) + end = input_line_pointer; + while (0 == strchr ("\n\t,; ", *end)) + end++; + if (end == input_line_pointer) { as_warn (_("Missing section name")); ignore_rest_of_line (); return; } - c = *p; - *p = 0; - string = xmalloc ((unsigned long) (p - input_line_pointer + 1)); - strcpy (string, input_line_pointer); - *p = c; - input_line_pointer = p; + + name = xmalloc (end - input_line_pointer + 1); + memcpy (name, input_line_pointer, end - input_line_pointer); + name[end - input_line_pointer] = '\0'; + input_line_pointer = end; } - - /* Switch to the section, creating it if necessary. */ - previous_section = now_seg; - previous_subsection = now_subseg; - - new_sec = bfd_get_section_by_name (stdoutput, string) == NULL; - sec = subseg_new (string, 0); - - /* If this section already existed, we don't bother to change the - flag values. */ - if (! new_sec) - { - while (! is_end_of_line[(unsigned char) *input_line_pointer]) - ++input_line_pointer; - ++input_line_pointer; - -#ifdef md_elf_section_change_hook - md_elf_section_change_hook (); -#endif - - return; - } - SKIP_WHITESPACE (); type = SHT_NULL; @@ -631,81 +790,43 @@ obj_elf_section (xxx) { /* Skip the comma. */ ++input_line_pointer; - SKIP_WHITESPACE (); if (*input_line_pointer == '"') { - /* Pick up a string with a combination of a, w, x. */ - ++input_line_pointer; - while (*input_line_pointer != '"') + beg = demand_copy_C_string (&dummy); + if (beg == NULL) { - switch (*input_line_pointer) - { - case 'a': - attr |= SHF_ALLOC; - break; - case 'w': - attr |= SHF_WRITE; - break; - case 'x': - attr |= SHF_EXECINSTR; - break; - default: - { - char *bad_msg = _("Bad .section directive: want a,w,x in string"); -#ifdef md_elf_section_letter - int md_attr = md_elf_section_letter (*input_line_pointer, &bad_msg); - if (md_attr) - attr |= md_attr; - else -#endif - { - as_warn (bad_msg); - ignore_rest_of_line (); - return; - } - } - } - ++input_line_pointer; + ignore_rest_of_line (); + return; } - - /* Skip the closing quote. */ - ++input_line_pointer; + attr |= obj_elf_parse_section_letters (beg, strlen (beg)); + free (beg); SKIP_WHITESPACE (); if (*input_line_pointer == ',') { + char c; ++input_line_pointer; SKIP_WHITESPACE (); - if (*input_line_pointer == '@' || *input_line_pointer == '%') + c = *input_line_pointer; + if (c == '"') { - ++input_line_pointer; - if (strncmp (input_line_pointer, "progbits", - sizeof "progbits" - 1) == 0) - { - type = SHT_PROGBITS; - input_line_pointer += sizeof "progbits" - 1; - } - else if (strncmp (input_line_pointer, "nobits", - sizeof "nobits" - 1) == 0) - { - type = SHT_NOBITS; - input_line_pointer += sizeof "nobits" - 1; - } - else + beg = demand_copy_C_string (&dummy); + if (beg == NULL) { -#ifdef md_elf_section_type - int md_type = md_elf_section_type (&input_line_pointer); - if (md_type) - type = md_type; - else -#endif - { - as_warn (_("Unrecognized section type")); - ignore_rest_of_line (); - } + ignore_rest_of_line (); + return; } + type = obj_elf_section_type (beg, strlen (beg)); + free (beg); + } + else if (c == '@' || c == '%') + { + beg = ++input_line_pointer; + c = get_symbol_end (); + *input_line_pointer = c; + type = obj_elf_section_type (beg, input_line_pointer - beg); } } } @@ -713,6 +834,8 @@ obj_elf_section (xxx) { do { + char c; + SKIP_WHITESPACE (); if (*input_line_pointer != '#') { @@ -720,39 +843,12 @@ obj_elf_section (xxx) ignore_rest_of_line (); return; } - ++input_line_pointer; - if (strncmp (input_line_pointer, "write", - sizeof "write" - 1) == 0) - { - attr |= SHF_WRITE; - input_line_pointer += sizeof "write" - 1; - } - else if (strncmp (input_line_pointer, "alloc", - sizeof "alloc" - 1) == 0) - { - attr |= SHF_ALLOC; - input_line_pointer += sizeof "alloc" - 1; - } - else if (strncmp (input_line_pointer, "execinstr", - sizeof "execinstr" - 1) == 0) - { - attr |= SHF_EXECINSTR; - input_line_pointer += sizeof "execinstr" - 1; - } - else - { -#ifdef md_elf_section_word - int md_attr = md_elf_section_word (&input_line_pointer); - if (md_attr) - attr |= md_attr; - else -#endif - { - as_warn (_("Unrecognized section attribute")); - ignore_rest_of_line (); - return; - } - } + beg = ++input_line_pointer; + c = get_symbol_end (); + *input_line_pointer = c; + + attr |= obj_elf_section_word (beg, input_line_pointer - beg); + SKIP_WHITESPACE (); } while (*input_line_pointer++ == ','); @@ -760,72 +856,9 @@ obj_elf_section (xxx) } } - /* See if this is one of the special sections. */ - for (i = 0; special_sections[i].name != NULL; i++) - { - if (string[1] == special_sections[i].name[1] - && strcmp (string, special_sections[i].name) == 0) - { - if (type == SHT_NULL) - type = special_sections[i].type; - else if (type != special_sections[i].type) - as_warn (_("Setting incorrect section type for %s"), string); - - if ((attr &~ special_sections[i].attributes) != 0) - { - /* As a GNU extension, we permit a .note section to be - allocatable. If the linker sees an allocateable - .note section, it will create a PT_NOTE segment in - the output file. */ - if (strcmp (string, ".note") != 0 - || attr != SHF_ALLOC) - as_warn (_("Setting incorrect section attributes for %s"), - string); - } - attr |= special_sections[i].attributes; - - break; - } - } - - flags = (SEC_RELOC - | ((attr & SHF_WRITE) ? 0 : SEC_READONLY) - | ((attr & SHF_ALLOC) ? SEC_ALLOC : 0) - | (((attr & SHF_ALLOC) && type != SHT_NOBITS) ? SEC_LOAD : 0) - | ((attr & SHF_EXECINSTR) ? SEC_CODE : 0)); - if (special_sections[i].name == NULL) - { - if (type == SHT_PROGBITS) - flags |= SEC_ALLOC | SEC_LOAD; - else if (type == SHT_NOBITS) - { - flags |= SEC_ALLOC; - flags &=~ SEC_LOAD; - } - -#ifdef md_elf_section_flags - flags = md_elf_section_flags (flags, attr, type); -#endif - } - - /* Prevent SEC_HAS_CONTENTS from being inadvertently set. */ - if (type == SHT_NOBITS) - seg_info (sec)->bss = 1; - - bfd_set_section_flags (stdoutput, sec, flags); - - /* Add a symbol for this section to the symbol table. */ - secsym = symbol_find (string); - if (secsym != NULL) - symbol_set_bfdsym (secsym, sec->symbol); - else - symbol_table_insert (section_symbol (sec)); - -#ifdef md_elf_section_change_hook - md_elf_section_change_hook (); -#endif - demand_empty_rest_of_line (); + + obj_elf_change_section (name, type, attr, push); } /* Change to the .data section. */ @@ -902,6 +935,9 @@ void obj_elf_previous (ignore) int ignore; { + segT new_section; + int new_subsection; + if (previous_section == 0) { as_bad (_(".previous without corresponding .section; ignored")); @@ -912,8 +948,38 @@ obj_elf_previous (ignore) md_flush_pending_output (); #endif - subseg_set (previous_section, previous_subsection); - previous_section = 0; + new_section = previous_section; + new_subsection = previous_subsection; + previous_section = now_seg; + previous_subsection = now_subseg; + subseg_set (new_section, new_subsection); + +#ifdef md_elf_section_change_hook + md_elf_section_change_hook (); +#endif +} + +static void +obj_elf_popsection (xxx) + int xxx; +{ + struct section_stack *top = section_stack; + + if (top == NULL) + { + as_bad (_(".popsection without corresponding .pushsection; ignored")); + return; + } + +#ifdef md_flush_pending_output + md_flush_pending_output (); +#endif + + section_stack = top->next; + previous_section = top->prev_seg; + previous_subsection = top->prev_subseg; + subseg_set (top->seg, top->subseg); + free (top); #ifdef md_elf_section_change_hook md_elf_section_change_hook (); diff --git a/gas/config/tc-alpha.c b/gas/config/tc-alpha.c index a166309..791f15d 100644 --- a/gas/config/tc-alpha.c +++ b/gas/config/tc-alpha.c @@ -4,7 +4,7 @@ Written by Alessandro Forin, based on earlier gas-1.38 target CPU files. Modified by Ken Raeburn for gas-2.x and ECOFF support. Modified by Richard Henderson for ELF support. - Modified by Klaus K"ampf for EVAX (openVMS/Alpha) support. + Modified by Klaus K"ampf for EVAX (OpenVMS/Alpha) support. This file is part of GAS, the GNU Assembler. @@ -1081,7 +1081,7 @@ md_apply_fix (fixP, valueP) #endif do_reloc_gp: - fixP->fx_addsy = section_symbol (absolute_section); + fixP->fx_addsy = section_symbol (now_seg); md_number_to_chars (fixpos, value, 2); break; @@ -2110,9 +2110,6 @@ FIXME expressionS newtok[3]; expressionS addend; - /* We're going to need this symbol in md_apply_fix(). */ - (void) section_symbol (absolute_section); - #ifdef OBJ_ECOFF if (regno (tok[2].X_add_number) == AXP_REG_PV) ecoff_set_gp_prolog_size (0); @@ -2499,7 +2496,8 @@ load_expression (targreg, exp, pbasereg, poffset) } insn.nfixups++; insn.fixups[0].reloc = BFD_RELOC_ALPHA_LITUSE; - insn.fixups[0].exp.X_op = O_constant; + insn.fixups[0].exp.X_op = O_symbol; + insn.fixups[0].exp.X_add_symbol = section_symbol (now_seg); insn.fixups[0].exp.X_add_number = 1; emit_lituse = 0; @@ -2650,7 +2648,8 @@ emit_ir_load (tok, ntok, opname) } insn.nfixups++; insn.fixups[0].reloc = BFD_RELOC_ALPHA_LITUSE; - insn.fixups[0].exp.X_op = O_constant; + insn.fixups[0].exp.X_op = O_symbol; + insn.fixups[0].exp.X_add_symbol = section_symbol (now_seg); insn.fixups[0].exp.X_add_number = 1; } @@ -2703,7 +2702,8 @@ emit_loadstore (tok, ntok, opname) } insn.nfixups++; insn.fixups[0].reloc = BFD_RELOC_ALPHA_LITUSE; - insn.fixups[0].exp.X_op = O_constant; + insn.fixups[0].exp.X_op = O_symbol; + insn.fixups[0].exp.X_add_symbol = section_symbol (now_seg); insn.fixups[0].exp.X_add_number = 1; } @@ -3288,7 +3288,8 @@ emit_jsrjmp (tok, ntok, vopname) } insn.nfixups++; insn.fixups[0].reloc = BFD_RELOC_ALPHA_LITUSE; - insn.fixups[0].exp.X_op = O_constant; + insn.fixups[0].exp.X_op = O_symbol; + insn.fixups[0].exp.X_add_symbol = section_symbol (now_seg); insn.fixups[0].exp.X_add_number = 3; } @@ -3458,7 +3459,7 @@ s_alpha_comm (ignore) p = frag_more (temp); new_seg->flags |= SEC_IS_COMMON; if (! S_IS_DEFINED (symbolP)) - symbolP->bsym->section = new_seg; + S_SET_SEGMENT (symbolP, new_seg); #else S_SET_VALUE (symbolP, (valueT) temp); #endif @@ -3767,7 +3768,7 @@ s_alpha_ent (ignore) } symbol = make_expr_symbol (&symexpr); - symbol->bsym->flags |= BSF_FUNCTION; + symbol_get_bfdsym (symbol)->flags |= BSF_FUNCTION; alpha_evax_proc.symbol = symbol; demand_empty_rest_of_line (); @@ -3851,7 +3852,8 @@ s_alpha_pdesc (ignore) entry_sym = make_expr_symbol (&exp); /* Save bfd symbol of proc desc in function symbol. */ - alpha_evax_proc.symbol->bsym->udata.p = (PTR)entry_sym->bsym; + symbol_get_bfdsym (alpha_evax_proc.symbol)->udata.p + = symbol_get_bfdsym (entry_sym); SKIP_WHITESPACE (); if (*input_line_pointer++ != ',') @@ -4142,14 +4144,14 @@ s_alpha_file (ignore) extern char *demand_copy_string PARAMS ((int *lenP)); sprintf (case_hack, "<CASE:%01d%01d>", - alpha_flag_hash_long_names, alpha_flag_show_after_trunc); + alpha_flag_hash_long_names, alpha_flag_show_after_trunc); s = symbol_find_or_make (case_hack); - s->bsym->flags |= BSF_FILE; + symbol_get_bfdsym (s)->flags |= BSF_FILE; get_absolute_expression (); s = symbol_find_or_make (demand_copy_string (&length)); - s->bsym->flags |= BSF_FILE; + symbol_get_bfdsym (s)->flags |= BSF_FILE; demand_empty_rest_of_line (); return; diff --git a/gas/config/tc-ppc.c b/gas/config/tc-ppc.c index a028e0b..cae3ac7 100644 --- a/gas/config/tc-ppc.c +++ b/gas/config/tc-ppc.c @@ -2126,29 +2126,25 @@ ppc_section_letter (letter, ptr_msg) } int -ppc_section_word (ptr_str) - char **ptr_str; +ppc_section_word (str, len) + char *str; + size_t len; { - if (strncmp (*ptr_str, "exclude", sizeof ("exclude")-1) == 0) - { - *ptr_str += sizeof ("exclude")-1; - return SHF_EXCLUDE; - } + if (len == 7 && strncmp (str, "exclude", 7) == 0) + return SHF_EXCLUDE; - return 0; + return -1; } int -ppc_section_type (ptr_str) - char **ptr_str; +ppc_section_type (str, len) + char *str; + size_t len; { - if (strncmp (*ptr_str, "ordered", sizeof ("ordered")-1) == 0) - { - *ptr_str += sizeof ("ordered")-1; - return SHT_ORDERED; - } + if (len == 7 && strncmp (str, "ordered", 7) == 0) + return SHT_ORDERED; - return 0; + return -1; } int diff --git a/gas/config/tc-ppc.h b/gas/config/tc-ppc.h index 1b239bc..e6d32d6 100644 --- a/gas/config/tc-ppc.h +++ b/gas/config/tc-ppc.h @@ -208,13 +208,13 @@ extern void ppc_adjust_symtab PARAMS ((void)); /* Support for SHF_EXCLUDE and SHT_ORDERED */ extern int ppc_section_letter PARAMS ((int, char **)); -extern int ppc_section_type PARAMS ((char **)); -extern int ppc_section_word PARAMS ((char **)); +extern int ppc_section_type PARAMS ((char *, size_t)); +extern int ppc_section_word PARAMS ((char *, size_t)); extern int ppc_section_flags PARAMS ((int, int, int)); #define md_elf_section_letter(LETTER, PTR_MSG) ppc_section_letter (LETTER, PTR_MSG) -#define md_elf_section_type(PTR_STR) ppc_section_type (PTR_STR) -#define md_elf_section_word(PTR_STR) ppc_section_word (PTR_STR) +#define md_elf_section_type(STR, LEN) ppc_section_type (STR, LEN) +#define md_elf_section_word(STR, LEN) ppc_section_word (STR, LEN) #define md_elf_section_flags(FLAGS, ATTR, TYPE) ppc_section_flags (FLAGS, ATTR, TYPE) /* Add extra PPC sections -- Note, for now, make .sbss2 and .PPC.EMB.sbss0 a diff --git a/gas/dwarf2dbg.c b/gas/dwarf2dbg.c index c23b7f6..4bea534 100644 --- a/gas/dwarf2dbg.c +++ b/gas/dwarf2dbg.c @@ -393,11 +393,17 @@ dwarf2_gen_line_info (addr, l) if (!ls.line_seg) { + symbolS *secsym; + ls.line_seg = subseg_new (".debug_line", 0); bfd_set_section_flags (stdoutput, ls.line_seg, SEC_READONLY); /* We're going to need this symbol. */ - (void) section_symbol (ls.line_seg); + secsym = symbol_find (".debug_line"); + if (secsym != NULL) + symbol_set_bfdsym (secsym, ls.line_seg->symbol); + else + symbol_table_insert (section_symbol (ls.line_seg)); } saved_seg = now_seg; @@ -116,14 +116,8 @@ typedef struct expressionS symbolS *X_op_symbol; /* A number to add. */ offsetT X_add_number; - /* The type of the expression. We can't assume that an arbitrary - compiler can handle a bitfield of enum type. FIXME: We could - check this using autoconf. */ -#ifdef __GNUC__ - operatorT X_op : 5; -#else - unsigned X_op : 5; -#endif + /* The type of the expression. */ + operatorT X_op; /* Non-zero if X_add_number should be regarded as unsigned. This is only valid for O_constant expressions. It is only used when an O_constant must be extended into a bignum (i.e., it is not used |