+/* Find an obj_section, GDB's wrapper around a bfd section for ASECTION
+ from ABFD. It might be that no such wrapper exists (for example debug
+ sections don't have such wrappers) in which case nullptr is returned. */
+
+static obj_section *
+maint_obj_section_from_bfd_section (bfd *abfd,
+ asection *asection,
+ objfile *ofile)
+{
+ if (ofile->sections == nullptr)
+ return nullptr;
+
+ obj_section *osect
+ = &ofile->sections[gdb_bfd_section_index (abfd, asection)];
+
+ if (osect >= ofile->sections_end)
+ return nullptr;
+
+ return osect;
+}
+
+/* Print information about ASECT from ABFD. DATUM holds a pointer to a
+ maint_print_section_data object. Where possible the information for
+ ASECT will print the relocated addresses of the section. */
+
+static void
+print_bfd_section_info_maybe_relocated (bfd *abfd,
+ asection *asect,
+ void *datum)
+{
+ maint_print_section_data *print_data = (maint_print_section_data *) datum;
+ objfile *objfile = print_data->objfile;
+
+ gdb_assert (objfile->sections != NULL);
+ obj_section *osect
+ = maint_obj_section_from_bfd_section (abfd, asect, objfile);
+
+ if (osect->the_bfd_section == NULL)
+ print_bfd_section_info (abfd, asect, datum);
+ else
+ print_objfile_section_info (abfd, osect, print_data);
+}
+
+/* Implement the "maintenance info sections" command. */
+