diff options
Diffstat (limited to 'gold/layout.cc')
-rw-r--r-- | gold/layout.cc | 39 |
1 files changed, 29 insertions, 10 deletions
diff --git a/gold/layout.cc b/gold/layout.cc index 899d4af0707..a50086897bb 100644 --- a/gold/layout.cc +++ b/gold/layout.cc @@ -3333,19 +3333,38 @@ Layout::create_gold_note() std::string desc = std::string("gold ") + gold::get_version_string(); - size_t trailing_padding; - Output_section* os = this->create_note("GNU", elfcpp::NT_GNU_GOLD_VERSION, - ".note.gnu.gold-version", desc.size(), - false, &trailing_padding); - if (os == NULL) - return; + Output_section* os; + Output_section_data* posd; - Output_section_data* posd = new Output_data_const(desc, 4); - os->add_output_section_data(posd); + if (!parameters->options().enable_linker_version()) + { + size_t trailing_padding; + + os = this->create_note("GNU", elfcpp::NT_GNU_GOLD_VERSION, + ".note.gnu.gold-version", desc.size(), + false, &trailing_padding); + if (os == NULL) + return; + + posd = new Output_data_const(desc, 4); + os->add_output_section_data(posd); - if (trailing_padding > 0) + if (trailing_padding > 0) + { + posd = new Output_data_zero_fill(trailing_padding, 0); + os->add_output_section_data(posd); + } + } + else { - posd = new Output_data_zero_fill(trailing_padding, 0); + os = this->choose_output_section(NULL, ".comment", + elfcpp::SHT_PROGBITS, 0, + false, ORDER_INVALID, + false, false, false); + if (os == NULL) + return; + + posd = new Output_data_const(desc, 1); os->add_output_section_data(posd); } } |