diff options
author | Tristan Gingold <gingold@adacore.com> | 2011-05-18 07:58:36 +0000 |
---|---|---|
committer | Tristan Gingold <gingold@adacore.com> | 2011-05-18 07:58:36 +0000 |
commit | 85645aed8531ad9723f328e2ebdd66272acde0e2 (patch) | |
tree | 929025f7b4866d74840afc4c42c8abe35c533bf5 /bfd | |
parent | cef6e90a3e87bbf7625f440459705639b92d4d83 (diff) | |
download | gdb-85645aed8531ad9723f328e2ebdd66272acde0e2.zip gdb-85645aed8531ad9723f328e2ebdd66272acde0e2.tar.gz gdb-85645aed8531ad9723f328e2ebdd66272acde0e2.tar.bz2 |
bfd
2011-05-18 Tristan Gingold <gingold@adacore.com>
* libxcoff.h (struct xcoff_dwsect_name): New type.
(XCOFF_DWSECT_NBR_NAMES): New macro.
(xcoff_dwsect_names): Declare.
* coffcode.h (sec_to_styp_flags): Handle xcoff dwarf sections.
(styp_to_sec_flags): Ditto.
(coff_new_section_hook): Ditto.
(coff_slurp_symbol_table): Handle C_DWARF and C_INFO.
* coff-rs6000.c (xcoff_dwsect_name): New variable.
gas
2011-05-18 Tristan Gingold <gingold@adacore.com>
* config/tc-ppc.h (ppc_tc_sy): Reorder fields.
Put size into an union with dw.
(OBJ_COPY_SYMBOL_ATTRIBUTES): Adjust.
(ppc_xcoff_end): Declare.
(md_end): Define.
* config/tc-ppc.c: Add includes for xcoff.
(ppc_dwsect): New function.
(md_pseudo_table): Add dwsect.
(struct dw_subsection): New.
(dw_sections): New.
(ppc_change_debug_section): New function.
(ppc_xcoff_end): Ditto.
(ppc_function): Adjust for ppc_tc_sy.
(ppc_symbol_new_hook): Ditto.
(ppc_frob_symbol): Ditto.
(ppc_frob_section): Do not set vma for debug sections.
(ppc_fix_adjustable): Return true for debug sections.
* config/obj-coff.c: Add includes for xcoff.
(coff_frob_section): Handle dwarf section.
gas/testsuite
2011-05-18 Tristan Gingold <gingold@adacore.com>
* gas/ppc/xcoff-dwsect-1-32.d: New test.
* gas/ppc/xcoff-dwsect-1-64.d: Ditto.
* gas/ppc/xcoff-dwsect-1.s: New file.
* gas/ppc/aix.exp (do_align_test): Add tests.
Diffstat (limited to 'bfd')
-rw-r--r-- | bfd/ChangeLog | 11 | ||||
-rw-r--r-- | bfd/coff-rs6000.c | 12 | ||||
-rw-r--r-- | bfd/coffcode.h | 37 | ||||
-rw-r--r-- | bfd/libxcoff.h | 22 |
4 files changed, 80 insertions, 2 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 0e8bdf1..80c0022f 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,14 @@ +2011-05-18 Tristan Gingold <gingold@adacore.com> + + * libxcoff.h (struct xcoff_dwsect_name): New type. + (XCOFF_DWSECT_NBR_NAMES): New macro. + (xcoff_dwsect_names): Declare. + * coffcode.h (sec_to_styp_flags): Handle xcoff dwarf sections. + (styp_to_sec_flags): Ditto. + (coff_new_section_hook): Ditto. + (coff_slurp_symbol_table): Handle C_DWARF and C_INFO. + * coff-rs6000.c (xcoff_dwsect_name): New variable. + 2011-05-17 Tomohiro Kashiwada <kikairoya@gmail.com> PR ld/12759 diff --git a/bfd/coff-rs6000.c b/bfd/coff-rs6000.c index 21da658..fa38321f 100644 --- a/bfd/coff-rs6000.c +++ b/bfd/coff-rs6000.c @@ -3862,6 +3862,18 @@ static unsigned long xcoff_glink_code[9] = 0x00000000, /* traceback table */ }; +/* Table to convert DWARF flags to section names. */ + +const struct xcoff_dwsect_name xcoff_dwsect_names[] = { + { SSUBTYP_DWINFO, ".dwinfo", TRUE }, + { SSUBTYP_DWLINE, ".dwline", TRUE }, + { SSUBTYP_DWPBNMS, ".dwpbnms", TRUE }, + { SSUBTYP_DWPBTYP, ".dwpbtyp", TRUE }, + { SSUBTYP_DWARNGE, ".dwarnge", TRUE }, + { SSUBTYP_DWABREV, ".dwabrev", FALSE }, + { SSUBTYP_DWSTR, ".dwstr", TRUE }, + { SSUBTYP_DWRNGES, ".dwrnges", TRUE } +}; static const struct xcoff_backend_data_rec bfd_xcoff_backend_data = { diff --git a/bfd/coffcode.h b/bfd/coffcode.h index b8b856e..b6deddd 100644 --- a/bfd/coffcode.h +++ b/bfd/coffcode.h @@ -581,6 +581,17 @@ sec_to_styp_flags (const char *sec_name, flagword sec_flags) { styp_flags = STYP_TYPCHK; } + else if (sec_flags & SEC_DEBUGGING) + { + int i; + + for (i = 0; i < XCOFF_DWSECT_NBR_NAMES; i++) + if (!strcmp (sec_name, xcoff_dwsect_names[i].name)) + { + styp_flags = STYP_DWARF | xcoff_dwsect_names[i].flag; + break; + } + } #endif /* Try and figure out what it should be */ else if (sec_flags & SEC_CODE) @@ -776,6 +787,10 @@ styp_to_sec_flags (bfd *abfd ATTRIBUTE_UNUSED, } else if (styp_flags & STYP_PAD) sec_flags = 0; +#ifdef RS6000COFF_C + else if (styp_flags & STYP_DWARF) + sec_flags |= SEC_DEBUGGING; +#endif else if (strcmp (name, _TEXT) == 0) { if (sec_flags & SEC_NEVER_LOAD) @@ -1717,6 +1732,7 @@ coff_new_section_hook (bfd * abfd, asection * section) { combined_entry_type *native; bfd_size_type amt; + unsigned char sclass = C_STAT; section->alignment_power = COFF_DEFAULT_SECTION_ALIGNMENT_POWER; @@ -1724,9 +1740,22 @@ coff_new_section_hook (bfd * abfd, asection * section) if (bfd_xcoff_text_align_power (abfd) != 0 && strcmp (bfd_get_section_name (abfd, section), ".text") == 0) section->alignment_power = bfd_xcoff_text_align_power (abfd); - if (bfd_xcoff_data_align_power (abfd) != 0 + else if (bfd_xcoff_data_align_power (abfd) != 0 && strcmp (bfd_get_section_name (abfd, section), ".data") == 0) section->alignment_power = bfd_xcoff_data_align_power (abfd); + else + { + int i; + + for (i = 0; i < XCOFF_DWSECT_NBR_NAMES; i++) + if (strcmp (bfd_get_section_name (abfd, section), + xcoff_dwsect_names[i].name) == 0) + { + section->alignment_power = 0; + sclass = C_DWARF; + break; + } + } #endif /* Set up the section symbol. */ @@ -1750,7 +1779,7 @@ coff_new_section_hook (bfd * abfd, asection * section) for n_numaux is already correct. */ native->u.syment.n_type = T_NULL; - native->u.syment.n_sclass = C_STAT; + native->u.syment.n_sclass = sclass; coffsymbol (section->symbol)->native = native; @@ -4755,6 +4784,10 @@ coff_slurp_symbol_table (bfd * abfd) case C_THUMBLABEL: /* Thumb label. */ case C_THUMBSTATFUNC:/* Thumb static function. */ #endif +#ifdef RS6000COFF_C + case C_DWARF: /* A label in a dwarf section. */ + case C_INFO: /* A label in a comment section. */ +#endif case C_LABEL: /* Label. */ if (src->u.syment.n_scnum == N_DEBUG) dst->symbol.flags = BSF_DEBUGGING; diff --git a/bfd/libxcoff.h b/bfd/libxcoff.h index 3900dd3..53a5e72 100644 --- a/bfd/libxcoff.h +++ b/bfd/libxcoff.h @@ -235,4 +235,26 @@ bfd_boolean xcoff_reloc_type_toc (XCOFF_RELOC_FUNCTION_ARGS); bfd_boolean xcoff_reloc_type_ba (XCOFF_RELOC_FUNCTION_ARGS); bfd_boolean xcoff_reloc_type_crel (XCOFF_RELOC_FUNCTION_ARGS); +/* Structure to describe dwarf sections. + Useful to convert from XCOFF section name to flag and vice-versa. + Also mark if section has a length field at the beginning. */ +struct xcoff_dwsect_name { + /* A XCOFF dwarf section is identified by its name. */ + unsigned int flag; + + /* Corresponding XCOFF section name. */ + const char *name; + + /* True if size must be prepended. */ + bfd_boolean def_size; +}; + +/* Number of entries in the array. The number is known and public so that user + can 'extend' this array by index. */ +#define XCOFF_DWSECT_NBR_NAMES 8 + +/* The dwarf sections array. */ +extern const struct xcoff_dwsect_name + xcoff_dwsect_names[XCOFF_DWSECT_NBR_NAMES]; + #endif /* LIBXCOFF_H */ |