Hexagon LLVM编译架构介绍(3)

240 篇文章 11 订阅

Hexagon LLVM编译架构介绍(3)

3.3 输入输出文件

LLVM 编译器预处理并将一个或多个 C 源文件编译为汇编源文件。 然后编译器调用 Hexagon 汇编器,它将汇编器源文件转换为目标文件。 编译器最终调用链接器,它将目标文件组合成一个可执行文件。

表 3-1 列出了输入文件类型和处理每种类型文件的工具。 编译器使用文件扩展名来确定如何处理文件。

在这里插入图片描述
注意:
所有文件扩展名都是区分大小写的文字字符串。 带有无法识别扩展名的输入文件被视为目标文件。
有关程序集和目标文件的更多信息,请参见 Hexagon Utilities 用户指南。

表 3-2 列出了输出文件类型和用于生成每种文件类型的工具。 编译器选项(第 3.4 节)用于指定输出文件类型。

在这里插入图片描述
注意:
如果未明确指定输出文件名(使用 -o 选项),编译器将使用表 3-2 中列出的默认文件名。

3.4 编译器选项

LLVM 编译器由命令行选项控制(第 3.2 节)。 支持许多 GCC 选项,以及特定于 LLVM 的选项。

注意:
许多 -f 、 -m 和 -W 选项可以用两种方式编写:-fsetting 启用二进制设置,或 -fno-setting 禁用设置。

展示
见第 3.4.1 节

-help
-v

汇编
见第 3.4.2 节

-###
-c -E -S -pipe
-o file
-Wp,arg[,arg...]
-Wa,arg[,arg...]
-Wl,arg[,arg...]
-x language

C dialect
见第 3.4.3 节

-ansi -fno-asm -fno-builtin
-ffreestanding -fgnu-runtime -fgnu89-inline
-fsigned-bitfields -fsigned-char -funsigned-char
-no-integrated-cpp -std=standard
-traditional -traditional-cpp -trigraphs
-Wpointer-sign

C++ dialect
见第 3.4.4 节

-cxx-isystem dir
-fno-access-control -fno-elide-constructors
-ffor-scope -fno-for-scope -fno-gnu-keywords
-fms-extensions -fno-operator-names -fno-rtti
-ftemplate-depth-n -fno-threadsafe-statics
-fvisibility-inlines-hidden
-fuse-cxa-atexit -nobuiltininc -nostdinc++
-Wc++0x-compat -Wno-deprecated
-Wnon-virtual-dtor -Woverloaded-virtual
-Wreorder

警告和错误消息
见第 3.4.5 节

-ferror-limit=n -ftemplate-backtrace-limit=n
-ferror-warn filename -fsyntax-only -pedantic
-pedantic-errors -Q-unused-arguments
-w -Wfoo -Wno-foo -Wall -Warray-bounds
-Wcast-align -Wchar-subscripts
-Wcomment -Wconversion
-Wdeclaration-after-statement -Wno-deprecated-declarations
-Wempty-body -Wendif-labels -Werror
-Werror=foo -Wno-error=foo
-Werror-implicit-function-declaration
-Weverything -Wextra -Wfloat-equal
-Wformat -Wformat=2 -Wno-format-extra-args
-Wformat-nonliteral -Wformat-security -Wignored-qualifiers
-Wimplicit -Wimplicit-function-declaration -Wimplicit-int
-Wno-invalid-offsetof -Wlong-long -Wmain
-Wmissing-braces -Wmissing-declarations
-Wmissing-noreturn -Wmissing-prototypes -Wno-multichar
-Wnonnull -Wpacked -Wpadded -Wparentheses -Wpointer-arith
-Wreturn-type -Wshadow -Wsign-compare
-Wswitch -Wswitch-enum -Wsystem-headers
-Wtrigraphs -Wundef -Wuninitialized -Wunknown-pragmas
-Wunreachable-code -Wunused -Wunused-function -Wunused-label
-Wunused-parameter -Wunused-value -Wunused-variable
-Wwrite-strings

调试
见第 3.4.6 节

-dumpmachine -dumpversion
-feliminate-unused-debug-symbols
-ftime-report -g[level] -print-file-name=library
-print-libgcc-file-name -print-multi-directory
-print-multi-lib -print-multi-os-directory
-print-prog-name=program -print-search-dirs
-save-temps -time

诊断格式
见第 3.4.7 节

-fcaret-diagnostics -fno-caret-diagnostics
-fcolor-diagnostics -fno-color-diagnostics
-fdiagnostics-format=(clang|msvc|vi)
-fdiagnostics-show-name -fno-diagnostics-show-name
-fdiagnostics-show-option -fno-diagnostics-show-option
-fdiagnostics-show-category=(none|id|name)
-fdiagnostics-fixit-info -fno-diagnostics-fixit-info
-fdiagnostics-print-source-range-info
-fno-diagnostics-print-source-range-info
-fdiagnostics-parseable-fixits
-fdiagnostics-show-note-include-stack
-fdiagnostics-show-template-tree
-fno-elide-type -fmessage-length=n
-fshow-column -fno-show-column
-fshow-source-location -fno-show-source-location

个别警告组
见第 3.4.8 节

-Wextra-tokens -Wambiguous-member-template
-Wbind-to-temporary-copy

编译器崩溃诊断
见第 3.4.9 节

-fno-crash-diagnostics

预处理器
见第 3.4.10 节

-A pred=ans -A -pred=ans -ansi -C -CC
-d(DMN) -D name -D name=definition
-fdollars-in-identifiers -fexec-charset=charset
-finput-charset=charset -fpch-deps -fpreprocessed
-fno-show-column -fstrict-overflow
-ftabstop=width -fwide-exec-charset=charset
-fworking-directory --help -H -I dir -I-
-idirafter dir -imacros file -include file
-iprefix prefix -isystem dir -iwithprefix dir
-iwithprefixbefore dir -M -MD -MF file
-MG -MM -MMD -MP -MQ target -MT target
-nostdinc -nostdinc++ -o file -P
-remap -std=standard --target-help -traditional-cpp
-trigraphs -U name -undef -v -version
--version -w -Wall -Wcomment
-Wcomments -Wendif-labels -Werror -Wimport
-Wsystem-headers
-Wtrigraphs -Wundef -Wunused-macros
-Xpreprocessor option

集会
见第 3.4.11 节

-Xassembler 选项

链接
见第 3.4.12 节

object_file_name -c -dynamic -E
-l library -mG0lib -moslib=library
-nodefaultlibs -nostartfiles -nostdlib
-pie -s -S -shared -shared-libgcc
-static -static-libgcc
-symbolic -u symbol -Xlinker option

目录搜索
见第 3.4.13 节

-Bprefix
-F dir -I dir
-I-
-Ldir

处理器版本
见第 3.4.14 节

-march=archname -mcpu=archname
-mv4 -mv5 -mv55

代码生成
见第 3.4.15 节

-fasynchronous-unwind-tables
-fno-common -femit-all-data -femit-all-decls
-fno-exceptions
-finstrument-functions
-fmerge-functions
-fpack-struct=n
-fpic -fPIC -fpie -fPIE
-fshort-enums -fno-short-enums
-fshort-wchar -fshort-wchar
-ftrap-function=value -ftrapv -ftrapv-handler
-funwind-tables -fverbose-asm -fwrapv
-fvisibility=[default|internal|hidden|protected]
-G size
-mno-global-merge
-mlong-calls
-pthread

矢量化
见第 3.4.16 节

-fvectorize-loops -fvectorize-loops-debug

优化
见第 3.4.17 节

-O
-O0
-O1
-O2
-O3
-Os
```**
具体优化**
见第 3.4.18 节

```bash
-falign-functions[=n] -falign-jumps[=n]
-falign-labels[=n] -falign-loops[=n]
-fdata-sections -ffunction-sections
-finline -finline-functions
-fnomerge-all-constants -fomit-frame-pointer
-foptimize-sibling-calls -fstack-protector
-fstack-protector-all -fstrict-aliasing
-funit-at-a-time -funroll-all-loops
-funroll-loops -fno-zero-initialized-in-bss

数学优化
见第 3.4.19 节

-fassociative-math -ffast-math -ffinite-math-only
-fmath-errno -fno-math-errno -freciprocal-math
-fno-signed-zeros -fno-trapping-math
-funsafe-math-optimizations

链接时间优化
见第 3.4.20 节

-S-lto -c-lto -Wlto arg,...
-flto-scope=(program|library)
-lto-no-inter-mod-inline -lto-w-no-unknown-sym
-lto-preserve symbol -lto-preserve-list filename

安全编程
见第 3.4.21 节

-analyze -compile-and-analyze dir
-analyzer-output type
-analyzer-checker=checker
-analyzer-disable-checker=checker
-analyzer-checker-help
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值