diff options
Diffstat (limited to 'gold')
-rw-r--r-- | gold/ChangeLog | 3 | ||||
-rw-r--r-- | gold/object.cc | 45 | ||||
-rw-r--r-- | gold/object.h | 2 | ||||
-rw-r--r-- | gold/po/gold.pot | 10 | ||||
-rw-r--r-- | gold/powerpc.cc | 11 | ||||
-rw-r--r-- | gold/target-reloc.h | 4 |
6 files changed, 22 insertions, 53 deletions
diff --git a/gold/ChangeLog b/gold/ChangeLog index 93a1125..cbdb467 100644 --- a/gold/ChangeLog +++ b/gold/ChangeLog @@ -1,5 +1,6 @@ -2023-07-03 Nick Clifton <nickc@redhat.com> +2023-07-30 Nick Clifton <nickc@redhat.com> + This is the 2.41 release. * po/gold.pot: Regenerate. 2023-07-03 Nick Clifton <nickc@redhat.com> diff --git a/gold/object.cc b/gold/object.cc index acd7c94..77b2690 100644 --- a/gold/object.cc +++ b/gold/object.cc @@ -3054,7 +3054,7 @@ Sized_relobj_file<size, big_endian>::find_kept_section_object( // Return the name of symbol SYMNDX. template<int size, bool big_endian> -std::string +const char* Sized_relobj_file<size, big_endian>::get_symbol_name(unsigned int symndx) { if (this->symtab_shndx_ == 0) @@ -3065,24 +3065,6 @@ Sized_relobj_file<size, big_endian>::get_symbol_name(unsigned int symndx) &symbols_size, false); - const unsigned char* p = symbols + symndx * This::sym_size; - if (p >= symbols + symbols_size) - return NULL; - - elfcpp::Sym<size, big_endian> sym(p); - - if (sym.get_st_name() == 0 && sym.get_st_type() == elfcpp::STT_SECTION) - { - bool is_ordinary; - unsigned int sym_shndx = this->adjust_sym_shndx(symndx, - sym.get_st_shndx(), - &is_ordinary); - if (!is_ordinary || sym_shndx >= this->shnum()) - return NULL; - - return this->section_name(sym_shndx); - } - unsigned int symbol_names_shndx = this->adjust_shndx(this->section_link(this->symtab_shndx_)); section_size_type names_size; @@ -3090,25 +3072,14 @@ Sized_relobj_file<size, big_endian>::get_symbol_name(unsigned int symndx) this->section_contents(symbol_names_shndx, &names_size, false); const char* symbol_names = reinterpret_cast<const char*>(symbol_names_u); - unsigned int sym_name = sym.get_st_name(); - if (sym_name >= names_size) + const unsigned char* p = symbols + symndx * This::sym_size; + + if (p >= symbols + symbols_size) return NULL; - const char* namep = symbol_names + sym_name; - const void* endp = memchr(namep, 0, names_size - sym_name); - if (!endp) - endp = symbol_names + names_size; - std::string name = std::string(namep, static_cast<const char*>(endp) - namep); - - if (!parameters->options().do_demangle()) - return name; - - char* demangled_name = cplus_demangle(name.c_str(), DMGL_ANSI | DMGL_PARAMS); - if (!demangled_name) - return name; - - name = demangled_name; - free(demangled_name); - return name; + + elfcpp::Sym<size, big_endian> sym(p); + + return symbol_names + sym.get_st_name(); } // Get symbol counts. diff --git a/gold/object.h b/gold/object.h index d6c53eb..e747289 100644 --- a/gold/object.h +++ b/gold/object.h @@ -2347,7 +2347,7 @@ class Sized_relobj_file : public Sized_relobj<size, big_endian> find_kept_section_object(unsigned int shndx, unsigned int* symndx_p) const; // Return the name of symbol SYMNDX. - std::string + const char* get_symbol_name(unsigned int symndx); // Compute final local symbol value. R_SYM is the local symbol index. diff --git a/gold/po/gold.pot b/gold/po/gold.pot index a7a0641..2c27cb0 100644 --- a/gold/po/gold.pot +++ b/gold/po/gold.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: https://sourceware.org/bugzilla/\n" -"POT-Creation-Date: 2023-07-03 11:43+0100\n" +"POT-Creation-Date: 2023-07-30 14:36+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" @@ -3656,14 +3656,18 @@ msgstr "" msgid "call lacks nop, can't restore toc; recompile with -fPIC" msgstr "" -#: powerpc.cc:12424 s390.cc:3479 +#: powerpc.cc:12426 powerpc.cc:12433 s390.cc:3479 msgid "relocation overflow" msgstr "" -#: powerpc.cc:12426 +#: powerpc.cc:12428 msgid "try relinking with a smaller --stub-group-size" msgstr "" +#: powerpc.cc:12434 +msgid "debug info may be unreliable, compile with -gdwarf64" +msgstr "" + #: readsyms.cc:285 #, c-format msgid "%s: file is empty" diff --git a/gold/powerpc.cc b/gold/powerpc.cc index e66d9cb..d62bdea 100644 --- a/gold/powerpc.cc +++ b/gold/powerpc.cc @@ -12420,24 +12420,17 @@ Target_powerpc<size, big_endian>::Relocate::relocate( && gsym->is_undefined() && is_branch_reloc<size>(r_type)))) { - std::string name; - if (gsym) - name = gsym->demangled_name(); - else - name = relinfo->object->get_symbol_name(r_sym); if (os->flags() & elfcpp::SHF_ALLOC) { gold_error_at_location(relinfo, relnum, rela.get_r_offset(), - _("reloc type %u overflow against '%s'"), - r_type, name.c_str()); + _("relocation overflow")); if (has_stub_value) gold_info(_("try relinking with a smaller --stub-group-size")); } else { gold_warning_at_location(relinfo, relnum, rela.get_r_offset(), - _("reloc type %u overflow against '%s'"), - r_type, name.c_str()); + _("relocation overflow")); gold_info(_("debug info may be unreliable, compile with -gdwarf64")); } } diff --git a/gold/target-reloc.h b/gold/target-reloc.h index 1df25ae..5f4c5c5 100644 --- a/gold/target-reloc.h +++ b/gold/target-reloc.h @@ -242,7 +242,7 @@ issue_discarded_error( relinfo, shndx, offset, _("relocation refers to local symbol \"%s\" [%u], " "which is defined in a discarded section"), - object->get_symbol_name(r_sym).c_str(), r_sym); + object->get_symbol_name(r_sym), r_sym); } else { @@ -264,7 +264,7 @@ issue_discarded_error( &key_symndx); if (key_symndx != 0) gold_info(_(" section group signature: \"%s\""), - object->get_symbol_name(key_symndx).c_str()); + object->get_symbol_name(key_symndx)); if (kept_obj != NULL) gold_info(_(" prevailing definition is from %s"), kept_obj->name().c_str()); |