I made two mistakes in the previous commit; it was not actually using
the argv that we built, and also the qemu logic was unconditionally
skipping the test.
Now I have verified that when mangling the RISC-V "hello world" test and
then using -Denable-qemu, we get a test failure.
SrcFn represents the function in the linked output file, if the
`Decl` is a function. This is stored here and not in `Fn` because `Decl`
survives across updates but `Fn` does not.
TODO Look into making `Fn` a longer lived structure and moving this field there
to save on memory usage.
Empirically, debug info consumers do not respect this field, or otherwise
consider it to be an error when it does not point exactly to the end of the header.
Therefore we rely on the NOP jump at the beginning of the Line Number Program for
padding rather than this field.
llvm-dwarfdump says the line number data is fine; gdb and
binutils-readelf crap out.
Supports writing the first function. Still TODO is:
* handling the .debug_line header growing too large
* adding a new file to an existing compilation
* adding an additional function to an existing file
* handling incremental updates
* adding the main IR debug ops for IR instructions
There are also issues to work out:
* readelf --debug-dump=rawline is saying there is no .debug_str section
even though there is
* readelf --debug-dump=decodedline is saying the file index 0 is bad
and reporting some other kind of corruption.
* the .debug_line header is written properly
* link.File.Elf gains:
- SrcFn, which is now a field in Module.Fn
- SrcFile, which is now a field in Module.Scope.File
* link.File.Elf gets a whole *Package field rather than only
root_src_dir_path.
* the fields first_dbg_line_file and last_dbg_line_file tell where the
Line Number Program begins and ends, which alows moving files when
the header gets too big, and allows appending files to the end.
* codegen is passed a buffer for emitting .debug_line
Line Number Program opcodes for functions.
See #5963
There is some work-in-progress code here, but I need to go make some
experimental changes to changing how to represent source locations and I
want to do that in a separate commit.