1..
2  -------------------------------------------------------------------
3  NOTE: This file is automatically generated by running clang-tblgen
4  -gen-opt-docs. Do not edit this file by hand!!
5  -------------------------------------------------------------------
6
7=====================================
8Clang command line argument reference
9=====================================
10.. contents::
11   :local:
12
13Introduction
14============
15
16This page lists the command line arguments currently supported by the
17GCC-compatible ``clang`` and ``clang++`` drivers.
18
19
20.. program:: clang
21.. option:: -B<dir>, --prefix <arg>, --prefix=<arg>
22
23Add <dir> to search path for binaries and object files used implicitly
24
25.. option:: -F<arg>
26
27Add directory to framework include search path
28
29.. option:: -ObjC
30
31Treat source input files as Objective-C inputs
32
33.. program:: clang1
34.. option:: -ObjC++
35.. program:: clang
36
37Treat source input files as Objective-C++ inputs
38
39.. option:: -Qn, -fno-ident
40
41Do not emit metadata containing compiler name and version
42
43.. option:: -Qunused-arguments
44
45Don't emit warning for unused driver arguments
46
47.. option:: -Qy, -fident
48
49Emit metadata containing compiler name and version
50
51.. option:: -Wa,<arg>,<arg2>...
52
53Pass the comma separated arguments in <arg> to the assembler
54
55.. option:: -Wlarge-by-value-copy=<arg>
56
57.. option:: -Xarch\_<arg1> <arg2>
58
59.. option:: -Xcuda-fatbinary <arg>
60
61Pass <arg> to fatbinary invocation
62
63.. option:: -Xcuda-ptxas <arg>
64
65Pass <arg> to the ptxas assembler
66
67.. option:: -Xopenmp-target <arg>
68
69Pass <arg> to the target offloading toolchain.
70
71.. program:: clang1
72.. option:: -Xopenmp-target=<triple> <arg>
73.. program:: clang
74
75Pass <arg> to the target offloading toolchain identified by <triple>.
76
77.. option:: -Z<arg>
78
79.. option:: -a<arg>, --profile-blocks
80
81.. option:: -all\_load
82
83.. option:: -allowable\_client <arg>
84
85.. option:: --analyze
86
87Run the static analyzer
88
89.. option:: --analyze-auto
90
91.. option:: --analyzer-no-default-checks
92
93.. option:: --analyzer-output<arg>
94
95Static analyzer report output format (html\|plist\|plist-multi-file\|plist-html\|text).
96
97.. option:: -ansi, --ansi
98
99.. option:: -arch <arg>
100
101.. program:: clang1
102.. option:: -arch\_errors\_fatal
103.. program:: clang
104
105.. program:: clang2
106.. option:: -arch\_only <arg>
107.. program:: clang
108
109.. option:: -arcmt-migrate-emit-errors
110
111Emit ARC errors even if the migrator can fix them
112
113.. option:: -arcmt-migrate-report-output <arg>
114
115Output path for the plist report
116
117.. option:: --autocomplete=<arg>
118
119.. option:: -bind\_at\_load
120
121.. option:: -bundle
122
123.. program:: clang1
124.. option:: -bundle\_loader <arg>
125.. program:: clang
126
127.. option:: -cfguard
128
129Emit tables required for Windows Control Flow Guard.
130
131.. option:: -client\_name<arg>
132
133.. option:: -compatibility\_version<arg>
134
135.. option:: --config <arg>
136
137Specifies configuration file
138
139.. option:: --constant-cfstrings
140
141.. option:: -coverage, --coverage
142
143.. option:: --cuda-compile-host-device
144
145Compile CUDA code for both host and device (default).  Has no effect on non-CUDA compilations.
146
147.. option:: --cuda-device-only
148
149Compile CUDA code for device only
150
151.. option:: --cuda-gpu-arch=<arg>, --no-cuda-gpu-arch=<arg>
152
153CUDA GPU architecture (e.g. sm\_35).  May be specified more than once.
154
155.. option:: --cuda-host-only
156
157Compile CUDA code for host only.  Has no effect on non-CUDA compilations.
158
159.. option:: --cuda-include-ptx=<arg>, --no-cuda-include-ptx=<arg>
160
161Include PTX for the following GPU architecture (e.g. sm\_35) or 'all'. May be specified more than once.
162
163.. option:: --cuda-noopt-device-debug, --no-cuda-noopt-device-debug
164
165Enable device-side debug info generation. Disables ptxas optimizations.
166
167.. option:: -current\_version<arg>
168
169.. option:: -dead\_strip
170
171.. option:: -dependency-dot <arg>
172
173Filename to write DOT-formatted header dependencies to
174
175.. option:: -dependency-file <arg>
176
177Filename (or -) to write dependency output to
178
179.. option:: -dumpmachine
180
181.. option:: -dumpversion
182
183.. option:: --dyld-prefix=<arg>, --dyld-prefix <arg>
184
185.. option:: -dylib\_file <arg>
186
187.. option:: -dylinker
188
189.. program:: clang1
190.. option:: -dylinker\_install\_name<arg>
191.. program:: clang
192
193.. option:: -dynamic
194
195.. option:: -dynamiclib
196
197.. option:: -emit-ast
198
199Emit Clang AST files for source inputs
200
201.. option:: -exported\_symbols\_list <arg>
202
203.. option:: -faligned-new=<arg>
204
205.. option:: -fcuda-approx-transcendentals, -fno-cuda-approx-transcendentals
206
207Use approximate transcendental functions
208
209.. option:: -fcuda-flush-denormals-to-zero, -fno-cuda-flush-denormals-to-zero
210
211Flush denormal floating point values to zero in CUDA device mode.
212
213.. option:: -fcuda-rdc, -fno-cuda-rdc
214
215Generate relocatable device code, also known as separate compilation mode.
216
217.. option:: -fcuda-short-ptr, -fno-cuda-short-ptr
218
219Use 32-bit pointers for accessing const/local/shared address spaces.
220
221.. option:: -ffixed-r19
222
223Reserve register r19 (Hexagon only)
224
225.. option:: -fheinous-gnu-extensions
226
227.. option:: -flat\_namespace
228
229.. option:: -fopenmp-targets=<arg1>,<arg2>...
230
231Specify comma-separated list of triples OpenMP offloading targets to be supported
232
233.. option:: -force\_cpusubtype\_ALL
234
235.. program:: clang1
236.. option:: -force\_flat\_namespace
237.. program:: clang
238
239.. program:: clang2
240.. option:: -force\_load <arg>
241.. program:: clang
242
243.. option:: -framework <arg>
244
245.. option:: -frtlib-add-rpath, -fno-rtlib-add-rpath
246
247Add -rpath with architecture-specific resource directory to the linker flags
248
249.. option:: --gcc-toolchain=<arg>, -gcc-toolchain <arg>
250
251Use the gcc toolchain at the given directory
252
253.. option:: -gcodeview
254
255Generate CodeView debug information
256
257.. option:: -headerpad\_max\_install\_names<arg>
258
259.. option:: -help, --help
260
261Display available options
262
263.. option:: --help-hidden
264
265Display help for hidden options
266
267.. option:: --hip-link
268
269Link clang-offload-bundler bundles for HIP
270
271.. option:: -image\_base <arg>
272
273.. option:: -index-header-map
274
275Make the next included directory (-I or -F) an indexer header map
276
277.. option:: -init <arg>
278
279.. option:: -install\_name <arg>
280
281.. option:: -keep\_private\_externs
282
283.. option:: -lazy\_framework <arg>
284
285.. program:: clang1
286.. option:: -lazy\_library <arg>
287.. program:: clang
288
289.. option:: -mbig-endian, -EB
290
291.. option:: --migrate
292
293Run the migrator
294
295.. option:: -mios-simulator-version-min=<arg>, -miphonesimulator-version-min=<arg>
296
297.. option:: -mlinker-version=<arg>
298
299.. option:: -mlittle-endian, -EL
300
301.. option:: -mllvm <arg>
302
303Additional arguments to forward to LLVM's option processing
304
305.. option:: -module-dependency-dir <arg>
306
307Directory to dump module dependencies to
308
309.. option:: -mtvos-simulator-version-min=<arg>, -mappletvsimulator-version-min=<arg>
310
311.. option:: -multi\_module
312
313.. option:: -multiply\_defined <arg>
314
315.. program:: clang1
316.. option:: -multiply\_defined\_unused <arg>
317.. program:: clang
318
319.. option:: -mwatchos-simulator-version-min=<arg>, -mwatchsimulator-version-min=<arg>
320
321.. option:: --no-cuda-version-check
322
323Don't error out if the detected version of the CUDA install is too low for the requested CUDA gpu architecture.
324
325.. option:: -no-integrated-cpp, --no-integrated-cpp
326
327.. option:: -no\_dead\_strip\_inits\_and\_terms
328
329.. option:: -nobuiltininc
330
331Disable builtin #include directories
332
333.. option:: -nocudainc
334
335.. option:: -nocudalib
336
337.. option:: -nodefaultlibs
338
339.. option:: -nofixprebinding
340
341.. option:: -nolibc
342
343.. option:: -nomultidefs
344
345.. option:: -nopie, -no-pie
346
347.. option:: -noprebind
348
349.. option:: -noprofilelib
350
351.. option:: -noseglinkedit
352
353.. option:: -nostartfiles
354
355.. option:: -nostdinc, --no-standard-includes
356
357.. program:: clang1
358.. option:: -nostdinc++
359.. program:: clang
360
361Disable standard #include directories for the C++ standard library
362
363.. option:: -nostdlib, --no-standard-libraries
364
365.. program:: clang1
366.. option:: -nostdlib++
367.. program:: clang
368
369.. option:: -nostdlibinc
370
371.. option:: -o<file>, --output <arg>, --output=<arg>
372
373Write output to <file>
374
375.. option:: -objcmt-atomic-property
376
377Make migration to 'atomic' properties
378
379.. option:: -objcmt-migrate-all
380
381Enable migration to modern ObjC
382
383.. option:: -objcmt-migrate-annotation
384
385Enable migration to property and method annotations
386
387.. option:: -objcmt-migrate-designated-init
388
389Enable migration to infer NS\_DESIGNATED\_INITIALIZER for initializer methods
390
391.. option:: -objcmt-migrate-instancetype
392
393Enable migration to infer instancetype for method result type
394
395.. option:: -objcmt-migrate-literals
396
397Enable migration to modern ObjC literals
398
399.. option:: -objcmt-migrate-ns-macros
400
401Enable migration to NS\_ENUM/NS\_OPTIONS macros
402
403.. option:: -objcmt-migrate-property
404
405Enable migration to modern ObjC property
406
407.. option:: -objcmt-migrate-property-dot-syntax
408
409Enable migration of setter/getter messages to property-dot syntax
410
411.. option:: -objcmt-migrate-protocol-conformance
412
413Enable migration to add protocol conformance on classes
414
415.. option:: -objcmt-migrate-readonly-property
416
417Enable migration to modern ObjC readonly property
418
419.. option:: -objcmt-migrate-readwrite-property
420
421Enable migration to modern ObjC readwrite property
422
423.. option:: -objcmt-migrate-subscripting
424
425Enable migration to modern ObjC subscripting
426
427.. option:: -objcmt-ns-nonatomic-iosonly
428
429Enable migration to use NS\_NONATOMIC\_IOSONLY macro for setting property's 'atomic' attribute
430
431.. option:: -objcmt-returns-innerpointer-property
432
433Enable migration to annotate property with NS\_RETURNS\_INNER\_POINTER
434
435.. option:: -objcmt-whitelist-dir-path=<arg>, -objcmt-white-list-dir-path=<arg>
436
437Only modify files with a filename contained in the provided directory path
438
439.. option:: -object
440
441.. option:: -p, --profile
442
443.. option:: -pagezero\_size<arg>
444
445.. option:: -pg
446
447Enable mcount instrumentation
448
449.. option:: -pie
450
451.. option:: -pipe, --pipe
452
453Use pipes between commands, when possible
454
455.. option:: -prebind
456
457.. program:: clang1
458.. option:: -prebind\_all\_twolevel\_modules
459.. program:: clang
460
461.. option:: -preload
462
463.. option:: --print-diagnostic-categories
464
465.. option:: -print-effective-triple, --print-effective-triple
466
467Print the effective target triple
468
469.. option:: -print-file-name=<file>, --print-file-name=<file>, --print-file-name <arg>
470
471Print the full library path of <file>
472
473.. option:: -print-ivar-layout
474
475Enable Objective-C Ivar layout bitmap print trace
476
477.. option:: -print-libgcc-file-name, --print-libgcc-file-name
478
479Print the library path for the currently used compiler runtime library ("libgcc.a" or "libclang\_rt.builtins.\*.a")
480
481.. option:: -print-multi-directory, --print-multi-directory
482
483.. option:: -print-multi-lib, --print-multi-lib
484
485.. option:: -print-prog-name=<name>, --print-prog-name=<name>, --print-prog-name <arg>
486
487Print the full program path of <name>
488
489.. option:: -print-resource-dir, --print-resource-dir
490
491Print the resource directory pathname
492
493.. option:: -print-search-dirs, --print-search-dirs
494
495Print the paths used for finding libraries and programs
496
497.. option:: -print-target-triple, --print-target-triple
498
499Print the normalized target triple
500
501.. option:: -private\_bundle
502
503.. option:: -pthread, -no-pthread
504
505Support POSIX threads in generated code
506
507.. option:: -pthreads
508
509.. option:: -rdynamic
510
511.. option:: -read\_only\_relocs <arg>
512
513.. option:: -relocatable-pch, --relocatable-pch
514
515Whether to build a relocatable precompiled header
516
517.. option:: -remap
518
519.. option:: -rewrite-legacy-objc
520
521Rewrite Legacy Objective-C source to C++
522
523.. option:: -rtlib=<arg>, --rtlib=<arg>, --rtlib <arg>
524
525Compiler runtime library to use
526
527.. option:: -save-stats=<arg>, --save-stats=<arg>, -save-stats (equivalent to -save-stats=cwd), --save-stats (equivalent to -save-stats=cwd)
528
529Save llvm statistics.
530
531.. option:: -save-temps=<arg>, --save-temps=<arg>, -save-temps (equivalent to -save-temps=cwd), --save-temps (equivalent to -save-temps=cwd)
532
533Save intermediate compilation results.
534
535.. option:: -sectalign <arg1> <arg2> <arg3>
536
537.. option:: -sectcreate <arg1> <arg2> <arg3>
538
539.. option:: -sectobjectsymbols <arg1> <arg2>
540
541.. option:: -sectorder <arg1> <arg2> <arg3>
542
543.. option:: -seg1addr<arg>
544
545.. option:: -seg\_addr\_table <arg>
546
547.. program:: clang1
548.. option:: -seg\_addr\_table\_filename <arg>
549.. program:: clang
550
551.. option:: -segaddr <arg1> <arg2>
552
553.. option:: -segcreate <arg1> <arg2> <arg3>
554
555.. option:: -seglinkedit
556
557.. option:: -segprot <arg1> <arg2> <arg3>
558
559.. option:: -segs\_read\_<arg>
560
561.. program:: clang1
562.. option:: -segs\_read\_only\_addr <arg>
563.. program:: clang
564
565.. program:: clang2
566.. option:: -segs\_read\_write\_addr <arg>
567.. program:: clang
568
569.. option:: -serialize-diagnostics <arg>, --serialize-diagnostics <arg>
570
571Serialize compiler diagnostics to a file
572
573.. option:: -shared, --shared
574
575.. option:: -shared-libgcc
576
577.. option:: -shared-libsan, -shared-libasan
578
579Dynamically link the sanitizer runtime
580
581.. option:: -single\_module
582
583.. option:: -specs=<arg>, --specs=<arg>
584
585.. option:: -static, --static
586
587.. option:: -static-libgcc
588
589.. option:: -static-libsan
590
591Statically link the sanitizer runtime
592
593.. option:: -static-libstdc++
594
595.. option:: -std-default=<arg>
596
597.. option:: -stdlib=<arg>, --stdlib=<arg>, --stdlib <arg>
598
599C++ standard library to use
600
601.. option:: -sub\_library<arg>
602
603.. program:: clang1
604.. option:: -sub\_umbrella<arg>
605.. program:: clang
606
607.. option:: --sysroot=<arg>, --sysroot <arg>
608
609.. option:: --target-help
610
611.. option:: --target=<arg>, -target <arg>
612
613Generate code for the given target
614
615.. option:: --print-supported-cpus
616
617Print supported cpu models for the given target
618
619.. option:: -time
620
621Time individual commands
622
623.. option:: -traditional, --traditional
624
625.. option:: -traditional-cpp, --traditional-cpp
626
627Enable some traditional CPP emulation
628
629.. option:: -twolevel\_namespace
630
631.. program:: clang1
632.. option:: -twolevel\_namespace\_hints
633.. program:: clang
634
635.. option:: -umbrella <arg>
636
637.. option:: -unexported\_symbols\_list <arg>
638
639.. option:: -v, --verbose
640
641Show commands to run and use verbose output
642
643.. option:: --verify-debug-info
644
645Verify the binary representation of debug output
646
647.. option:: --version
648
649Print version information
650
651.. option:: -w, --no-warnings
652
653Suppress all warnings
654
655.. option:: -weak-l<arg>
656
657.. option:: -weak\_framework <arg>
658
659.. program:: clang1
660.. option:: -weak\_library <arg>
661.. program:: clang
662
663.. program:: clang2
664.. option:: -weak\_reference\_mismatches <arg>
665.. program:: clang
666
667.. option:: -whatsloaded
668
669.. option:: -whyload
670
671.. option:: -working-directory<arg>, -working-directory=<arg>
672
673Resolve file paths relative to the specified directory
674
675.. option:: -x<language>, --language <arg>, --language=<arg>
676
677Treat subsequent input files as having type <language>
678
679.. option:: -y<arg>
680
681Actions
682=======
683The action to perform on the input.
684
685.. option:: -E, --preprocess
686
687Only run the preprocessor
688
689.. option:: -S, --assemble
690
691Only run preprocess and compilation steps
692
693.. option:: -c, --compile
694
695Only run preprocess, compile, and assemble steps
696
697.. option:: -emit-llvm
698
699Use the LLVM representation for assembler and object files
700
701.. option:: -fsyntax-only
702
703.. option:: -module-file-info
704
705Provide information about a particular module file
706
707.. option:: --precompile
708
709Only precompile the input
710
711.. option:: -rewrite-objc
712
713Rewrite Objective-C source to C++
714
715.. option:: -verify-pch
716
717Load and verify that a pre-compiled header file is not stale
718
719Compilation flags
720=================
721
722Flags controlling the behavior of Clang during compilation. These flags have
723no effect during actions that do not perform compilation.
724
725.. option:: -Xassembler <arg>
726
727Pass <arg> to the assembler
728
729.. option:: -Xclang <arg>
730
731Pass <arg> to the clang compiler
732
733.. option:: -fclang-abi-compat=<version>
734
735Attempt to match the ABI of Clang <version>
736
737.. option:: -fcomment-block-commands=<arg>,<arg2>...
738
739Treat each comma separated argument in <arg> as a documentation comment block command
740
741.. option:: -fcomplete-member-pointers, -fno-complete-member-pointers
742
743Require member pointer base types to be complete if they would be significant under the Microsoft ABI
744
745.. option:: -fcrash-diagnostics-dir=<arg>
746
747.. option:: -fdeclspec, -fno-declspec
748
749Allow \_\_declspec as a keyword
750
751.. option:: -fdepfile-entry=<arg>
752
753.. option:: -fdiagnostics-fixit-info, -fno-diagnostics-fixit-info
754
755.. option:: -fdiagnostics-format=<arg>
756
757.. option:: -fdiagnostics-parseable-fixits
758
759Print fix-its in machine parseable form
760
761.. option:: -fdiagnostics-print-source-range-info
762
763Print source range spans in numeric form
764
765.. option:: -fdiagnostics-show-category=<arg>
766
767.. option:: -fdiscard-value-names, -fno-discard-value-names
768
769Discard value names in LLVM IR
770
771.. option:: -fexperimental-isel, -fno-experimental-isel
772
773Enables the experimental global instruction selector
774
775.. option:: -fexperimental-new-pass-manager, -fno-experimental-new-pass-manager
776
777Enables an experimental new pass manager in LLVM.
778
779.. option:: -ffine-grained-bitfield-accesses, -fno-fine-grained-bitfield-accesses
780
781Use separate accesses for consecutive bitfield runs with legal widths and alignments.
782
783.. option:: -finline-functions, -fno-inline-functions
784
785Inline suitable functions
786
787.. option:: -finline-hint-functions
788
789Inline functions which are (explicitly or implicitly) marked inline
790
791.. option:: -fno-crash-diagnostics
792
793Disable auto-generation of preprocessed source files and a script for reproduction during a clang crash
794
795.. option:: -fno-sanitize-blacklist
796
797Don't use blacklist file for sanitizers
798
799.. option:: -fparse-all-comments
800
801.. option:: -frecord-command-line, -frecord-gcc-switches, -fno-record-command-line, -fno-record-gcc-switches
802
803Generate a section named ".GCC.command.line" containing the clang driver
804command-line. After linking, the section may contain multiple command lines,
805which will be individually terminated by null bytes. Separate arguments within
806a command line are combined with spaces; spaces and backslashes within an
807argument are escaped with backslashes. This format differs from the format of
808the equivalent section produced by GCC with the -frecord-gcc-switches flag.
809This option is currently only supported on ELF targets.
810
811.. option:: -fsanitize-address-field-padding=<arg>
812
813Level of field padding for AddressSanitizer
814
815.. option:: -fsanitize-address-globals-dead-stripping
816
817Enable linker dead stripping of globals in AddressSanitizer
818
819.. option:: -fsanitize-address-use-odr-indicator, -fno-sanitize-address-use-odr-indicator
820
821Enable ODR indicator globals to avoid false ODR violation reports in partially sanitized programs at the cost of an increase in binary size
822
823.. option:: -fsanitize-address-poison-custom-array-cookie, -fno-sanitize-address-poison-custom-array-cookie
824
825Enable "poisoning" array cookies when allocating arrays with a custom operator new\[\] in Address Sanitizer, preventing accesses to the cookies from user code. An array cookie is a small implementation-defined header added to certain array allocations to record metadata such as the length of the array. Accesses to array cookies from user code are technically allowed by the standard but are more likely to be the result of an out-of-bounds array access.
826
827An operator new\[\] is "custom" if it is not one of the allocation functions provided by the C++ standard library. Array cookies from non-custom allocation functions are always poisoned.
828
829.. option:: -fsanitize-address-use-after-scope, -fno-sanitize-address-use-after-scope
830
831Enable use-after-scope detection in AddressSanitizer
832
833.. option:: -fsanitize-blacklist=<arg>
834
835Path to blacklist file for sanitizers
836
837.. option:: -fsanitize-cfi-cross-dso, -fno-sanitize-cfi-cross-dso
838
839Enable control flow integrity (CFI) checks for cross-DSO calls.
840
841.. option:: -fsanitize-cfi-icall-generalize-pointers
842
843Generalize pointers in CFI indirect call type signature checks
844
845.. option:: -fsanitize-coverage=<arg1>,<arg2>..., -fno-sanitize-coverage=<arg1>,<arg2>...
846
847Specify the type of coverage instrumentation for Sanitizers
848
849.. option:: -fsanitize-link-c++-runtime
850
851.. option:: -fsanitize-memory-track-origins, -fno-sanitize-memory-track-origins
852
853Enable origins tracking in MemorySanitizer
854
855.. program:: clang1
856.. option:: -fsanitize-memory-track-origins=<arg>
857.. program:: clang
858
859Enable origins tracking in MemorySanitizer
860
861.. option:: -fsanitize-memory-use-after-dtor, -fno-sanitize-memory-use-after-dtor
862
863Enable use-after-destroy detection in MemorySanitizer
864
865.. option:: -fsanitize-minimal-runtime, -fno-sanitize-minimal-runtime
866
867.. option:: -fsanitize-recover, -fno-sanitize-recover
868
869.. program:: clang1
870.. option:: -fsanitize-recover=<arg1>,<arg2>..., -fno-sanitize-recover=<arg1>,<arg2>...
871.. program:: clang
872
873Enable recovery for specified sanitizers
874
875.. option:: -fsanitize-stats, -fno-sanitize-stats
876
877Enable sanitizer statistics gathering.
878
879.. option:: -fsanitize-thread-atomics, -fno-sanitize-thread-atomics
880
881Enable atomic operations instrumentation in ThreadSanitizer (default)
882
883.. option:: -fsanitize-thread-func-entry-exit, -fno-sanitize-thread-func-entry-exit
884
885Enable function entry/exit instrumentation in ThreadSanitizer (default)
886
887.. option:: -fsanitize-thread-memory-access, -fno-sanitize-thread-memory-access
888
889Enable memory access instrumentation in ThreadSanitizer (default)
890
891.. option:: -fsanitize-trap=<arg1>,<arg2>..., -fno-sanitize-trap=<arg1>,<arg2>...
892
893Enable trapping for specified sanitizers
894
895.. option:: -fsanitize-undefined-strip-path-components=<number>
896
897Strip (or keep only, if negative) a given number of path components when emitting check metadata.
898
899.. option:: -fsanitize-undefined-trap-on-error, -fno-sanitize-undefined-trap-on-error
900
901.. option:: -fsanitize=<check>,<arg2>..., -fno-sanitize=<arg1>,<arg2>...
902
903Turn on runtime checks for various forms of undefined or suspicious behavior. See user manual for available checks
904
905.. option:: -moutline, -mno-outline
906
907Enable function outlining (AArch64 only)
908
909.. option:: --param <arg>, --param=<arg>
910
911.. option:: -std=<arg>, --std=<arg>, --std <arg>
912
913Language standard to compile for
914
915Preprocessor flags
916~~~~~~~~~~~~~~~~~~
917
918Flags controlling the behavior of the Clang preprocessor.
919
920.. option:: -C, --comments
921
922Include comments in preprocessed output
923
924.. option:: -CC, --comments-in-macros
925
926Include comments from within macros in preprocessed output
927
928.. option:: -D<macro>=<value>, --define-macro <arg>, --define-macro=<arg>
929
930Define <macro> to <value> (or 1 if <value> omitted)
931
932.. option:: -H, --trace-includes
933
934Show header includes and nesting depth
935
936.. option:: -P, --no-line-commands
937
938Disable linemarker output in -E mode
939
940.. option:: -U<macro>, --undefine-macro <arg>, --undefine-macro=<arg>
941
942Undefine macro <macro>
943
944.. option:: -Wp,<arg>,<arg2>...
945
946Pass the comma separated arguments in <arg> to the preprocessor
947
948.. option:: -Xpreprocessor <arg>
949
950Pass <arg> to the preprocessor
951
952Include path management
953-----------------------
954
955Flags controlling how ``#include``\s are resolved to files.
956
957.. option:: -I<dir>, --include-directory <arg>, --include-directory=<arg>
958
959Add directory to include search path
960
961.. option:: -I-, --include-barrier
962
963Restrict all prior -I flags to double-quoted inclusion and remove current directory from include path
964
965.. option:: --cuda-path-ignore-env
966
967Ignore environment variables to detect CUDA installation
968
969.. option:: --cuda-path=<arg>
970
971CUDA installation path
972
973.. option:: -cxx-isystem<directory>
974
975Add directory to the C++ SYSTEM include search path
976
977.. option:: -fbuild-session-file=<file>
978
979Use the last modification time of <file> as the build session timestamp
980
981.. option:: -fbuild-session-timestamp=<time since Epoch in seconds>
982
983Time when the current build session started
984
985.. option:: -fmodule-file=\[<name>=\]<file>
986
987Specify the mapping of module name to precompiled module file, or load a module file if name is omitted.
988
989.. option:: -fmodules-cache-path=<directory>
990
991Specify the module cache path
992
993.. option:: -fmodules-disable-diagnostic-validation
994
995Disable validation of the diagnostic options when loading the module
996
997.. option:: -fmodules-prune-after=<seconds>
998
999Specify the interval (in seconds) after which a module file will be considered unused
1000
1001.. option:: -fmodules-prune-interval=<seconds>
1002
1003Specify the interval (in seconds) between attempts to prune the module cache
1004
1005.. option:: -fmodules-user-build-path <directory>
1006
1007Specify the module user build path
1008
1009.. option:: -fmodules-validate-once-per-build-session
1010
1011Don't verify input files for the modules if the module has been successfully validated or loaded during this build session
1012
1013.. option:: -fmodules-validate-system-headers, -fno-modules-validate-system-headers
1014
1015Validate the system headers that a module depends on when loading the module
1016
1017.. option:: -fprebuilt-module-path=<directory>
1018
1019Specify the prebuilt module path
1020
1021.. option:: -idirafter<arg>, --include-directory-after <arg>, --include-directory-after=<arg>
1022
1023Add directory to AFTER include search path
1024
1025.. option:: -iframework<arg>
1026
1027Add directory to SYSTEM framework search path
1028
1029.. option:: -iframeworkwithsysroot<directory>
1030
1031Add directory to SYSTEM framework search path, absolute paths are relative to -isysroot
1032
1033.. option:: -imacros<file>, --imacros<file>, --imacros=<arg>
1034
1035Include macros from file before parsing
1036
1037.. option:: -include<file>, --include<file>, --include=<arg>
1038
1039Include file before parsing
1040
1041.. option:: -include-pch <file>
1042
1043Include precompiled header file
1044
1045.. option:: -iprefix<dir>, --include-prefix <arg>, --include-prefix=<arg>
1046
1047Set the -iwithprefix/-iwithprefixbefore prefix
1048
1049.. option:: -iquote<directory>
1050
1051Add directory to QUOTE include search path
1052
1053.. option:: -isysroot<dir>
1054
1055Set the system root directory (usually /)
1056
1057.. option:: -isystem<directory>
1058
1059Add directory to SYSTEM include search path
1060
1061.. option:: -isystem-after<directory>
1062
1063Add directory to end of the SYSTEM include search path
1064
1065.. option:: -ivfsoverlay<arg>
1066
1067Overlay the virtual filesystem described by file over the real file system
1068
1069.. option:: -iwithprefix<dir>, --include-with-prefix <arg>, --include-with-prefix-after <arg>, --include-with-prefix-after=<arg>, --include-with-prefix=<arg>
1070
1071Set directory to SYSTEM include search path with prefix
1072
1073.. option:: -iwithprefixbefore<dir>, --include-with-prefix-before <arg>, --include-with-prefix-before=<arg>
1074
1075Set directory to include search path with prefix
1076
1077.. option:: -iwithsysroot<directory>
1078
1079Add directory to SYSTEM include search path, absolute paths are relative to -isysroot
1080
1081.. option:: --ptxas-path=<arg>
1082
1083Path to ptxas (used for compiling CUDA code)
1084
1085.. option:: --system-header-prefix=<prefix>, --no-system-header-prefix=<prefix>, --system-header-prefix <arg>
1086
1087Treat all #include paths starting with <prefix> as including a system header.
1088
1089Dependency file generation
1090--------------------------
1091
1092Flags controlling generation of a dependency file for ``make``-like build
1093systems.
1094
1095.. option:: -M, --dependencies
1096
1097Like -MD, but also implies -E and writes to stdout by default
1098
1099.. option:: -MD, --write-dependencies
1100
1101Write a depfile containing user and system headers
1102
1103.. option:: -MF<file>
1104
1105Write depfile output from -MMD, -MD, -MM, or -M to <file>
1106
1107.. option:: -MG, --print-missing-file-dependencies
1108
1109Add missing headers to depfile
1110
1111.. option:: -MJ<arg>
1112
1113Write a compilation database entry per input
1114
1115.. option:: -MM, --user-dependencies
1116
1117Like -MMD, but also implies -E and writes to stdout by default
1118
1119.. option:: -MMD, --write-user-dependencies
1120
1121Write a depfile containing user headers
1122
1123.. option:: -MP
1124
1125Create phony target for each dependency (other than main file)
1126
1127.. option:: -MQ<arg>
1128
1129Specify name of main file output to quote in depfile
1130
1131.. option:: -MT<arg>
1132
1133Specify name of main file output in depfile
1134
1135.. option:: -MV
1136
1137Use NMake/Jom format for the depfile
1138
1139Dumping preprocessor state
1140--------------------------
1141
1142Flags allowing the state of the preprocessor to be dumped in various ways.
1143
1144.. option:: -d
1145
1146.. program:: clang1
1147.. option:: -d<arg>
1148.. program:: clang
1149
1150.. option:: -dD
1151
1152Print macro definitions in -E mode in addition to normal output
1153
1154.. option:: -dI
1155
1156Print include directives in -E mode in addition to normal output
1157
1158.. option:: -dM
1159
1160Print macro definitions in -E mode instead of normal output
1161
1162Diagnostic flags
1163~~~~~~~~~~~~~~~~
1164
1165Flags controlling which warnings, errors, and remarks Clang will generate.
1166See the :doc:`full list of warning and remark flags <DiagnosticsReference>`.
1167
1168.. option:: -R<remark>
1169
1170Enable the specified remark
1171
1172.. option:: -Rpass-analysis=<arg>
1173
1174Report transformation analysis from optimization passes whose name matches the given POSIX regular expression
1175
1176.. option:: -Rpass-missed=<arg>
1177
1178Report missed transformations by optimization passes whose name matches the given POSIX regular expression
1179
1180.. option:: -Rpass=<arg>
1181
1182Report transformations performed by optimization passes whose name matches the given POSIX regular expression
1183
1184.. option:: -W<warning>, --extra-warnings, --warn-<arg>, --warn-=<arg>
1185
1186Enable the specified warning
1187
1188.. option:: -Wdeprecated, -Wno-deprecated
1189
1190Enable warnings for deprecated constructs and define \_\_DEPRECATED
1191
1192.. option:: -Wnonportable-cfstrings<arg>, -Wno-nonportable-cfstrings<arg>
1193
1194Target-independent compilation options
1195~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1196.. option:: -Wframe-larger-than=<arg>
1197
1198.. option:: -fPIC, -fno-PIC
1199
1200.. option:: -fPIE, -fno-PIE
1201
1202.. option:: -faccess-control, -fno-access-control
1203
1204.. option:: -faddrsig, -fno-addrsig
1205
1206Emit an address-significance table
1207
1208.. option:: -falign-functions, -fno-align-functions
1209
1210.. program:: clang1
1211.. option:: -falign-functions=<arg>
1212.. program:: clang
1213
1214.. program:: clang1
1215.. option:: -faligned-allocation, -faligned-new, -fno-aligned-allocation
1216.. program:: clang
1217
1218Enable C++17 aligned allocation functions
1219
1220.. option:: -fallow-editor-placeholders, -fno-allow-editor-placeholders
1221
1222Treat editor placeholders as valid source code
1223
1224.. option:: -fallow-unsupported
1225
1226.. option:: -faltivec, -fno-altivec
1227
1228.. option:: -fansi-escape-codes
1229
1230Use ANSI escape codes for diagnostics
1231
1232.. option:: -fapple-kext, -findirect-virtual-calls, -fterminated-vtables
1233
1234Use Apple's kernel extensions ABI
1235
1236.. option:: -fapple-pragma-pack, -fno-apple-pragma-pack
1237
1238Enable Apple gcc-compatible #pragma pack handling
1239
1240.. option:: -fapplication-extension, -fno-application-extension
1241
1242Restrict code to those available for App Extensions
1243
1244.. option:: -fasm, -fno-asm
1245
1246.. option:: -fasm-blocks, -fno-asm-blocks
1247
1248.. option:: -fassociative-math, -fno-associative-math
1249
1250.. option:: -fassume-sane-operator-new, -fno-assume-sane-operator-new
1251
1252.. option:: -fast
1253
1254.. option:: -fastcp
1255
1256.. option:: -fastf
1257
1258.. option:: -fasynchronous-unwind-tables, -fno-asynchronous-unwind-tables
1259
1260.. option:: -fautolink, -fno-autolink
1261
1262.. option:: -fblocks, -fno-blocks
1263
1264Enable the 'blocks' language feature
1265
1266.. option:: -fbootclasspath=<arg>, --bootclasspath <arg>, --bootclasspath=<arg>
1267
1268.. option:: -fborland-extensions, -fno-borland-extensions
1269
1270Accept non-standard constructs supported by the Borland compiler
1271
1272.. option:: -fbracket-depth=<arg>
1273
1274.. option:: -fbuiltin, -fno-builtin
1275
1276.. option:: -fbuiltin-module-map
1277
1278Load the clang builtins module map file.
1279
1280.. option:: -fc++-static-destructors, -fno-c++-static-destructors
1281
1282Enable C++ static destructor registration (the default)
1283
1284.. option:: -fcaret-diagnostics, -fno-caret-diagnostics
1285
1286.. option:: -fcf-protection=<arg>, -fcf-protection (equivalent to -fcf-protection=full)
1287
1288Instrument control-flow architecture protection. Options: return, branch, full, none.
1289
1290.. option:: -fchar8\_t, -fno-char8\_t
1291
1292Enable C++ builtin type char8\_t
1293
1294.. option:: -fclasspath=<arg>, --CLASSPATH <arg>, --CLASSPATH=<arg>, --classpath <arg>, --classpath=<arg>
1295
1296.. option:: -fcolor-diagnostics, -fno-color-diagnostics
1297
1298Use colors in diagnostics
1299
1300.. option:: -fcommon, -fno-common
1301
1302.. option:: -fcompile-resource=<arg>, --resource <arg>, --resource=<arg>
1303
1304.. option:: -fconstant-cfstrings, -fno-constant-cfstrings
1305
1306.. option:: -fconstant-string-class=<arg>
1307
1308.. option:: -fconstexpr-backtrace-limit=<arg>
1309
1310.. option:: -fconstexpr-depth=<arg>
1311
1312.. option:: -fconstexpr-steps=<arg>
1313
1314.. option:: -fcoroutines-ts, -fno-coroutines-ts
1315
1316Enable support for the C++ Coroutines TS
1317
1318.. option:: -fcoverage-mapping, -fno-coverage-mapping
1319
1320Generate coverage mapping to enable code coverage analysis
1321
1322.. option:: -fcreate-profile
1323
1324.. option:: -fcxx-exceptions, -fno-cxx-exceptions
1325
1326Enable C++ exceptions
1327
1328.. option:: -fcxx-modules, -fno-cxx-modules
1329
1330.. option:: -fdata-sections, -fno-data-sections
1331
1332Place each data in its own section (ELF Only)
1333
1334.. option:: -fdebug-info-for-profiling, -fno-debug-info-for-profiling
1335
1336Emit extra debug info to make sample profile more accurate.
1337
1338.. option:: -fdebug-macro, -fno-debug-macro
1339
1340Emit macro debug information
1341
1342.. option:: -fdebug-pass-arguments
1343
1344.. option:: -fdebug-pass-structure
1345
1346.. option:: -fdebug-prefix-map=<arg>
1347
1348remap file source paths in debug info
1349
1350.. option:: -fdebug-types-section, -fno-debug-types-section
1351
1352Place debug types in their own section (ELF Only)
1353
1354.. option:: -fdelayed-template-parsing, -fno-delayed-template-parsing
1355
1356Parse templated function definitions at the end of the translation unit
1357
1358.. option:: -fdelete-null-pointer-checks, -fno-delete-null-pointer-checks
1359
1360Treat usage of null pointers as undefined behavior.
1361
1362.. option:: -fdenormal-fp-math=<arg>
1363
1364.. option:: -fdiagnostics-absolute-paths
1365
1366Print absolute paths in diagnostics
1367
1368.. option:: -fdiagnostics-color, -fno-diagnostics-color
1369
1370.. program:: clang1
1371.. option:: -fdiagnostics-color=<arg>
1372.. program:: clang
1373
1374.. option:: -fdiagnostics-hotness-threshold=<number>
1375
1376Prevent optimization remarks from being output if they do not have at least this profile count
1377
1378.. option:: -fdiagnostics-show-hotness, -fno-diagnostics-show-hotness
1379
1380Enable profile hotness information in diagnostic line
1381
1382.. option:: -fdiagnostics-show-note-include-stack, -fno-diagnostics-show-note-include-stack
1383
1384Display include stacks for diagnostic notes
1385
1386.. option:: -fdiagnostics-show-option, -fno-diagnostics-show-option
1387
1388Print option name with mappable diagnostics
1389
1390.. option:: -fdiagnostics-show-template-tree
1391
1392Print a template comparison tree for differing templates
1393
1394.. option:: -fdigraphs, -fno-digraphs
1395
1396Enable alternative token representations '<:', ':>', '<%', '%>', '%:', '%:%:' (default)
1397
1398.. option:: -fdollars-in-identifiers, -fno-dollars-in-identifiers
1399
1400Allow '$' in identifiers
1401
1402.. option:: -fdouble-square-bracket-attributes, -fno-double-square-bracket-attributes
1403
1404Enable '\[\[\]\]' attributes in all C and C++ language modes
1405
1406.. option:: -fdwarf-directory-asm, -fno-dwarf-directory-asm
1407
1408.. option:: -fdwarf-exceptions
1409
1410Use DWARF style exceptions
1411
1412.. option:: -felide-constructors, -fno-elide-constructors
1413
1414.. option:: -feliminate-unused-debug-symbols, -fno-eliminate-unused-debug-symbols
1415
1416.. option:: -fembed-bitcode=<option>, -fembed-bitcode (equivalent to -fembed-bitcode=all), -fembed-bitcode-marker (equivalent to -fembed-bitcode=marker)
1417
1418Embed LLVM bitcode (option: off, all, bitcode, marker)
1419
1420.. option:: -femit-all-decls
1421
1422Emit all declarations, even if unused
1423
1424.. option:: -femulated-tls, -fno-emulated-tls
1425
1426Use emutls functions to access thread\_local variables
1427
1428.. option:: -fencoding=<arg>, --encoding <arg>, --encoding=<arg>
1429
1430.. option:: -ferror-limit=<arg>
1431
1432.. option:: -fescaping-block-tail-calls, -fno-escaping-block-tail-calls
1433
1434.. option:: -fexceptions, -fno-exceptions
1435
1436Enable support for exception handling
1437
1438.. option:: -fexec-charset=<arg>
1439
1440.. option:: -fextdirs=<arg>, --extdirs <arg>, --extdirs=<arg>
1441
1442.. option:: -ffast-math, -fno-fast-math
1443
1444Allow aggressive, lossy floating-point optimizations
1445
1446.. option:: -ffinite-math-only, -fno-finite-math-only
1447
1448.. option:: -ffixed-point, -fno-fixed-point
1449
1450Enable fixed point types
1451
1452.. option:: -ffor-scope, -fno-for-scope
1453
1454.. option:: -fforce-emit-vtables, -fno-force-emit-vtables
1455
1456Emits more virtual tables to improve devirtualization
1457
1458.. option:: -fforce-enable-int128, -fno-force-enable-int128
1459
1460Enable support for int128\_t type
1461
1462.. option:: -ffp-contract=<arg>
1463
1464Form fused FP ops (e.g. FMAs): fast (everywhere) \| on (according to FP\_CONTRACT pragma, default) \| off (never fuse)
1465
1466.. option:: -ffreestanding
1467
1468Assert that the compilation takes place in a freestanding environment
1469
1470.. option:: -ffunction-sections, -fno-function-sections
1471
1472Place each function in its own section (ELF Only)
1473
1474.. option:: -fgnu-inline-asm, -fno-gnu-inline-asm
1475
1476.. option:: -fgnu-keywords, -fno-gnu-keywords
1477
1478Allow GNU-extension keywords regardless of language standard
1479
1480.. option:: -fgnu-runtime
1481
1482Generate output compatible with the standard GNU Objective-C runtime
1483
1484.. option:: -fgnu89-inline, -fno-gnu89-inline
1485
1486Use the gnu89 inline semantics
1487
1488.. option:: -fhonor-infinities, -fhonor-infinites, -fno-honor-infinities
1489
1490.. option:: -fhonor-nans, -fno-honor-nans
1491
1492.. option:: -fhosted
1493
1494.. option:: -fimplicit-module-maps, -fmodule-maps, -fno-implicit-module-maps
1495
1496Implicitly search the file system for module map files.
1497
1498.. option:: -fimplicit-modules, -fno-implicit-modules
1499
1500.. option:: -finput-charset=<arg>
1501
1502.. option:: -finstrument-function-entry-bare
1503
1504Instrument function entry only, after inlining, without arguments to the instrumentation call
1505
1506.. option:: -finstrument-functions
1507
1508Generate calls to instrument function entry and exit
1509
1510.. option:: -finstrument-functions-after-inlining
1511
1512Like -finstrument-functions, but insert the calls after inlining
1513
1514.. option:: -fintegrated-as, -fno-integrated-as, -integrated-as
1515
1516Enable the integrated assembler
1517
1518.. option:: -fjump-tables, -fno-jump-tables
1519
1520.. option:: -fkeep-static-consts
1521
1522Keep static const variables even if unused
1523
1524.. option:: -flax-vector-conversions, -fno-lax-vector-conversions
1525
1526.. option:: -flimited-precision=<arg>
1527
1528.. option:: -flto, -fno-lto
1529
1530Enable LTO in 'full' mode
1531
1532.. option:: -flto-jobs=<arg>
1533
1534Controls the backend parallelism of -flto=thin (default of 0 means the number of threads will be derived from the number of CPUs detected)
1535
1536.. program:: clang1
1537.. option:: -flto=<arg>
1538.. program:: clang
1539
1540Set LTO mode to either 'full' or 'thin'
1541
1542.. option:: -fmacro-backtrace-limit=<arg>
1543
1544.. option:: -fmath-errno, -fno-math-errno
1545
1546Require math functions to indicate errors by setting errno
1547
1548.. option:: -fmax-type-align=<arg>
1549
1550Specify the maximum alignment to enforce on pointers lacking an explicit alignment
1551
1552.. option:: -fmerge-all-constants, -fno-merge-all-constants
1553
1554Allow merging of constants
1555
1556.. option:: -fmessage-length=<arg>
1557
1558.. option:: -fmodule-file-deps, -fno-module-file-deps
1559
1560.. option:: -fmodule-map-file=<file>
1561
1562Load this module map file
1563
1564.. option:: -fmodule-name=<name>, -fmodule-implementation-of <arg>, -fmodule-name <arg>
1565
1566Specify the name of the module to build
1567
1568.. option:: -fmodules, -fno-modules
1569
1570Enable the 'modules' language feature
1571
1572.. option:: -fmodules-decluse, -fno-modules-decluse
1573
1574Require declaration of modules used within a module
1575
1576.. option:: -fmodules-ignore-macro=<arg>
1577
1578Ignore the definition of the given macro when building and loading modules
1579
1580.. option:: -fmodules-search-all, -fno-modules-search-all
1581
1582Search even non-imported modules to resolve references
1583
1584.. option:: -fmodules-strict-decluse
1585
1586Like -fmodules-decluse but requires all headers to be in modules
1587
1588.. option:: -fmodules-ts
1589
1590Enable support for the C++ Modules TS
1591
1592.. option:: -fms-compatibility, -fno-ms-compatibility
1593
1594Enable full Microsoft Visual C++ compatibility
1595
1596.. option:: -fms-compatibility-version=<arg>
1597
1598Dot-separated value representing the Microsoft compiler version number to report in \_MSC\_VER (0 = don't define it (default))
1599
1600.. option:: -fms-extensions, -fno-ms-extensions
1601
1602Accept some non-standard constructs supported by the Microsoft compiler
1603
1604.. option:: -fms-memptr-rep=<arg>
1605
1606.. option:: -fms-volatile<arg>
1607
1608.. option:: -fmsc-version=<arg>
1609
1610Microsoft compiler version number to report in \_MSC\_VER (0 = don't define it (default))
1611
1612.. option:: -fmudflap
1613
1614.. option:: -fmudflapth
1615
1616.. option:: -fnested-functions
1617
1618.. option:: -fnew-alignment=<align>, -fnew-alignment <arg>
1619
1620Specifies the largest alignment guaranteed by '::operator new(size\_t)'
1621
1622.. option:: -fnext-runtime
1623
1624.. option:: -fno-builtin-<arg>
1625
1626Disable implicit builtin knowledge of a specific function
1627
1628.. option:: -fno-elide-type
1629
1630Do not elide types when printing diagnostics
1631
1632.. option:: -fno-max-type-align
1633
1634.. option:: -fno-operator-names
1635
1636Do not treat C++ operator name keywords as synonyms for operators
1637
1638.. option:: -fno-rtti-data
1639
1640Control emission of RTTI data
1641
1642.. option:: -fno-strict-modules-decluse
1643
1644.. option:: -fno-working-directory
1645
1646.. option:: -fnoxray-link-deps
1647
1648.. option:: -fobjc-abi-version=<arg>
1649
1650.. option:: -fobjc-arc, -fno-objc-arc
1651
1652Synthesize retain and release calls for Objective-C pointers
1653
1654.. option:: -fobjc-arc-exceptions, -fno-objc-arc-exceptions
1655
1656Use EH-safe code when synthesizing retains and releases in -fobjc-arc
1657
1658.. option:: -fobjc-exceptions, -fno-objc-exceptions
1659
1660Enable Objective-C exceptions
1661
1662.. option:: -fobjc-infer-related-result-type, -fno-objc-infer-related-result-type
1663
1664.. option:: -fobjc-legacy-dispatch, -fno-objc-legacy-dispatch
1665
1666.. option:: -fobjc-link-runtime
1667
1668.. option:: -fobjc-nonfragile-abi, -fno-objc-nonfragile-abi
1669
1670.. option:: -fobjc-nonfragile-abi-version=<arg>
1671
1672.. option:: -fobjc-runtime=<arg>
1673
1674Specify the target Objective-C runtime kind and version
1675
1676.. option:: -fobjc-sender-dependent-dispatch
1677
1678.. option:: -fobjc-weak, -fno-objc-weak
1679
1680Enable ARC-style weak references in Objective-C
1681
1682.. option:: -fomit-frame-pointer, -fno-omit-frame-pointer
1683
1684.. option:: -fopenmp, -fno-openmp
1685
1686Parse OpenMP pragmas and generate parallel code.
1687
1688.. option:: -fopenmp-simd, -fno-openmp-simd
1689
1690Emit OpenMP code only for SIMD-based constructs.
1691
1692.. option:: -fopenmp-version=<arg>
1693
1694.. program:: clang1
1695.. option:: -fopenmp=<arg>
1696.. program:: clang
1697
1698.. option:: -foperator-arrow-depth=<arg>
1699
1700.. option:: -foptimization-record-file=<arg>
1701
1702Specify the file name of any generated YAML optimization record
1703
1704.. option:: -foptimize-sibling-calls, -fno-optimize-sibling-calls
1705
1706.. option:: -foutput-class-dir=<arg>, --output-class-directory <arg>, --output-class-directory=<arg>
1707
1708.. option:: -fpack-struct, -fno-pack-struct
1709
1710.. program:: clang1
1711.. option:: -fpack-struct=<arg>
1712.. program:: clang
1713
1714Specify the default maximum struct packing alignment
1715
1716.. option:: -fpascal-strings, -fno-pascal-strings, -mpascal-strings
1717
1718Recognize and construct Pascal-style string literals
1719
1720.. option:: -fpcc-struct-return
1721
1722Override the default ABI to return all structs on the stack
1723
1724.. option:: -fpch-preprocess
1725
1726.. option:: -fpic, -fno-pic
1727
1728.. option:: -fpie, -fno-pie
1729
1730.. option:: -fplt, -fno-plt
1731
1732Use the PLT to make function calls
1733
1734.. option:: -fplugin=<dsopath>
1735
1736Load the named plugin (dynamic shared object)
1737
1738.. option:: -fpreserve-as-comments, -fno-preserve-as-comments
1739
1740.. option:: -fprofile-arcs, -fno-profile-arcs
1741
1742.. option:: -fprofile-dir=<arg>
1743
1744.. option:: -fprofile-generate, -fno-profile-generate
1745
1746Generate instrumented code to collect execution counts into default.profraw (overridden by LLVM\_PROFILE\_FILE env var)
1747
1748.. program:: clang1
1749.. option:: -fprofile-generate=<directory>
1750.. program:: clang
1751
1752Generate instrumented code to collect execution counts into <directory>/default.profraw (overridden by LLVM\_PROFILE\_FILE env var)
1753
1754.. option:: -fprofile-instr-generate, -fno-profile-instr-generate
1755
1756Generate instrumented code to collect execution counts into default.profraw file (overridden by '=' form of option or LLVM\_PROFILE\_FILE env var)
1757
1758.. program:: clang1
1759.. option:: -fprofile-instr-generate=<file>
1760.. program:: clang
1761
1762Generate instrumented code to collect execution counts into <file> (overridden by LLVM\_PROFILE\_FILE env var)
1763
1764.. option:: -fprofile-instr-use, -fno-profile-instr-use, -fprofile-use
1765
1766.. program:: clang1
1767.. option:: -fprofile-instr-use=<arg>
1768.. program:: clang
1769
1770Use instrumentation data for profile-guided optimization
1771
1772.. option:: -fprofile-sample-accurate, -fauto-profile-accurate, -fno-profile-sample-accurate
1773
1774Specifies that the sample profile is accurate. If the sample
1775               profile is accurate, callsites without profile samples are marked
1776               as cold. Otherwise, treat callsites without profile samples as if
1777               we have no profile
1778
1779.. option:: -fprofile-sample-use, -fauto-profile, -fno-profile-sample-use
1780
1781.. program:: clang1
1782.. option:: -fprofile-sample-use=<arg>, -fauto-profile=<arg>
1783.. program:: clang
1784
1785Enable sample-based profile guided optimizations
1786
1787.. program:: clang1
1788.. option:: -fprofile-use=<pathname>
1789.. program:: clang
1790
1791Use instrumentation data for profile-guided optimization. If pathname is a directory, it reads from <pathname>/default.profdata. Otherwise, it reads from file <pathname>.
1792
1793.. option:: -freciprocal-math, -fno-reciprocal-math
1794
1795Allow division operations to be reassociated
1796
1797.. option:: -freg-struct-return
1798
1799Override the default ABI to return small structs in registers
1800
1801.. option:: -fregister-global-dtors-with-atexit, -fno-register-global-dtors-with-atexit
1802
1803Use atexit or \_\_cxa\_atexit to register global destructors
1804
1805.. option:: -frelaxed-template-template-args, -fno-relaxed-template-template-args
1806
1807Enable C++17 relaxed template template argument matching
1808
1809.. option:: -freroll-loops, -fno-reroll-loops
1810
1811Turn on loop reroller
1812
1813.. option:: -fretain-comments-from-system-headers
1814
1815.. option:: -frewrite-imports, -fno-rewrite-imports
1816
1817.. option:: -frewrite-includes, -fno-rewrite-includes
1818
1819.. option:: -frewrite-map-file <arg>
1820
1821.. program:: clang1
1822.. option:: -frewrite-map-file=<arg>
1823.. program:: clang
1824
1825.. option:: -fropi, -fno-ropi
1826
1827.. option:: -frtti, -fno-rtti
1828
1829.. option:: -frwpi, -fno-rwpi
1830
1831.. option:: -fsave-optimization-record, -fno-save-optimization-record
1832
1833Generate a YAML optimization record file
1834
1835.. option:: -fseh-exceptions
1836
1837Use SEH style exceptions
1838
1839.. option:: -fshort-enums, -fno-short-enums
1840
1841Allocate to an enum type only as many bytes as it needs for the declared range of possible values
1842
1843.. option:: -fshort-wchar, -fno-short-wchar
1844
1845Force wchar\_t to be a short unsigned int
1846
1847.. option:: -fshow-column, -fno-show-column
1848
1849.. option:: -fshow-overloads=<arg>
1850
1851Which overload candidates to show when overload resolution fails: best\|all; defaults to all
1852
1853.. option:: -fshow-source-location, -fno-show-source-location
1854
1855.. option:: -fsignaling-math, -fno-signaling-math
1856
1857.. option:: -fsigned-bitfields
1858
1859.. option:: -fsigned-char, -fno-signed-char, --signed-char
1860
1861.. option:: -fsigned-zeros, -fno-signed-zeros
1862
1863.. option:: -fsized-deallocation, -fno-sized-deallocation
1864
1865Enable C++14 sized global deallocation functions
1866
1867.. option:: -fsjlj-exceptions
1868
1869Use SjLj style exceptions
1870
1871.. option:: -fslp-vectorize, -fno-slp-vectorize, -ftree-slp-vectorize
1872
1873Enable the superword-level parallelism vectorization passes
1874
1875.. option:: -fspell-checking, -fno-spell-checking
1876
1877.. option:: -fspell-checking-limit=<arg>
1878
1879.. option:: -fsplit-dwarf-inlining, -fno-split-dwarf-inlining
1880
1881Provide minimal debug info in the object/executable to facilitate online symbolication/stack traces in the absence of .dwo/.dwp files when using Split DWARF
1882
1883.. option:: -fsplit-stack
1884
1885.. option:: -fstack-protector, -fno-stack-protector
1886
1887Enable stack protectors for functions potentially vulnerable to stack smashing
1888
1889.. option:: -fstack-protector-all
1890
1891Force the usage of stack protectors for all functions
1892
1893.. option:: -fstack-protector-strong
1894
1895Use a strong heuristic to apply stack protectors to functions
1896
1897.. option:: -fstack-size-section, -fno-stack-size-section
1898
1899Emit section containing metadata on function stack sizes
1900
1901.. option:: -fstandalone-debug, -fno-limit-debug-info, -fno-standalone-debug
1902
1903Emit full debug info for all types used by the program
1904
1905.. option:: -fstrict-aliasing, -fno-strict-aliasing
1906
1907.. option:: -fstrict-enums, -fno-strict-enums
1908
1909Enable optimizations based on the strict definition of an enum's value range
1910
1911.. option:: -fstrict-float-cast-overflow, -fno-strict-float-cast-overflow
1912
1913Assume that overflowing float-to-int casts are undefined (default)
1914
1915.. option:: -fstrict-overflow, -fno-strict-overflow
1916
1917.. option:: -fstrict-return, -fno-strict-return
1918
1919Always treat control flow paths that fall off the end of a non-void function as unreachable
1920
1921.. option:: -fstrict-vtable-pointers, -fno-strict-vtable-pointers
1922
1923Enable optimizations based on the strict rules for overwriting polymorphic C++ objects
1924
1925.. option:: -fstruct-path-tbaa, -fno-struct-path-tbaa
1926
1927.. option:: -ftabstop=<arg>
1928
1929.. option:: -ftemplate-backtrace-limit=<arg>
1930
1931.. option:: -ftemplate-depth-<arg>
1932
1933.. option:: -ftemplate-depth=<arg>
1934
1935.. option:: -ftest-coverage
1936
1937.. option:: -fthinlto-index=<arg>
1938
1939Perform ThinLTO importing using provided function summary index
1940
1941.. option:: -fthreadsafe-statics, -fno-threadsafe-statics
1942
1943.. option:: -ftime-report
1944
1945.. option:: -ftime-trace
1946
1947Turn on time profiler
1948
1949.. option:: -ftime-trace-granularity=<arg>
1950
1951Minimum time granularity (in microseconds) traced by time profiler
1952
1953.. option:: -ftls-model=<arg>
1954
1955.. option:: -ftrap-function=<arg>
1956
1957Issue call to specified function rather than a trap instruction
1958
1959.. option:: -ftrapping-math, -fno-trapping-math
1960
1961.. option:: -ftrapv
1962
1963Trap on integer overflow
1964
1965.. option:: -ftrapv-handler <arg>
1966
1967.. program:: clang1
1968.. option:: -ftrapv-handler=<function name>
1969.. program:: clang
1970
1971Specify the function to be called on overflow
1972
1973.. option:: -ftrigraphs, -fno-trigraphs, -trigraphs, --trigraphs
1974
1975Process trigraph sequences
1976
1977.. option:: -funique-section-names, -fno-unique-section-names
1978
1979Use unique names for text and data sections (ELF Only)
1980
1981.. option:: -funit-at-a-time, -fno-unit-at-a-time
1982
1983.. option:: -funroll-loops, -fno-unroll-loops
1984
1985Turn on loop unroller
1986
1987.. option:: -funsafe-math-optimizations, -fno-unsafe-math-optimizations
1988
1989.. option:: -funsigned-bitfields
1990
1991.. option:: -funsigned-char, -fno-unsigned-char, --unsigned-char
1992
1993.. option:: -funwind-tables, -fno-unwind-tables
1994
1995.. option:: -fuse-cxa-atexit, -fno-use-cxa-atexit
1996
1997.. option:: -fuse-init-array, -fno-use-init-array
1998
1999Use .init\_array instead of .ctors
2000
2001.. option:: -fuse-ld=<arg>
2002
2003.. option:: -fuse-line-directives, -fno-use-line-directives
2004
2005.. option:: -fveclib=<arg>
2006
2007Use the given vector functions library
2008
2009.. option:: -fvectorize, -fno-vectorize, -ftree-vectorize
2010
2011Enable the loop vectorization passes
2012
2013.. option:: -fverbose-asm, -fno-verbose-asm, -dA
2014
2015.. option:: -fvisibility-inlines-hidden
2016
2017Give inline C++ member functions hidden visibility by default
2018
2019.. option:: -fvisibility-ms-compat
2020
2021Give global types 'default' visibility and global functions and variables 'hidden' visibility by default
2022
2023.. option:: -fvisibility=<arg>
2024
2025Set the default symbol visibility for all global declarations
2026
2027.. option:: -fwhole-program-vtables, -fno-whole-program-vtables
2028
2029Enables whole-program vtable optimization. Requires -flto
2030
2031.. option:: -fwrapv, -fno-wrapv
2032
2033Treat signed integer overflow as two's complement
2034
2035.. option:: -fwritable-strings
2036
2037Store string literals as writable data
2038
2039.. option:: -fxray-always-emit-customevents, -fno-xray-always-emit-customevents
2040
2041Determine whether to always emit \_\_xray\_customevent(...) calls even if the function it appears in is not always instrumented.
2042
2043.. option:: -fxray-always-emit-typedevents, -fno-xray-always-emit-typedevents
2044
2045Determine whether to always emit \_\_xray\_typedevent(...) calls even if the function it appears in is not always instrumented.
2046
2047.. option:: -fxray-always-instrument=<arg>
2048
2049DEPRECATED: Filename defining the whitelist for imbuing the 'always instrument' XRay attribute.
2050
2051.. option:: -fxray-attr-list=<arg>
2052
2053Filename defining the list of functions/types for imbuing XRay attributes.
2054
2055.. option:: -fxray-instruction-threshold<arg>
2056
2057.. program:: clang1
2058.. option:: -fxray-instruction-threshold=<arg>
2059.. program:: clang
2060
2061Sets the minimum function size to instrument with XRay
2062
2063.. option:: -fxray-instrument, -fno-xray-instrument
2064
2065Generate XRay instrumentation sleds on function entry and exit
2066
2067.. option:: -fxray-instrumentation-bundle=<arg>
2068
2069Select which XRay instrumentation points to emit. Options: all, none, function, custom. Default is 'all'.
2070
2071.. option:: -fxray-link-deps
2072
2073Tells clang to add the link dependencies for XRay.
2074
2075.. option:: -fxray-modes=<arg>
2076
2077List of modes to link in by default into XRay instrumented binaries.
2078
2079.. option:: -fxray-never-instrument=<arg>
2080
2081DEPRECATED: Filename defining the whitelist for imbuing the 'never instrument' XRay attribute.
2082
2083.. option:: -fzero-initialized-in-bss, -fno-zero-initialized-in-bss
2084
2085.. option:: -fzvector, -fno-zvector, -mzvector
2086
2087Enable System z vector language extension
2088
2089.. option:: -pedantic, --pedantic, -no-pedantic, --no-pedantic
2090
2091.. option:: -pedantic-errors, --pedantic-errors
2092
2093OpenCL flags
2094------------
2095.. option:: -cl-denorms-are-zero
2096
2097OpenCL only. Allow denormals to be flushed to zero.
2098
2099.. option:: -cl-fast-relaxed-math
2100
2101OpenCL only. Sets -cl-finite-math-only and -cl-unsafe-math-optimizations, and defines \_\_FAST\_RELAXED\_MATH\_\_.
2102
2103.. option:: -cl-finite-math-only
2104
2105OpenCL only. Allow floating-point optimizations that assume arguments and results are not NaNs or +-Inf.
2106
2107.. option:: -cl-fp32-correctly-rounded-divide-sqrt
2108
2109OpenCL only. Specify that single precision floating-point divide and sqrt used in the program source are correctly rounded.
2110
2111.. option:: -cl-kernel-arg-info
2112
2113OpenCL only. Generate kernel argument metadata.
2114
2115.. option:: -cl-mad-enable
2116
2117OpenCL only. Allow use of less precise MAD computations in the generated binary.
2118
2119.. option:: -cl-no-signed-zeros
2120
2121OpenCL only. Allow use of less precise no signed zeros computations in the generated binary.
2122
2123.. option:: -cl-opt-disable
2124
2125OpenCL only. This option disables all optimizations. By default optimizations are enabled.
2126
2127.. option:: -cl-single-precision-constant
2128
2129OpenCL only. Treat double precision floating-point constant as single precision constant.
2130
2131.. option:: -cl-std=<arg>
2132
2133OpenCL language standard to compile for.
2134
2135.. option:: -cl-strict-aliasing
2136
2137OpenCL only. This option is added for compatibility with OpenCL 1.0.
2138
2139.. option:: -cl-uniform-work-group-size
2140
2141OpenCL only. Defines that the global work-size be a multiple of the work-group size specified to clEnqueueNDRangeKernel
2142
2143.. option:: -cl-unsafe-math-optimizations
2144
2145OpenCL only. Allow unsafe floating-point optimizations.  Also implies -cl-no-signed-zeros and -cl-mad-enable.
2146
2147Target-dependent compilation options
2148~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2149.. option:: -G<size>, -G=<arg>, -msmall-data-threshold=<arg>
2150
2151Put objects of at most <size> bytes into small data section (MIPS / Hexagon)
2152
2153.. option:: -m16
2154
2155.. option:: -m32
2156
2157.. option:: -m64
2158
2159.. option:: -mabi=<arg>
2160
2161.. option:: -malign-double
2162
2163Align doubles to two words in structs (x86 only)
2164
2165.. option:: -march=<arg>
2166
2167.. option:: -masm=<arg>
2168
2169.. option:: -mbackchain, -mno-backchain
2170
2171Link stack frames through backchain on System Z
2172
2173.. option:: -mcmodel=<arg>
2174
2175.. option:: -mconsole<arg>
2176
2177.. option:: -mcpu=<arg>, -mv5 (equivalent to -mcpu=hexagonv5), -mv55 (equivalent to -mcpu=hexagonv55), -mv60 (equivalent to -mcpu=hexagonv60), -mv62 (equivalent to -mcpu=hexagonv62), -mv65 (equivalent to -mcpu=hexagonv65)
2178
2179Use -mcpu=? to see a list of supported cpu models.
2180
2181.. option:: -mcrc, -mno-crc
2182
2183Allow use of CRC instructions (ARM/Mips only)
2184
2185.. option:: -mdefault-build-attributes<arg>, -mno-default-build-attributes<arg>
2186
2187.. option:: -mdll<arg>
2188
2189.. option:: -mdynamic-no-pic<arg>
2190
2191.. option:: -meabi <arg>
2192
2193Set EABI type, e.g. 4, 5 or gnu (default depends on triple)
2194
2195.. option:: -mfentry
2196
2197Insert calls to fentry at function entry (x86 only)
2198
2199.. option:: -mfloat-abi=<arg>
2200
2201.. option:: -mfpmath=<arg>
2202
2203.. option:: -mfpu=<arg>
2204
2205.. option:: -mglobal-merge, -mno-global-merge
2206
2207Enable merging of globals
2208
2209.. option:: -mhard-float
2210
2211.. option:: -mhwdiv=<arg>, --mhwdiv <arg>, --mhwdiv=<arg>
2212
2213.. option:: -miamcu, -mno-iamcu
2214
2215Use Intel MCU ABI
2216
2217.. option:: -mimplicit-float, -mno-implicit-float
2218
2219.. option:: -mimplicit-it=<arg>
2220
2221.. option:: -mincremental-linker-compatible, -mno-incremental-linker-compatible
2222
2223(integrated-as) Emit an object file which can be used with an incremental linker
2224
2225.. option:: -miphoneos-version-min=<arg>, -mios-version-min=<arg>
2226
2227.. option:: -mkernel
2228
2229.. option:: -mlong-calls, -mno-long-calls
2230
2231Generate branches with extended addressability, usually via indirect jumps.
2232
2233.. option:: -mmacosx-version-min=<arg>, -mmacos-version-min=<arg>
2234
2235Set macOS deployment target
2236
2237.. option:: -mmcu=<arg>
2238
2239.. option:: -mms-bitfields, -mno-ms-bitfields
2240
2241Set the default structure layout to be compatible with the Microsoft compiler standard
2242
2243.. option:: -momit-leaf-frame-pointer, -mno-omit-leaf-frame-pointer
2244
2245Omit frame pointer setup for leaf functions
2246
2247.. option:: -moslib=<arg>
2248
2249.. option:: -mpie-copy-relocations, -mno-pie-copy-relocations
2250
2251Use copy relocations support for PIE builds
2252
2253.. option:: -mprefer-vector-width=<arg>
2254
2255Specifies preferred vector width for auto-vectorization. Defaults to 'none' which allows target specific decisions.
2256
2257.. option:: -mqdsp6-compat
2258
2259Enable hexagon-qdsp6 backward compatibility
2260
2261.. option:: -mrecip
2262
2263.. program:: clang1
2264.. option:: -mrecip=<arg1>,<arg2>...
2265.. program:: clang
2266
2267.. option:: -mred-zone, -mno-red-zone
2268
2269.. option:: -mregparm=<arg>
2270
2271.. option:: -mrelax-all, -mno-relax-all
2272
2273(integrated-as) Relax all machine instructions
2274
2275.. option:: -mretpoline, -mno-retpoline
2276
2277.. option:: -mrtd, -mno-rtd
2278
2279Make StdCall calling convention the default
2280
2281.. option:: -msign-return-address=<arg>
2282
2283Select return address signing scope
2284
2285.. option:: -msoft-float, -mno-soft-float
2286
2287Use software floating point
2288
2289.. option:: -mstack-alignment=<arg>
2290
2291Set the stack alignment
2292
2293.. option:: -mstack-arg-probe, -mno-stack-arg-probe
2294
2295Enable stack probes
2296
2297.. option:: -mstack-probe-size=<arg>
2298
2299Set the stack probe size
2300
2301.. option:: -mstackrealign, -mno-stackrealign
2302
2303Force realign the stack at entry to every function
2304
2305.. option:: -mthread-model <arg>
2306
2307The thread model to use, e.g. posix, single (posix by default)
2308
2309.. option:: -mthreads<arg>
2310
2311.. option:: -mthumb, -mno-thumb
2312
2313.. option:: -mtune=<arg>
2314
2315Use -mtune=? to see a list of supported cpu models.
2316
2317.. option:: -mtvos-version-min=<arg>, -mappletvos-version-min=<arg>
2318
2319.. option:: -municode<arg>
2320
2321.. option:: -mvx, -mno-vx
2322
2323.. option:: -mwarn-nonportable-cfstrings, -mno-warn-nonportable-cfstrings
2324
2325.. option:: -mwatchos-version-min=<arg>
2326
2327.. option:: -mwindows<arg>
2328
2329.. option:: -mx32
2330
2331AARCH64
2332-------
2333.. option:: -ffixed-x1
2334
2335Reserve the x1 register (AArch64 only)
2336
2337.. option:: -ffixed-x2
2338
2339Reserve the x2 register (AArch64 only)
2340
2341.. option:: -ffixed-x3
2342
2343Reserve the x3 register (AArch64 only)
2344
2345.. option:: -ffixed-x4
2346
2347Reserve the x4 register (AArch64 only)
2348
2349.. option:: -ffixed-x5
2350
2351Reserve the x5 register (AArch64 only)
2352
2353.. option:: -ffixed-x6
2354
2355Reserve the x6 register (AArch64 only)
2356
2357.. option:: -ffixed-x7
2358
2359Reserve the x7 register (AArch64 only)
2360
2361.. option:: -ffixed-x18
2362
2363Reserve the x18 register (AArch64 only)
2364
2365.. option:: -ffixed-x20
2366
2367Reserve the x20 register (AArch64 only)
2368
2369.. option:: -fcall-saved-x8
2370
2371Make the x8 register call-saved (AArch64 only)
2372
2373.. option:: -fcall-saved-x9
2374
2375Make the x9 register call-saved (AArch64 only)
2376
2377.. option:: -fcall-saved-x10
2378
2379Make the x10 register call-saved (AArch64 only)
2380
2381.. option:: -fcall-saved-x11
2382
2383Make the x11 register call-saved (AArch64 only)
2384
2385.. option:: -fcall-saved-x12
2386
2387Make the x12 register call-saved (AArch64 only)
2388
2389.. option:: -fcall-saved-x13
2390
2391Make the x13 register call-saved (AArch64 only)
2392
2393.. option:: -fcall-saved-x14
2394
2395Make the x14 register call-saved (AArch64 only)
2396
2397.. option:: -fcall-saved-x15
2398
2399Make the x15 register call-saved (AArch64 only)
2400
2401.. option:: -fcall-saved-x18
2402
2403Make the x18 register call-saved (AArch64 only)
2404
2405.. option:: -mfix-cortex-a53-835769, -mno-fix-cortex-a53-835769
2406
2407Workaround Cortex-A53 erratum 835769 (AArch64 only)
2408
2409.. option:: -mgeneral-regs-only
2410
2411Generate code which only uses the general purpose registers (AArch64 only)
2412
2413AMDGPU
2414------
2415.. option:: -mcumode, -mno-cumode
2416
2417CU wavefront execution mode is used if enabled and WGP wavefront execution mode
2418is used if disabled (AMDGPU only)
2419
2420.. option:: -mwavefrontsize64, -mno-wavefrontsize64
2421
2422Wavefront size 64 is used if enabled and wavefront size 32 if disabled (AMDGPU only)
2423
2424.. option:: -mxnack, -mno-xnack
2425
2426Enable XNACK (AMDGPU only)
2427
2428ARM
2429---
2430.. option:: -ffixed-r9
2431
2432Reserve the r9 register (ARM only)
2433
2434.. option:: -mexecute-only, -mno-execute-only, -mpure-code
2435
2436Disallow generation of data access to code sections (ARM only)
2437
2438.. option:: -mno-movt
2439
2440Disallow use of movt/movw pairs (ARM only)
2441
2442.. option:: -mno-neg-immediates
2443
2444Disallow converting instructions with negative immediates to their negation or inversion.
2445
2446.. option:: -mnocrc
2447
2448Disallow use of CRC instructions (ARM only)
2449
2450.. option:: -mrestrict-it, -mno-restrict-it
2451
2452Disallow generation of deprecated IT blocks for ARMv8. It is on by default for ARMv8 Thumb mode.
2453
2454.. option:: -mtp=<arg>
2455
2456Read thread pointer from coprocessor register (ARM only)
2457
2458.. option:: -munaligned-access, -mno-unaligned-access
2459
2460Allow memory accesses to be unaligned (AArch32/AArch64 only)
2461
2462Hexagon
2463-------
2464.. option:: -mieee-rnd-near
2465
2466.. option:: -mmemops, -mno-memops
2467
2468Enable generation of memop instructions
2469
2470.. option:: -mnvj, -mno-nvj
2471
2472Enable generation of new-value jumps
2473
2474.. option:: -mnvs, -mno-nvs
2475
2476Enable generation of new-value stores
2477
2478.. option:: -mpackets, -mno-packets
2479
2480Enable generation of instruction packets
2481
2482Hexagon
2483-------
2484.. option:: -mhvx, -mno-hvx
2485
2486Enable Hexagon Vector eXtensions
2487
2488.. option:: -mhvx-length=<arg>
2489
2490Set Hexagon Vector Length
2491
2492.. program:: clang1
2493.. option:: -mhvx=<arg>
2494.. program:: clang
2495
2496Enable Hexagon Vector eXtensions
2497
2498MIPS
2499----
2500.. option:: -mabicalls, -mno-abicalls
2501
2502Enable SVR4-style position-independent code (Mips only)
2503
2504.. option:: -mabs=<arg>
2505
2506.. option:: -mcheck-zero-division, -mno-check-zero-division
2507
2508.. option:: -mcompact-branches=<arg>
2509
2510.. option:: -mdouble-float
2511
2512.. option:: -mdsp, -mno-dsp
2513
2514.. option:: -mdspr2, -mno-dspr2
2515
2516.. option:: -membedded-data, -mno-embedded-data
2517
2518Place constants in the .rodata section instead of the .sdata section even if they meet the -G <size> threshold (MIPS)
2519
2520.. option:: -mextern-sdata, -mno-extern-sdata
2521
2522Assume that externally defined data is in the small data if it meets the -G <size> threshold (MIPS)
2523
2524.. option:: -mfp32
2525
2526Use 32-bit floating point registers (MIPS only)
2527
2528.. option:: -mfp64
2529
2530Use 64-bit floating point registers (MIPS only)
2531
2532.. option:: -mginv, -mno-ginv
2533
2534.. option:: -mgpopt, -mno-gpopt
2535
2536Use GP relative accesses for symbols known to be in a small data section (MIPS)
2537
2538.. option:: -mindirect-jump=<arg>
2539
2540Change indirect jump instructions to inhibit speculation
2541
2542.. option:: -mips16
2543
2544.. option:: -mldc1-sdc1, -mno-ldc1-sdc1
2545
2546.. option:: -mlocal-sdata, -mno-local-sdata
2547
2548Extend the -G behaviour to object local data (MIPS)
2549
2550.. option:: -mmadd4, -mno-madd4
2551
2552Enable the generation of 4-operand madd.s, madd.d and related instructions.
2553
2554.. option:: -mmicromips, -mno-micromips
2555
2556.. option:: -mmsa, -mno-msa
2557
2558Enable MSA ASE (MIPS only)
2559
2560.. option:: -mmt, -mno-mt
2561
2562Enable MT ASE (MIPS only)
2563
2564.. option:: -mnan=<arg>
2565
2566.. option:: -mno-mips16
2567
2568.. option:: -msingle-float
2569
2570.. option:: -mvirt, -mno-virt
2571
2572.. option:: -mxgot, -mno-xgot
2573
2574PowerPC
2575-------
2576.. option:: -maltivec, -mno-altivec
2577
2578.. option:: -mcmpb, -mno-cmpb
2579
2580.. option:: -mcrbits, -mno-crbits
2581
2582.. option:: -mcrypto, -mno-crypto
2583
2584.. option:: -mdirect-move, -mno-direct-move
2585
2586.. option:: -mfloat128, -mno-float128
2587
2588.. option:: -mfprnd, -mno-fprnd
2589
2590.. option:: -mhtm, -mno-htm
2591
2592.. option:: -minvariant-function-descriptors, -mno-invariant-function-descriptors
2593
2594.. option:: -misel, -mno-isel
2595
2596.. option:: -mlongcall, -mno-longcall
2597
2598.. option:: -mmfocrf, -mmfcrf, -mno-mfocrf
2599
2600.. option:: -mpopcntd, -mno-popcntd
2601
2602.. option:: -mpower8-vector, -mno-power8-vector
2603
2604.. option:: -mpower9-vector, -mno-power9-vector
2605
2606.. option:: -mqpx, -mno-qpx
2607
2608.. option:: -msecure-plt
2609
2610.. option:: -mvsx, -mno-vsx
2611
2612WebAssembly
2613-----------
2614.. option:: -mexception-handling, -mno-exception-handling
2615
2616.. option:: -mnontrapping-fptoint, -mno-nontrapping-fptoint
2617
2618.. option:: -msign-ext, -mno-sign-ext
2619
2620.. option:: -msimd128, -mno-simd128
2621
2622X86
2623---
2624.. option:: -m3dnow, -mno-3dnow
2625
2626.. option:: -m3dnowa, -mno-3dnowa
2627
2628.. option:: -madx, -mno-adx
2629
2630.. option:: -maes, -mno-aes
2631
2632.. option:: -mavx, -mno-avx
2633
2634.. option:: -mavx2, -mno-avx2
2635
2636.. option:: -mavx512bitalg, -mno-avx512bitalg
2637
2638.. option:: -mavx512bf16, -mno-avx512bf16
2639
2640.. option:: -mavx512bw, -mno-avx512bw
2641
2642.. option:: -mavx512cd, -mno-avx512cd
2643
2644.. option:: -mavx512dq, -mno-avx512dq
2645
2646.. option:: -mavx512er, -mno-avx512er
2647
2648.. option:: -mavx512f, -mno-avx512f
2649
2650.. option:: -mavx512ifma, -mno-avx512ifma
2651
2652.. option:: -mavx512pf, -mno-avx512pf
2653
2654.. option:: -mavx512vbmi, -mno-avx512vbmi
2655
2656.. option:: -mavx512vbmi2, -mno-avx512vbmi2
2657
2658.. option:: -mavx512vl, -mno-avx512vl
2659
2660.. option:: -mavx512vnni, -mno-avx512vnni
2661
2662.. option:: -mavx512vp2intersect, -mno-avx512vp2intersect
2663
2664.. option:: -mavx512vpopcntdq, -mno-avx512vpopcntdq
2665
2666.. option:: -mbmi, -mno-bmi
2667
2668.. option:: -mbmi2, -mno-bmi2
2669
2670.. option:: -mcldemote, -mno-cldemote
2671
2672.. option:: -mclflushopt, -mno-clflushopt
2673
2674.. option:: -mclwb, -mno-clwb
2675
2676.. option:: -mclzero, -mno-clzero
2677
2678.. option:: -mcx16, -mno-cx16
2679
2680.. option:: -menqcmd, -mno-enqcmd
2681
2682.. option:: -mf16c, -mno-f16c
2683
2684.. option:: -mfma, -mno-fma
2685
2686.. option:: -mfma4, -mno-fma4
2687
2688.. option:: -mfsgsbase, -mno-fsgsbase
2689
2690.. option:: -mfxsr, -mno-fxsr
2691
2692.. option:: -mgfni, -mno-gfni
2693
2694.. option:: -minvpcid, -mno-invpcid
2695
2696.. option:: -mlwp, -mno-lwp
2697
2698.. option:: -mlzcnt, -mno-lzcnt
2699
2700.. option:: -mmmx, -mno-mmx
2701
2702.. option:: -mmovbe, -mno-movbe
2703
2704.. option:: -mmovdir64b, -mno-movdir64b
2705
2706.. option:: -mmovdiri, -mno-movdiri
2707
2708.. option:: -mmpx, -mno-mpx
2709
2710.. option:: -mmwaitx, -mno-mwaitx
2711
2712.. option:: -mpclmul, -mno-pclmul
2713
2714.. option:: -mpconfig, -mno-pconfig
2715
2716.. option:: -mpku, -mno-pku
2717
2718.. option:: -mpopcnt, -mno-popcnt
2719
2720.. option:: -mprefetchwt1, -mno-prefetchwt1
2721
2722.. option:: -mprfchw, -mno-prfchw
2723
2724.. option:: -mptwrite, -mno-ptwrite
2725
2726.. option:: -mrdpid, -mno-rdpid
2727
2728.. option:: -mrdrnd, -mno-rdrnd
2729
2730.. option:: -mrdseed, -mno-rdseed
2731
2732.. option:: -mretpoline-external-thunk, -mno-retpoline-external-thunk
2733
2734.. option:: -mrtm, -mno-rtm
2735
2736.. option:: -msahf, -mno-sahf
2737
2738.. option:: -msgx, -mno-sgx
2739
2740.. option:: -msha, -mno-sha
2741
2742.. option:: -mshstk, -mno-shstk
2743
2744.. option:: -msse, -mno-sse
2745
2746.. option:: -msse2, -mno-sse2
2747
2748.. option:: -msse3, -mno-sse3
2749
2750.. option:: -msse4.1, -mno-sse4.1
2751
2752.. program:: clang1
2753.. option:: -msse4.2, -mno-sse4.2, -msse4
2754.. program:: clang
2755
2756.. option:: -msse4a, -mno-sse4a
2757
2758.. option:: -mssse3, -mno-ssse3
2759
2760.. option:: -mtbm, -mno-tbm
2761
2762.. option:: -mvaes, -mno-vaes
2763
2764.. option:: -mvpclmulqdq, -mno-vpclmulqdq
2765
2766.. option:: -mwaitpkg, -mno-waitpkg
2767
2768.. option:: -mwbnoinvd, -mno-wbnoinvd
2769
2770.. option:: -mx87, -m80387, -mno-x87
2771
2772.. option:: -mxop, -mno-xop
2773
2774.. option:: -mxsave, -mno-xsave
2775
2776.. option:: -mxsavec, -mno-xsavec
2777
2778.. option:: -mxsaveopt, -mno-xsaveopt
2779
2780.. option:: -mxsaves, -mno-xsaves
2781
2782RISCV
2783-----
2784.. option:: -mrelax, -mno-relax
2785
2786Enable linker relaxation
2787
2788Optimization level
2789~~~~~~~~~~~~~~~~~~
2790
2791Flags controlling how much optimization should be performed.
2792
2793.. option:: -O<arg>, -O (equivalent to -O2), --optimize, --optimize=<arg>
2794
2795.. option:: -Ofast<arg>
2796
2797Debug information generation
2798~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2799
2800Flags controlling how much and what kind of debug information should be
2801generated.
2802
2803Kind and level of debug information
2804-----------------------------------
2805.. option:: -g, --debug, --debug=<arg>
2806
2807Generate source-level debug information
2808
2809.. option:: -gdwarf-2
2810
2811Generate source-level debug information with dwarf version 2
2812
2813.. option:: -gdwarf-3
2814
2815Generate source-level debug information with dwarf version 3
2816
2817.. option:: -gdwarf-4, -gdwarf
2818
2819Generate source-level debug information with dwarf version 4
2820
2821.. option:: -gdwarf-5
2822
2823Generate source-level debug information with dwarf version 5
2824
2825.. option:: -gfull
2826
2827.. option:: -gused
2828
2829Debug level
2830___________
2831.. option:: -g0
2832
2833.. option:: -g2
2834
2835.. option:: -g3
2836
2837.. option:: -ggdb0
2838
2839.. option:: -ggdb1
2840
2841.. option:: -ggdb2
2842
2843.. option:: -ggdb3
2844
2845.. option:: -gline-tables-only, -g1, -gmlt
2846
2847Emit debug line number tables only
2848
2849.. option:: -gmodules
2850
2851Generate debug info with external references to clang modules or precompiled headers
2852
2853Debugger to tune debug information for
2854______________________________________
2855.. option:: -ggdb
2856
2857.. option:: -glldb
2858
2859.. option:: -gsce
2860
2861Debug information flags
2862-----------------------
2863.. option:: -gcolumn-info, -gno-column-info
2864
2865.. option:: -gdwarf-aranges
2866
2867.. option:: -gembed-source, -gno-embed-source
2868
2869Embed source text in DWARF debug sections
2870
2871.. option:: -ggnu-pubnames, -gno-gnu-pubnames
2872
2873.. option:: -gpubnames, -gno-pubnames
2874
2875.. option:: -grecord-command-line, -grecord-gcc-switches, -gno-record-command-line, -gno-record-gcc-switches
2876
2877.. option:: -gsplit-dwarf
2878
2879.. option:: -gstrict-dwarf, -gno-strict-dwarf
2880
2881.. option:: -gz
2882
2883DWARF debug sections compression type
2884
2885.. program:: clang1
2886.. option:: -gz=<arg>
2887.. program:: clang
2888
2889DWARF debug sections compression type
2890
2891Static analyzer flags
2892=====================
2893
2894Flags controlling the behavior of the Clang Static Analyzer.
2895
2896.. option:: -Xanalyzer <arg>
2897
2898Pass <arg> to the static analyzer
2899
2900Fortran compilation flags
2901=========================
2902
2903Flags that will be passed onto the ``gfortran`` compiler when Clang is given
2904a Fortran input.
2905
2906.. option:: -A<arg>, --assert <arg>, --assert=<arg>
2907
2908.. option:: -A-<arg>
2909
2910.. option:: -J<arg>
2911
2912.. option:: -cpp
2913
2914.. option:: -faggressive-function-elimination, -fno-aggressive-function-elimination
2915
2916.. option:: -falign-commons, -fno-align-commons
2917
2918.. option:: -fall-intrinsics, -fno-all-intrinsics
2919
2920.. option:: -fautomatic, -fno-automatic
2921
2922.. option:: -fbackslash, -fno-backslash
2923
2924.. option:: -fbacktrace, -fno-backtrace
2925
2926.. option:: -fblas-matmul-limit=<arg>
2927
2928.. option:: -fbounds-check, -fno-bounds-check
2929
2930.. option:: -fcheck-array-temporaries, -fno-check-array-temporaries
2931
2932.. option:: -fcheck=<arg>
2933
2934.. option:: -fcoarray=<arg>
2935
2936.. option:: -fconvert=<arg>
2937
2938.. option:: -fcray-pointer, -fno-cray-pointer
2939
2940.. option:: -fd-lines-as-code, -fno-d-lines-as-code
2941
2942.. option:: -fd-lines-as-comments, -fno-d-lines-as-comments
2943
2944.. option:: -fdefault-double-8, -fno-default-double-8
2945
2946.. option:: -fdefault-integer-8, -fno-default-integer-8
2947
2948.. option:: -fdefault-real-8, -fno-default-real-8
2949
2950.. option:: -fdollar-ok, -fno-dollar-ok
2951
2952.. option:: -fdump-fortran-optimized, -fno-dump-fortran-optimized
2953
2954.. option:: -fdump-fortran-original, -fno-dump-fortran-original
2955
2956.. option:: -fdump-parse-tree, -fno-dump-parse-tree
2957
2958.. option:: -fexternal-blas, -fno-external-blas
2959
2960.. option:: -ff2c, -fno-f2c
2961
2962.. option:: -ffixed-form, -fno-fixed-form
2963
2964.. option:: -ffixed-line-length-<arg>
2965
2966.. option:: -ffpe-trap=<arg>
2967
2968.. option:: -ffree-form, -fno-free-form
2969
2970.. option:: -ffree-line-length-<arg>
2971
2972.. option:: -ffrontend-optimize, -fno-frontend-optimize
2973
2974.. option:: -fimplicit-none, -fno-implicit-none
2975
2976.. option:: -finit-character=<arg>
2977
2978.. option:: -finit-integer=<arg>
2979
2980.. option:: -finit-local-zero, -fno-init-local-zero
2981
2982.. option:: -finit-logical=<arg>
2983
2984.. option:: -finit-real=<arg>
2985
2986.. option:: -finteger-4-integer-8, -fno-integer-4-integer-8
2987
2988.. option:: -fintrinsic-modules-path, -fno-intrinsic-modules-path
2989
2990.. option:: -fmax-array-constructor=<arg>
2991
2992.. option:: -fmax-errors=<arg>
2993
2994.. option:: -fmax-identifier-length, -fno-max-identifier-length
2995
2996.. option:: -fmax-stack-var-size=<arg>
2997
2998.. option:: -fmax-subrecord-length=<arg>
2999
3000.. option:: -fmodule-private, -fno-module-private
3001
3002.. option:: -fpack-derived, -fno-pack-derived
3003
3004.. option:: -fprotect-parens, -fno-protect-parens
3005
3006.. option:: -frange-check, -fno-range-check
3007
3008.. option:: -freal-4-real-10, -fno-real-4-real-10
3009
3010.. option:: -freal-4-real-16, -fno-real-4-real-16
3011
3012.. option:: -freal-4-real-8, -fno-real-4-real-8
3013
3014.. option:: -freal-8-real-10, -fno-real-8-real-10
3015
3016.. option:: -freal-8-real-16, -fno-real-8-real-16
3017
3018.. option:: -freal-8-real-4, -fno-real-8-real-4
3019
3020.. option:: -frealloc-lhs, -fno-realloc-lhs
3021
3022.. option:: -frecord-marker=<arg>
3023
3024.. option:: -frecursive, -fno-recursive
3025
3026.. option:: -frepack-arrays, -fno-repack-arrays
3027
3028.. option:: -fsecond-underscore, -fno-second-underscore
3029
3030.. option:: -fsign-zero, -fno-sign-zero
3031
3032.. option:: -fstack-arrays, -fno-stack-arrays
3033
3034.. option:: -funderscoring, -fno-underscoring
3035
3036.. option:: -fwhole-file, -fno-whole-file
3037
3038.. option:: -imultilib <arg>
3039
3040.. option:: -nocpp
3041
3042.. option:: -static-libgfortran
3043
3044Linker flags
3045============
3046Flags that are passed on to the linker
3047
3048.. option:: -L<dir>, --library-directory <arg>, --library-directory=<arg>
3049
3050Add directory to library search path
3051
3052.. option:: -Mach
3053
3054.. option:: -T<script>
3055
3056Specify <script> as linker script
3057
3058.. option:: -Tbss<addr>
3059
3060Set starting address of BSS to <addr>
3061
3062.. option:: -Tdata<addr>
3063
3064Set starting address of DATA to <addr>
3065
3066.. option:: -Ttext<addr>
3067
3068Set starting address of TEXT to <addr>
3069
3070.. option:: -Wl,<arg>,<arg2>...
3071
3072Pass the comma separated arguments in <arg> to the linker
3073
3074.. option:: -X
3075
3076.. option:: -Xlinker <arg>, --for-linker <arg>, --for-linker=<arg>
3077
3078Pass <arg> to the linker
3079
3080.. program:: clang1
3081.. option:: -Z
3082.. program:: clang
3083
3084.. option:: -e<arg>, --entry
3085
3086.. option:: -filelist <arg>
3087
3088.. option:: --hip-device-lib-path=<arg>
3089
3090HIP device library path
3091
3092.. option:: --hip-device-lib=<arg>
3093
3094HIP device library
3095
3096.. option:: -l<arg>
3097
3098.. option:: -r
3099
3100.. option:: -rpath <arg>
3101
3102.. option:: -s
3103
3104.. option:: -t
3105
3106.. option:: -u<arg>, --force-link <arg>, --force-link=<arg>
3107
3108.. option:: -undef
3109
3110undef all system defines
3111
3112.. option:: -undefined<arg>, --no-undefined
3113
3114.. option:: -z <arg>
3115
3116Pass -z <arg> to the linker
3117
3118