+
+ // For the ARM target, we need to add a PT_ARM_EXIDX segment for
+ // the .ARM.exidx section.
+ if (!layout->script_options()->saw_phdrs_clause()
+ && !parameters->options().relocatable())
+ {
+ Output_section* exidx_section =
+ layout->find_output_section(".ARM.exidx");
+
+ if (exidx_section != NULL
+ && exidx_section->type() == elfcpp::SHT_ARM_EXIDX)
+ {
+ gold_assert(layout->find_output_segment(elfcpp::PT_ARM_EXIDX, 0, 0)
+ == NULL);
+ Output_segment* exidx_segment =
+ layout->make_output_segment(elfcpp::PT_ARM_EXIDX, elfcpp::PF_R);
+ exidx_segment->add_output_section(exidx_section, elfcpp::PF_R);
+ }
+ }