From: Hans-Peter Nilsson Date: Wed, 29 Jul 2015 03:39:27 +0000 (+0200) Subject: bfd/mmo.c (MMIX): Fix massive gcc LTO testsuite failures. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=11509220a045532b1995b4af5dac2f921b541003;p=binutils-gdb.git bfd/mmo.c (MMIX): Fix massive gcc LTO testsuite failures. * mmo.c (mmo_write_symbols_and_terminator): Skip symbol-type assignment loop for bfd plugin objects. --- diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 5aa84e02812..fd17ed6ed88 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,8 @@ +2015-07-29 Hans-Peter Nilsson + + * mmo.c (mmo_write_symbols_and_terminator): Skip symbol-type + assignment loop for bfd plugin objects. + 2015-07-28 Alan Modra * elf.c (_bfd_elf_map_sections_to_segments): Do not make a new diff --git a/bfd/mmo.c b/bfd/mmo.c index bdf2a1276bc..b269ffba603 100644 --- a/bfd/mmo.c +++ b/bfd/mmo.c @@ -2934,59 +2934,65 @@ mmo_write_symbols_and_terminator (bfd *abfd) count++; } - for (i = 0, serno = 1; i < count && table[i] != NULL; i++) + /* Don't bother inspecting symbols in plugin dummy objects; their + symbols aren't fully inspectable. */ + if ((abfd->flags & BFD_PLUGIN) == 0) { - asymbol *s = table[i]; + for (i = 0, serno = 1; i < count && table[i] != NULL; i++) + { + asymbol *s = table[i]; - /* It's not enough to consult bfd_is_local_label, since it does not - mean "local" in the sense of linkable-and-observable-after-link. - Let's just check the BSF_GLOBAL flag. + /* It's not enough to consult bfd_is_local_label, since it does not + mean "local" in the sense of linkable-and-observable-after-link. + Let's just check the BSF_GLOBAL flag. - Also, don't export symbols with characters not in the allowed set. */ - if ((s->flags & (BSF_DEBUGGING|BSF_GLOBAL)) == BSF_GLOBAL - && strspn (s->name, - valid_mmo_symbol_character_set) == strlen (s->name)) - { - struct mmo_symbol sym; - memset (&sym, 0, sizeof (sym)); - - /* Need to strip const here; strdup:ing would leak and the - existing string must be safe to reuse. */ - sym.name = (char *) s->name; - sym.value = - s->value - + s->section->output_section->vma - + s->section->output_offset; - - if (bfd_is_und_section (s->section)) - sym.sym_type = mmo_undef_sym; - else if (strcmp (s->section->name, MMO_DATA_SECTION_NAME) == 0 - /* The encoding of data symbols require that the "rest" - of the value fits in 6 bytes, so the upper two bytes - must be 0x2000. All other symbols get to be the - absolute type. */ - && (sym.value >> 48) == 0x2000) - sym.sym_type = mmo_data_sym; - else if (strcmp (s->section->name, MMIX_REG_SECTION_NAME) == 0) - sym.sym_type = mmo_reg_sym; - else if (strcmp (s->section->name, - MMIX_REG_CONTENTS_SECTION_NAME) == 0) + Also, don't export symbols with characters not in the + allowed set. */ + if ((s->flags & (BSF_DEBUGGING|BSF_GLOBAL)) == BSF_GLOBAL + && strspn (s->name, + valid_mmo_symbol_character_set) == strlen (s->name)) { - sym.sym_type = mmo_reg_sym; - sym.value /= 8; - } - else - sym.sym_type = mmo_abs_sym; + struct mmo_symbol sym; + memset (&sym, 0, sizeof (sym)); + + /* Need to strip const here; strdup:ing would leak and the + existing string must be safe to reuse. */ + sym.name = (char *) s->name; + sym.value = + s->value + + s->section->output_section->vma + + s->section->output_offset; + + if (bfd_is_und_section (s->section)) + sym.sym_type = mmo_undef_sym; + else if (strcmp (s->section->name, MMO_DATA_SECTION_NAME) == 0 + /* The encoding of data symbols require that the "rest" + of the value fits in 6 bytes, so the upper two bytes + must be 0x2000. All other symbols get to be the + absolute type. */ + && (sym.value >> 48) == 0x2000) + sym.sym_type = mmo_data_sym; + else if (strcmp (s->section->name, MMIX_REG_SECTION_NAME) == 0) + sym.sym_type = mmo_reg_sym; + else if (strcmp (s->section->name, + MMIX_REG_CONTENTS_SECTION_NAME) == 0) + { + sym.sym_type = mmo_reg_sym; + sym.value /= 8; + } + else + sym.sym_type = mmo_abs_sym; - /* FIXME: We assume the order of the received symbols is an - ordered mapping of the serial numbers. This is not - necessarily true if we e.g. objcopy a mmo file to another and - there are gaps in the numbering. Not sure if this can - happen. Not sure what to do. */ - sym.serno = serno++; + /* FIXME: We assume the order of the received symbols is an + ordered mapping of the serial numbers. This is not + necessarily true if we e.g. objcopy a mmo file to another and + there are gaps in the numbering. Not sure if this can + happen. Not sure what to do. */ + sym.serno = serno++; - if (! mmo_internal_add_3_sym (abfd, &root, &sym)) - return FALSE; + if (! mmo_internal_add_3_sym (abfd, &root, &sym)) + return FALSE; + } } }