-frecord-command-line

Purpose

Saves the command-line options used for compiling a source file to the corresponding object file or binary file.

Note: The classic XL option, -qsaveopt, discards the command-line options after linking. Unlike -qsaveopt, -frecord-command-line saves the command-line options after linking.

Syntax

Read syntax diagramSkip visual syntax diagram-f no-record-command-linerecord-command-line

Default

-fno-record-command-line.

Usage

Command-line compiler options are copied as a string into the object file or binary file, using the following format:
Read syntax diagramSkip visual syntax diagram @(#) opt + invocation options
where:
invocation
Shows the command used for the compilation, for example, ibm-clang.
options
The list of command line options specified on the command line, with individual options separated by single spaces.

Examples

Compile t.c with the following command:

$ ibm-clang -frecord-command-line -O3 -c t.c

Issuing the what command on the resulting t.o object file produces information similar to the following:

$ what t.o
t.o:
	opt ibm-clang -frecord-command-line -O3 -c t.c

ibm-clang shows the invocation command used and -frecord-command-line -O3 shows the compilation options.

Note: When compiling non-fat LTO files (-flto), ibm-llvm-dis must be used to retrieve the command-line options from an object file.
$ ibm-llvm-dis -o - t.o | grep -F record-command-line
!6 = !{!"ibm-clang -frecord-command-line -flto=full -c t.c"}