+ if (flag_dwarf_sections)
+ {
+ char * name;
+ const char * sec_name;
+
+ /* Switch to the relevent sub-section before we start to emit
+ the line number table.
+
+ FIXME: These sub-sections do not have a normal Line Number
+ Program Header, thus strictly speaking they are not valid
+ DWARF sections. Unfortunately the DWARF standard assumes
+ a one-to-one relationship between compilation units and
+ line number tables. Thus we have to have a .debug_line
+ section, as well as our sub-sections, and we have to ensure
+ that all of the sub-sections are merged into a proper
+ .debug_line section before a debugger sees them. */
+
+ sec_name = bfd_get_section_name (stdoutput, seg);
+ if (strcmp (sec_name, ".text") != 0)
+ {
+ unsigned int len;
+
+ len = strlen (sec_name);
+ name = xmalloc (len + 11 + 2);
+ sprintf (name, ".debug_line%s", sec_name);
+ subseg_set (subseg_get (name, FALSE), 0);
+ }
+ else
+ /* Don't create a .debug_line.text section -
+ that is redundant. Instead just switch back to the
+ normal .debug_line section. */
+ subseg_set (subseg_get (".debug_line", FALSE), 0);
+ }
+