From de6beb02a530a8da6e0525e99b9c1ab24252064e Mon Sep 17 00:00:00 2001 From: Scott Linder Date: Fri, 14 Dec 2018 15:38:15 +0000 Subject: Implement -frecord-command-line (-frecord-gcc-switches) Implement options in clang to enable recording the driver command-line in an ELF section. Implement a new special named metadata, llvm.commandline, to support frontends embedding their command-line options in IR/ASM/ELF. This differs from the GCC implementation in some key ways: * In GCC there is only one command-line possible per compilation-unit, in LLVM it mirrors llvm.ident and multiple are allowed. * In GCC individual options are separated by NULL bytes, in LLVM entire command-lines are separated by NULL bytes. The advantage of the GCC approach is to clearly delineate options in the face of embedded spaces. The advantage of the LLVM approach is to support merging multiple command-lines unambiguously, while handling embedded spaces with escaping. Differential Revision: https://reviews.llvm.org/D54487 Clang Differential Revision: https://reviews.llvm.org/D54489 llvm-svn: 349155 --- clang/docs/ClangCommandLineReference.rst | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'clang/docs') diff --git a/clang/docs/ClangCommandLineReference.rst b/clang/docs/ClangCommandLineReference.rst index 540c8527d280..61abd05e0cc9 100644 --- a/clang/docs/ClangCommandLineReference.rst +++ b/clang/docs/ClangCommandLineReference.rst @@ -792,6 +792,16 @@ Don't use blacklist file for sanitizers .. option:: -fparse-all-comments +.. option:: -frecord-command-line, -frecord-gcc-switches, -fno-record-command-line, -fno-record-gcc-switches + +Generate a section named ".GCC.command.line" containing the clang driver +command-line. After linking, the section may contain multiple command lines, +which will be individually terminated by null bytes. Separate arguments within +a command line are combined with spaces; spaces and backslashes within an +argument are escaped with backslashes. This format differs from the format of +the equivalent section produced by GCC with the -frecord-gcc-switches flag. +This option is currently only supported on ELF targets. + .. option:: -fsanitize-address-field-padding= Level of field padding for AddressSanitizer @@ -2831,7 +2841,7 @@ Embed source text in DWARF debug sections .. option:: -gpubnames, -gno-pubnames -.. option:: -grecord-gcc-switches, -gno-record-gcc-switches +.. option:: -grecord-command-line, -grecord-gcc-switches, -gno-record-command-line, -gno-record-gcc-switches .. option:: -gsplit-dwarf -- cgit v1.2.3