Implement a new special named metadata, llvm.commandline, to support frontends embedding their command-line options in IR/ASM/code-objects. Specifically this supports adding the -frecord-gcc-switches option to Clang.
This differs from the GCC implementation in a few ways, and I am looking for feedback on whether these differences are reasonable/correct.
In GCC there is only one command-line possible per compilation-unit, in LLVM it mirrors llvm.ident and multiple are allowed.
For the ELF section (".GCC.command.line"), in the case of GCC the options are null-terminated (e.g. '-foo\0-bar\0-baz\0'); in LLVM, in order to differentiate multiple merged command-lines, the null byte instead separates entire command-lines (e.g. '\0compiler1 -foo -bar -baz\0compiler2 -qux\0'). This is the biggest departure in terms of implementation, but in the face of section merging I don't understand how the GCC approach works in any meaningful way. The advantage I see to the GCC approach is unambiguously separating individual arguments without relying on shell-style parsing.