+// Given an address OFFSET relative to the start of input section
+// SHNDX in OBJECT, return whether this address is being included in
+// the final link. This should only be called if SHNDX in OBJECT has
+// a special mapping.
+
+bool
+Output_section::is_input_address_mapped(const Relobj* object,
+ unsigned int shndx,
+ off_t offset) const
+{
+ gold_assert(object->is_section_specially_mapped(shndx));
+
+ for (Input_section_list::const_iterator p = this->input_sections_.begin();
+ p != this->input_sections_.end();
+ ++p)
+ {
+ off_t output_offset;
+ if (p->output_offset(object, shndx, offset, &output_offset))
+ return output_offset != -1;
+ }
+
+ // By default we assume that the address is mapped. This should
+ // only be called after we have passed all sections to Layout. At
+ // that point we should know what we are discarding.
+ return true;
+}
+
+// Given an address OFFSET relative to the start of input section
+// SHNDX in object OBJECT, return the output offset relative to the
+// start of the section. This should only be called if SHNDX in
+// OBJECT has a special mapping.
+
+off_t
+Output_section::output_offset(const Relobj* object, unsigned int shndx,
+ off_t offset) const
+{
+ gold_assert(object->is_section_specially_mapped(shndx));
+ // This can only be called meaningfully when layout is complete.
+ gold_assert(Output_data::is_layout_complete());
+
+ for (Input_section_list::const_iterator p = this->input_sections_.begin();
+ p != this->input_sections_.end();
+ ++p)
+ {
+ off_t output_offset;
+ if (p->output_offset(object, shndx, offset, &output_offset))
+ return output_offset;
+ }
+ gold_unreachable();
+}
+