+/* Return the section_offsets* that CS points to. */
+static int cs_to_section PARAMS ((struct coff_symbol *, struct objfile *));
+
+struct find_targ_sec_arg {
+ int targ_index;
+ int *resultp;
+};
+
+static void find_targ_sec PARAMS ((bfd *, asection *, void *));
+
+static void find_targ_sec (abfd, sect, obj)
+ bfd *abfd;
+ asection *sect;
+ PTR obj;
+{
+ struct find_targ_sec_arg *args = (struct find_targ_sec_arg *)obj;
+ if (sect->target_index == args->targ_index)
+ {
+ /* This is the section. Figure out what SECT_OFF_* code it is. */
+ if (bfd_get_section_flags (abfd, sect) & SEC_CODE)
+ *args->resultp = SECT_OFF_TEXT;
+ else if (bfd_get_section_flags (abfd, sect) & SEC_LOAD)
+ *args->resultp = SECT_OFF_DATA;
+ else
+ *args->resultp = SECT_OFF_BSS;
+ }
+}
+
+/* Return the section number (SECT_OFF_*) that CS points to. */
+static int
+cs_to_section (cs, objfile)
+ struct coff_symbol *cs;
+ struct objfile *objfile;
+{
+ int off = SECT_OFF_TEXT;
+ struct find_targ_sec_arg args;
+ args.targ_index = cs->c_secnum;
+ args.resultp = &off;
+ bfd_map_over_sections (objfile->obfd, find_targ_sec, &args);
+ return off;
+}
+