diff options
author | H.J. Lu <hjl.tools@gmail.com> | 2020-12-19 13:30:39 -0800 |
---|---|---|
committer | H.J. Lu <hjl.tools@gmail.com> | 2020-12-19 13:37:04 -0800 |
commit | 97aac4ec3293dc4a3fdb45a744a2991ae56514c2 (patch) | |
tree | 5d001c56054449c969d72d4c7dc770fd5cd2c14e /gold/incremental.cc | |
parent | 60108e47b5b16b32a62eb32c5e6f929ab2cb5cf1 (diff) | |
download | binutils-97aac4ec3293dc4a3fdb45a744a2991ae56514c2.zip binutils-97aac4ec3293dc4a3fdb45a744a2991ae56514c2.tar.gz binutils-97aac4ec3293dc4a3fdb45a744a2991ae56514c2.tar.bz2 |
gold: Move sym declaration just before use
Move sym declaration just before use to avoid -Wmaybe-uninitialized
warning from GCC 11.
PR gold/27097
* incremental.cc (Sized_relobj_incr::do_add_symbols): Move sym
declaration just before use.
(Sized_incr_dynobj::do_add_symbols): Likewise.
* plugin.cc (Sized_pluginobj::do_add_symbols): Likewise.
Diffstat (limited to 'gold/incremental.cc')
-rw-r--r-- | gold/incremental.cc | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/gold/incremental.cc b/gold/incremental.cc index 1f2ae5b..525c92c 100644 --- a/gold/incremental.cc +++ b/gold/incremental.cc @@ -2129,7 +2129,6 @@ Sized_relobj_incr<size, big_endian>::do_add_symbols( { const int sym_size = elfcpp::Elf_sizes<size>::sym_size; unsigned char symbuf[sym_size]; - elfcpp::Sym<size, big_endian> sym(symbuf); elfcpp::Sym_write<size, big_endian> osym(symbuf); typedef typename elfcpp::Elf_types<size>::Elf_WXword Elf_size_type; @@ -2196,6 +2195,7 @@ Sized_relobj_incr<size, big_endian>::do_add_symbols( osym.put_st_other(gsym.get_st_other()); osym.put_st_shndx(shndx); + elfcpp::Sym<size, big_endian> sym(symbuf); Symbol* res = symtab->add_from_incrobj(this, name, NULL, &sym); if (shndx != elfcpp::SHN_UNDEF) @@ -2730,7 +2730,6 @@ Sized_incr_dynobj<size, big_endian>::do_add_symbols( { const int sym_size = elfcpp::Elf_sizes<size>::sym_size; unsigned char symbuf[sym_size]; - elfcpp::Sym<size, big_endian> sym(symbuf); elfcpp::Sym_write<size, big_endian> osym(symbuf); unsigned int nsyms = this->input_reader_.get_global_symbol_count(); @@ -2795,6 +2794,7 @@ Sized_incr_dynobj<size, big_endian>::do_add_symbols( osym.put_st_other(gsym.get_st_other()); osym.put_st_shndx(shndx); + elfcpp::Sym<size, big_endian> sym(symbuf); Sized_symbol<size>* res = symtab->add_from_incrobj<size, big_endian>(this, name, NULL, &sym); this->symbols_[i] = res; |