From 5696ab0b73cb827e7b3636255694d1fe61c89a32 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Tue, 19 Jan 2010 17:55:49 +0000 Subject: elfcpp/: * elfcpp.h (PN_XNUM): Define. gold/: * output.cc (Output_section_headers::do_sized_write): Write large segment count to sh_info field. (Output_file_header::do_sized_write): For large segment count, write PN_XNUM to e_phnum field. --- gold/ChangeLog | 7 +++++++ gold/output.cc | 11 ++++++++--- 2 files changed, 15 insertions(+), 3 deletions(-) (limited to 'gold') diff --git a/gold/ChangeLog b/gold/ChangeLog index 0c6e1a0..2bf56d4 100644 --- a/gold/ChangeLog +++ b/gold/ChangeLog @@ -1,3 +1,10 @@ +2010-01-19 Ian Lance Taylor + + * output.cc (Output_section_headers::do_sized_write): Write large + segment count to sh_info field. + (Output_file_header::do_sized_write): For large segment count, + write PN_XNUM to e_phnum field. + 2010-01-15 Viktor Kutuzov * arm.cc (Arm_relocate_functions::thm_jump6): New function. diff --git a/gold/output.cc b/gold/output.cc index 634249f..2a97078 100644 --- a/gold/output.cc +++ b/gold/output.cc @@ -213,7 +213,9 @@ Output_section_headers::do_sized_write(Output_file* of) else oshdr.put_sh_link(shstrndx); - oshdr.put_sh_info(0); + size_t segment_count = this->segment_list_->size(); + oshdr.put_sh_info(segment_count >= elfcpp::PN_XNUM ? segment_count : 0); + oshdr.put_sh_addralign(0); oshdr.put_sh_entsize(0); } @@ -470,8 +472,11 @@ Output_file_header::do_sized_write(Output_file* of) else { oehdr.put_e_phentsize(elfcpp::Elf_sizes::phdr_size); - oehdr.put_e_phnum(this->segment_header_->data_size() - / elfcpp::Elf_sizes::phdr_size); + size_t phnum = (this->segment_header_->data_size() + / elfcpp::Elf_sizes::phdr_size); + if (phnum > elfcpp::PN_XNUM) + phnum = elfcpp::PN_XNUM; + oehdr.put_e_phnum(phnum); } oehdr.put_e_shentsize(elfcpp::Elf_sizes::shdr_size); -- cgit v1.1