Ah, yes. That is what I thought first too. But gcc is sneaky :)
If gcc detects gas has support for the .loc directive, it will not
output the section itself, but let gas generate it (because the
assembler has exact info on instruction sizes).
Sure, but there is no .loc in there! In fact, it's gas that is quite
sneaky here.
/* If there is no line information and no non-empty .debug_info
section, or if there is both a non-empty .debug_info and a non-empty
.debug_line, then we do nothing. */
So its the presence of some .section .debug_info content (even without any
.file, let alone .loc) that makes it emit the .debug_line header.
If there is a bug here, it's a gas bug.
Thanks,
Roland