aboutsummaryrefslogtreecommitdiff
path: root/gold/output.cc
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2018-12-02 05:42:36 -0800
committerH.J. Lu <hjl.tools@gmail.com>2018-12-02 05:43:04 -0800
commit5f6c22aee74f17393b82934a5682d985672e011a (patch)
treefb4a7272b32272ff0b678b1482d61073d55c45d7 /gold/output.cc
parent3134061ce6e33ade4cc65a36578b94983228815e (diff)
downloadgdb-5f6c22aee74f17393b82934a5682d985672e011a.zip
gdb-5f6c22aee74f17393b82934a5682d985672e011a.tar.gz
gdb-5f6c22aee74f17393b82934a5682d985672e011a.tar.bz2
gold: Get alignment of uncompressed section from ch_addralign
The ELF compression header has a field (ch_addralign) that is set to the alignment of the uncompressed section. This way the section itself can have a different alignment than the decompressed section. Update decompress_input_section to get alignment of the decompressed section and use it when merging decompressed strings. PR binutils/23919 * merge.cc (Output_merge_string<Char_type>::do_add_input_section): Get addralign from decompressed_section_contents. * object.cc (build_compressed_section_map): Set info.addralign. (Object::decompressed_section_contents): Add a palign argument and store p->second.addralign in *palign if it isn't NULL. * object.h (Compressed_section_info): Add addralign. (section_is_compressed): Add a palign argument, default it to NULL, store p->second.addralign in *palign if it isn't NULL. (Object::decompressed_section_contents): Likewise. * output.cc (Output_section::add_input_section): Get addralign from section_is_compressed.
Diffstat (limited to 'gold/output.cc')
-rw-r--r--gold/output.cc11
1 files changed, 6 insertions, 5 deletions
diff --git a/gold/output.cc b/gold/output.cc
index 1701db1..75ac3bc 100644
--- a/gold/output.cc
+++ b/gold/output.cc
@@ -2448,7 +2448,13 @@ Output_section::add_input_section(Layout* layout,
unsigned int reloc_shndx,
bool have_sections_script)
{
+ section_size_type input_section_size = shdr.get_sh_size();
+ section_size_type uncompressed_size;
elfcpp::Elf_Xword addralign = shdr.get_sh_addralign();
+ if (object->section_is_compressed(shndx, &uncompressed_size,
+ &addralign))
+ input_section_size = uncompressed_size;
+
if ((addralign & (addralign - 1)) != 0)
{
object->error(_("invalid alignment %lu for section \"%s\""),
@@ -2498,11 +2504,6 @@ Output_section::add_input_section(Layout* layout,
}
}
- section_size_type input_section_size = shdr.get_sh_size();
- section_size_type uncompressed_size;
- if (object->section_is_compressed(shndx, &uncompressed_size))
- input_section_size = uncompressed_size;
-
off_t offset_in_section;
if (this->has_fixed_layout())