X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=gold%2Freloc.cc;h=40d8f39d99cf54ce08622a0f6b7b0c6affd3f856;hb=234529260a90b6ac6ed38ddac45d6ed15149e8f8;hp=ca54f153a3f1ef6f28cab52711bd19bb44893786;hpb=bd8d853f779692d3d4f8dfb65cf173f7e080f498;p=deliverable%2Fbinutils-gdb.git diff --git a/gold/reloc.cc b/gold/reloc.cc index ca54f153a3..40d8f39d99 100644 --- a/gold/reloc.cc +++ b/gold/reloc.cc @@ -1,6 +1,6 @@ // reloc.cc -- relocate input files for gold. -// Copyright (C) 2006-2016 Free Software Foundation, Inc. +// Copyright (C) 2006-2019 Free Software Foundation, Inc. // Written by Ian Lance Taylor . // This file is part of gold. @@ -871,7 +871,30 @@ Sized_relobj_file::do_relocate_sections( Output_file* of, Views* pviews) { - unsigned int shnum = this->shnum(); + this->relocate_section_range(symtab, layout, pshdrs, of, pviews, + 1, this->shnum() - 1); +} + +// Relocate section data for the range of sections START_SHNDX through +// END_SHNDX. + +template +void +Sized_relobj_file::relocate_section_range( + const Symbol_table* symtab, + const Layout* layout, + const unsigned char* pshdrs, + Output_file* of, + Views* pviews, + unsigned int start_shndx, + unsigned int end_shndx) +{ + gold_assert(start_shndx >= 1); + gold_assert(end_shndx < this->shnum()); + + if (end_shndx < start_shndx) + return; + Sized_target* target = parameters->sized_target(); @@ -883,8 +906,8 @@ Sized_relobj_file::do_relocate_sections( relinfo.layout = layout; relinfo.object = this; - const unsigned char* p = pshdrs + This::shdr_size; - for (unsigned int i = 1; i < shnum; ++i, p += This::shdr_size) + const unsigned char* p = pshdrs + start_shndx * This::shdr_size; + for (unsigned int i = start_shndx; i <= end_shndx; ++i, p += This::shdr_size) { typename This::Shdr shdr(p); @@ -1717,6 +1740,17 @@ Sized_relobj_file<32, false>::do_relocate_sections( Output_file* of, Views* pviews); +template +void +Sized_relobj_file<32, false>::relocate_section_range( + const Symbol_table* symtab, + const Layout* layout, + const unsigned char* pshdrs, + Output_file* of, + Views* pviews, + unsigned int start_shndx, + unsigned int end_shndx); + template unsigned char* Sized_relobj_file<32, false>::do_get_output_view( @@ -1734,6 +1768,17 @@ Sized_relobj_file<32, true>::do_relocate_sections( Output_file* of, Views* pviews); +template +void +Sized_relobj_file<32, true>::relocate_section_range( + const Symbol_table* symtab, + const Layout* layout, + const unsigned char* pshdrs, + Output_file* of, + Views* pviews, + unsigned int start_shndx, + unsigned int end_shndx); + template unsigned char* Sized_relobj_file<32, true>::do_get_output_view( @@ -1751,6 +1796,17 @@ Sized_relobj_file<64, false>::do_relocate_sections( Output_file* of, Views* pviews); +template +void +Sized_relobj_file<64, false>::relocate_section_range( + const Symbol_table* symtab, + const Layout* layout, + const unsigned char* pshdrs, + Output_file* of, + Views* pviews, + unsigned int start_shndx, + unsigned int end_shndx); + template unsigned char* Sized_relobj_file<64, false>::do_get_output_view( @@ -1768,6 +1824,17 @@ Sized_relobj_file<64, true>::do_relocate_sections( Output_file* of, Views* pviews); +template +void +Sized_relobj_file<64, true>::relocate_section_range( + const Symbol_table* symtab, + const Layout* layout, + const unsigned char* pshdrs, + Output_file* of, + Views* pviews, + unsigned int start_shndx, + unsigned int end_shndx); + template unsigned char* Sized_relobj_file<64, true>::do_get_output_view(