The latest kali clang

description:

  clang-Clang C, C++ and Objective-C compilers.
  Clang is a C, C++ and Objective-C compiler, which includes preprocessing, analysis, optimization, code generation, assembly and linking. According to the advanced mode settings passed, Clang will stop before completing the complete link. Although Clang is highly integrated, it is important to understand the stages of compilation and how to call it. These stages are:
  Drive: The
    clang executable is actually a small driver that controls the overall execution of other tools (such as compilers, assemblers, and linkers). Normally you don't need to interact with the driver, but you can use it transparently to run other tools.
  Preprocessing:
    This stage deals with the tokenization of input source files, macro expansion, #include expansion and other preprocessing instructions. The output of this stage is usually called ".i" (for C), ".ii" (for C++), ".mi" (for Objective-C) or ".mii" (for Objective-C++) file.
  Parsing and semantic analysis:
    This stage parses the input file and converts the preprocessor token into a parse tree. Once the syntax analysis tree is adopted, it will apply semantic analysis to calculate the type of expression and determine whether the code is in the correct format. This stage is responsible for generating most compiler warnings and parsing errors. The output of this stage is the "Abstract Syntax Tree" (AST).
  Code generation and optimization:
    This stage converts the AST into low-level intermediate code (called "LLVM IR"), and finally into machine code. This stage is responsible for optimizing the generated code and handling target-specific code generation. The output of this stage is usually called ".s" file or "assembly" file.
    Clang also supports the use of an integrated assembler, in which the code generator directly generates object files. This avoids the overhead of generating ".s" files and calling the target assembler.
  Assembler:
    This stage runs the target assembler to convert the output of the compiler into a target object file. The output of this stage is usually called an ".o" file or an "object" file.
  Linker:
    This stage runs the target linker to merge multiple target files into executable files or dynamic libraries. The output of this stage is usually called "a.out", ".dylib" or ".so" file.     Clang
  static analyzer:
Clang static analyzer is a tool that scans source code to try to find errors through code analysis. This tool uses many parts of Clang and is built into the same driver. For more details on how to use the static analyzer, see https://clang-analyzer.llvm.org .

Options:

  Stage selection options:

	-E
		运行预处理器阶段。

	-fsyntax-only
		运行预处理器、解析器和类型检查阶段。

	-S
		运行前面的阶段以及LLVM生成和优化阶段以及特定于目标的代码生成,从而生成一个程序集文件。

	-c
		运行上述所有程序,再加上汇编程序,生成一个目标”.o”对象文件。

  No stage selection option:
    If no stage selection option is specified, run all the above stages and run the linker to merge the results into an executable library or a shared library.

  Language selection and mode options:

	-x <language>
		将后续的输入文件视为具有类型语言。

	-std=<standard>
		指定要编译的语言标准。
			C语言支持的值有:c89, c90,iso9899:1990…

	-stdlib=<library>
		指定要使用的c++标准库;支持的选项是libstdc++和libc++。如果未指定,将使用平台默认值。

	-rtlib=<library>
		指定要使用的编译器运行时库;支持的选项是libgcc和compiler-rt。如果未指定,将使用平台默认值。

	-ansi
		与-std = c89相同。

	-ObjC,-ObjC++
		将源输入文件分别视为Objective-C和object - c++输入。

	-trigraghs
		启用trigraghs

	-ffreestanding
		指示该文件应针对独立环境而非托管环境进行编译。

	-fno-builtin
		禁用strlen()和malloc()等内置函数的特殊处理和优化。

	-fmath-errno
		指出应该将数学函数视为更新errno。

	-fpascal-strings
		使用" \pfoo "启用pascal风格的字符串支持。

	-fms-extensions
		启用对Microsoft扩展的支持。
	
	-fmsc-version=
		设置_MSC_VER。 在Windows上默认为1300。 否则不设置。

	-fborland-extensions
		启用对Borland扩展的支持。

	-fwritable-strings
		将所有字符串文字默认设置为可写。 这将禁用字符串唯一化和其他优化。

	-flax-vector-conversions
		允许使用松散的类型检查规则进行隐式矢量转换。

	-fblocks
		启用“阻止”语言功能。

	-fobjc-abi-version=version
		选择要使用的Objective-C ABI版本。 可用版本为1(旧式“脆弱” ABI),2(非脆弱ABI 1)和3(非脆弱ABI 2)。

	-fobjc-nonfragile-abi-version=<version>
		选择默认使用的Objective-C非脆弱ABI版本。只有当非脆弱ABI被启用时,这个才会被用作Objective-C ABI(通过-fobjc-nonfragile-abi,或者因为它是平台默认值)。			
	-fobjc-nonfragile-abi,-fno-obj-nonfragile-abi
		启用Objective-C非脆弱ABI。在默认ABI的平台上,可以用-fno-objc-nonfragile-abi禁用它。

  Target selection options:
    Clang fully supports cross-compilation as an inherent part of its design. Depending on how your version of Clang is configured, it may support many cross-compilers, or only support native targets.

	-target <architecture>
		指定要为其构建的体系结构。

	--print-supported-cpus
		打印出给定目标支持的处理器列表(通过-target =<architecture>或-arch <architecture>指定)。如果没有指定目标,将使用系统默认目标。

	-mcpu=?,-mtune=?
		–print-supported-cpus的别名

	-march=<cpu>
		指定Clang应该为特定处理器家族成员和更高版本生成代码。 例如,如果指定-march = i486,则允许编译器生成在i486和更高版本的处理器上有效的指令,但在较早版本的处理器上可能不存在。

  Code generation options:
    -O0, -O1, -O2, -O3, -Ofast, -Os, -Oz, -Og, -O, -O4
    specify which optimization level to use:

		-O0
			意味着“无优化”:这个级别编译速度最快,生成的调试代码最多。

		-O1
			在-O0和-O2之间。

		-O2
			中等水平的优化,支持大多数优化。

		-O3
			与-O2相似,不同之处在于它可以使优化执行的时间更长或可能生成更大的代码(以使程序运行更快)。

		-Ofast
			启用-O3中的所有优化以及可能违反严格遵守语言标准的其他激进优化。

		-Os
			比如-O2,通过额外的优化来减少代码大小。

		-Oz
			比如-Os(也就是-O2),但是进一步减少了代码大小。

		-Og
			像-O1。 在将来的版本中,此选项可能会禁用不同的优化,以提高可调试性。
			
		-O 
			相当于- O2。

		-O4 and higher
			目前相当于-O3

	    -g,-gilne-tables-only,-gmodules
		控制调试信息输出。注意,Clang调试信息在-O0下工作得最好。当指定多个以-g开头的选项时,最后一个将生效:
		
		-g
			生成调试信息
		
		-gline-tables-only
			只生成行表调试信息。这允许使用内联信息进行符号化回溯,但不包括关于变量、变量位置或类型的任何信息。

		-gmodules
			生成包含对Clang模块或预编译头中定义的类型的外部引用的调试信息,而不是将冗余的调试类型信息发送到每个目标文件中。 此选项透明地将Clang模块格式切换为将Clang模块与调试信息一起保存的目标文件容器。 当编译使用Clang模块或预编译头文件的程序时,此选项将生成具有更快的编译时间和更小的目标文件的完整调试信息。在构建静态库以分发给其他计算机时,不应使用此选项,因为调试信息将包含引用 将库中的目标文件建立在机器上的模块高速缓存中。

	-fstandalone-debug -fno-standalone-debug
		Clang支持许多优化以减少二进制文件中调试信息的大小。 它们的工作原理是,调试类型信息可以分布在多个编译单元上。 例如,Clang不会为模块不需要的类型发出类型定义,而可以用前置声明代替。 此外,Clang将仅在包含该类的vtable的模块中为动态C ++类发出类型信息。
		-fstandalone-debug选项关闭这些优化。 当使用不带调试信息的第三方库时,这很有用。 这是Darwin的默认设置。请注意,对于程序完全未引用的类型,Clang永远不会发出类型信息。

	-fexceptions
		启用展开信息的生成。 这允许通过Clang编译堆栈帧引发异常。 在x86-64中默认情况下处于启用状态。

	-ftrapv
		生成代码以捕获整数溢出错误。 C中未定义有符号整数溢出。使用此标志,将生成额外的代码来检测此情况并在发生时中止。

	-fvisibility
		此标志设置默认可见性级别。

	-fcommon,-fno-common
		此标志指定没有初始化式的变量具有公共链接。它可以用-fno-common禁用。

	-ftls-model=<model>
		设置用于线程局部变量的默认线程局部存储(TLS)模型。有效值为:" global-dynamic ", " local-dynamic ", " initial-exec "和" local-exec "。默认是“global-dynamic”。可以使用tls_model属性重写默认模型。如果可能的话,编译器将尝试选择一个更有效的模型。
		
		-flto,-flto=full,-flto=thin,-emit-llvm
			生成LLVM格式的输出文件,适用于链接时间优化。 与-S一起使用时,将生成LLVM中间语言汇编文件,否则将生成LLVM位代码格式的目标文件(取决于阶段选择选项,可以将其传递给链接器)。
			-flto的默认值为“ full”,其中LLVM位代码适用于整体式链接时间优化(LTO),其中链接程序将所有此类模块合并为单个组合模块以进行优化。 如果使用“ thin”,则会调用ThinLTO编译。

  Driver options:

-###
	打印(但不要运行)要为此编译运行的命令。

--help
	显示可用的选项。

--Qunused-arguments
	不要为未使用的驱动程序参数发出任何警告。

-Wa,<args>
	将args中以逗号分隔的参数传递给汇编程序。

-Wl,<args>
	将args中以逗号分隔的参数传递给链接器。

-Wp,<args>
	将args中逗号分隔的参数传递给预处理器。

-Xanalyzer <arg>
	将arg传递给静态分析器。

-Xassembler <arg>
	将arg传递给汇编程序。

-Xlinker <arg>
	将参数传递给链接器。

-Xpreprocessor <arg>
	将参数传递给预处理器。

-o <file>
	将输出写入文件

-print-file-name=<file>
	打印文件的完整库路径。

-print-libgcc-file-name
	打印当前使用的编译器运行时库的库路径(“ libgcc.a”或“ libclang_rt.builtins.*.a”)。

-print-prog-name=<name>
	打印名称的完整程序路径。

-print-search-dirs
	打印用于查找库和程序的路径。

-save-temps
	保存中间编译结果。

-save-stats,-save-stats=cwd,-save-stats=obj
	将内部代码生成(LLVM)统计数据保存到当前目录(-save-stats/ " -save-stats=cwd ")或输出文件目录(" -save-state=obj ")中的一个文件中。


-integrated-as,-no-integrated-as
	分别用于启用和禁用集成汇编程序的使用。默认情况下,集成汇编程序是否打开取决于目标。

-time
	为单个命令计时。

-ftime-report
	打印每个编译阶段的时序摘要

-v
	显示运行和使用详细输出的命令。

  Diagnosis options:
    -fshow-column,-fshow-source-location,-fcaret-diagnostics,-fdiagnostics-fixit-info,-fdiagnostics-parseable-fixits,-fdiagnostics-print-source-range-info,-fprint-source- range-info, -fdiagnostics-show-option, -fmessage-length
    These options control how Clang prints diagnostic information (errors and warnings). For more information, please refer to the Clang User Manual.

  Preprocessing options:

		-D<macroname>=<value>
			将一个隐式#define添加到预定义缓冲区中,该缓冲区在对源文件进行预处理之前会被读取。

		-U<macroname>
			将一个隐式#undef添加到预定义缓冲区中,该缓冲区在对源文件进行预处理之前会被读取。

		-include <filename>
			将一个隐式#include添加到预定义缓冲区中,该缓冲区在对源文件进行预处理之前已被读取。

		-I<directory>
			将指定目录添加到包含文件的搜索路径。

			-F<directory>
				将指定的目录添加到框架包含文件的搜索路径中。

			-nostdinc
				不要在标准系统目录或编译器内置目录中搜索包含文件。

			-nostdlibinc
				不要在标准系统目录中搜索包含文件,而要搜索编译器内置的包含目录。

			-nobuiltininc
				不要在clang的内置目录中搜索包含文件。	

Note: For more information about kali, please follow the official account (bilu), or visit the personally built kali site, Bilu ( https://www.bilu.asia )

kali site pen road
At the same time, you can also directly visit https://mobile.yangkeduo.com/goods.html?goods_id=209567782598 to get kali related information one step in advance.

Insert picture description here

Next, a kali-related document will be released every day, so stay tuned.

Guess you like

Origin blog.csdn.net/qq_40399982/article/details/112328869