diff options
author | Bob Wilson <bob.wilson@acm.org> | 2003-10-14 22:28:28 +0000 |
---|---|---|
committer | Bob Wilson <bob.wilson@acm.org> | 2003-10-14 22:28:28 +0000 |
commit | b614a7028d7381e4ec589c60aa7edab0d1d60ada (patch) | |
tree | 0bc28afbfdc2fad0d33c1f3c738dd7f7b388c3ca | |
parent | 2641f58d6902ba4f360be89549c26e761fde910e (diff) | |
download | gdb-b614a7028d7381e4ec589c60aa7edab0d1d60ada.zip gdb-b614a7028d7381e4ec589c60aa7edab0d1d60ada.tar.gz gdb-b614a7028d7381e4ec589c60aa7edab0d1d60ada.tar.bz2 |
bfd ChangeLog:
2003-10-14 Bob Wilson <bob.wilson@acm.org>
* elf32-xtensa.c (get_is_linkonce_section): Delete.
(xtensa_is_property_section, xtensa_is_littable_section): Use
XTENSA_INSN_SEC_NAME and XTENSA_LIT_SEC_NAME macros. Do not recognize
linkonce sections containing ".xt.insn" and ".xt.lit" substrings.
(xtensa_get_property_section_name): Check section name instead of
calling get_is_linkonce_section. Remove unused bfd parameter. Use
XTENSA_INSN_SEC_NAME and XTENSA_LIT_SEC_NAME macros. Never generate
linkonce section names by appending ".xt.insn" or ".xt.lit".
(xtensa_read_table_entries): Remove bfd argument in call to
xtensa_get_property_section_name. Free section name when done.
(elf_xtensa_combine_prop_entries): Free leaking table.
gas ChangeLog:
2003-10-14 Bob Wilson <bob.wilson@acm.org>
* config/tc-xtensa.c (xtensa_create_property_segments): Remove bfd
argument in call to xtensa_get_property_section_name. Formatting.
include ChangeLog:
2003-10-14 Bob Wilson <bob.wilson@acm.org>
* elf/xtensa.h: Formatting. Fix comments about property section
names for linkonce sections.
-rw-r--r-- | bfd/ChangeLog | 14 | ||||
-rw-r--r-- | bfd/elf32-xtensa.c | 136 | ||||
-rw-r--r-- | gas/ChangeLog | 5 | ||||
-rw-r--r-- | gas/config/tc-xtensa.c | 9 | ||||
-rw-r--r-- | include/ChangeLog | 5 | ||||
-rw-r--r-- | include/elf/xtensa.h | 7 |
6 files changed, 80 insertions, 96 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 33dd4d6..235bc66 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,17 @@ +2003-10-14 Bob Wilson <bob.wilson@acm.org> + + * elf32-xtensa.c (get_is_linkonce_section): Delete. + (xtensa_is_property_section, xtensa_is_littable_section): Use + XTENSA_INSN_SEC_NAME and XTENSA_LIT_SEC_NAME macros. Do not recognize + linkonce sections containing ".xt.insn" and ".xt.lit" substrings. + (xtensa_get_property_section_name): Check section name instead of + calling get_is_linkonce_section. Remove unused bfd parameter. Use + XTENSA_INSN_SEC_NAME and XTENSA_LIT_SEC_NAME macros. Never generate + linkonce section names by appending ".xt.insn" or ".xt.lit". + (xtensa_read_table_entries): Remove bfd argument in call to + xtensa_get_property_section_name. Free section name when done. + (elf_xtensa_combine_prop_entries): Free leaking table. + 2003-10-13 Richard Sandiford <rsandifo@redht.com> * elfxx-mips.c (_bfd_mips_elf_size_dynamic_sections): Don't add diff --git a/bfd/elf32-xtensa.c b/bfd/elf32-xtensa.c index ee8f311..1c6413b 100644 --- a/bfd/elf32-xtensa.c +++ b/bfd/elf32-xtensa.c @@ -212,10 +212,8 @@ static bfd_boolean is_literal_section PARAMS ((asection *)); static int internal_reloc_compare PARAMS ((const PTR, const PTR)); -static bfd_boolean get_is_linkonce_section - PARAMS ((bfd *, asection *)); extern char *xtensa_get_property_section_name - PARAMS ((bfd *, asection *, const char *)); + PARAMS ((asection *, const char *)); /* Other functions called directly by the linker. */ @@ -504,8 +502,9 @@ xtensa_read_table_entries (abfd, section, table_p, sec_name) Elf_Internal_Rela *internal_relocs; table_section_name = - xtensa_get_property_section_name (abfd, section, sec_name); + xtensa_get_property_section_name (section, sec_name); table_section = bfd_get_section_by_name (abfd, table_section_name); + free (table_section_name); if (table_section != NULL) table_size = bfd_get_section_size_before_reloc (table_section); @@ -2314,6 +2313,7 @@ elf_xtensa_combine_prop_entries (output_bfd, sxtlit, sgotloc) memcpy (sgotloc->contents, contents, section_size); free (contents); + free (table); return num; } @@ -5605,25 +5605,25 @@ pcrel_reloc_fits (opnd, self_address, dest_address) } +static int linkonce_len = sizeof (".gnu.linkonce.") - 1; +static int insn_sec_len = sizeof (XTENSA_INSN_SEC_NAME) - 1; +static int lit_sec_len = sizeof (XTENSA_LIT_SEC_NAME) - 1; + + static bfd_boolean xtensa_is_property_section (sec) asection *sec; { - static int linkonce_len = sizeof (".gnu.linkonce.") - 1; + if (strncmp (XTENSA_INSN_SEC_NAME, sec->name, insn_sec_len) == 0 + || strncmp (XTENSA_LIT_SEC_NAME, sec->name, lit_sec_len) == 0) + return TRUE; - if (strncmp (".xt.insn", sec->name, 8) == 0 - || strncmp (".xt.lit", sec->name, 7) == 0) + if (strncmp (".gnu.linkonce.", sec->name, linkonce_len) == 0 + && (sec->name[linkonce_len] == 'x' + || sec->name[linkonce_len] == 'p') + && sec->name[linkonce_len + 1] == '.') return TRUE; - if (strncmp (".gnu.linkonce.", sec->name, linkonce_len) == 0) - { - if (strncmp ("x.", sec->name + linkonce_len, 2) == 0 - || strncmp ("p.", sec->name + linkonce_len, 2) == 0) - return TRUE; - if (strstr (sec->name + linkonce_len, ".xt.insn") != NULL - || strstr (sec->name + linkonce_len, ".xt.lit") != NULL) - return TRUE; - } return FALSE; } @@ -5632,18 +5632,14 @@ static bfd_boolean xtensa_is_littable_section (sec) asection *sec; { - static int linkonce_len = sizeof (".gnu.linkonce.") - 1; + if (strncmp (XTENSA_LIT_SEC_NAME, sec->name, lit_sec_len) == 0) + return TRUE; - if (strncmp (".xt.lit", sec->name, 7) == 0) + if (strncmp (".gnu.linkonce.", sec->name, linkonce_len) == 0 + && sec->name[linkonce_len] == 'p' + && sec->name[linkonce_len + 1] == '.') return TRUE; - if (strncmp (".gnu.linkonce.", sec->name, linkonce_len) == 0) - { - if (strncmp ("p.", sec->name + linkonce_len, 2) == 0) - return TRUE; - if (strstr (sec->name + linkonce_len, ".xt.lit") != NULL) - return TRUE; - } return FALSE; } @@ -5671,78 +5667,42 @@ internal_reloc_compare (ap, bp) } -static bfd_boolean -get_is_linkonce_section (abfd, sec) - bfd *abfd ATTRIBUTE_UNUSED; - asection *sec; -{ - flagword flags, link_once_flags; - bfd_boolean is_linkonce = FALSE;; - - flags = bfd_get_section_flags (abfd, sec); - link_once_flags = (flags & SEC_LINK_ONCE); - if (link_once_flags != 0) - is_linkonce = TRUE; - - /* In order for this to be useful to the assembler - before the linkonce flag is set we need to - check for the GNU extension name. */ - if (!is_linkonce && - strncmp (sec->name, ".gnu.linkonce", sizeof ".gnu.linkonce" - 1) == 0) - is_linkonce = TRUE; - - return is_linkonce; -} - - char * -xtensa_get_property_section_name (abfd, sec, base_name) - bfd *abfd; +xtensa_get_property_section_name (sec, base_name) asection *sec; - const char * base_name; + const char *base_name; { - char *table_sec_name = NULL; - bfd_boolean is_linkonce; - - is_linkonce = get_is_linkonce_section (abfd, sec); - - if (!is_linkonce) + if (strncmp (sec->name, ".gnu.linkonce.", linkonce_len) == 0) { - table_sec_name = strdup (base_name); - } - else - { - static size_t prefix_len = sizeof (".gnu.linkonce.t.") - 1; - size_t len = strlen (sec->name) + 1; - char repl_char = '\0'; - const char *segname = sec->name; - - if (strncmp (segname, ".gnu.linkonce.t.", prefix_len) == 0) - { - if (strcmp (base_name, ".xt.insn") == 0) - repl_char = 'x'; - else if (strcmp (base_name, ".xt.lit") == 0) - repl_char = 'p'; - } - - if (repl_char != '\0') - { - char *name = (char *) bfd_malloc (len); - memcpy (name, sec->name, len); - name[prefix_len - 2] = repl_char; - table_sec_name = name; - } + char *prop_sec_name; + const char *suffix; + char linkonce_kind = 0; + + if (strcmp (base_name, XTENSA_INSN_SEC_NAME) == 0) + linkonce_kind = 'x'; + else if (strcmp (base_name, XTENSA_LIT_SEC_NAME) == 0) + linkonce_kind = 'p'; else + abort (); + + prop_sec_name = (char *) bfd_malloc (strlen (sec->name) + 1); + memcpy (prop_sec_name, ".gnu.linkonce.", linkonce_len); + prop_sec_name[linkonce_len] = linkonce_kind; + prop_sec_name[linkonce_len + 1] = '.'; + + suffix = sec->name + linkonce_len; + while (*suffix) { - size_t base_len = strlen (base_name) + 1; - char *name = (char *) bfd_malloc (len + base_len); - memcpy (name, sec->name, len - 1); - memcpy (name + len - 1, base_name, base_len); - table_sec_name = name; + suffix += 1; + if (suffix[-1] == '.') + break; } + strcpy (prop_sec_name + linkonce_len + 2, suffix); + + return prop_sec_name; } - return table_sec_name; + return strdup (base_name); } diff --git a/gas/ChangeLog b/gas/ChangeLog index 096e5ef..39222d3 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,8 @@ +2003-10-14 Bob Wilson <bob.wilson@acm.org> + + * config/tc-xtensa.c (xtensa_create_property_segments): Remove bfd + argument in call to xtensa_get_property_section_name. Formatting. + 2003-10-11 Kaz Kojima <kkojima@rr.iij4u.or.jp> * config/tc-sh.h (sh_coff_reloc_mangle): Delete an extra diff --git a/gas/config/tc-xtensa.c b/gas/config/tc-xtensa.c index afd983d..99509bd 100644 --- a/gas/config/tc-xtensa.c +++ b/gas/config/tc-xtensa.c @@ -677,7 +677,7 @@ static bfd_boolean get_frag_is_insn /* Import from elf32-xtensa.c in BFD library. */ extern char *xtensa_get_property_section_name - PARAMS ((bfd *, asection *, const char *)); + PARAMS ((asection *, const char *)); /* TInsn and IStack functions. */ static bfd_boolean tinsn_has_symbolic_operands @@ -7916,12 +7916,11 @@ xtensa_create_property_segments (property_function, section_name_base, segT sec = *seclist; if (section_has_property (sec, property_function)) { - char * property_section_name = - xtensa_get_property_section_name (stdoutput, sec, - section_name_base); + char *property_section_name = + xtensa_get_property_section_name (sec, section_name_base); segT insn_sec = retrieve_xtensa_section (property_section_name); segment_info_type *xt_seg_info = retrieve_segment_info (insn_sec); - xtensa_block_info ** xt_blocks = + xtensa_block_info **xt_blocks = &xt_seg_info->tc_segment_info_data.blocks[sec_type]; /* Walk over all of the frchains here and add new sections. */ add_xt_block_frags (sec, insn_sec, xt_blocks, property_function); diff --git a/include/ChangeLog b/include/ChangeLog index 9302e29..34f66f0 100644 --- a/include/ChangeLog +++ b/include/ChangeLog @@ -1,3 +1,8 @@ +2003-10-14 Bob Wilson <bob.wilson@acm.org> + + * elf/xtensa.h: Formatting. Fix comments about property section + names for linkonce sections. + 2003-09-22 Andrew Cagney <cagney@redhat.com> * floatformat.h (struct floatformat): Add field "is_valid". diff --git a/include/elf/xtensa.h b/include/elf/xtensa.h index 394ee41..6c584c7 100644 --- a/include/elf/xtensa.h +++ b/include/elf/xtensa.h @@ -16,7 +16,8 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, + USA. */ /* This file holds definitions specific to the Xtensa ELF ABI. */ @@ -68,8 +69,8 @@ END_RELOC_NUMBERS (R_XTENSA_max) /* Definitions for instruction and literal property tables. The - instruction tables for ".gnu.linkonce.t.*" sections are placed in - the following sections: + tables for ".gnu.linkonce.*" sections are placed in the following + sections: instruction tables: .gnu.linkonce.x.* literal tables: .gnu.linkonce.p.* |