diff options
Diffstat (limited to 'usr.bin/clang')
112 files changed, 13732 insertions, 0 deletions
diff --git a/usr.bin/clang/Makefile b/usr.bin/clang/Makefile new file mode 100644 index 000000000000..45939bca7a16 --- /dev/null +++ b/usr.bin/clang/Makefile @@ -0,0 +1,72 @@ +# $FreeBSD$ + +.include <src.opts.mk> + +.if ${MK_CLANG} != "no" +SUBDIR+= clang +.endif + +.if !defined(TOOLS_PREFIX) +# LLVM binutils are needed to support features such as LTO, so we build them +# by default if clang is enabled. If MK_LLVM_BINUTILS is set, we also use them +# as the default binutils (ar,nm,addr2line, etc.). +.if ${MK_CLANG} != "no" || ${MK_LLVM_BINUTILS} != "no" +SUBDIR+= llvm-ar +SUBDIR+= llvm-nm +SUBDIR+= llvm-objcopy +SUBDIR+= llvm-objdump +SUBDIR+= llvm-readobj +SUBDIR+= llvm-size +SUBDIR+= llvm-strings +SUBDIR+= llvm-symbolizer +.endif + +.if ${MK_LLVM_BINUTILS} != "no" || ${MK_LLVM_CXXFILT} != "no" +SUBDIR+= llvm-cxxfilt +.endif + +.if ${MK_CLANG_EXTRAS} != "no" +SUBDIR+= bugpoint +SUBDIR+= llc +SUBDIR+= lli +SUBDIR+= llvm-as +SUBDIR+= llvm-bcanalyzer +SUBDIR+= llvm-cxxdump +SUBDIR+= llvm-diff +SUBDIR+= llvm-dis +SUBDIR+= llvm-dwarfdump +SUBDIR+= llvm-dwarfutil +SUBDIR+= llvm-dwp +SUBDIR+= llvm-extract +SUBDIR+= llvm-link +SUBDIR+= llvm-lto +SUBDIR+= llvm-lto2 +SUBDIR+= llvm-mc +SUBDIR+= llvm-mca +SUBDIR+= llvm-modextract +SUBDIR+= llvm-pdbutil +SUBDIR+= llvm-rtdyld +SUBDIR+= llvm-xray +SUBDIR+= opt +.endif + +.if ${MK_CLANG_EXTRAS} != "no" || ${MK_CLANG_FORMAT} != "no" +SUBDIR+= clang-format +.endif + +.if ${MK_LLD} != "no" +SUBDIR+= lld +.endif +.if ${MK_LLDB} != "no" +SUBDIR+= lldb +SUBDIR+= lldb-server +.endif +.if ${MK_LLVM_COV} != "no" +SUBDIR+= llvm-cov +SUBDIR+= llvm-profdata +.endif +.endif # TOOLS_PREFIX + +SUBDIR_PARALLEL= + +.include <bsd.subdir.mk> diff --git a/usr.bin/clang/Makefile.inc b/usr.bin/clang/Makefile.inc new file mode 100644 index 000000000000..ba32f0c1032d --- /dev/null +++ b/usr.bin/clang/Makefile.inc @@ -0,0 +1,15 @@ +# $FreeBSD$ + +WARNS?= 0 + +.include <bsd.compiler.mk> + +MK_PIE:= no # Explicit libXXX.a references + +.if ${COMPILER_TYPE} == "clang" +DEBUG_FILES_CFLAGS= -gline-tables-only +.else +DEBUG_FILES_CFLAGS= -g1 +.endif + +.include "../Makefile.inc" diff --git a/usr.bin/clang/bugpoint/Makefile b/usr.bin/clang/bugpoint/Makefile new file mode 100644 index 000000000000..2ca34d2579e3 --- /dev/null +++ b/usr.bin/clang/bugpoint/Makefile @@ -0,0 +1,19 @@ +# $FreeBSD$ + +PROG_CXX= bugpoint + +SRCDIR= llvm/tools/bugpoint +SRCS+= BugDriver.cpp +SRCS+= CrashDebugger.cpp +SRCS+= ExecutionDriver.cpp +SRCS+= ExtractFunction.cpp +SRCS+= FindBugs.cpp +SRCS+= Miscompilation.cpp +SRCS+= OptimizerDriver.cpp +SRCS+= ToolRunner.cpp +SRCS+= bugpoint.cpp + +LIBADD+= z +LIBADD+= zstd + +.include "../llvm.prog.mk" diff --git a/usr.bin/clang/bugpoint/Makefile.depend b/usr.bin/clang/bugpoint/Makefile.depend new file mode 100644 index 000000000000..1423340957b6 --- /dev/null +++ b/usr.bin/clang/bugpoint/Makefile.depend @@ -0,0 +1,24 @@ +# $FreeBSD$ +# Autogenerated - do NOT edit! + +DIRDEPS = \ + gnu/lib/csu \ + include \ + include/xlocale \ + lib/${CSU_DIR} \ + lib/clang/libllvm \ + lib/libc \ + lib/libc++ \ + lib/libcompiler_rt \ + lib/libcxxrt \ + lib/libthr \ + lib/libz \ + lib/msun \ + lib/ncurses/ncursesw \ + + +.include <dirdeps.mk> + +.if ${DEP_RELDIR} == ${_DEP_RELDIR} +# local dependencies - needed for -jN in clean tree +.endif diff --git a/usr.bin/clang/bugpoint/bugpoint.1 b/usr.bin/clang/bugpoint/bugpoint.1 new file mode 100644 index 000000000000..97b227ea82d1 --- /dev/null +++ b/usr.bin/clang/bugpoint/bugpoint.1 @@ -0,0 +1,309 @@ +.\" $FreeBSD$ +.\" Man page generated from reStructuredText. +. +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.TH "BUGPOINT" "1" "2021-06-07" "12" "LLVM" +.SH NAME +bugpoint \- automatic test case reduction tool +.SH SYNOPSIS +.sp +\fBbugpoint\fP [\fIoptions\fP] [\fIinput LLVM ll/bc files\fP] [\fILLVM passes\fP] \fB\-\-args\fP +\fIprogram arguments\fP +.SH DESCRIPTION +.sp +\fBbugpoint\fP narrows down the source of problems in LLVM tools and passes. It +can be used to debug three types of failures: optimizer crashes, miscompilations +by optimizers, or bad native code generation (including problems in the static +and JIT compilers). It aims to reduce large test cases to small, useful ones. +For more information on the design and inner workings of \fBbugpoint\fP, as well as +advice for using bugpoint, see /Bugpoint in the LLVM +distribution. +.SH OPTIONS +.sp +\fB\-\-additional\-so\fP \fIlibrary\fP +.INDENT 0.0 +.INDENT 3.5 +Load the dynamic shared object \fIlibrary\fP into the test program whenever it is +run. This is useful if you are debugging programs which depend on non\-LLVM +libraries (such as the X or curses libraries) to run. +.UNINDENT +.UNINDENT +.sp +\fB\-\-append\-exit\-code\fP=\fI{true,false}\fP +.INDENT 0.0 +.INDENT 3.5 +Append the test programs exit code to the output file so that a change in exit +code is considered a test failure. Defaults to false. +.UNINDENT +.UNINDENT +.sp +\fB\-\-args\fP \fIprogram args\fP +.INDENT 0.0 +.INDENT 3.5 +Pass all arguments specified after \fB\-\-args\fP to the test program whenever it runs. +Note that if any of the \fIprogram args\fP start with a "\fB\-\fP", you should use: +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +bugpoint [bugpoint args] \-\-args \-\- [program args] +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +The "\fB\-\-\fP" right after the \fB\-\-args\fP option tells \fBbugpoint\fP to consider +any options starting with "\fB\-\fP" to be part of the \fB\-\-args\fP option, not as +options to \fBbugpoint\fP itself. +.UNINDENT +.UNINDENT +.sp +\fB\-\-tool\-args\fP \fItool args\fP +.INDENT 0.0 +.INDENT 3.5 +Pass all arguments specified after \fB\-\-tool\-args\fP to the LLVM tool under test +(\fBllc\fP, \fBlli\fP, etc.) whenever it runs. You should use this option in the +following way: +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +bugpoint [bugpoint args] \-\-tool\-args \-\- [tool args] +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +The "\fB\-\-\fP" right after the \fB\-\-tool\-args\fP option tells \fBbugpoint\fP to +consider any options starting with "\fB\-\fP" to be part of the \fB\-\-tool\-args\fP +option, not as options to \fBbugpoint\fP itself. (See \fB\-\-args\fP, above.) +.UNINDENT +.UNINDENT +.sp +\fB\-\-safe\-tool\-args\fP \fItool args\fP +.INDENT 0.0 +.INDENT 3.5 +Pass all arguments specified after \fB\-\-safe\-tool\-args\fP to the "safe" execution +tool. +.UNINDENT +.UNINDENT +.sp +\fB\-\-gcc\-tool\-args\fP \fIgcc tool args\fP +.INDENT 0.0 +.INDENT 3.5 +Pass all arguments specified after \fB\-\-gcc\-tool\-args\fP to the invocation of +\fBgcc\fP\&. +.UNINDENT +.UNINDENT +.sp +\fB\-\-opt\-args\fP \fIopt args\fP +.INDENT 0.0 +.INDENT 3.5 +Pass all arguments specified after \fB\-\-opt\-args\fP to the invocation of \fBopt\fP\&. +.UNINDENT +.UNINDENT +.sp +\fB\-\-disable\-{dce,simplifycfg}\fP +.INDENT 0.0 +.INDENT 3.5 +Do not run the specified passes to clean up and reduce the size of the test +program. By default, \fBbugpoint\fP uses these passes internally when attempting to +reduce test programs. If you\(aqre trying to find a bug in one of these passes, +\fBbugpoint\fP may crash. +.UNINDENT +.UNINDENT +.sp +\fB\-\-enable\-valgrind\fP +.INDENT 0.0 +.INDENT 3.5 +Use valgrind to find faults in the optimization phase. This will allow +bugpoint to find otherwise asymptomatic problems caused by memory +mis\-management. +.UNINDENT +.UNINDENT +.sp +\fB\-find\-bugs\fP +.INDENT 0.0 +.INDENT 3.5 +Continually randomize the specified passes and run them on the test program +until a bug is found or the user kills \fBbugpoint\fP\&. +.UNINDENT +.UNINDENT +.sp +\fB\-help\fP +.INDENT 0.0 +.INDENT 3.5 +Print a summary of command line options. +.UNINDENT +.UNINDENT +.sp +\fB\-\-input\fP \fIfilename\fP +.INDENT 0.0 +.INDENT 3.5 +Open \fIfilename\fP and redirect the standard input of the test program, whenever +it runs, to come from that file. +.UNINDENT +.UNINDENT +.sp +\fB\-\-load\fP \fIplugin\fP +.INDENT 0.0 +.INDENT 3.5 +Load the dynamic object \fIplugin\fP into \fBbugpoint\fP itself. This object should +register new optimization passes. Once loaded, the object will add new command +line options to enable various optimizations. To see the new complete list of +optimizations, use the \fB\-help\fP and \fB\-\-load\fP options together; for example: +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +bugpoint \-\-load myNewPass.so \-help +.ft P +.fi +.UNINDENT +.UNINDENT +.UNINDENT +.UNINDENT +.sp +\fB\-\-mlimit\fP \fImegabytes\fP +.INDENT 0.0 +.INDENT 3.5 +Specifies an upper limit on memory usage of the optimization and codegen. Set +to zero to disable the limit. +.UNINDENT +.UNINDENT +.sp +\fB\-\-output\fP \fIfilename\fP +.INDENT 0.0 +.INDENT 3.5 +Whenever the test program produces output on its standard output stream, it +should match the contents of \fIfilename\fP (the "reference output"). If you +do not use this option, \fBbugpoint\fP will attempt to generate a reference output +by compiling the program with the "safe" backend and running it. +.UNINDENT +.UNINDENT +.sp +\fB\-\-run\-{int,jit,llc,custom}\fP +.INDENT 0.0 +.INDENT 3.5 +Whenever the test program is compiled, \fBbugpoint\fP should generate code for it +using the specified code generator. These options allow you to choose the +interpreter, the JIT compiler, the static native code compiler, or a +custom command (see \fB\-\-exec\-command\fP) respectively. +.UNINDENT +.UNINDENT +.sp +\fB\-\-safe\-{llc,custom}\fP +.INDENT 0.0 +.INDENT 3.5 +When debugging a code generator, \fBbugpoint\fP should use the specified code +generator as the "safe" code generator. This is a known\-good code generator +used to generate the "reference output" if it has not been provided, and to +compile portions of the program that as they are excluded from the testcase. +These options allow you to choose the +static native code compiler, or a custom command, (see \fB\-\-exec\-command\fP) +respectively. The interpreter and the JIT backends cannot currently +be used as the "safe" backends. +.UNINDENT +.UNINDENT +.sp +\fB\-\-exec\-command\fP \fIcommand\fP +.INDENT 0.0 +.INDENT 3.5 +This option defines the command to use with the \fB\-\-run\-custom\fP and +\fB\-\-safe\-custom\fP options to execute the bitcode testcase. This can +be useful for cross\-compilation. +.UNINDENT +.UNINDENT +.sp +\fB\-\-compile\-command\fP \fIcommand\fP +.INDENT 0.0 +.INDENT 3.5 +This option defines the command to use with the \fB\-\-compile\-custom\fP +option to compile the bitcode testcase. The command should exit with a +failure exit code if the file is "interesting" and should exit with a +success exit code (i.e. 0) otherwise (this is the same as if it crashed on +"interesting" inputs). +.sp +This can be useful for +testing compiler output without running any link or execute stages. To +generate a reduced unit test, you may add CHECK directives to the +testcase and pass the name of an executable compile\-command script in this form: +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +#!/bin/sh +llc "$@" +not FileCheck [bugpoint input file].ll < bugpoint\-test\-program.s +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +This script will "fail" as long as FileCheck passes. So the result +will be the minimum bitcode that passes FileCheck. +.UNINDENT +.UNINDENT +.sp +\fB\-\-safe\-path\fP \fIpath\fP +.INDENT 0.0 +.INDENT 3.5 +This option defines the path to the command to execute with the +\fB\-\-safe\-{int,jit,llc,custom}\fP +option. +.UNINDENT +.UNINDENT +.sp +\fB\-\-verbose\-errors\fP=\fI{true,false}\fP +.INDENT 0.0 +.INDENT 3.5 +The default behavior of bugpoint is to print "<crash>" when it finds a reduced +test that crashes compilation. This flag prints the output of the crashing +program to stderr. This is useful to make sure it is the same error being +tracked down and not a different error that happens to crash the compiler as +well. Defaults to false. +.UNINDENT +.UNINDENT +.SH EXIT STATUS +.sp +If \fBbugpoint\fP succeeds in finding a problem, it will exit with 0. Otherwise, +if an error occurs, it will exit with a non\-zero value. +.SH SEE ALSO +.sp +\fBopt(1)\fP +.SH AUTHOR +Maintained by the LLVM Team (https://llvm.org/). +.SH COPYRIGHT +2003-2021, LLVM Project +.\" Generated by docutils manpage writer. +. diff --git a/usr.bin/clang/clang-format/Makefile b/usr.bin/clang/clang-format/Makefile new file mode 100644 index 000000000000..3ace97fd8482 --- /dev/null +++ b/usr.bin/clang/clang-format/Makefile @@ -0,0 +1,9 @@ +# $FreeBSD$ + +PROG_CXX= clang-format +MAN= + +SRCDIR= clang/tools/clang-format +SRCS+= ClangFormat.cpp + +.include "../clang.prog.mk" diff --git a/usr.bin/clang/clang-format/Makefile.depend b/usr.bin/clang/clang-format/Makefile.depend new file mode 100644 index 000000000000..6cbdf44b0812 --- /dev/null +++ b/usr.bin/clang/clang-format/Makefile.depend @@ -0,0 +1,24 @@ +# $FreeBSD$ +# Autogenerated - do NOT edit! + +DIRDEPS = \ + gnu/lib/csu \ + include \ + include/xlocale \ + lib/${CSU_DIR} \ + lib/clang/libclang \ + lib/clang/libllvm \ + lib/libc \ + lib/libc++ \ + lib/libcompiler_rt \ + lib/libcxxrt \ + lib/libthr \ + lib/msun \ + lib/ncurses/ncursesw \ + + +.include <dirdeps.mk> + +.if ${DEP_RELDIR} == ${_DEP_RELDIR} +# local dependencies - needed for -jN in clean tree +.endif diff --git a/usr.bin/clang/clang-tblgen/Makefile b/usr.bin/clang/clang-tblgen/Makefile new file mode 100644 index 000000000000..5b3532873c19 --- /dev/null +++ b/usr.bin/clang/clang-tblgen/Makefile @@ -0,0 +1,32 @@ +# $FreeBSD$ + +PROG_CXX= clang-tblgen +MAN= + +SRCDIR= clang/utils/TableGen +SRCS+= ASTTableGen.cpp +SRCS+= ClangASTNodesEmitter.cpp +SRCS+= ClangASTPropertiesEmitter.cpp +SRCS+= ClangAttrEmitter.cpp +SRCS+= ClangCommentCommandInfoEmitter.cpp +SRCS+= ClangCommentHTMLNamedCharacterReferenceEmitter.cpp +SRCS+= ClangCommentHTMLTagsEmitter.cpp +SRCS+= ClangDataCollectorsEmitter.cpp +SRCS+= ClangDiagnosticsEmitter.cpp +SRCS+= ClangOpcodesEmitter.cpp +SRCS+= ClangOpenCLBuiltinEmitter.cpp +SRCS+= ClangOptionDocEmitter.cpp +SRCS+= ClangSACheckersEmitter.cpp +SRCS+= ClangSyntaxEmitter.cpp +SRCS+= ClangTypeNodesEmitter.cpp +SRCS+= MveEmitter.cpp +SRCS+= NeonEmitter.cpp +SRCS+= RISCVVEmitter.cpp +SRCS+= SveEmitter.cpp +SRCS+= TableGen.cpp + +.include "${SRCTOP}/lib/clang/clang.pre.mk" + +CFLAGS.RISCVVEmitter.cpp+= -I${CLANG_SRCS}/include + +.include "../clang.prog.mk" diff --git a/usr.bin/clang/clang-tblgen/Makefile.depend b/usr.bin/clang/clang-tblgen/Makefile.depend new file mode 100644 index 000000000000..5459b436be4c --- /dev/null +++ b/usr.bin/clang/clang-tblgen/Makefile.depend @@ -0,0 +1,23 @@ +# $FreeBSD$ +# Autogenerated - do NOT edit! + +DIRDEPS = \ + gnu/lib/csu \ + include \ + include/xlocale \ + lib/${CSU_DIR} \ + lib/clang/libllvm \ + lib/libc \ + lib/libc++ \ + lib/libcompiler_rt \ + lib/libcxxrt \ + lib/libthr \ + lib/msun \ + lib/ncurses/ncursesw \ + + +.include <dirdeps.mk> + +.if ${DEP_RELDIR} == ${_DEP_RELDIR} +# local dependencies - needed for -jN in clean tree +.endif diff --git a/usr.bin/clang/clang-tblgen/Makefile.depend.host b/usr.bin/clang/clang-tblgen/Makefile.depend.host new file mode 100644 index 000000000000..fc72483f0f06 --- /dev/null +++ b/usr.bin/clang/clang-tblgen/Makefile.depend.host @@ -0,0 +1,12 @@ +# $FreeBSD$ +# Autogenerated - do NOT edit! + +DIRDEPS = \ + lib/clang/libllvmminimal \ + + +.include <dirdeps.mk> + +.if ${DEP_RELDIR} == ${_DEP_RELDIR} +# local dependencies - needed for -jN in clean tree +.endif diff --git a/usr.bin/clang/clang.prog.mk b/usr.bin/clang/clang.prog.mk new file mode 100644 index 000000000000..79229be332a8 --- /dev/null +++ b/usr.bin/clang/clang.prog.mk @@ -0,0 +1,33 @@ +# $FreeBSD$ + +.include "${SRCTOP}/lib/clang/clang.pre.mk" + +CFLAGS+= -I${OBJTOP}/lib/clang/libclang +CFLAGS+= -I${OBJTOP}/lib/clang/libllvm + +.include "${SRCTOP}/lib/clang/clang.build.mk" + +# Special case for the bootstrap-tools phase. +.if (defined(TOOLS_PREFIX) || ${MACHINE} == "host") && \ + ${PROG_CXX} == "clang-tblgen" +LIBDEPS+= clangminimal +LIBDEPS+= llvmminimal +.else +LIBDEPS+= clang +LIBDEPS+= llvm +.endif + +.for lib in ${LIBDEPS} +DPADD+= ${OBJTOP}/lib/clang/lib${lib}/lib${lib}.a +LDADD+= ${OBJTOP}/lib/clang/lib${lib}/lib${lib}.a +.endfor + +PACKAGE= clang + +.if ${.MAKE.OS} == "FreeBSD" || !defined(BOOTSTRAPPING) +LIBADD+= execinfo +LIBADD+= ncursesw +.endif +LIBADD+= pthread + +.include <bsd.prog.mk> diff --git a/usr.bin/clang/clang/CC.sh b/usr.bin/clang/clang/CC.sh new file mode 100755 index 000000000000..45faeec0ec45 --- /dev/null +++ b/usr.bin/clang/clang/CC.sh @@ -0,0 +1,4 @@ +#!/bin/sh +# $FreeBSD$ +# This file is in the public domain. +exec /usr/bin/c++ "$@" diff --git a/usr.bin/clang/clang/Makefile b/usr.bin/clang/clang/Makefile new file mode 100644 index 000000000000..1e946276c76b --- /dev/null +++ b/usr.bin/clang/clang/Makefile @@ -0,0 +1,42 @@ +# $FreeBSD$ + +.include <src.opts.mk> + +PROG_CXX= clang + +SRCDIR= clang/tools/driver +SRCS+= cc1_main.cpp +SRCS+= cc1as_main.cpp +SRCS+= cc1gen_reproducer_main.cpp +SRCS+= driver.cpp + +CFLAGS.driver.cpp+= -Dclang_main=main + +.if ${MK_SHARED_TOOLCHAIN} == "no" +NO_SHARED?= yes + +.endif + +LINKS= ${BINDIR}/clang ${BINDIR}/clang++ \ + ${BINDIR}/clang ${BINDIR}/clang-cpp +MLINKS= clang.1 clang++.1 \ + clang.1 clang-cpp.1 + +SCRIPTS=CC.sh +SCRIPTSNAME=CC + +LINKS+= ${BINDIR}/clang ${BINDIR}/cc \ + ${BINDIR}/clang ${BINDIR}/c++ \ + ${BINDIR}/clang ${BINDIR}/cpp +MLINKS+= clang.1 cc.1 \ + clang.1 c++.1 \ + clang.1 CC.1 \ + clang.1 cpp.1 + +LIBADD+= z +LIBADD+= zstd + +# Ensure we don't add CFLAGS.clang when using GCC +NO_TARGET_FLAGS= + +.include "../clang.prog.mk" diff --git a/usr.bin/clang/clang/Makefile.depend b/usr.bin/clang/clang/Makefile.depend new file mode 100644 index 000000000000..50ee86e9addb --- /dev/null +++ b/usr.bin/clang/clang/Makefile.depend @@ -0,0 +1,24 @@ +# $FreeBSD$ +# Autogenerated - do NOT edit! + +DIRDEPS = \ + gnu/lib/csu \ + include \ + include/xlocale \ + lib/${CSU_DIR} \ + lib/clang/libclang \ + lib/clang/libllvm \ + lib/libc \ + lib/libc++ \ + lib/libcompiler_rt \ + lib/libthr \ + lib/libz \ + lib/msun \ + lib/ncurses/ncursesw \ + + +.include <dirdeps.mk> + +.if ${DEP_RELDIR} == ${_DEP_RELDIR} +# local dependencies - needed for -jN in clean tree +.endif diff --git a/usr.bin/clang/clang/clang.1 b/usr.bin/clang/clang/clang.1 new file mode 100644 index 000000000000..10e78ebe16df --- /dev/null +++ b/usr.bin/clang/clang/clang.1 @@ -0,0 +1,909 @@ +.\" $FreeBSD$ +.\" Man page generated from reStructuredText. +. +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.TH "CLANG" "1" "2021-06-07" "12" "Clang" +.SH NAME +clang \- the Clang C, C++, and Objective-C compiler +.SH SYNOPSIS +.sp +\fBclang\fP [\fIoptions\fP] \fIfilename ...\fP +.SH DESCRIPTION +.sp +\fBclang\fP is a C, C++, and Objective\-C compiler which encompasses +preprocessing, parsing, optimization, code generation, assembly, and linking. +Depending on which high\-level mode setting is passed, Clang will stop before +doing a full link. While Clang is highly integrated, it is important to +understand the stages of compilation, to understand how to invoke it. These +stages are: +.INDENT 0.0 +.TP +.B Driver +The clang executable is actually a small driver which controls the overall +execution of other tools such as the compiler, assembler and linker. +Typically you do not need to interact with the driver, but you +transparently use it to run the other tools. +.TP +.B Preprocessing +This stage handles tokenization of the input source file, macro expansion, +#include expansion and handling of other preprocessor directives. The +output of this stage is typically called a ".i" (for C), ".ii" (for C++), +".mi" (for Objective\-C), or ".mii" (for Objective\-C++) file. +.TP +.B Parsing and Semantic Analysis +This stage parses the input file, translating preprocessor tokens into a +parse tree. Once in the form of a parse tree, it applies semantic +analysis to compute types for expressions as well and determine whether +the code is well formed. This stage is responsible for generating most of +the compiler warnings as well as parse errors. The output of this stage is +an "Abstract Syntax Tree" (AST). +.TP +.B Code Generation and Optimization +This stage translates an AST into low\-level intermediate code (known as +"LLVM IR") and ultimately to machine code. This phase is responsible for +optimizing the generated code and handling target\-specific code generation. +The output of this stage is typically called a ".s" file or "assembly" file. +.sp +Clang also supports the use of an integrated assembler, in which the code +generator produces object files directly. This avoids the overhead of +generating the ".s" file and of calling the target assembler. +.TP +.B Assembler +This stage runs the target assembler to translate the output of the +compiler into a target object file. The output of this stage is typically +called a ".o" file or "object" file. +.TP +.B Linker +This stage runs the target linker to merge multiple object files into an +executable or dynamic library. The output of this stage is typically called +an "a.out", ".dylib" or ".so" file. +.UNINDENT +.sp +\fBClang Static Analyzer\fP +.sp +The Clang Static Analyzer is a tool that scans source code to try to find bugs +through code analysis. This tool uses many parts of Clang and is built into +the same driver. Please see <\fI\%https://clang\-analyzer.llvm.org\fP> for more details +on how to use the static analyzer. +.SH OPTIONS +.SS Stage Selection Options +.INDENT 0.0 +.TP +.B \-E +Run the preprocessor stage. +.UNINDENT +.INDENT 0.0 +.TP +.B \-fsyntax\-only +Run the preprocessor, parser and type checking stages. +.UNINDENT +.INDENT 0.0 +.TP +.B \-S +Run the previous stages as well as LLVM generation and optimization stages +and target\-specific code generation, producing an assembly file. +.UNINDENT +.INDENT 0.0 +.TP +.B \-c +Run all of the above, plus the assembler, generating a target ".o" object file. +.UNINDENT +.INDENT 0.0 +.TP +.B no stage selection option +If no stage selection option is specified, all stages above are run, and the +linker is run to combine the results into an executable or shared library. +.UNINDENT +.SS Language Selection and Mode Options +.INDENT 0.0 +.TP +.B \-x <language> +Treat subsequent input files as having type language. +.UNINDENT +.INDENT 0.0 +.TP +.B \-std=<standard> +Specify the language standard to compile for. +.sp +Supported values for the C language are: +.INDENT 7.0 +.INDENT 3.5 +.nf +\fBc89\fP +\fBc90\fP +\fBiso9899:1990\fP +.fi +.sp +.INDENT 0.0 +.INDENT 3.5 +ISO C 1990 +.UNINDENT +.UNINDENT +.nf +\fBiso9899:199409\fP +.fi +.sp +.INDENT 0.0 +.INDENT 3.5 +ISO C 1990 with amendment 1 +.UNINDENT +.UNINDENT +.nf +\fBgnu89\fP +\fBgnu90\fP +.fi +.sp +.INDENT 0.0 +.INDENT 3.5 +ISO C 1990 with GNU extensions +.UNINDENT +.UNINDENT +.nf +\fBc99\fP +\fBiso9899:1999\fP +.fi +.sp +.INDENT 0.0 +.INDENT 3.5 +ISO C 1999 +.UNINDENT +.UNINDENT +.nf +\fBgnu99\fP +.fi +.sp +.INDENT 0.0 +.INDENT 3.5 +ISO C 1999 with GNU extensions +.UNINDENT +.UNINDENT +.nf +\fBc11\fP +\fBiso9899:2011\fP +.fi +.sp +.INDENT 0.0 +.INDENT 3.5 +ISO C 2011 +.UNINDENT +.UNINDENT +.nf +\fBgnu11\fP +.fi +.sp +.INDENT 0.0 +.INDENT 3.5 +ISO C 2011 with GNU extensions +.UNINDENT +.UNINDENT +.nf +\fBc17\fP +\fBiso9899:2017\fP +.fi +.sp +.INDENT 0.0 +.INDENT 3.5 +ISO C 2017 +.UNINDENT +.UNINDENT +.nf +\fBgnu17\fP +.fi +.sp +.INDENT 0.0 +.INDENT 3.5 +ISO C 2017 with GNU extensions +.UNINDENT +.UNINDENT +.UNINDENT +.UNINDENT +.sp +The default C language standard is \fBgnu17\fP, except on PS4, where it is +\fBgnu99\fP\&. +.sp +Supported values for the C++ language are: +.INDENT 7.0 +.INDENT 3.5 +.nf +\fBc++98\fP +\fBc++03\fP +.fi +.sp +.INDENT 0.0 +.INDENT 3.5 +ISO C++ 1998 with amendments +.UNINDENT +.UNINDENT +.nf +\fBgnu++98\fP +\fBgnu++03\fP +.fi +.sp +.INDENT 0.0 +.INDENT 3.5 +ISO C++ 1998 with amendments and GNU extensions +.UNINDENT +.UNINDENT +.nf +\fBc++11\fP +.fi +.sp +.INDENT 0.0 +.INDENT 3.5 +ISO C++ 2011 with amendments +.UNINDENT +.UNINDENT +.nf +\fBgnu++11\fP +.fi +.sp +.INDENT 0.0 +.INDENT 3.5 +ISO C++ 2011 with amendments and GNU extensions +.UNINDENT +.UNINDENT +.nf +\fBc++14\fP +.fi +.sp +.INDENT 0.0 +.INDENT 3.5 +ISO C++ 2014 with amendments +.UNINDENT +.UNINDENT +.nf +\fBgnu++14\fP +.fi +.sp +.INDENT 0.0 +.INDENT 3.5 +ISO C++ 2014 with amendments and GNU extensions +.UNINDENT +.UNINDENT +.nf +\fBc++17\fP +.fi +.sp +.INDENT 0.0 +.INDENT 3.5 +ISO C++ 2017 with amendments +.UNINDENT +.UNINDENT +.nf +\fBgnu++17\fP +.fi +.sp +.INDENT 0.0 +.INDENT 3.5 +ISO C++ 2017 with amendments and GNU extensions +.UNINDENT +.UNINDENT +.nf +\fBc++2a\fP +.fi +.sp +.INDENT 0.0 +.INDENT 3.5 +Working draft for ISO C++ 2020 +.UNINDENT +.UNINDENT +.nf +\fBgnu++2a\fP +.fi +.sp +.INDENT 0.0 +.INDENT 3.5 +Working draft for ISO C++ 2020 with GNU extensions +.UNINDENT +.UNINDENT +.UNINDENT +.UNINDENT +.sp +The default C++ language standard is \fBgnu++14\fP\&. +.sp +Supported values for the OpenCL language are: +.INDENT 7.0 +.INDENT 3.5 +.nf +\fBcl1.0\fP +.fi +.sp +.INDENT 0.0 +.INDENT 3.5 +OpenCL 1.0 +.UNINDENT +.UNINDENT +.nf +\fBcl1.1\fP +.fi +.sp +.INDENT 0.0 +.INDENT 3.5 +OpenCL 1.1 +.UNINDENT +.UNINDENT +.nf +\fBcl1.2\fP +.fi +.sp +.INDENT 0.0 +.INDENT 3.5 +OpenCL 1.2 +.UNINDENT +.UNINDENT +.nf +\fBcl2.0\fP +.fi +.sp +.INDENT 0.0 +.INDENT 3.5 +OpenCL 2.0 +.UNINDENT +.UNINDENT +.UNINDENT +.UNINDENT +.sp +The default OpenCL language standard is \fBcl1.0\fP\&. +.sp +Supported values for the CUDA language are: +.INDENT 7.0 +.INDENT 3.5 +.nf +\fBcuda\fP +.fi +.sp +.INDENT 0.0 +.INDENT 3.5 +NVIDIA CUDA(tm) +.UNINDENT +.UNINDENT +.UNINDENT +.UNINDENT +.UNINDENT +.INDENT 0.0 +.TP +.B \-stdlib=<library> +Specify the C++ standard library to use; supported options are libstdc++ and +libc++. If not specified, platform default will be used. +.UNINDENT +.INDENT 0.0 +.TP +.B \-rtlib=<library> +Specify the compiler runtime library to use; supported options are libgcc and +compiler\-rt. If not specified, platform default will be used. +.UNINDENT +.INDENT 0.0 +.TP +.B \-ansi +Same as \-std=c89. +.UNINDENT +.INDENT 0.0 +.TP +.B \-ObjC, \-ObjC++ +Treat source input files as Objective\-C and Object\-C++ inputs respectively. +.UNINDENT +.INDENT 0.0 +.TP +.B \-trigraphs +Enable trigraphs. +.UNINDENT +.INDENT 0.0 +.TP +.B \-ffreestanding +Indicate that the file should be compiled for a freestanding, not a hosted, +environment. Note that it is assumed that a freestanding environment will +additionally provide \fImemcpy\fP, \fImemmove\fP, \fImemset\fP and \fImemcmp\fP +implementations, as these are needed for efficient codegen for many programs. +.UNINDENT +.INDENT 0.0 +.TP +.B \-fno\-builtin +Disable special handling and optimizations of builtin functions like +\fBstrlen()\fP and \fBmalloc()\fP\&. +.UNINDENT +.INDENT 0.0 +.TP +.B \-fmath\-errno +Indicate that math functions should be treated as updating \fBerrno\fP\&. +.UNINDENT +.INDENT 0.0 +.TP +.B \-fpascal\-strings +Enable support for Pascal\-style strings with "\epfoo". +.UNINDENT +.INDENT 0.0 +.TP +.B \-fms\-extensions +Enable support for Microsoft extensions. +.UNINDENT +.INDENT 0.0 +.TP +.B \-fmsc\-version= +Set _MSC_VER. Defaults to 1300 on Windows. Not set otherwise. +.UNINDENT +.INDENT 0.0 +.TP +.B \-fborland\-extensions +Enable support for Borland extensions. +.UNINDENT +.INDENT 0.0 +.TP +.B \-fwritable\-strings +Make all string literals default to writable. This disables uniquing of +strings and other optimizations. +.UNINDENT +.INDENT 0.0 +.TP +.B \-flax\-vector\-conversions, \-flax\-vector\-conversions=<kind>, \-fno\-lax\-vector\-conversions +Allow loose type checking rules for implicit vector conversions. +Possible values of <kind>: +.INDENT 7.0 +.IP \(bu 2 +\fBnone\fP: allow no implicit conversions between vectors +.IP \(bu 2 +\fBinteger\fP: allow implicit bitcasts between integer vectors of the same +overall bit\-width +.IP \(bu 2 +\fBall\fP: allow implicit bitcasts between any vectors of the same +overall bit\-width +.UNINDENT +.sp +<kind> defaults to \fBinteger\fP if unspecified. +.UNINDENT +.INDENT 0.0 +.TP +.B \-fblocks +Enable the "Blocks" language feature. +.UNINDENT +.INDENT 0.0 +.TP +.B \-fobjc\-abi\-version=version +Select the Objective\-C ABI version to use. Available versions are 1 (legacy +"fragile" ABI), 2 (non\-fragile ABI 1), and 3 (non\-fragile ABI 2). +.UNINDENT +.INDENT 0.0 +.TP +.B \-fobjc\-nonfragile\-abi\-version=<version> +Select the Objective\-C non\-fragile ABI version to use by default. This will +only be used as the Objective\-C ABI when the non\-fragile ABI is enabled +(either via \fI\%\-fobjc\-nonfragile\-abi\fP, or because it is the platform +default). +.UNINDENT +.INDENT 0.0 +.TP +.B \-fobjc\-nonfragile\-abi, \-fno\-objc\-nonfragile\-abi +Enable use of the Objective\-C non\-fragile ABI. On platforms for which this is +the default ABI, it can be disabled with \fI\%\-fno\-objc\-nonfragile\-abi\fP\&. +.UNINDENT +.SS Target Selection Options +.sp +Clang fully supports cross compilation as an inherent part of its design. +Depending on how your version of Clang is configured, it may have support for a +number of cross compilers, or may only support a native target. +.INDENT 0.0 +.TP +.B \-arch <architecture> +Specify the architecture to build for. +.UNINDENT +.INDENT 0.0 +.TP +.B \-mmacosx\-version\-min=<version> +When building for macOS, specify the minimum version supported by your +application. +.UNINDENT +.INDENT 0.0 +.TP +.B \-miphoneos\-version\-min +When building for iPhone OS, specify the minimum version supported by your +application. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-print\-supported\-cpus +Print out a list of supported processors for the given target (specified +through \fB\-\-target=<architecture>\fP or \fI\%\-arch\fP \fB<architecture>\fP). If no +target is specified, the system default target will be used. +.UNINDENT +.INDENT 0.0 +.TP +.B \-mcpu=?, \-mtune=? +Acts as an alias for \fI\%\-\-print\-supported\-cpus\fP\&. +.UNINDENT +.INDENT 0.0 +.TP +.B \-march=<cpu> +Specify that Clang should generate code for a specific processor family +member and later. For example, if you specify \-march=i486, the compiler is +allowed to generate instructions that are valid on i486 and later processors, +but which may not exist on earlier ones. +.UNINDENT +.SS Code Generation Options +.INDENT 0.0 +.TP +.B \-O0, \-O1, \-O2, \-O3, \-Ofast, \-Os, \-Oz, \-Og, \-O, \-O4 +Specify which optimization level to use: +.INDENT 7.0 +.INDENT 3.5 +\fI\%\-O0\fP Means "no optimization": this level compiles the fastest and +generates the most debuggable code. +.sp +\fI\%\-O1\fP Somewhere between \fI\%\-O0\fP and \fI\%\-O2\fP\&. +.sp +\fI\%\-O2\fP Moderate level of optimization which enables most +optimizations. +.sp +\fI\%\-O3\fP Like \fI\%\-O2\fP, except that it enables optimizations that +take longer to perform or that may generate larger code (in an attempt to +make the program run faster). +.sp +\fI\%\-Ofast\fP Enables all the optimizations from \fI\%\-O3\fP along +with other aggressive optimizations that may violate strict compliance with +language standards. +.sp +\fI\%\-Os\fP Like \fI\%\-O2\fP with extra optimizations to reduce code +size. +.sp +\fI\%\-Oz\fP Like \fI\%\-Os\fP (and thus \fI\%\-O2\fP), but reduces code +size further. +.sp +\fI\%\-Og\fP Like \fI\%\-O1\fP\&. In future versions, this option might +disable different optimizations in order to improve debuggability. +.sp +\fI\%\-O\fP Equivalent to \fI\%\-O1\fP\&. +.sp +\fI\%\-O4\fP and higher +.INDENT 0.0 +.INDENT 3.5 +Currently equivalent to \fI\%\-O3\fP +.UNINDENT +.UNINDENT +.UNINDENT +.UNINDENT +.UNINDENT +.INDENT 0.0 +.TP +.B \-g, \-gline\-tables\-only, \-gmodules +Control debug information output. Note that Clang debug information works +best at \fI\%\-O0\fP\&. When more than one option starting with \fI\-g\fP is +specified, the last one wins: +.INDENT 7.0 +.INDENT 3.5 +\fB\-g\fP Generate debug information. +.sp +\fB\-gline\-tables\-only\fP Generate only line table debug information. This +allows for symbolicated backtraces with inlining information, but does not +include any information about variables, their locations or types. +.sp +\fI\%\-gmodules\fP Generate debug information that contains external +references to types defined in Clang modules or precompiled headers instead +of emitting redundant debug type information into every object file. This +option transparently switches the Clang module format to object file +containers that hold the Clang module together with the debug information. +When compiling a program that uses Clang modules or precompiled headers, +this option produces complete debug information with faster compile +times and much smaller object files. +.sp +This option should not be used when building static libraries for +distribution to other machines because the debug info will contain +references to the module cache on the machine the object files in the +library were built on. +.UNINDENT +.UNINDENT +.UNINDENT +.INDENT 0.0 +.TP +.B \-fstandalone\-debug \-fno\-standalone\-debug +Clang supports a number of optimizations to reduce the size of debug +information in the binary. They work based on the assumption that the +debug type information can be spread out over multiple compilation units. +For instance, Clang will not emit type definitions for types that are not +needed by a module and could be replaced with a forward declaration. +Further, Clang will only emit type info for a dynamic C++ class in the +module that contains the vtable for the class. +.sp +The \fB\-fstandalone\-debug\fP option turns off these optimizations. +This is useful when working with 3rd\-party libraries that don\(aqt come with +debug information. This is the default on Darwin. Note that Clang will +never emit type information for types that are not referenced at all by the +program. +.UNINDENT +.INDENT 0.0 +.TP +.B \-feliminate\-unused\-debug\-types +By default, Clang does not emit type information for types that are defined +but not used in a program. To retain the debug info for these unused types, +the negation \fB\-fno\-eliminate\-unused\-debug\-types\fP can be used. +.UNINDENT +.INDENT 0.0 +.TP +.B \-fexceptions +Enable generation of unwind information. This allows exceptions to be thrown +through Clang compiled stack frames. This is on by default in x86\-64. +.UNINDENT +.INDENT 0.0 +.TP +.B \-ftrapv +Generate code to catch integer overflow errors. Signed integer overflow is +undefined in C. With this flag, extra code is generated to detect this and +abort when it happens. +.UNINDENT +.INDENT 0.0 +.TP +.B \-fvisibility +This flag sets the default visibility level. +.UNINDENT +.INDENT 0.0 +.TP +.B \-fcommon, \-fno\-common +This flag specifies that variables without initializers get common linkage. +It can be disabled with \fI\%\-fno\-common\fP\&. +.UNINDENT +.INDENT 0.0 +.TP +.B \-ftls\-model=<model> +Set the default thread\-local storage (TLS) model to use for thread\-local +variables. Valid values are: "global\-dynamic", "local\-dynamic", +"initial\-exec" and "local\-exec". The default is "global\-dynamic". The default +model can be overridden with the tls_model attribute. The compiler will try +to choose a more efficient model if possible. +.UNINDENT +.INDENT 0.0 +.TP +.B \-flto, \-flto=full, \-flto=thin, \-emit\-llvm +Generate output files in LLVM formats, suitable for link time optimization. +When used with \fI\%\-S\fP this generates LLVM intermediate language +assembly files, otherwise this generates LLVM bitcode format object files +(which may be passed to the linker depending on the stage selection options). +.sp +The default for \fI\%\-flto\fP is "full", in which the +LLVM bitcode is suitable for monolithic Link Time Optimization (LTO), where +the linker merges all such modules into a single combined module for +optimization. With "thin", ThinLTO +compilation is invoked instead. +.sp +\fBNOTE:\fP +.INDENT 7.0 +.INDENT 3.5 +On Darwin, when using \fI\%\-flto\fP along with \fB\-g\fP and +compiling and linking in separate steps, you also need to pass +\fB\-Wl,\-object_path_lto,<lto\-filename>.o\fP at the linking step to instruct the +ld64 linker not to delete the temporary object file generated during Link +Time Optimization (this flag is automatically passed to the linker by Clang +if compilation and linking are done in a single step). This allows debugging +the executable as well as generating the \fB\&.dSYM\fP bundle using \fBdsymutil(1)\fP\&. +.UNINDENT +.UNINDENT +.UNINDENT +.SS Driver Options +.INDENT 0.0 +.TP +.B \-### +Print (but do not run) the commands to run for this compilation. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-help +Display available options. +.UNINDENT +.INDENT 0.0 +.TP +.B \-Qunused\-arguments +Do not emit any warnings for unused driver arguments. +.UNINDENT +.INDENT 0.0 +.TP +.B \-Wa,<args> +Pass the comma separated arguments in args to the assembler. +.UNINDENT +.INDENT 0.0 +.TP +.B \-Wl,<args> +Pass the comma separated arguments in args to the linker. +.UNINDENT +.INDENT 0.0 +.TP +.B \-Wp,<args> +Pass the comma separated arguments in args to the preprocessor. +.UNINDENT +.INDENT 0.0 +.TP +.B \-Xanalyzer <arg> +Pass arg to the static analyzer. +.UNINDENT +.INDENT 0.0 +.TP +.B \-Xassembler <arg> +Pass arg to the assembler. +.UNINDENT +.INDENT 0.0 +.TP +.B \-Xlinker <arg> +Pass arg to the linker. +.UNINDENT +.INDENT 0.0 +.TP +.B \-Xpreprocessor <arg> +Pass arg to the preprocessor. +.UNINDENT +.INDENT 0.0 +.TP +.B \-o <file> +Write output to file. +.UNINDENT +.INDENT 0.0 +.TP +.B \-print\-file\-name=<file> +Print the full library path of file. +.UNINDENT +.INDENT 0.0 +.TP +.B \-print\-libgcc\-file\-name +Print the library path for the currently used compiler runtime library +("libgcc.a" or "libclang_rt.builtins.*.a"). +.UNINDENT +.INDENT 0.0 +.TP +.B \-print\-prog\-name=<name> +Print the full program path of name. +.UNINDENT +.INDENT 0.0 +.TP +.B \-print\-search\-dirs +Print the paths used for finding libraries and programs. +.UNINDENT +.INDENT 0.0 +.TP +.B \-save\-temps +Save intermediate compilation results. +.UNINDENT +.INDENT 0.0 +.TP +.B \-save\-stats, \-save\-stats=cwd, \-save\-stats=obj +Save internal code generation (LLVM) statistics to a file in the current +directory (\fI\%\-save\-stats\fP/"\-save\-stats=cwd") or the directory +of the output file ("\-save\-state=obj"). +.UNINDENT +.INDENT 0.0 +.TP +.B \-integrated\-as, \-no\-integrated\-as +Used to enable and disable, respectively, the use of the integrated +assembler. Whether the integrated assembler is on by default is target +dependent. +.UNINDENT +.INDENT 0.0 +.TP +.B \-time +Time individual commands. +.UNINDENT +.INDENT 0.0 +.TP +.B \-ftime\-report +Print timing summary of each stage of compilation. +.UNINDENT +.INDENT 0.0 +.TP +.B \-v +Show commands to run and use verbose output. +.UNINDENT +.SS Diagnostics Options +.INDENT 0.0 +.TP +.B \-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 out information about diagnostics +(errors and warnings). Please see the Clang User\(aqs Manual for more information. +.UNINDENT +.SS Preprocessor Options +.INDENT 0.0 +.TP +.B \-D<macroname>=<value> +Adds an implicit #define into the predefines buffer which is read before the +source file is preprocessed. +.UNINDENT +.INDENT 0.0 +.TP +.B \-U<macroname> +Adds an implicit #undef into the predefines buffer which is read before the +source file is preprocessed. +.UNINDENT +.INDENT 0.0 +.TP +.B \-include <filename> +Adds an implicit #include into the predefines buffer which is read before the +source file is preprocessed. +.UNINDENT +.INDENT 0.0 +.TP +.B \-I<directory> +Add the specified directory to the search path for include files. +.UNINDENT +.INDENT 0.0 +.TP +.B \-F<directory> +Add the specified directory to the search path for framework include files. +.UNINDENT +.INDENT 0.0 +.TP +.B \-nostdinc +Do not search the standard system directories or compiler builtin directories +for include files. +.UNINDENT +.INDENT 0.0 +.TP +.B \-nostdlibinc +Do not search the standard system directories for include files, but do +search compiler builtin include directories. +.UNINDENT +.INDENT 0.0 +.TP +.B \-nobuiltininc +Do not search clang\(aqs builtin directory for include files. +.UNINDENT +.SH ENVIRONMENT +.INDENT 0.0 +.TP +.B TMPDIR, TEMP, TMP +These environment variables are checked, in order, for the location to write +temporary files used during the compilation process. +.UNINDENT +.INDENT 0.0 +.TP +.B CPATH +If this environment variable is present, it is treated as a delimited list of +paths to be added to the default system include path list. The delimiter is +the platform dependent delimiter, as used in the PATH environment variable. +.sp +Empty components in the environment variable are ignored. +.UNINDENT +.INDENT 0.0 +.TP +.B C_INCLUDE_PATH, OBJC_INCLUDE_PATH, CPLUS_INCLUDE_PATH, OBJCPLUS_INCLUDE_PATH +These environment variables specify additional paths, as for \fI\%CPATH\fP, which are +only used when processing the appropriate language. +.UNINDENT +.INDENT 0.0 +.TP +.B MACOSX_DEPLOYMENT_TARGET +If \fI\%\-mmacosx\-version\-min\fP is unspecified, the default deployment +target is read from this environment variable. This option only affects +Darwin targets. +.UNINDENT +.SH BUGS +.sp +To report bugs, please visit <\fI\%https://bugs.llvm.org/\fP>. Most bug reports should +include preprocessed source files (use the \fI\%\-E\fP option) and the full +output of the compiler, along with information to reproduce. +.SH SEE ALSO +.sp +\fBld(1)\fP +.SH AUTHOR +Maintained by the Clang / LLVM Team (<http://clang.llvm.org>) +.SH COPYRIGHT +2007-2021, The Clang Team +.\" Generated by docutils manpage writer. +. diff --git a/usr.bin/clang/llc/Makefile b/usr.bin/clang/llc/Makefile new file mode 100644 index 000000000000..42835ff00656 --- /dev/null +++ b/usr.bin/clang/llc/Makefile @@ -0,0 +1,11 @@ +# $FreeBSD$ + +PROG_CXX= llc + +SRCDIR= llvm/tools/llc +SRCS+= llc.cpp + +LIBADD+= z +LIBADD+= zstd + +.include "../llvm.prog.mk" diff --git a/usr.bin/clang/llc/Makefile.depend b/usr.bin/clang/llc/Makefile.depend new file mode 100644 index 000000000000..1423340957b6 --- /dev/null +++ b/usr.bin/clang/llc/Makefile.depend @@ -0,0 +1,24 @@ +# $FreeBSD$ +# Autogenerated - do NOT edit! + +DIRDEPS = \ + gnu/lib/csu \ + include \ + include/xlocale \ + lib/${CSU_DIR} \ + lib/clang/libllvm \ + lib/libc \ + lib/libc++ \ + lib/libcompiler_rt \ + lib/libcxxrt \ + lib/libthr \ + lib/libz \ + lib/msun \ + lib/ncurses/ncursesw \ + + +.include <dirdeps.mk> + +.if ${DEP_RELDIR} == ${_DEP_RELDIR} +# local dependencies - needed for -jN in clean tree +.endif diff --git a/usr.bin/clang/llc/llc.1 b/usr.bin/clang/llc/llc.1 new file mode 100644 index 000000000000..0fb50f43ed9d --- /dev/null +++ b/usr.bin/clang/llc/llc.1 @@ -0,0 +1,296 @@ +.\" $FreeBSD$ +.\" Man page generated from reStructuredText. +. +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.TH "LLC" "1" "2021-06-07" "12" "LLVM" +.SH NAME +llc \- LLVM static compiler +.SH SYNOPSIS +.sp +\fBllc\fP [\fIoptions\fP] [\fIfilename\fP] +.SH DESCRIPTION +.sp +The \fBllc\fP command compiles LLVM source inputs into assembly language +for a specified architecture. The assembly language output can then be passed +through a native assembler and linker to generate a native executable. +.sp +The choice of architecture for the output assembly code is automatically +determined from the input file, unless the \fI\%\-march\fP option is used to +override the default. +.SH OPTIONS +.sp +If \fBfilename\fP is "\fB\-\fP" or omitted, \fBllc\fP reads from standard input. +Otherwise, it will from \fBfilename\fP\&. Inputs can be in either the LLVM assembly +language format (\fB\&.ll\fP) or the LLVM bitcode format (\fB\&.bc\fP). +.sp +If the \fI\%\-o\fP option is omitted, then \fBllc\fP will send its output +to standard output if the input is from standard input. If the \fI\%\-o\fP +option specifies "\fB\-\fP", then the output will also be sent to standard output. +.sp +If no \fI\%\-o\fP option is specified and an input file other than "\fB\-\fP" is +specified, then \fBllc\fP creates the output filename by taking the input +filename, removing any existing \fB\&.bc\fP extension, and adding a \fB\&.s\fP suffix. +.sp +Other \fBllc\fP options are described below. +.SS End\-user Options +.INDENT 0.0 +.TP +.B \-help +Print a summary of command line options. +.UNINDENT +.INDENT 0.0 +.TP +.B \-o <filename> +Use \fB<filename>\fP as the output filename. See the summary above for more +details. +.UNINDENT +.INDENT 0.0 +.TP +.B \-O=uint +Generate code at different optimization levels. These correspond to the +\fB\-O0\fP, \fB\-O1\fP, \fB\-O2\fP, and \fB\-O3\fP optimization levels used by +\fBclang\fP\&. +.UNINDENT +.INDENT 0.0 +.TP +.B \-mtriple=<target triple> +Override the target triple specified in the input file with the specified +string. +.UNINDENT +.INDENT 0.0 +.TP +.B \-march=<arch> +Specify the architecture for which to generate assembly, overriding the target +encoded in the input file. See the output of \fBllc \-help\fP for a list of +valid architectures. By default this is inferred from the target triple or +autodetected to the current architecture. +.UNINDENT +.INDENT 0.0 +.TP +.B \-mcpu=<cpuname> +Specify a specific chip in the current architecture to generate code for. +By default this is inferred from the target triple and autodetected to +the current architecture. For a list of available CPUs, use: +.INDENT 7.0 +.INDENT 3.5 +.sp +.nf +.ft C +llvm\-as < /dev/null | llc \-march=xyz \-mcpu=help +.ft P +.fi +.UNINDENT +.UNINDENT +.UNINDENT +.INDENT 0.0 +.TP +.B \-filetype=<output file type> +Specify what kind of output \fBllc\fP should generated. Options are: \fBasm\fP +for textual assembly ( \fB\(aq.s\(aq\fP), \fBobj\fP for native object files (\fB\(aq.o\(aq\fP) +and \fBnull\fP for not emitting anything (for performance testing). +.sp +Note that not all targets support all options. +.UNINDENT +.INDENT 0.0 +.TP +.B \-mattr=a1,+a2,\-a3,... +Override or control specific attributes of the target, such as whether SIMD +operations are enabled or not. The default set of attributes is set by the +current CPU. For a list of available attributes, use: +.INDENT 7.0 +.INDENT 3.5 +.sp +.nf +.ft C +llvm\-as < /dev/null | llc \-march=xyz \-mattr=help +.ft P +.fi +.UNINDENT +.UNINDENT +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-frame\-pointer +Specify effect of frame pointer elimination optimization (all,non\-leaf,none). +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-disable\-excess\-fp\-precision +Disable optimizations that may produce excess precision for floating point. +Note that this option can dramatically slow down code on some systems +(e.g. X86). +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-enable\-no\-infs\-fp\-math +Enable optimizations that assume no Inf values. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-enable\-no\-nans\-fp\-math +Enable optimizations that assume no NAN values. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-enable\-no\-signed\-zeros\-fp\-math +Enable FP math optimizations that assume the sign of 0 is insignificant. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-enable\-no\-trapping\-fp\-math +Enable setting the FP exceptions build attribute not to use exceptions. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-enable\-unsafe\-fp\-math +Enable optimizations that make unsafe assumptions about IEEE math (e.g. that +addition is associative) or may not work for all input ranges. These +optimizations allow the code generator to make use of some instructions which +would otherwise not be usable (such as \fBfsin\fP on X86). +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-stats +Print statistics recorded by code\-generation passes. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-time\-passes +Record the amount of time needed for each pass and print a report to standard +error. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-load=<dso_path> +Dynamically load \fBdso_path\fP (a path to a dynamically shared object) that +implements an LLVM target. This will permit the target name to be used with +the \fI\%\-march\fP option so that code can be generated for that target. +.UNINDENT +.INDENT 0.0 +.TP +.B \-meabi=[default|gnu|4|5] +Specify which EABI version should conform to. Valid EABI versions are \fIgnu\fP, +\fI4\fP and \fI5\fP\&. Default value (\fIdefault\fP) depends on the triple. +.UNINDENT +.INDENT 0.0 +.TP +.B \-stack\-size\-section +Emit the .stack_sizes section which contains stack size metadata. The section +contains an array of pairs of function symbol values (pointer size) and stack +sizes (unsigned LEB128). The stack size values only include the space allocated +in the function prologue. Functions with dynamic stack allocations are not +included. +.UNINDENT +.INDENT 0.0 +.TP +.B \-remarks\-section +Emit the __remarks (MachO) section which contains metadata about remark +diagnostics. +.UNINDENT +.SS Tuning/Configuration Options +.INDENT 0.0 +.TP +.B \-\-print\-after\-isel +Print generated machine code after instruction selection (useful for debugging). +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-regalloc=<allocator> +Specify the register allocator to use. +Valid register allocators are: +.sp +\fIbasic\fP +.INDENT 7.0 +.INDENT 3.5 +Basic register allocator. +.UNINDENT +.UNINDENT +.sp +\fIfast\fP +.INDENT 7.0 +.INDENT 3.5 +Fast register allocator. It is the default for unoptimized code. +.UNINDENT +.UNINDENT +.sp +\fIgreedy\fP +.INDENT 7.0 +.INDENT 3.5 +Greedy register allocator. It is the default for optimized code. +.UNINDENT +.UNINDENT +.sp +\fIpbqp\fP +.INDENT 7.0 +.INDENT 3.5 +Register allocator based on \(aqPartitioned Boolean Quadratic Programming\(aq. +.UNINDENT +.UNINDENT +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-spiller=<spiller> +Specify the spiller to use for register allocators that support it. Currently +this option is used only by the linear scan register allocator. The default +\fBspiller\fP is \fIlocal\fP\&. Valid spillers are: +.sp +\fIsimple\fP +.INDENT 7.0 +.INDENT 3.5 +Simple spiller +.UNINDENT +.UNINDENT +.sp +\fIlocal\fP +.INDENT 7.0 +.INDENT 3.5 +Local spiller +.UNINDENT +.UNINDENT +.UNINDENT +.SS Intel IA\-32\-specific Options +.INDENT 0.0 +.TP +.B \-\-x86\-asm\-syntax=[att|intel] +Specify whether to emit assembly code in AT&T syntax (the default) or Intel +syntax. +.UNINDENT +.SH EXIT STATUS +.sp +If \fBllc\fP succeeds, it will exit with 0. Otherwise, if an error +occurs, it will exit with a non\-zero value. +.SH SEE ALSO +.sp +\fBlli(1)\fP +.SH AUTHOR +Maintained by the LLVM Team (https://llvm.org/). +.SH COPYRIGHT +2003-2021, LLVM Project +.\" Generated by docutils manpage writer. +. diff --git a/usr.bin/clang/lld/Makefile b/usr.bin/clang/lld/Makefile new file mode 100644 index 000000000000..fb10ca7176d1 --- /dev/null +++ b/usr.bin/clang/lld/Makefile @@ -0,0 +1,113 @@ +# $FreeBSD$ + +.include <src.opts.mk> + +LLVM_BASE= ${SRCTOP}/contrib/llvm-project +LLVM_SRCS= ${LLVM_BASE}/llvm +LLD_SRCS= ${LLVM_BASE}/lld + +PACKAGE= lld +PROG_CXX= ld.lld +# Man page directory +.PATH: ${LLD_SRCS}/docs +.if (!defined(TOOLS_PREFIX) && ${MK_LLD_IS_LD} != "no") || \ + (defined(TOOLS_PREFIX) && ${MK_LLD_BOOTSTRAP} != "no") +SYMLINKS= ${PROG_CXX} ${BINDIR}/ld +MLINKS= ld.lld.1 ld.1 +.endif + +.if ${MK_SHARED_TOOLCHAIN} == "no" +NO_SHARED?= yes +.endif + +.include "${SRCTOP}/lib/clang/llvm.pre.mk" + +CFLAGS+= -I${LLD_SRCS}/ELF +CFLAGS+= -I${LLD_SRCS}/include +CFLAGS+= -I${.OBJDIR} +CFLAGS+= -I${OBJTOP}/lib/clang/libllvm +CFLAGS+= -I${SRCTOP}/sys/contrib/zstd/lib + +SRCDIR= lld +SRCS+= Common/Args.cpp +SRCS+= Common/CommonLinkerContext.cpp +SRCS+= Common/DWARF.cpp +SRCS+= Common/ErrorHandler.cpp +SRCS+= Common/Filesystem.cpp +SRCS+= Common/Memory.cpp +SRCS+= Common/Reproduce.cpp +SRCS+= Common/Strings.cpp +SRCS+= Common/TargetOptionsCommandFlags.cpp +SRCS+= Common/Version.cpp +SRCS+= ELF/AArch64ErrataFix.cpp +SRCS+= ELF/ARMErrataFix.cpp +SRCS+= ELF/Arch/AArch64.cpp +SRCS+= ELF/Arch/AMDGPU.cpp +SRCS+= ELF/Arch/ARM.cpp +SRCS+= ELF/Arch/AVR.cpp +SRCS+= ELF/Arch/Hexagon.cpp +SRCS+= ELF/Arch/MSP430.cpp +SRCS+= ELF/Arch/Mips.cpp +SRCS+= ELF/Arch/MipsArchTree.cpp +SRCS+= ELF/Arch/PPC.cpp +SRCS+= ELF/Arch/PPC64.cpp +SRCS+= ELF/Arch/RISCV.cpp +SRCS+= ELF/Arch/SPARCV9.cpp +SRCS+= ELF/Arch/X86.cpp +SRCS+= ELF/Arch/X86_64.cpp +SRCS+= ELF/CallGraphSort.cpp +SRCS+= ELF/DWARF.cpp +SRCS+= ELF/Driver.cpp +SRCS+= ELF/DriverUtils.cpp +SRCS+= ELF/EhFrame.cpp +SRCS+= ELF/ICF.cpp +SRCS+= ELF/InputFiles.cpp +SRCS+= ELF/InputSection.cpp +SRCS+= ELF/LTO.cpp +SRCS+= ELF/LinkerScript.cpp +SRCS+= ELF/MapFile.cpp +SRCS+= ELF/MarkLive.cpp +SRCS+= ELF/OutputSections.cpp +SRCS+= ELF/Relocations.cpp +SRCS+= ELF/ScriptLexer.cpp +SRCS+= ELF/ScriptParser.cpp +SRCS+= ELF/SymbolTable.cpp +SRCS+= ELF/Symbols.cpp +SRCS+= ELF/SyntheticSections.cpp +SRCS+= ELF/Target.cpp +SRCS+= ELF/Thunks.cpp +SRCS+= ELF/Writer.cpp +SRCS+= tools/lld/lld.cpp + +CFLAGS.lld.cpp+= -Dlld_main=main + +.include "${SRCTOP}/lib/clang/llvm.build.mk" + +LIBDEPS+= llvm + +.for lib in ${LIBDEPS} +DPADD+= ${OBJTOP}/lib/clang/lib${lib}/lib${lib}.a +LDADD+= ${OBJTOP}/lib/clang/lib${lib}/lib${lib}.a +.endfor + +INCFILE= Options.inc +TDFILE= ${LLD_SRCS}/ELF/Options.td +GENOPT= -gen-opt-parser-defs +${INCFILE}: ${TDFILE} + ${LLVM_TBLGEN} ${GENOPT} -I ${LLVM_SRCS}/include -d ${.TARGET:C/$/.d/} \ + -o ${.TARGET} ${TDFILE} +TGHDRS+= ${INCFILE} + +DEPENDFILES+= ${TGHDRS:C/$/.d/} +DPSRCS+= ${TGHDRS} +CLEANFILES+= ${TGHDRS} ${TGHDRS:C/$/.d/} + +.if ${.MAKE.OS} == "FreeBSD" || !defined(BOOTSTRAPPING) +LIBADD+= execinfo +LIBADD+= tinfow +.endif +LIBADD+= pthread +LIBADD+= z +LIBADD+= zstd + +.include <bsd.prog.mk> diff --git a/usr.bin/clang/lld/Makefile.depend b/usr.bin/clang/lld/Makefile.depend new file mode 100644 index 000000000000..878fb135c885 --- /dev/null +++ b/usr.bin/clang/lld/Makefile.depend @@ -0,0 +1,25 @@ +# $FreeBSD$ +# Autogenerated - do NOT edit! + +DIRDEPS = \ + gnu/lib/csu \ + include \ + include/xlocale \ + lib/${CSU_DIR} \ + lib/clang/libllvm \ + lib/libc \ + lib/libc++ \ + lib/libcompiler_rt \ + lib/libcxxrt \ + lib/libthr \ + lib/libz \ + lib/msun \ + lib/ncurses/ncursesw \ + usr.bin/clang/llvm-tblgen.host \ + + +.include <dirdeps.mk> + +.if ${DEP_RELDIR} == ${_DEP_RELDIR} +# local dependencies - needed for -jN in clean tree +.endif diff --git a/usr.bin/clang/lldb-server/Makefile b/usr.bin/clang/lldb-server/Makefile new file mode 100644 index 000000000000..838f8f164d5c --- /dev/null +++ b/usr.bin/clang/lldb-server/Makefile @@ -0,0 +1,55 @@ +# $FreeBSD$ + +.include "${SRCTOP}/lib/clang/lldb.pre.mk" + +PACKAGE= lldb +PROG_CXX= lldb-server + +CFLAGS+= -I${LLDB_SRCS}/include +CFLAGS+= -I${LLDB_SRCS}/source +CFLAGS+= -I${.OBJDIR} + +SRCDIR= lldb/tools/lldb-server + +SRCS+= Acceptor.cpp +SRCS+= LLDBServerUtilities.cpp +SRCS+= SystemInitializerLLGS.cpp +SRCS+= lldb-gdbserver.cpp +SRCS+= lldb-platform.cpp +SRCS+= lldb-server.cpp + +.include "${SRCTOP}/lib/clang/clang.build.mk" + +LIBDEPS+= lldb +LIBDEPS+= clang +LIBDEPS+= llvm + +.for lib in ${LIBDEPS} +DPADD+= ${OBJTOP}/lib/clang/lib${lib}/lib${lib}.a +LDADD+= ${OBJTOP}/lib/clang/lib${lib}/lib${lib}.a +.endfor + +INCFILE= LLGSOptions.inc +TDFILE= ${LLDB_SRCS}/tools/lldb-server/LLGSOptions.td +GENOPT= -gen-opt-parser-defs +${INCFILE}: ${TDFILE} + ${LLVM_TBLGEN} ${GENOPT} -I ${LLVM_SRCS}/include -d ${.TARGET:C/$/.d/} \ + -o ${.TARGET} ${TDFILE} +TGHDRS+= ${INCFILE} + +DEPENDFILES+= ${TGHDRS:C/$/.d/} +DPSRCS+= ${TGHDRS} +CLEANFILES+= ${TGHDRS} ${TGHDRS:C/$/.d/} + +LIBADD+= tinfow +LIBADD+= edit +LIBADD+= execinfo +LIBADD+= lua +LIBADD+= lzma +LIBADD+= ncursesw +LIBADD+= panel +LIBADD+= pthread +LIBADD+= z +LIBADD+= zstd + +.include <bsd.prog.mk> diff --git a/usr.bin/clang/lldb-server/lldb-server.1 b/usr.bin/clang/lldb-server/lldb-server.1 new file mode 100644 index 000000000000..929696aa33a8 --- /dev/null +++ b/usr.bin/clang/lldb-server/lldb-server.1 @@ -0,0 +1,262 @@ +.\" $FreeBSD$ +.\" Man page generated from reStructuredText. +. +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.TH "LLDB-SERVER" "1" "2021-06-07" "12" "LLDB" +.SH NAME +lldb-server \- LLDB Documentation +.SH SYNOPSIS +.nf +\fBlldb\-server\fP v[ersion] +\fBlldb\-server\fP g[dbserver] [\fIoptions\fP] +\fBlldb\-server\fP p[latform] [\fIoptions\fP] +.fi +.sp +.SH DESCRIPTION +.sp +\fBlldb\-server\fP provides the server counterpart of the LLVM debugger. +The server runs and monitors the debugged program, while the user interfaces +with it via a client, either running locally or connecting remotely. +.sp +All of the code in the LLDB project is available under the Apache 2.0 License +with LLVM exceptions. +.SH COMMANDS +.sp +The first argument to lldb\-server specifies a command to run. +.INDENT 0.0 +.TP +.B v[ersion] +Prints lldb\-server version and exits. +.UNINDENT +.INDENT 0.0 +.TP +.B g[dbserver] +Runs the server using the gdb\-remote protocol. LLDB can afterwards +connect to the server using \fIgdb\-remote\fP command. +.UNINDENT +.INDENT 0.0 +.TP +.B p[latform] +Runs the platform server. LLDB can afterwards connect to the server using +\fIplatform select\fP, followed by \fIplatform connect\fP\&. +.UNINDENT +.SH GDBSERVER COMMAND +.nf +\fBlldb\-server\fP g[dbserver] [\fIoptions\fP] [[\fIhost\fP]:\fIport\fP] [[\-\-] \fIprogram\fP \fIargs\fP\&...] +.fi +.sp +.SS CONNECTION +.INDENT 0.0 +.TP +.B host:port +Specifies the hostname and TCP port to listen on. Obligatory unless another +listening option is used. If host is empty, \fIlocalhost\fP will be used. If port +is zero, a random port will be selected, and written as specified by \-\-pipe +or \-\-named\-pipe options. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-fd <fd> +Communicate over the given file descriptor instead of sockets. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-named\-pipe <name> +Write the listening port number to the specified named pipe. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-pipe <fd> +Write the listening port number to the specified pipe (fd). +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-reverse\-connect +Connect to the client instead of passively waiting for a connection. In this +case, [host]:port denotes the remote address to connect to. +.UNINDENT +.SS GENERAL OPTIONS +.INDENT 0.0 +.TP +.B \-\-help +Prints out the usage information and exits. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-log\-channels <channel1 categories...:channel2 categories...> +Channels to log. A colon\-separated list of entries. Each entry starts with +a channel followed by a space\-separated list of categories. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-log\-file <file> +Destination file to log to. If empty, log to stderr. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-setsid +Run lldb\-server in a new session. +.UNINDENT +.SS TARGET SELECTION +.INDENT 0.0 +.TP +.B \-\-attach <pid\-or\-name> +Attach to the process given by a (numeric) process id or a name. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\- program args +Launch a program for debugging. +.UNINDENT +.sp +If neither of target options are used, \fBlldb\-server\fP is started +without a specific target. It can be afterwards instructed by the client +to launch or attach. +.SH PLATFORM COMMAND +.nf +\fBlldb\-server\fP p[latform] [\fIoptions\fP] \-\-server \-\-listen [[\fIhost\fP]:\fIport\fP] +.fi +.sp +.SS CONNECTION +.INDENT 0.0 +.TP +.B \-\-server +Run in server mode, handling multiple connections. If this is not specified, +lldb\-server will accept only one connection and exit when it is finished. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-listen <host>:<port> +Hostname and port to listen on. Obligatory. If \fIport\fP is zero, a random port +will be used. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-socket\-file <path> +Write the listening socket port number to the specified file. +.UNINDENT +.SS GENERAL OPTIONS +.INDENT 0.0 +.TP +.B \-\-log\-channels <channel1 categories...:channel2 categories...> +Channels to log. A colon\-separated list of entries. Each entry starts with +a channel followed by a space\-separated list of categories. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-log\-file <file> +Destination file to log to. If empty, log to stderr. +.UNINDENT +.SS GDB\-SERVER CONNECTIONS +.INDENT 0.0 +.TP +.B \-\-gdbserver\-port <port> +Define a port to be used for gdb\-server connections. Can be specified multiple +times to allow multiple ports. Has no effect if \-\-min\-gdbserver\-port +and \-\-max\-gdbserver\-port are specified. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-min\-gdbserver\-port <port> +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-max\-gdbserver\-port <port> +Specify the range of ports that can be used for gdb\-server connections. Both +options need to be specified simultaneously. Overrides \-\-gdbserver\-port. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-port\-offset <offset> +Add the specified offset to port numbers returned by server. This is useful +if the server is running behind a firewall, and a range of ports is redirected +to it with an offset. +.UNINDENT +.SH EXAMPLES +.sp +The server can be started in several modes. +.sp +In order to launch a new process inside the debugger, pass the path to it +and the arguments to the debugged executable as positional arguments. +To disambiguate between arguments passed to lldb and arguments passed +to the debugged executable, arguments starting with a \- must be passed after +\-\-. The server will launch the new executable and stop it immediately, waiting +for the client to connect. +.INDENT 0.0 +.INDENT 3.5 +lldb\-server g :1234 /path/to/program program\-argument \-\- \-\-program\-option +.UNINDENT +.UNINDENT +.sp +For convenience, passing the executable after \-\- is also supported. +.INDENT 0.0 +.INDENT 3.5 +lldb\-server g :1234 \-\- /path/to/program program\-argument \-\-program\-option +.UNINDENT +.UNINDENT +.sp +In order to attach to a running process, pass \-\-attach along with the process +identifier or name. The process will be stopped immediately after starting +the server. Note that terminating the server will usually cause the process +to be detached and continue execution. +.INDENT 0.0 +.INDENT 3.5 +lldb\-server g :1234 \-\-attach 12345 +lldb\-server g :1234 \-\-attach program\-name +.UNINDENT +.UNINDENT +.sp +Use \fIgdb\-remote\fP command to connect to the server: +.INDENT 0.0 +.INDENT 3.5 +(lldb) gdb\-remote 1234 +.UNINDENT +.UNINDENT +.sp +lldb\-server can also be started without an inferior. In this case, the client +can select the target after connecting to the server. Note that some commands +(e.g. \fItarget create\fP) will disconnect and launch a local lldb\-server instead. +.INDENT 0.0 +.INDENT 3.5 +lldb\-server g :1234 +.sp +(lldb) gdb\-remote 1234 +(lldb) process launch a.out +.UNINDENT +.UNINDENT +.SH SEE ALSO +.sp +The LLDB project page \fI\%https://lldb.llvm.org\fP has many different resources +for \fBlldb\-server\fP users. +.SH AUTHOR +LLVM project +.SH COPYRIGHT +2007-2021, The LLDB Team +.\" Generated by docutils manpage writer. +. diff --git a/usr.bin/clang/lldb-tblgen/Makefile b/usr.bin/clang/lldb-tblgen/Makefile new file mode 100644 index 000000000000..7a5ea077b293 --- /dev/null +++ b/usr.bin/clang/lldb-tblgen/Makefile @@ -0,0 +1,12 @@ +# $FreeBSD$ + +PROG_CXX= lldb-tblgen +MAN= + +SRCDIR= lldb/utils/TableGen +SRCS+= LLDBOptionDefEmitter.cpp +SRCS+= LLDBPropertyDefEmitter.cpp +SRCS+= LLDBTableGen.cpp +SRCS+= LLDBTableGenUtils.cpp + +.include "../llvm.prog.mk" diff --git a/usr.bin/clang/lldb/Makefile b/usr.bin/clang/lldb/Makefile new file mode 100644 index 000000000000..158b8780df56 --- /dev/null +++ b/usr.bin/clang/lldb/Makefile @@ -0,0 +1,49 @@ +# $FreeBSD$ + +.include "${SRCTOP}/lib/clang/lldb.pre.mk" + +PACKAGE= lldb +PROG_CXX= lldb + +CFLAGS+= -I${LLDB_SRCS}/include +CFLAGS+= -I${.OBJDIR} + +SRCDIR= lldb/tools/driver +SRCS+= Driver.cpp + +.include "${SRCTOP}/lib/clang/clang.build.mk" + +LIBDEPS+= lldb +LIBDEPS+= clang +LIBDEPS+= llvm + +.for lib in ${LIBDEPS} +DPADD+= ${OBJTOP}/lib/clang/lib${lib}/lib${lib}.a +LDADD+= ${OBJTOP}/lib/clang/lib${lib}/lib${lib}.a +.endfor + +INCFILE= Options.inc +TDFILE= ${LLVM_BASE}/${SRCDIR}/Options.td +GENOPT= -gen-opt-parser-defs +${INCFILE}: ${TDFILE} + ${LLVM_TBLGEN} ${GENOPT} -I ${LLVM_SRCS}/include -d ${.TARGET:C/$/.d/} \ + -o ${.TARGET} ${TDFILE} +TGHDRS+= ${INCFILE} + +DEPENDFILES+= ${TGHDRS:C/$/.d/} +DPSRCS+= ${TGHDRS} +CLEANFILES+= ${TGHDRS} ${TGHDRS:C/$/.d/} + +LIBADD= tinfow +LIBADD+= edit +LIBADD+= execinfo +LIBADD+= kvm +LIBADD+= lua +LIBADD+= lzma +LIBADD+= ncursesw +LIBADD+= panelw +LIBADD+= pthread +LIBADD+= z +LIBADD+= zstd + +.include <bsd.prog.mk> diff --git a/usr.bin/clang/lldb/Makefile.depend b/usr.bin/clang/lldb/Makefile.depend new file mode 100644 index 000000000000..920832156fd8 --- /dev/null +++ b/usr.bin/clang/lldb/Makefile.depend @@ -0,0 +1,29 @@ +# $FreeBSD$ +# Autogenerated - do NOT edit! + +DIRDEPS = \ + gnu/lib/csu \ + include \ + include/xlocale \ + lib/${CSU_DIR} \ + lib/clang/libclang \ + lib/clang/liblldb \ + lib/clang/libllvm \ + lib/libc \ + lib/libc++ \ + lib/libcompiler_rt \ + lib/libcxxrt \ + lib/libedit \ + lib/libthr \ + lib/libz \ + lib/msun \ + lib/ncurses/ncurses \ + lib/ncurses/ncursesw \ + lib/ncurses/panel \ + + +.include <dirdeps.mk> + +.if ${DEP_RELDIR} == ${_DEP_RELDIR} +# local dependencies - needed for -jN in clean tree +.endif diff --git a/usr.bin/clang/lldb/lldb.1 b/usr.bin/clang/lldb/lldb.1 new file mode 100644 index 000000000000..d3a85ff554e2 --- /dev/null +++ b/usr.bin/clang/lldb/lldb.1 @@ -0,0 +1,430 @@ +.\" $FreeBSD$ +.\" Man page generated from reStructuredText. +. +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.TH "LLDB" "1" "2021-06-07" "12" "LLDB" +.SH NAME +lldb \- LLDB Documentation +.SH SYNOPSIS +.nf +\fBlldb\fP [\fIoptions\fP] \fIexecutable\fP +.fi +.sp +.SH DESCRIPTION +.sp +\fBlldb\fP is a next generation, high\-performance debugger. It is built as +a set of reusable components which highly leverage existing libraries in the +larger LLVM Project, such as the Clang expression parser and LLVM disassembler. +.sp +\fBlldb\fP is the default debugger in Xcode on macOS and supports +debugging C, Objective\-C and C++ on the desktop and iOS devices and simulator. +.sp +All of the code in the LLDB project is available under the Apache 2.0 License +with LLVM exceptions. +.SH ATTACHING +.INDENT 0.0 +.TP +.B \-\-attach\-name <name> +Tells the debugger to attach to a process with the given name. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-attach\-pid <pid> +Tells the debugger to attach to a process with the given pid. +.UNINDENT +.INDENT 0.0 +.TP +.B \-n <value> +Alias for \-\-attach\-name +.UNINDENT +.INDENT 0.0 +.TP +.B \-p <value> +Alias for \-\-attach\-pid +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-wait\-for +Tells the debugger to wait for a process with the given pid or name to launch before attaching. +.UNINDENT +.INDENT 0.0 +.TP +.B \-w +Alias for \-\-wait\-for +.UNINDENT +.SH COMMANDS +.INDENT 0.0 +.TP +.B \-\-batch +Tells the debugger to run the commands from \-s, \-S, \-o & \-O, and then quit. +.UNINDENT +.INDENT 0.0 +.TP +.B \-b +Alias for \-\-batch +.UNINDENT +.INDENT 0.0 +.TP +.B \-K <value> +Alias for \-\-source\-on\-crash +.UNINDENT +.INDENT 0.0 +.TP +.B \-k <value> +Alias for \-\-one\-line\-on\-crash +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-local\-lldbinit +Allow the debugger to parse the .lldbinit files in the current working directory, unless \-\-no\-lldbinit is passed. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-no\-lldbinit +Do not automatically parse any \(aq.lldbinit\(aq files. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-one\-line\-before\-file <command> +Tells the debugger to execute this one\-line lldb command before any file provided on the command line has been loaded. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-one\-line\-on\-crash <command> +When in batch mode, tells the debugger to run this one\-line lldb command if the target crashes. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-one\-line <command> +Tells the debugger to execute this one\-line lldb command after any file provided on the command line has been loaded. +.UNINDENT +.INDENT 0.0 +.TP +.B \-O <value> +Alias for \-\-one\-line\-before\-file +.UNINDENT +.INDENT 0.0 +.TP +.B \-o <value> +Alias for \-\-one\-line +.UNINDENT +.INDENT 0.0 +.TP +.B \-Q +Alias for \-\-source\-quietly +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-source\-before\-file <file> +Tells the debugger to read in and execute the lldb commands in the given file, before any file has been loaded. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-source\-on\-crash <file> +When in batch mode, tells the debugger to source this file of lldb commands if the target crashes. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-source\-quietly +Tells the debugger to execute this one\-line lldb command before any file has been loaded. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-source <file> +Tells the debugger to read in and execute the lldb commands in the given file, after any file has been loaded. +.UNINDENT +.INDENT 0.0 +.TP +.B \-S <value> +Alias for \-\-source\-before\-file +.UNINDENT +.INDENT 0.0 +.TP +.B \-s <value> +Alias for \-\-source +.UNINDENT +.INDENT 0.0 +.TP +.B \-x +Alias for \-\-no\-lldbinit +.UNINDENT +.SH OPTIONS +.INDENT 0.0 +.TP +.B \-\-arch <architecture> +Tells the debugger to use the specified architecture when starting and running the program. +.UNINDENT +.INDENT 0.0 +.TP +.B \-a <value> +Alias for \-\-arch +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-capture\-path <filename> +Tells the debugger to use the given filename for the reproducer. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-capture +Tells the debugger to capture a reproducer. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-core <filename> +Tells the debugger to use the full path to <filename> as the core file. +.UNINDENT +.INDENT 0.0 +.TP +.B \-c <value> +Alias for \-\-core +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-debug +Tells the debugger to print out extra information for debugging itself. +.UNINDENT +.INDENT 0.0 +.TP +.B \-d +Alias for \-\-debug +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-editor +Tells the debugger to open source files using the host\(aqs "external editor" mechanism. +.UNINDENT +.INDENT 0.0 +.TP +.B \-e +Alias for \-\-editor +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-file <filename> +Tells the debugger to use the file <filename> as the program to be debugged. +.UNINDENT +.INDENT 0.0 +.TP +.B \-f <value> +Alias for \-\-file +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-help +Prints out the usage information for the LLDB debugger. +.UNINDENT +.INDENT 0.0 +.TP +.B \-h +Alias for \-\-help +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-no\-use\-colors +Do not use colors. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-replay <filename> +Tells the debugger to replay a reproducer from <filename>. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-version +Prints out the current version number of the LLDB debugger. +.UNINDENT +.INDENT 0.0 +.TP +.B \-v +Alias for \-\-version +.UNINDENT +.INDENT 0.0 +.TP +.B \-X +Alias for \-\-no\-use\-color +.UNINDENT +.SH REPL +.INDENT 0.0 +.TP +.B \-r=<flags> +Alias for \-\-repl=<flags> +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-repl\-language <language> +Chooses the language for the REPL. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-repl=<flags> +Runs lldb in REPL mode with a stub process with the given flags. +.UNINDENT +.INDENT 0.0 +.TP +.B \-R <value> +Alias for \-\-repl\-language +.UNINDENT +.SH SCRIPTING +.INDENT 0.0 +.TP +.B \-l <value> +Alias for \-\-script\-language +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-python\-path +Prints out the path to the lldb.py file for this version of lldb. +.UNINDENT +.INDENT 0.0 +.TP +.B \-P +Alias for \-\-python\-path +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-script\-language <language> +Tells the debugger to use the specified scripting language for user\-defined scripts. +.UNINDENT +.SH EXAMPLES +.sp +The debugger can be started in several modes. +.sp +Passing an executable as a positional argument prepares lldb to debug the given +executable. To disambiguate between arguments passed to lldb and arguments +passed to the debugged executable, arguments starting with a \- must be passed +after \-\-. +.INDENT 0.0 +.INDENT 3.5 +lldb \-\-arch x86_64 /path/to/program program argument \-\- \-\-arch arvm7 +.UNINDENT +.UNINDENT +.sp +For convenience, passing the executable after \-\- is also supported. +.INDENT 0.0 +.INDENT 3.5 +lldb \-\-arch x86_64 \-\- /path/to/program program argument \-\-arch arvm7 +.UNINDENT +.UNINDENT +.sp +Passing one of the attach options causes \fBlldb\fP to immediately attach +to the given process. +.INDENT 0.0 +.INDENT 3.5 +lldb \-p <pid> +lldb \-n <process\-name> +.UNINDENT +.UNINDENT +.sp +Passing \-\-repl starts \fBlldb\fP in REPL mode. +.INDENT 0.0 +.INDENT 3.5 +lldb \-r +.UNINDENT +.UNINDENT +.sp +Passing \-\-core causes \fBlldb\fP to debug the core file. +.INDENT 0.0 +.INDENT 3.5 +lldb \-c /path/to/core +.UNINDENT +.UNINDENT +.sp +Command options can be combined with these modes and cause \fBlldb\fP to +run the specified commands before or after events, like loading the file or +crashing, in the order provided on the command line. +.INDENT 0.0 +.INDENT 3.5 +lldb \-O \(aqsettings set stop\-disassembly\-count 20\(aq \-o \(aqrun\(aq \-o \(aqbt\(aq +lldb \-S /source/before/file \-s /source/after/file +lldb \-K /source/before/crash \-k /source/after/crash +.UNINDENT +.UNINDENT +.sp +Note: In REPL mode no file is loaded, so commands specified to run after +loading the file (via \-o or \-s) will be ignored. +.SH USING LLDB +.sp +In \fBlldb\fP there is a help command which can be used to find +descriptions and examples of all \fBlldb\fP commands. To get help on +"breakpoint set" you would type "help breakpoint set". +.sp +There is also an apropos command which will search the help text of all +commands for a given term ‐‐ this is useful for locating a command by topic. +For instance, "apropos breakpoint" will list any command that has the word +"breakpoint" in its help text. +.SH CONFIGURATION FILES +.sp +\fBlldb\fP reads things like settings, aliases and commands from the +\&.lldbinit file. +.sp +First, \fBlldb\fP will try to read the application specific init file +whose name is ~/.lldbinit followed by a "\-" and the name of the current +program. This would be ~/.lldbinit\-lldb for the command line \fBlldb\fP +and ~/.lldbinit\-Xcode for Xcode. If there is no application specific init +file, \fBlldb\fP will look for an init file in the home directory. +If launched with a \fI\%REPL\fP option, it will first look for a REPL configuration +file, specific to the REPL language. The init file should be named as follow: +\fB\&.lldbinit\-<language>\-repl\fP (i.e. \fB\&.lldbinit\-swift\-repl\fP). If this file doesn\(aqt +exist, or \fBlldb\fP wasn\(aqt launch with \fI\%REPL\fP, meaning there is neither +a REPL init file nor an application specific init file, \fBlldb\fP will fallback to +the global ~/.lldbinit. +.sp +Secondly, it will look for an .lldbinit file in the current working directory. +For security reasons, \fBlldb\fP will print a warning and not source this +file by default. This behavior can be changed by changing the +target.load\-cwd\-lldbinit setting. +.sp +To always load the .lldbinit file in the current working directory, add the +following command to ~/.lldbinit: +.INDENT 0.0 +.INDENT 3.5 +settings set target.load\-cwd\-lldbinit true +.UNINDENT +.UNINDENT +.sp +To never load the .lldbinit file in the current working directory and silence +the warning, add the following command to ~/.lldbinit: +.INDENT 0.0 +.INDENT 3.5 +settings set target.load\-cwd\-lldbinit false +.UNINDENT +.UNINDENT +.SH SEE ALSO +.sp +The LLDB project page \fI\%https://lldb.llvm.org\fP has many different resources +for \fBlldb\fP users ‐‐ the gdb/lldb command equivalence page +\fI\%https://lldb.llvm.org/use/map.html\fP can be especially helpful for users +coming from gdb. +.SH AUTHOR +LLVM project +.SH COPYRIGHT +2007-2021, The LLDB Team +.\" Generated by docutils manpage writer. +. diff --git a/usr.bin/clang/lli/Makefile b/usr.bin/clang/lli/Makefile new file mode 100644 index 000000000000..0c8d621f42a6 --- /dev/null +++ b/usr.bin/clang/lli/Makefile @@ -0,0 +1,12 @@ +# $FreeBSD$ + +PROG_CXX= lli + +SRCDIR= llvm/tools/lli +SRCS+= ExecutionUtils.cpp +SRCS+= lli.cpp + +LIBADD+= z +LIBADD+= zstd + +.include "../llvm.prog.mk" diff --git a/usr.bin/clang/lli/Makefile.depend b/usr.bin/clang/lli/Makefile.depend new file mode 100644 index 000000000000..1423340957b6 --- /dev/null +++ b/usr.bin/clang/lli/Makefile.depend @@ -0,0 +1,24 @@ +# $FreeBSD$ +# Autogenerated - do NOT edit! + +DIRDEPS = \ + gnu/lib/csu \ + include \ + include/xlocale \ + lib/${CSU_DIR} \ + lib/clang/libllvm \ + lib/libc \ + lib/libc++ \ + lib/libcompiler_rt \ + lib/libcxxrt \ + lib/libthr \ + lib/libz \ + lib/msun \ + lib/ncurses/ncursesw \ + + +.include <dirdeps.mk> + +.if ${DEP_RELDIR} == ${_DEP_RELDIR} +# local dependencies - needed for -jN in clean tree +.endif diff --git a/usr.bin/clang/lli/lli.1 b/usr.bin/clang/lli/lli.1 new file mode 100644 index 000000000000..6684ab4411b8 --- /dev/null +++ b/usr.bin/clang/lli/lli.1 @@ -0,0 +1,299 @@ +.\" $FreeBSD$ +.\" Man page generated from reStructuredText. +. +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.TH "LLI" "1" "2021-06-07" "12" "LLVM" +.SH NAME +lli \- directly execute programs from LLVM bitcode +.SH SYNOPSIS +.sp +\fBlli\fP [\fIoptions\fP] [\fIfilename\fP] [\fIprogram args\fP] +.SH DESCRIPTION +.sp +\fBlli\fP directly executes programs in LLVM bitcode format. It takes a program +in LLVM bitcode format and executes it using a just\-in\-time compiler or an +interpreter. +.sp +\fBlli\fP is \fInot\fP an emulator. It will not execute IR of different architectures +and it can only interpret (or JIT\-compile) for the host architecture. +.sp +The JIT compiler takes the same arguments as other tools, like \fBllc\fP, +but they don\(aqt necessarily work for the interpreter. +.sp +If \fIfilename\fP is not specified, then \fBlli\fP reads the LLVM bitcode for the +program from standard input. +.sp +The optional \fIargs\fP specified on the command line are passed to the program as +arguments. +.SH GENERAL OPTIONS +.INDENT 0.0 +.TP +.B \-fake\-argv0=executable +Override the \fBargv[0]\fP value passed into the executing program. +.UNINDENT +.INDENT 0.0 +.TP +.B \-force\-interpreter={false,true} +If set to true, use the interpreter even if a just\-in\-time compiler is available +for this architecture. Defaults to false. +.UNINDENT +.INDENT 0.0 +.TP +.B \-help +Print a summary of command line options. +.UNINDENT +.INDENT 0.0 +.TP +.B \-load=pluginfilename +Causes \fBlli\fP to load the plugin (shared object) named \fIpluginfilename\fP and use +it for optimization. +.UNINDENT +.INDENT 0.0 +.TP +.B \-stats +Print statistics from the code\-generation passes. This is only meaningful for +the just\-in\-time compiler, at present. +.UNINDENT +.INDENT 0.0 +.TP +.B \-time\-passes +Record the amount of time needed for each code\-generation pass and print it to +standard error. +.UNINDENT +.INDENT 0.0 +.TP +.B \-version +Print out the version of \fBlli\fP and exit without doing anything else. +.UNINDENT +.SH TARGET OPTIONS +.INDENT 0.0 +.TP +.B \-mtriple=target triple +Override the target triple specified in the input bitcode file with the +specified string. This may result in a crash if you pick an +architecture which is not compatible with the current system. +.UNINDENT +.INDENT 0.0 +.TP +.B \-march=arch +Specify the architecture for which to generate assembly, overriding the target +encoded in the bitcode file. See the output of \fBllc \-help\fP for a list of +valid architectures. By default this is inferred from the target triple or +autodetected to the current architecture. +.UNINDENT +.INDENT 0.0 +.TP +.B \-mcpu=cpuname +Specify a specific chip in the current architecture to generate code for. +By default this is inferred from the target triple and autodetected to +the current architecture. For a list of available CPUs, use: +\fBllvm\-as < /dev/null | llc \-march=xyz \-mcpu=help\fP +.UNINDENT +.INDENT 0.0 +.TP +.B \-mattr=a1,+a2,\-a3,... +Override or control specific attributes of the target, such as whether SIMD +operations are enabled or not. The default set of attributes is set by the +current CPU. For a list of available attributes, use: +\fBllvm\-as < /dev/null | llc \-march=xyz \-mattr=help\fP +.UNINDENT +.SH FLOATING POINT OPTIONS +.INDENT 0.0 +.TP +.B \-disable\-excess\-fp\-precision +Disable optimizations that may increase floating point precision. +.UNINDENT +.INDENT 0.0 +.TP +.B \-enable\-no\-infs\-fp\-math +Enable optimizations that assume no Inf values. +.UNINDENT +.INDENT 0.0 +.TP +.B \-enable\-no\-nans\-fp\-math +Enable optimizations that assume no NAN values. +.UNINDENT +.INDENT 0.0 +.TP +.B \-enable\-unsafe\-fp\-math +Causes \fBlli\fP to enable optimizations that may decrease floating point +precision. +.UNINDENT +.INDENT 0.0 +.TP +.B \-soft\-float +Causes \fBlli\fP to generate software floating point library calls instead of +equivalent hardware instructions. +.UNINDENT +.SH CODE GENERATION OPTIONS +.INDENT 0.0 +.TP +.B \-code\-model=model +Choose the code model from: +.INDENT 7.0 +.INDENT 3.5 +.sp +.nf +.ft C +default: Target default code model +tiny: Tiny code model +small: Small code model +kernel: Kernel code model +medium: Medium code model +large: Large code model +.ft P +.fi +.UNINDENT +.UNINDENT +.UNINDENT +.INDENT 0.0 +.TP +.B \-disable\-post\-RA\-scheduler +Disable scheduling after register allocation. +.UNINDENT +.INDENT 0.0 +.TP +.B \-disable\-spill\-fusing +Disable fusing of spill code into instructions. +.UNINDENT +.INDENT 0.0 +.TP +.B \-jit\-enable\-eh +Exception handling should be enabled in the just\-in\-time compiler. +.UNINDENT +.INDENT 0.0 +.TP +.B \-join\-liveintervals +Coalesce copies (default=true). +.UNINDENT +.INDENT 0.0 +.TP +.B \-nozero\-initialized\-in\-bss +Don\(aqt place zero\-initialized symbols into the BSS section. +.UNINDENT +.INDENT 0.0 +.TP +.B \-pre\-RA\-sched=scheduler +Instruction schedulers available (before register allocation): +.INDENT 7.0 +.INDENT 3.5 +.sp +.nf +.ft C +=default: Best scheduler for the target +=none: No scheduling: breadth first sequencing +=simple: Simple two pass scheduling: minimize critical path and maximize processor utilization +=simple\-noitin: Simple two pass scheduling: Same as simple except using generic latency +=list\-burr: Bottom\-up register reduction list scheduling +=list\-tdrr: Top\-down register reduction list scheduling +=list\-td: Top\-down list scheduler +.ft P +.fi +.UNINDENT +.UNINDENT +.UNINDENT +.INDENT 0.0 +.TP +.B \-regalloc=allocator +Register allocator to use (default=linearscan) +.INDENT 7.0 +.INDENT 3.5 +.sp +.nf +.ft C +=bigblock: Big\-block register allocator +=linearscan: linear scan register allocator =local \- local register allocator +=simple: simple register allocator +.ft P +.fi +.UNINDENT +.UNINDENT +.UNINDENT +.INDENT 0.0 +.TP +.B \-relocation\-model=model +Choose relocation model from: +.INDENT 7.0 +.INDENT 3.5 +.sp +.nf +.ft C +=default: Target default relocation model +=static: Non\-relocatable code =pic \- Fully relocatable, position independent code +=dynamic\-no\-pic: Relocatable external references, non\-relocatable code +.ft P +.fi +.UNINDENT +.UNINDENT +.UNINDENT +.INDENT 0.0 +.TP +.B \-spiller +Spiller to use (default=local) +.INDENT 7.0 +.INDENT 3.5 +.sp +.nf +.ft C +=simple: simple spiller +=local: local spiller +.ft P +.fi +.UNINDENT +.UNINDENT +.UNINDENT +.INDENT 0.0 +.TP +.B \-x86\-asm\-syntax=syntax +Choose style of code to emit from X86 backend: +.INDENT 7.0 +.INDENT 3.5 +.sp +.nf +.ft C +=att: Emit AT&T\-style assembly +=intel: Emit Intel\-style assembly +.ft P +.fi +.UNINDENT +.UNINDENT +.UNINDENT +.SH EXIT STATUS +.sp +If \fBlli\fP fails to load the program, it will exit with an exit code of 1. +Otherwise, it will return the exit code of the program it executes. +.SH SEE ALSO +.sp +\fBllc(1)\fP +.SH AUTHOR +Maintained by the LLVM Team (https://llvm.org/). +.SH COPYRIGHT +2003-2021, LLVM Project +.\" Generated by docutils manpage writer. +. diff --git a/usr.bin/clang/llvm-ar/Makefile b/usr.bin/clang/llvm-ar/Makefile new file mode 100644 index 000000000000..3718248f5de9 --- /dev/null +++ b/usr.bin/clang/llvm-ar/Makefile @@ -0,0 +1,22 @@ +# $FreeBSD$ + +.include <src.opts.mk> + +PROG_CXX= llvm-ar +MAN= llvm-ar.1 llvm-ranlib.1 + +SRCDIR= llvm/tools/llvm-ar +SRCS+= llvm-ar.cpp + +CFLAGS.llvm-ar.cpp+= -Dllvm_ar_main=main + +LIBADD+= z + +LINKS+= ${BINDIR}/llvm-ar ${BINDIR}/llvm-ranlib + +.if ${MK_LLVM_BINUTILS} != "no" +LINKS+= ${BINDIR}/llvm-ar ${BINDIR}/ar ${BINDIR}/llvm-ar ${BINDIR}/ranlib +MLINKS+= llvm-ar.1 ar.1 llvm-ar.1 ranlib.1 +.endif + +.include "../llvm.prog.mk" diff --git a/usr.bin/clang/llvm-ar/Makefile.depend b/usr.bin/clang/llvm-ar/Makefile.depend new file mode 100644 index 000000000000..1423340957b6 --- /dev/null +++ b/usr.bin/clang/llvm-ar/Makefile.depend @@ -0,0 +1,24 @@ +# $FreeBSD$ +# Autogenerated - do NOT edit! + +DIRDEPS = \ + gnu/lib/csu \ + include \ + include/xlocale \ + lib/${CSU_DIR} \ + lib/clang/libllvm \ + lib/libc \ + lib/libc++ \ + lib/libcompiler_rt \ + lib/libcxxrt \ + lib/libthr \ + lib/libz \ + lib/msun \ + lib/ncurses/ncursesw \ + + +.include <dirdeps.mk> + +.if ${DEP_RELDIR} == ${_DEP_RELDIR} +# local dependencies - needed for -jN in clean tree +.endif diff --git a/usr.bin/clang/llvm-ar/llvm-ar.1 b/usr.bin/clang/llvm-ar/llvm-ar.1 new file mode 100644 index 000000000000..d386e6bcc6fa --- /dev/null +++ b/usr.bin/clang/llvm-ar/llvm-ar.1 @@ -0,0 +1,420 @@ +.\" $FreeBSD$ +.\" Man page generated from reStructuredText. +. +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.TH "LLVM-AR" "1" "2021-06-07" "12" "LLVM" +.SH NAME +llvm-ar \- LLVM archiver +.SH SYNOPSIS +.sp +\fBllvm\-ar\fP [\-]{dmpqrstx}[abcDilLNoOPsSTuUvV] [relpos] [count] archive [files...] +.SH DESCRIPTION +.sp +The \fBllvm\-ar\fP command is similar to the common Unix utility, +\fBar\fP\&. It archives several files, such as objects and LLVM bitcode +files into a single archive library that can be linked into a program. However, +the archive can contain any kind of file. By default, \fBllvm\-ar\fP +generates a symbol table that makes linking faster because only the symbol +table needs to be consulted, not each individual file member of the archive. +.sp +The \fBllvm\-ar\fP command can be used to \fIread\fP archive files in SVR4, +GNU, BSD and Darwin format, and \fIwrite\fP in the GNU, BSD, and Darwin style +archive files. If an SVR4 format archive is used with the \fI\%r\fP +(replace), \fI\%d\fP (delete), \fI\%m\fP (move) or \fI\%q\fP +(quick update) operations, the archive will be reconstructed in the format +defined by \fI\%\-\-format\fP\&. +.sp +Here\(aqs where \fBllvm\-ar\fP departs from previous \fBar\fP +implementations: +.sp +\fIThe following option is not supported\fP +.INDENT 0.0 +.INDENT 3.5 +[f] \- truncate inserted filenames +.UNINDENT +.UNINDENT +.sp +\fIThe following options are ignored for compatibility\fP +.INDENT 0.0 +.INDENT 3.5 +\-\-plugin=<string> \- load a plugin which adds support for other file formats +.sp +[l] \- ignored in \fBar\fP +.UNINDENT +.UNINDENT +.sp +\fISymbol Table\fP +.INDENT 0.0 +.INDENT 3.5 +Since \fBllvm\-ar\fP supports bitcode files, the symbol table it creates +includes both native and bitcode symbols. +.UNINDENT +.UNINDENT +.sp +\fIDeterministic Archives\fP +.INDENT 0.0 +.INDENT 3.5 +By default, \fBllvm\-ar\fP always uses zero for timestamps and UIDs/GIDs +to write archives in a deterministic mode. This is equivalent to the +\fI\%D\fP modifier being enabled by default. If you wish to maintain +compatibility with other \fBar\fP implementations, you can pass the +\fI\%U\fP modifier to write actual timestamps and UIDs/GIDs. +.UNINDENT +.UNINDENT +.sp +\fIWindows Paths\fP +.INDENT 0.0 +.INDENT 3.5 +When on Windows \fBllvm\-ar\fP treats the names of archived \fIfiles\fP in the same +case sensitive manner as the operating system. When on a non\-Windows machine +\fBllvm\-ar\fP does not consider character case. +.UNINDENT +.UNINDENT +.SH OPTIONS +.sp +\fBllvm\-ar\fP operations are compatible with other \fBar\fP +implementations. However, there are a few modifiers (\fI\%L\fP) that are not +found in other \fBar\fP implementations. The options for +\fBllvm\-ar\fP specify a single basic Operation to perform on the archive, +a variety of Modifiers for that Operation, the name of the archive file, and an +optional list of file names. If the \fIfiles\fP option is not specified, it +generally means either "none" or "all" members, depending on the operation. The +Options, Operations and Modifiers are explained in the sections below. +.sp +The minimal set of options is at least one operator and the name of the +archive. +.SS Operations +.INDENT 0.0 +.TP +.B d [NT] +Delete files from the \fBarchive\fP\&. The \fI\%N\fP and \fI\%T\fP modifiers +apply to this operation. The \fIfiles\fP options specify which members should be +removed from the archive. It is not an error if a specified file does not +appear in the archive. If no \fIfiles\fP are specified, the archive is not +modified. +.UNINDENT +.INDENT 0.0 +.TP +.B m [abi] +Move files from one location in the \fBarchive\fP to another. The \fI\%a\fP, +\fI\%b\fP, and \fI\%i\fP modifiers apply to this operation. The \fIfiles\fP +will all be moved to the location given by the modifiers. If no modifiers are +used, the files will be moved to the end of the archive. If no \fIfiles\fP are +specified, the archive is not modified. +.UNINDENT +.INDENT 0.0 +.TP +.B p [v] +Print \fIfiles\fP to the standard output stream. If no \fIfiles\fP are specified, the +entire \fBarchive\fP is printed. With the \fI\%v\fP modifier, +\fBllvm\-ar\fP also prints out the name of the file being output. Printing +binary files is ill\-advised as they might confuse your terminal settings. The +\fI\%p\fP operation never modifies the archive. +.UNINDENT +.INDENT 0.0 +.TP +.B q [LT] +Quickly append files to the end of the \fBarchive\fP without removing +duplicates. If no \fIfiles\fP are specified, the archive is not modified. The +behavior when appending one archive to another depends upon whether the +\fI\%L\fP and \fI\%T\fP modifiers are used: +.INDENT 7.0 +.IP \(bu 2 +Appending a regular archive to a regular archive will append the archive +file. If the \fI\%L\fP modifier is specified the members will be appended +instead. +.IP \(bu 2 +Appending a regular archive to a thin archive requires the \fI\%T\fP +modifier and will append the archive file. The \fI\%L\fP modifier is not +supported. +.IP \(bu 2 +Appending a thin archive to a regular archive will append the archive file. +If the \fI\%L\fP modifier is specified the members will be appended +instead. +.IP \(bu 2 +Appending a thin archive to a thin archive will always quick append its +members. +.UNINDENT +.UNINDENT +.INDENT 0.0 +.TP +.B r [abTu] +Replace existing \fIfiles\fP or insert them at the end of the \fBarchive\fP if +they do not exist. The \fI\%a\fP, \fI\%b\fP, \fI\%T\fP and \fI\%u\fP +modifiers apply to this operation. If no \fIfiles\fP are specified, the archive +is not modified. +.UNINDENT +.sp +t[v] +\&.. option:: t [vO] +.INDENT 0.0 +.INDENT 3.5 +Print the table of contents. Without any modifiers, this operation just prints +the names of the members to the standard output stream. With the \fI\%v\fP +modifier, \fBllvm\-ar\fP also prints out the file type (B=bitcode, +S=symbol table, blank=regular file), the permission mode, the owner and group, +are ignored when extracting \fIfiles\fP and set to placeholder values when adding +size, and the date. With the \fI\%O\fP modifier, display member offsets. If +any \fIfiles\fP are specified, the listing is only for those files. If no \fIfiles\fP +are specified, the table of contents for the whole archive is printed. +.UNINDENT +.UNINDENT +.INDENT 0.0 +.TP +.B V +A synonym for the \fI\%\-\-version\fP option. +.UNINDENT +.INDENT 0.0 +.TP +.B x [oP] +Extract \fBarchive\fP members back to files. The \fI\%o\fP modifier applies +to this operation. This operation retrieves the indicated \fIfiles\fP from the +archive and writes them back to the operating system\(aqs file system. If no +\fIfiles\fP are specified, the entire archive is extracted. +.UNINDENT +.SS Modifiers (operation specific) +.sp +The modifiers below are specific to certain operations. See the Operations +section to determine which modifiers are applicable to which operations. +.INDENT 0.0 +.TP +.B a +When inserting or moving member files, this option specifies the destination +of the new files as being after the \fIrelpos\fP member. If \fIrelpos\fP is not found, +the files are placed at the end of the \fBarchive\fP\&. \fIrelpos\fP cannot be +consumed without either \fI\%a\fP, \fI\%b\fP or \fI\%i\fP\&. +.UNINDENT +.INDENT 0.0 +.TP +.B b +When inserting or moving member files, this option specifies the destination +of the new files as being before the \fIrelpos\fP member. If \fIrelpos\fP is not +found, the files are placed at the end of the \fBarchive\fP\&. \fIrelpos\fP cannot +be consumed without either \fI\%a\fP, \fI\%b\fP or \fI\%i\fP\&. This +modifier is identical to the \fI\%i\fP modifier. +.UNINDENT +.INDENT 0.0 +.TP +.B i +A synonym for the \fI\%b\fP option. +.UNINDENT +.INDENT 0.0 +.TP +.B L +When quick appending an \fBarchive\fP, instead quick append its members. This +is a feature for \fBllvm\-ar\fP that is not found in gnu\-ar. +.UNINDENT +.INDENT 0.0 +.TP +.B N +When extracting or deleting a member that shares its name with another member, +the \fIcount\fP parameter allows you to supply a positive whole number that +selects the instance of the given name, with "1" indicating the first +instance. If \fI\%N\fP is not specified the first member of that name will +be selected. If \fIcount\fP is not supplied, the operation fails.*count* cannot be +.UNINDENT +.INDENT 0.0 +.TP +.B o +When extracting files, use the modification times of any \fIfiles\fP as they +appear in the \fBarchive\fP\&. By default \fIfiles\fP extracted from the archive +use the time of extraction. +.UNINDENT +.INDENT 0.0 +.TP +.B O +Display member offsets inside the archive. +.UNINDENT +.INDENT 0.0 +.TP +.B T +When creating or modifying an archive, this option specifies that the +\fBarchive\fP will be thin. By default, archives are not created as thin +archives and when modifying a thin archive, it will be converted to a regular +archive. +.UNINDENT +.INDENT 0.0 +.TP +.B v +When printing \fIfiles\fP or the \fBarchive\fP table of contents, this modifier +instructs \fBllvm\-ar\fP to include additional information in the output. +.UNINDENT +.SS Modifiers (generic) +.sp +The modifiers below may be applied to any operation. +.INDENT 0.0 +.TP +.B c +For the \fI\%r\fP (replace)and \fI\%q\fP (quick update) operations, +\fBllvm\-ar\fP will always create the archive if it doesn\(aqt exist. +Normally, \fBllvm\-ar\fP will print a warning message indicating that the +\fBarchive\fP is being created. Using this modifier turns off +that warning. +.UNINDENT +.INDENT 0.0 +.TP +.B D +Use zero for timestamps and UIDs/GIDs. This is set by default. +.UNINDENT +.INDENT 0.0 +.TP +.B P +Use full paths when matching member names rather than just the file name. +This can be useful when manipulating an \fBarchive\fP generated by another +archiver, as some allow paths as member names. This is the default behavior +for thin archives. +.UNINDENT +.INDENT 0.0 +.TP +.B s +This modifier requests that an archive index (or symbol table) be added to the +\fBarchive\fP, as if using ranlib. The symbol table will contain all the +externally visible functions and global variables defined by all the bitcode +files in the archive. By default \fBllvm\-ar\fP generates symbol tables in +archives. This can also be used as an operation. +.UNINDENT +.INDENT 0.0 +.TP +.B S +This modifier is the opposite of the \fI\%s\fP modifier. It instructs +\fBllvm\-ar\fP to not build the symbol table. If both \fI\%s\fP and +\fI\%S\fP are used, the last modifier to occur in the options will prevail. +.UNINDENT +.INDENT 0.0 +.TP +.B u +Only update \fBarchive\fP members with \fIfiles\fP that have more recent +timestamps. +.UNINDENT +.INDENT 0.0 +.TP +.B U +Use actual timestamps and UIDs/GIDs. +.UNINDENT +.SS Other +.INDENT 0.0 +.TP +.B \-\-format=<type> +This option allows for default, gnu, darwin or bsd \fB<type>\fP to be selected. +When creating an \fBarchive\fP, \fB<type>\fP will default to that of the host +machine. +.UNINDENT +.INDENT 0.0 +.TP +.B \-h, \-\-help +Print a summary of command\-line options and their meanings. +.UNINDENT +.INDENT 0.0 +.TP +.B \-M +This option allows for MRI scripts to be read through the standard input +stream. No other options are compatible with this option. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-version +Display the version of the \fBllvm\-ar\fP executable. +.UNINDENT +.INDENT 0.0 +.TP +.B @<FILE> +Read command\-line options and commands from response file \fB<FILE>\fP\&. +.UNINDENT +.SH MRI SCRIPTS +.sp +\fBllvm\-ar\fP understands a subset of the MRI scripting interface commonly +supported by archivers following in the ar tradition. An MRI script contains a +sequence of commands to be executed by the archiver. The \fI\%\-M\fP option +allows for an MRI script to be passed to \fBllvm\-ar\fP through the +standard input stream. +.sp +Note that \fBllvm\-ar\fP has known limitations regarding the use of MRI +scripts: +.INDENT 0.0 +.IP \(bu 2 +Each script can only create one archive. +.IP \(bu 2 +Existing archives can not be modified. +.UNINDENT +.SS MRI Script Commands +.sp +Each command begins with the command\(aqs name and must appear on its own line. +Some commands have arguments, which must be separated from the name by +whitespace. An MRI script should begin with either a \fI\%CREATE\fP or +\fI\%CREATETHIN\fP command and will typically end with a \fI\%SAVE\fP +command. Any text after either \(aq*\(aq or \(aq;\(aq is treated as a comment. +.INDENT 0.0 +.TP +.B CREATE archive +Begin creation of a regular archive with the specified name. Subsequent +commands act upon this \fBarchive\fP\&. +.UNINDENT +.INDENT 0.0 +.TP +.B CREATETHIN archive +Begin creation of a thin archive with the specified name. Subsequent +commands act upon this \fBarchive\fP\&. +.UNINDENT +.INDENT 0.0 +.TP +.B ADDLIB archive +Append the contents of \fBarchive\fP to the current archive. +.UNINDENT +.INDENT 0.0 +.TP +.B ADDMOD <file> +Append \fB<file>\fP to the current archive. +.UNINDENT +.INDENT 0.0 +.TP +.B DELETE <file> +Delete the member of the current archive whose file name, excluding directory +components, matches \fB<file>\fP\&. +.UNINDENT +.INDENT 0.0 +.TP +.B SAVE +Write the current archive to the path specified in the previous +\fI\%CREATE\fP/\fI\%CREATETHIN\fP command. +.UNINDENT +.INDENT 0.0 +.TP +.B END +Ends the MRI script (optional). +.UNINDENT +.SH EXIT STATUS +.sp +If \fBllvm\-ar\fP succeeds, it will exit with 0. Otherwise, if an error occurs, it +will exit with a non\-zero value. +.SH AUTHOR +Maintained by the LLVM Team (https://llvm.org/). +.SH COPYRIGHT +2003-2021, LLVM Project +.\" Generated by docutils manpage writer. +. diff --git a/usr.bin/clang/llvm-ar/llvm-ranlib.1 b/usr.bin/clang/llvm-ar/llvm-ranlib.1 new file mode 100644 index 000000000000..3fd6e6618dd1 --- /dev/null +++ b/usr.bin/clang/llvm-ar/llvm-ranlib.1 @@ -0,0 +1,52 @@ +.\" $FreeBSD$ +.\" Man page generated from reStructuredText. +. +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.TH "LLVM-RANLIB" "1" "2021-06-07" "12" "LLVM" +.SH NAME +llvm-ranlib \- generates an archive index +.SH SYNOPSIS +.sp +\fBllvm\-ranlib\fP [\fIoptions\fP] +.SH DESCRIPTION +.sp +\fBllvm\-ranlib\fP is an alias for the llvm\-ar tool that +generates an index for an archive. It can be used as a replacement for GNU\(aqs +\fBranlib\fP tool. +.sp +Running \fBllvm\-ranlib\fP is equivalent to running \fBllvm\-ar s\fP\&. +.SH SEE ALSO +.sp +\fBllvm\-ar(1)\fP +.SH AUTHOR +Maintained by the LLVM Team (https://llvm.org/). +.SH COPYRIGHT +2003-2021, LLVM Project +.\" Generated by docutils manpage writer. +. diff --git a/usr.bin/clang/llvm-as/Makefile b/usr.bin/clang/llvm-as/Makefile new file mode 100644 index 000000000000..49d9d172e341 --- /dev/null +++ b/usr.bin/clang/llvm-as/Makefile @@ -0,0 +1,8 @@ +# $FreeBSD$ + +PROG_CXX= llvm-as + +SRCDIR= llvm/tools/llvm-as +SRCS+= llvm-as.cpp + +.include "../llvm.prog.mk" diff --git a/usr.bin/clang/llvm-as/Makefile.depend b/usr.bin/clang/llvm-as/Makefile.depend new file mode 100644 index 000000000000..1423340957b6 --- /dev/null +++ b/usr.bin/clang/llvm-as/Makefile.depend @@ -0,0 +1,24 @@ +# $FreeBSD$ +# Autogenerated - do NOT edit! + +DIRDEPS = \ + gnu/lib/csu \ + include \ + include/xlocale \ + lib/${CSU_DIR} \ + lib/clang/libllvm \ + lib/libc \ + lib/libc++ \ + lib/libcompiler_rt \ + lib/libcxxrt \ + lib/libthr \ + lib/libz \ + lib/msun \ + lib/ncurses/ncursesw \ + + +.include <dirdeps.mk> + +.if ${DEP_RELDIR} == ${_DEP_RELDIR} +# local dependencies - needed for -jN in clean tree +.endif diff --git a/usr.bin/clang/llvm-as/llvm-as.1 b/usr.bin/clang/llvm-as/llvm-as.1 new file mode 100644 index 000000000000..e6e7be2ad85d --- /dev/null +++ b/usr.bin/clang/llvm-as/llvm-as.1 @@ -0,0 +1,87 @@ +.\" $FreeBSD$ +.\" Man page generated from reStructuredText. +. +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.TH "LLVM-AS" "1" "2021-06-07" "12" "LLVM" +.SH NAME +llvm-as \- LLVM assembler +.SH SYNOPSIS +.sp +\fBllvm\-as\fP [\fIoptions\fP] [\fIfilename\fP] +.SH DESCRIPTION +.sp +\fBllvm\-as\fP is the LLVM assembler. It reads a file containing human\-readable +LLVM assembly language, translates it to LLVM bitcode, and writes the result +into a file or to standard output. +.sp +If \fIfilename\fP is omitted or is \fB\-\fP, then \fBllvm\-as\fP reads its input from +standard input. +.sp +If an output file is not specified with the \fB\-o\fP option, then +\fBllvm\-as\fP sends its output to a file or standard output by following +these rules: +.INDENT 0.0 +.IP \(bu 2 +If the input is standard input, then the output is standard output. +.IP \(bu 2 +If the input is a file that ends with \fB\&.ll\fP, then the output file is of the +same name, except that the suffix is changed to \fB\&.bc\fP\&. +.IP \(bu 2 +If the input is a file that does not end with the \fB\&.ll\fP suffix, then the +output file has the same name as the input file, except that the \fB\&.bc\fP +suffix is appended. +.UNINDENT +.SH OPTIONS +.INDENT 0.0 +.TP +\fB\-f\fP +Enable binary output on terminals. Normally, \fBllvm\-as\fP will refuse to +write raw bitcode output if the output stream is a terminal. With this option, +\fBllvm\-as\fP will write raw bitcode regardless of the output device. +.TP +\fB\-help\fP +Print a summary of command line options. +.TP +\fB\-o\fP \fIfilename\fP +Specify the output file name. If \fIfilename\fP is \fB\-\fP, then \fBllvm\-as\fP +sends its output to standard output. +.UNINDENT +.SH EXIT STATUS +.sp +If \fBllvm\-as\fP succeeds, it will exit with 0. Otherwise, if an error occurs, it +will exit with a non\-zero value. +.SH SEE ALSO +.sp +\fBllvm\-dis(1)\fP, as(1) +.SH AUTHOR +Maintained by the LLVM Team (https://llvm.org/). +.SH COPYRIGHT +2003-2021, LLVM Project +.\" Generated by docutils manpage writer. +. diff --git a/usr.bin/clang/llvm-bcanalyzer/Makefile b/usr.bin/clang/llvm-bcanalyzer/Makefile new file mode 100644 index 000000000000..ad327ce2832e --- /dev/null +++ b/usr.bin/clang/llvm-bcanalyzer/Makefile @@ -0,0 +1,8 @@ +# $FreeBSD$ + +PROG_CXX= llvm-bcanalyzer + +SRCDIR= llvm/tools/llvm-bcanalyzer +SRCS+= llvm-bcanalyzer.cpp + +.include "../llvm.prog.mk" diff --git a/usr.bin/clang/llvm-bcanalyzer/Makefile.depend b/usr.bin/clang/llvm-bcanalyzer/Makefile.depend new file mode 100644 index 000000000000..1423340957b6 --- /dev/null +++ b/usr.bin/clang/llvm-bcanalyzer/Makefile.depend @@ -0,0 +1,24 @@ +# $FreeBSD$ +# Autogenerated - do NOT edit! + +DIRDEPS = \ + gnu/lib/csu \ + include \ + include/xlocale \ + lib/${CSU_DIR} \ + lib/clang/libllvm \ + lib/libc \ + lib/libc++ \ + lib/libcompiler_rt \ + lib/libcxxrt \ + lib/libthr \ + lib/libz \ + lib/msun \ + lib/ncurses/ncursesw \ + + +.include <dirdeps.mk> + +.if ${DEP_RELDIR} == ${_DEP_RELDIR} +# local dependencies - needed for -jN in clean tree +.endif diff --git a/usr.bin/clang/llvm-bcanalyzer/llvm-bcanalyzer.1 b/usr.bin/clang/llvm-bcanalyzer/llvm-bcanalyzer.1 new file mode 100644 index 000000000000..edf11f29b7df --- /dev/null +++ b/usr.bin/clang/llvm-bcanalyzer/llvm-bcanalyzer.1 @@ -0,0 +1,476 @@ +.\" $FreeBSD$ +.\" Man page generated from reStructuredText. +. +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.TH "LLVM-BCANALYZER" "1" "2021-06-07" "12" "LLVM" +.SH NAME +llvm-bcanalyzer \- LLVM bitcode analyzer +.SH SYNOPSIS +.sp +\fBllvm\-bcanalyzer\fP [\fIoptions\fP] [\fIfilename\fP] +.SH DESCRIPTION +.sp +The \fBllvm\-bcanalyzer\fP command is a small utility for analyzing bitcode +files. The tool reads a bitcode file (such as generated with the +\fBllvm\-as\fP tool) and produces a statistical report on the contents of +the bitcode file. The tool can also dump a low level but human readable +version of the bitcode file. This tool is probably not of much interest or +utility except for those working directly with the bitcode file format. Most +LLVM users can just ignore this tool. +.sp +If \fIfilename\fP is omitted or is \fB\-\fP, then \fBllvm\-bcanalyzer\fP reads its +input from standard input. This is useful for combining the tool into a +pipeline. Output is written to the standard output. +.SH OPTIONS +.INDENT 0.0 +.TP +.B \-nodetails +Causes \fBllvm\-bcanalyzer\fP to abbreviate its output by writing out only +a module level summary. The details for individual functions are not +displayed. +.UNINDENT +.INDENT 0.0 +.TP +.B \-dump +Causes \fBllvm\-bcanalyzer\fP to dump the bitcode in a human readable +format. This format is significantly different from LLVM assembly and +provides details about the encoding of the bitcode file. +.UNINDENT +.INDENT 0.0 +.TP +.B \-verify +Causes \fBllvm\-bcanalyzer\fP to verify the module produced by reading the +bitcode. This ensures that the statistics generated are based on a consistent +module. +.UNINDENT +.INDENT 0.0 +.TP +.B \-help +Print a summary of command line options. +.UNINDENT +.SH EXIT STATUS +.sp +If \fBllvm\-bcanalyzer\fP succeeds, it will exit with 0. Otherwise, if an +error occurs, it will exit with a non\-zero value, usually 1. +.SH SUMMARY OUTPUT DEFINITIONS +.sp +The following items are always printed by llvm\-bcanalyzer. They comprize the +summary output. +.sp +\fBBitcode Analysis Of Module\fP +.INDENT 0.0 +.INDENT 3.5 +This just provides the name of the module for which bitcode analysis is being +generated. +.UNINDENT +.UNINDENT +.sp +\fBBitcode Version Number\fP +.INDENT 0.0 +.INDENT 3.5 +The bitcode version (not LLVM version) of the file read by the analyzer. +.UNINDENT +.UNINDENT +.sp +\fBFile Size\fP +.INDENT 0.0 +.INDENT 3.5 +The size, in bytes, of the entire bitcode file. +.UNINDENT +.UNINDENT +.sp +\fBModule Bytes\fP +.INDENT 0.0 +.INDENT 3.5 +The size, in bytes, of the module block. Percentage is relative to File Size. +.UNINDENT +.UNINDENT +.sp +\fBFunction Bytes\fP +.INDENT 0.0 +.INDENT 3.5 +The size, in bytes, of all the function blocks. Percentage is relative to File +Size. +.UNINDENT +.UNINDENT +.sp +\fBGlobal Types Bytes\fP +.INDENT 0.0 +.INDENT 3.5 +The size, in bytes, of the Global Types Pool. Percentage is relative to File +Size. This is the size of the definitions of all types in the bitcode file. +.UNINDENT +.UNINDENT +.sp +\fBConstant Pool Bytes\fP +.INDENT 0.0 +.INDENT 3.5 +The size, in bytes, of the Constant Pool Blocks Percentage is relative to File +Size. +.UNINDENT +.UNINDENT +.sp +\fBModule Globals Bytes\fP +.INDENT 0.0 +.INDENT 3.5 +Ths size, in bytes, of the Global Variable Definitions and their initializers. +Percentage is relative to File Size. +.UNINDENT +.UNINDENT +.sp +\fBInstruction List Bytes\fP +.INDENT 0.0 +.INDENT 3.5 +The size, in bytes, of all the instruction lists in all the functions. +Percentage is relative to File Size. Note that this value is also included in +the Function Bytes. +.UNINDENT +.UNINDENT +.sp +\fBCompaction Table Bytes\fP +.INDENT 0.0 +.INDENT 3.5 +The size, in bytes, of all the compaction tables in all the functions. +Percentage is relative to File Size. Note that this value is also included in +the Function Bytes. +.UNINDENT +.UNINDENT +.sp +\fBSymbol Table Bytes\fP +.INDENT 0.0 +.INDENT 3.5 +The size, in bytes, of all the symbol tables in all the functions. Percentage is +relative to File Size. Note that this value is also included in the Function +Bytes. +.UNINDENT +.UNINDENT +.sp +\fBDependent Libraries Bytes\fP +.INDENT 0.0 +.INDENT 3.5 +The size, in bytes, of the list of dependent libraries in the module. Percentage +is relative to File Size. Note that this value is also included in the Module +Global Bytes. +.UNINDENT +.UNINDENT +.sp +\fBNumber Of Bitcode Blocks\fP +.INDENT 0.0 +.INDENT 3.5 +The total number of blocks of any kind in the bitcode file. +.UNINDENT +.UNINDENT +.sp +\fBNumber Of Functions\fP +.INDENT 0.0 +.INDENT 3.5 +The total number of function definitions in the bitcode file. +.UNINDENT +.UNINDENT +.sp +\fBNumber Of Types\fP +.INDENT 0.0 +.INDENT 3.5 +The total number of types defined in the Global Types Pool. +.UNINDENT +.UNINDENT +.sp +\fBNumber Of Constants\fP +.INDENT 0.0 +.INDENT 3.5 +The total number of constants (of any type) defined in the Constant Pool. +.UNINDENT +.UNINDENT +.sp +\fBNumber Of Basic Blocks\fP +.INDENT 0.0 +.INDENT 3.5 +The total number of basic blocks defined in all functions in the bitcode file. +.UNINDENT +.UNINDENT +.sp +\fBNumber Of Instructions\fP +.INDENT 0.0 +.INDENT 3.5 +The total number of instructions defined in all functions in the bitcode file. +.UNINDENT +.UNINDENT +.sp +\fBNumber Of Long Instructions\fP +.INDENT 0.0 +.INDENT 3.5 +The total number of long instructions defined in all functions in the bitcode +file. Long instructions are those taking greater than 4 bytes. Typically long +instructions are GetElementPtr with several indices, PHI nodes, and calls to +functions with large numbers of arguments. +.UNINDENT +.UNINDENT +.sp +\fBNumber Of Operands\fP +.INDENT 0.0 +.INDENT 3.5 +The total number of operands used in all instructions in the bitcode file. +.UNINDENT +.UNINDENT +.sp +\fBNumber Of Compaction Tables\fP +.INDENT 0.0 +.INDENT 3.5 +The total number of compaction tables in all functions in the bitcode file. +.UNINDENT +.UNINDENT +.sp +\fBNumber Of Symbol Tables\fP +.INDENT 0.0 +.INDENT 3.5 +The total number of symbol tables in all functions in the bitcode file. +.UNINDENT +.UNINDENT +.sp +\fBNumber Of Dependent Libs\fP +.INDENT 0.0 +.INDENT 3.5 +The total number of dependent libraries found in the bitcode file. +.UNINDENT +.UNINDENT +.sp +\fBTotal Instruction Size\fP +.INDENT 0.0 +.INDENT 3.5 +The total size of the instructions in all functions in the bitcode file. +.UNINDENT +.UNINDENT +.sp +\fBAverage Instruction Size\fP +.INDENT 0.0 +.INDENT 3.5 +The average number of bytes per instruction across all functions in the bitcode +file. This value is computed by dividing Total Instruction Size by Number Of +Instructions. +.UNINDENT +.UNINDENT +.sp +\fBMaximum Type Slot Number\fP +.INDENT 0.0 +.INDENT 3.5 +The maximum value used for a type\(aqs slot number. Larger slot number values take +more bytes to encode. +.UNINDENT +.UNINDENT +.sp +\fBMaximum Value Slot Number\fP +.INDENT 0.0 +.INDENT 3.5 +The maximum value used for a value\(aqs slot number. Larger slot number values take +more bytes to encode. +.UNINDENT +.UNINDENT +.sp +\fBBytes Per Value\fP +.INDENT 0.0 +.INDENT 3.5 +The average size of a Value definition (of any type). This is computed by +dividing File Size by the total number of values of any type. +.UNINDENT +.UNINDENT +.sp +\fBBytes Per Global\fP +.INDENT 0.0 +.INDENT 3.5 +The average size of a global definition (constants and global variables). +.UNINDENT +.UNINDENT +.sp +\fBBytes Per Function\fP +.INDENT 0.0 +.INDENT 3.5 +The average number of bytes per function definition. This is computed by +dividing Function Bytes by Number Of Functions. +.UNINDENT +.UNINDENT +.sp +\fB# of VBR 32\-bit Integers\fP +.INDENT 0.0 +.INDENT 3.5 +The total number of 32\-bit integers encoded using the Variable Bit Rate +encoding scheme. +.UNINDENT +.UNINDENT +.sp +\fB# of VBR 64\-bit Integers\fP +.INDENT 0.0 +.INDENT 3.5 +The total number of 64\-bit integers encoded using the Variable Bit Rate encoding +scheme. +.UNINDENT +.UNINDENT +.sp +\fB# of VBR Compressed Bytes\fP +.INDENT 0.0 +.INDENT 3.5 +The total number of bytes consumed by the 32\-bit and 64\-bit integers that use +the Variable Bit Rate encoding scheme. +.UNINDENT +.UNINDENT +.sp +\fB# of VBR Expanded Bytes\fP +.INDENT 0.0 +.INDENT 3.5 +The total number of bytes that would have been consumed by the 32\-bit and 64\-bit +integers had they not been compressed with the Variable Bit Rage encoding +scheme. +.UNINDENT +.UNINDENT +.sp +\fBBytes Saved With VBR\fP +.INDENT 0.0 +.INDENT 3.5 +The total number of bytes saved by using the Variable Bit Rate encoding scheme. +The percentage is relative to # of VBR Expanded Bytes. +.UNINDENT +.UNINDENT +.SH DETAILED OUTPUT DEFINITIONS +.sp +The following definitions occur only if the \-nodetails option was not given. +The detailed output provides additional information on a per\-function basis. +.sp +\fBType\fP +.INDENT 0.0 +.INDENT 3.5 +The type signature of the function. +.UNINDENT +.UNINDENT +.sp +\fBByte Size\fP +.INDENT 0.0 +.INDENT 3.5 +The total number of bytes in the function\(aqs block. +.UNINDENT +.UNINDENT +.sp +\fBBasic Blocks\fP +.INDENT 0.0 +.INDENT 3.5 +The number of basic blocks defined by the function. +.UNINDENT +.UNINDENT +.sp +\fBInstructions\fP +.INDENT 0.0 +.INDENT 3.5 +The number of instructions defined by the function. +.UNINDENT +.UNINDENT +.sp +\fBLong Instructions\fP +.INDENT 0.0 +.INDENT 3.5 +The number of instructions using the long instruction format in the function. +.UNINDENT +.UNINDENT +.sp +\fBOperands\fP +.INDENT 0.0 +.INDENT 3.5 +The number of operands used by all instructions in the function. +.UNINDENT +.UNINDENT +.sp +\fBInstruction Size\fP +.INDENT 0.0 +.INDENT 3.5 +The number of bytes consumed by instructions in the function. +.UNINDENT +.UNINDENT +.sp +\fBAverage Instruction Size\fP +.INDENT 0.0 +.INDENT 3.5 +The average number of bytes consumed by the instructions in the function. +This value is computed by dividing Instruction Size by Instructions. +.UNINDENT +.UNINDENT +.sp +\fBBytes Per Instruction\fP +.INDENT 0.0 +.INDENT 3.5 +The average number of bytes used by the function per instruction. This value +is computed by dividing Byte Size by Instructions. Note that this is not the +same as Average Instruction Size. It computes a number relative to the total +function size not just the size of the instruction list. +.UNINDENT +.UNINDENT +.sp +\fBNumber of VBR 32\-bit Integers\fP +.INDENT 0.0 +.INDENT 3.5 +The total number of 32\-bit integers found in this function (for any use). +.UNINDENT +.UNINDENT +.sp +\fBNumber of VBR 64\-bit Integers\fP +.INDENT 0.0 +.INDENT 3.5 +The total number of 64\-bit integers found in this function (for any use). +.UNINDENT +.UNINDENT +.sp +\fBNumber of VBR Compressed Bytes\fP +.INDENT 0.0 +.INDENT 3.5 +The total number of bytes in this function consumed by the 32\-bit and 64\-bit +integers that use the Variable Bit Rate encoding scheme. +.UNINDENT +.UNINDENT +.sp +\fBNumber of VBR Expanded Bytes\fP +.INDENT 0.0 +.INDENT 3.5 +The total number of bytes in this function that would have been consumed by +the 32\-bit and 64\-bit integers had they not been compressed with the Variable +Bit Rate encoding scheme. +.UNINDENT +.UNINDENT +.sp +\fBBytes Saved With VBR\fP +.INDENT 0.0 +.INDENT 3.5 +The total number of bytes saved in this function by using the Variable Bit +Rate encoding scheme. The percentage is relative to # of VBR Expanded Bytes. +.UNINDENT +.UNINDENT +.SH SEE ALSO +.sp +\fBllvm\-dis(1)\fP, /BitCodeFormat +.SH AUTHOR +Maintained by the LLVM Team (https://llvm.org/). +.SH COPYRIGHT +2003-2021, LLVM Project +.\" Generated by docutils manpage writer. +. diff --git a/usr.bin/clang/llvm-cov/Makefile b/usr.bin/clang/llvm-cov/Makefile new file mode 100644 index 000000000000..d5754223ca0e --- /dev/null +++ b/usr.bin/clang/llvm-cov/Makefile @@ -0,0 +1,25 @@ +# $FreeBSD$ + +.include <src.opts.mk> + +PROG_CXX= llvm-cov +LINKS= ${BINDIR}/llvm-cov ${BINDIR}/gcov +MLINKS= llvm-cov.1 gcov.1 + +SRCDIR= llvm/tools/llvm-cov +SRCS+= CodeCoverage.cpp +SRCS+= CoverageExporterJson.cpp +SRCS+= CoverageExporterLcov.cpp +SRCS+= CoverageFilters.cpp +SRCS+= CoverageReport.cpp +SRCS+= CoverageSummaryInfo.cpp +SRCS+= SourceCoverageView.cpp +SRCS+= SourceCoverageViewHTML.cpp +SRCS+= SourceCoverageViewText.cpp +SRCS+= TestingSupport.cpp +SRCS+= gcov.cpp +SRCS+= llvm-cov.cpp + +LIBADD+= z + +.include "../llvm.prog.mk" diff --git a/usr.bin/clang/llvm-cov/Makefile.depend b/usr.bin/clang/llvm-cov/Makefile.depend new file mode 100644 index 000000000000..1423340957b6 --- /dev/null +++ b/usr.bin/clang/llvm-cov/Makefile.depend @@ -0,0 +1,24 @@ +# $FreeBSD$ +# Autogenerated - do NOT edit! + +DIRDEPS = \ + gnu/lib/csu \ + include \ + include/xlocale \ + lib/${CSU_DIR} \ + lib/clang/libllvm \ + lib/libc \ + lib/libc++ \ + lib/libcompiler_rt \ + lib/libcxxrt \ + lib/libthr \ + lib/libz \ + lib/msun \ + lib/ncurses/ncursesw \ + + +.include <dirdeps.mk> + +.if ${DEP_RELDIR} == ${_DEP_RELDIR} +# local dependencies - needed for -jN in clean tree +.endif diff --git a/usr.bin/clang/llvm-cov/llvm-cov.1 b/usr.bin/clang/llvm-cov/llvm-cov.1 new file mode 100644 index 000000000000..fb1006d4ea94 --- /dev/null +++ b/usr.bin/clang/llvm-cov/llvm-cov.1 @@ -0,0 +1,484 @@ +.\" $FreeBSD$ +.\" Man page generated from reStructuredText. +. +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.TH "LLVM-COV" "1" "2021-06-07" "12" "LLVM" +.SH NAME +llvm-cov \- emit coverage information +.SH SYNOPSIS +.sp +\fBllvm\-cov\fP \fIcommand\fP [\fIargs...\fP] +.SH DESCRIPTION +.sp +The \fBllvm\-cov\fP tool shows code coverage information for +programs that are instrumented to emit profile data. It can be used to +work with \fBgcov\fP\-style coverage or with \fBclang\fP\(aqs instrumentation +based profiling. +.sp +If the program is invoked with a base name of \fBgcov\fP, it will behave as if +the \fBllvm\-cov gcov\fP command were called. Otherwise, a command should +be provided. +.SH COMMANDS +.INDENT 0.0 +.IP \(bu 2 +\fI\%gcov\fP +.IP \(bu 2 +\fI\%show\fP +.IP \(bu 2 +\fI\%report\fP +.IP \(bu 2 +\fI\%export\fP +.UNINDENT +.SH GCOV COMMAND +.SS SYNOPSIS +.sp +\fBllvm\-cov gcov\fP [\fIoptions\fP] \fISOURCEFILE\fP +.SS DESCRIPTION +.sp +The \fBllvm\-cov gcov\fP tool reads code coverage data files and displays +the coverage information for a specified source file. It is compatible with the +\fBgcov\fP tool from version 4.2 of \fBGCC\fP and may also be compatible with some +later versions of \fBgcov\fP\&. +.sp +To use \fBllvm\-cov gcov\fP, you must first build an instrumented version +of your application that collects coverage data as it runs. Compile with the +\fB\-fprofile\-arcs\fP and \fB\-ftest\-coverage\fP options to add the +instrumentation. (Alternatively, you can use the \fB\-\-coverage\fP option, which +includes both of those other options.) You should compile with debugging +information (\fB\-g\fP) and without optimization (\fB\-O0\fP); otherwise, the +coverage data cannot be accurately mapped back to the source code. +.sp +At the time you compile the instrumented code, a \fB\&.gcno\fP data file will be +generated for each object file. These \fB\&.gcno\fP files contain half of the +coverage data. The other half of the data comes from \fB\&.gcda\fP files that are +generated when you run the instrumented program, with a separate \fB\&.gcda\fP +file for each object file. Each time you run the program, the execution counts +are summed into any existing \fB\&.gcda\fP files, so be sure to remove any old +files if you do not want their contents to be included. +.sp +By default, the \fB\&.gcda\fP files are written into the same directory as the +object files, but you can override that by setting the \fBGCOV_PREFIX\fP and +\fBGCOV_PREFIX_STRIP\fP environment variables. The \fBGCOV_PREFIX_STRIP\fP +variable specifies a number of directory components to be removed from the +start of the absolute path to the object file directory. After stripping those +directories, the prefix from the \fBGCOV_PREFIX\fP variable is added. These +environment variables allow you to run the instrumented program on a machine +where the original object file directories are not accessible, but you will +then need to copy the \fB\&.gcda\fP files back to the object file directories +where \fBllvm\-cov gcov\fP expects to find them. +.sp +Once you have generated the coverage data files, run \fBllvm\-cov gcov\fP +for each main source file where you want to examine the coverage results. This +should be run from the same directory where you previously ran the +compiler. The results for the specified source file are written to a file named +by appending a \fB\&.gcov\fP suffix. A separate output file is also created for +each file included by the main source file, also with a \fB\&.gcov\fP suffix added. +.sp +The basic content of an \fB\&.gcov\fP output file is a copy of the source file with +an execution count and line number prepended to every line. The execution +count is shown as \fB\-\fP if a line does not contain any executable code. If +a line contains code but that code was never executed, the count is displayed +as \fB#####\fP\&. +.SS OPTIONS +.INDENT 0.0 +.TP +.B \-a, \-\-all\-blocks +Display all basic blocks. If there are multiple blocks for a single line of +source code, this option causes llvm\-cov to show the count for each block +instead of just one count for the entire line. +.UNINDENT +.INDENT 0.0 +.TP +.B \-b, \-\-branch\-probabilities +Display conditional branch probabilities and a summary of branch information. +.UNINDENT +.INDENT 0.0 +.TP +.B \-c, \-\-branch\-counts +Display branch counts instead of probabilities (requires \-b). +.UNINDENT +.INDENT 0.0 +.TP +.B \-f, \-\-function\-summaries +Show a summary of coverage for each function instead of just one summary for +an entire source file. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-help +Display available options (\-\-help\-hidden for more). +.UNINDENT +.INDENT 0.0 +.TP +.B \-l, \-\-long\-file\-names +For coverage output of files included from the main source file, add the +main file name followed by \fB##\fP as a prefix to the output file names. This +can be combined with the \-\-preserve\-paths option to use complete paths for +both the main file and the included file. +.UNINDENT +.INDENT 0.0 +.TP +.B \-n, \-\-no\-output +Do not output any \fB\&.gcov\fP files. Summary information is still +displayed. +.UNINDENT +.INDENT 0.0 +.TP +.B \-o=<DIR|FILE>, \-\-object\-directory=<DIR>, \-\-object\-file=<FILE> +Find objects in DIR or based on FILE\(aqs path. If you specify a particular +object file, the coverage data files are expected to have the same base name +with \fB\&.gcno\fP and \fB\&.gcda\fP extensions. If you specify a directory, the +files are expected in that directory with the same base name as the source +file. +.UNINDENT +.INDENT 0.0 +.TP +.B \-p, \-\-preserve\-paths +Preserve path components when naming the coverage output files. In addition +to the source file name, include the directories from the path to that +file. The directories are separate by \fB#\fP characters, with \fB\&.\fP directories +removed and \fB\&..\fP directories replaced by \fB^\fP characters. When used with +the \-\-long\-file\-names option, this applies to both the main file name and the +included file name. +.UNINDENT +.INDENT 0.0 +.TP +.B \-u, \-\-unconditional\-branches +Include unconditional branches in the output for the \-\-branch\-probabilities +option. +.UNINDENT +.INDENT 0.0 +.TP +.B \-version +Display the version of llvm\-cov. +.UNINDENT +.INDENT 0.0 +.TP +.B \-x, \-\-hash\-filenames +Use md5 hash of file name when naming the coverage output files. The source +file name will be suffixed by \fB##\fP followed by MD5 hash calculated for it. +.UNINDENT +.SS EXIT STATUS +.sp +\fBllvm\-cov gcov\fP returns 1 if it cannot read input files. Otherwise, +it exits with zero. +.SH SHOW COMMAND +.SS SYNOPSIS +.sp +\fBllvm\-cov show\fP [\fIoptions\fP] \-instr\-profile \fIPROFILE\fP \fIBIN\fP [\fI\-object BIN,...\fP] [[\fI\-object BIN\fP]] [\fISOURCES\fP] +.SS DESCRIPTION +.sp +The \fBllvm\-cov show\fP command shows line by line coverage of the +binaries \fIBIN\fP,... using the profile data \fIPROFILE\fP\&. It can optionally be +filtered to only show the coverage for the files listed in \fISOURCES\fP\&. +.sp +\fIBIN\fP may be an executable, object file, dynamic library, or archive (thin or +otherwise). +.sp +To use \fBllvm\-cov show\fP, you need a program that is compiled with +instrumentation to emit profile and coverage data. To build such a program with +\fBclang\fP use the \fB\-fprofile\-instr\-generate\fP and \fB\-fcoverage\-mapping\fP +flags. If linking with the \fBclang\fP driver, pass \fB\-fprofile\-instr\-generate\fP +to the link stage to make sure the necessary runtime libraries are linked in. +.sp +The coverage information is stored in the built executable or library itself, +and this is what you should pass to \fBllvm\-cov show\fP as a \fIBIN\fP +argument. The profile data is generated by running this instrumented program +normally. When the program exits it will write out a raw profile file, +typically called \fBdefault.profraw\fP, which can be converted to a format that +is suitable for the \fIPROFILE\fP argument using the \fBllvm\-profdata merge\fP +tool. +.SS OPTIONS +.INDENT 0.0 +.TP +.B \-show\-branches=<VIEW> +Show coverage for branch conditions in terms of either count or percentage. +The supported views are: "count", "percent". +.UNINDENT +.INDENT 0.0 +.TP +.B \-show\-line\-counts +Show the execution counts for each line. Defaults to true, unless another +\fB\-show\fP option is used. +.UNINDENT +.INDENT 0.0 +.TP +.B \-show\-expansions +Expand inclusions, such as preprocessor macros or textual inclusions, inline +in the display of the source file. Defaults to false. +.UNINDENT +.INDENT 0.0 +.TP +.B \-show\-instantiations +For source regions that are instantiated multiple times, such as templates in +\fBC++\fP, show each instantiation separately as well as the combined summary. +Defaults to true. +.UNINDENT +.INDENT 0.0 +.TP +.B \-show\-regions +Show the execution counts for each region by displaying a caret that points to +the character where the region starts. Defaults to false. +.UNINDENT +.INDENT 0.0 +.TP +.B \-show\-line\-counts\-or\-regions +Show the execution counts for each line if there is only one region on the +line, but show the individual regions if there are multiple on the line. +Defaults to false. +.UNINDENT +.INDENT 0.0 +.TP +.B \-use\-color +Enable or disable color output. By default this is autodetected. +.UNINDENT +.INDENT 0.0 +.TP +.B \-arch=[*NAMES*] +Specify a list of architectures such that the Nth entry in the list +corresponds to the Nth specified binary. If the covered object is a universal +binary, this specifies the architecture to use. It is an error to specify an +architecture that is not included in the universal binary or to use an +architecture that does not match a non\-universal binary. +.UNINDENT +.INDENT 0.0 +.TP +.B \-name=<NAME> +Show code coverage only for functions with the given name. +.UNINDENT +.INDENT 0.0 +.TP +.B \-name\-whitelist=<FILE> +Show code coverage only for functions listed in the given file. Each line in +the file should start with \fIwhitelist_fun:\fP, immediately followed by the name +of the function to accept. This name can be a wildcard expression. +.UNINDENT +.INDENT 0.0 +.TP +.B \-name\-regex=<PATTERN> +Show code coverage only for functions that match the given regular expression. +.UNINDENT +.INDENT 0.0 +.TP +.B \-ignore\-filename\-regex=<PATTERN> +Skip source code files with file paths that match the given regular expression. +.UNINDENT +.INDENT 0.0 +.TP +.B \-format=<FORMAT> +Use the specified output format. The supported formats are: "text", "html". +.UNINDENT +.INDENT 0.0 +.TP +.B \-tab\-size=<TABSIZE> +Replace tabs with <TABSIZE> spaces when preparing reports. Currently, this is +only supported for the html format. +.UNINDENT +.INDENT 0.0 +.TP +.B \-output\-dir=PATH +Specify a directory to write coverage reports into. If the directory does not +exist, it is created. When used in function view mode (i.e when \-name or +\-name\-regex are used to select specific functions), the report is written to +PATH/functions.EXTENSION. When used in file view mode, a report for each file +is written to PATH/REL_PATH_TO_FILE.EXTENSION. +.UNINDENT +.INDENT 0.0 +.TP +.B \-Xdemangler=<TOOL>|<TOOL\-OPTION> +Specify a symbol demangler. This can be used to make reports more +human\-readable. This option can be specified multiple times to supply +arguments to the demangler (e.g \fI\-Xdemangler c++filt \-Xdemangler \-n\fP for C++). +The demangler is expected to read a newline\-separated list of symbols from +stdin and write a newline\-separated list of the same length to stdout. +.UNINDENT +.INDENT 0.0 +.TP +.B \-num\-threads=N, \-j=N +Use N threads to write file reports (only applicable when \-output\-dir is +specified). When N=0, llvm\-cov auto\-detects an appropriate number of threads to +use. This is the default. +.UNINDENT +.INDENT 0.0 +.TP +.B \-line\-coverage\-gt=<N> +Show code coverage only for functions with line coverage greater than the +given threshold. +.UNINDENT +.INDENT 0.0 +.TP +.B \-line\-coverage\-lt=<N> +Show code coverage only for functions with line coverage less than the given +threshold. +.UNINDENT +.INDENT 0.0 +.TP +.B \-region\-coverage\-gt=<N> +Show code coverage only for functions with region coverage greater than the +given threshold. +.UNINDENT +.INDENT 0.0 +.TP +.B \-region\-coverage\-lt=<N> +Show code coverage only for functions with region coverage less than the given +threshold. +.UNINDENT +.INDENT 0.0 +.TP +.B \-path\-equivalence=<from>,<to> +Map the paths in the coverage data to local source file paths. This allows you +to generate the coverage data on one machine, and then use llvm\-cov on a +different machine where you have the same files on a different path. +.UNINDENT +.SH REPORT COMMAND +.SS SYNOPSIS +.sp +\fBllvm\-cov report\fP [\fIoptions\fP] \-instr\-profile \fIPROFILE\fP \fIBIN\fP [\fI\-object BIN,...\fP] [[\fI\-object BIN\fP]] [\fISOURCES\fP] +.SS DESCRIPTION +.sp +The \fBllvm\-cov report\fP command displays a summary of the coverage of +the binaries \fIBIN\fP,... using the profile data \fIPROFILE\fP\&. It can optionally be +filtered to only show the coverage for the files listed in \fISOURCES\fP\&. +.sp +\fIBIN\fP may be an executable, object file, dynamic library, or archive (thin or +otherwise). +.sp +If no source files are provided, a summary line is printed for each file in the +coverage data. If any files are provided, summaries can be shown for each +function in the listed files if the \fB\-show\-functions\fP option is enabled. +.sp +For information on compiling programs for coverage and generating profile data, +see \fI\%SHOW COMMAND\fP\&. +.SS OPTIONS +.INDENT 0.0 +.TP +.B \-use\-color[=VALUE] +Enable or disable color output. By default this is autodetected. +.UNINDENT +.INDENT 0.0 +.TP +.B \-arch=<name> +If the covered binary is a universal binary, select the architecture to use. +It is an error to specify an architecture that is not included in the +universal binary or to use an architecture that does not match a +non\-universal binary. +.UNINDENT +.INDENT 0.0 +.TP +.B \-show\-branch\-summary +Show statistics for all branch conditions. Defaults to true. +.UNINDENT +.INDENT 0.0 +.TP +.B \-show\-functions +Show coverage summaries for each function. Defaults to false. +.UNINDENT +.INDENT 0.0 +.TP +.B \-show\-instantiation\-summary +Show statistics for all function instantiations. Defaults to false. +.UNINDENT +.INDENT 0.0 +.TP +.B \-ignore\-filename\-regex=<PATTERN> +Skip source code files with file paths that match the given regular expression. +.UNINDENT +.SH EXPORT COMMAND +.SS SYNOPSIS +.sp +\fBllvm\-cov export\fP [\fIoptions\fP] \-instr\-profile \fIPROFILE\fP \fIBIN\fP [\fI\-object BIN,...\fP] [[\fI\-object BIN\fP]] [\fISOURCES\fP] +.SS DESCRIPTION +.sp +The \fBllvm\-cov export\fP command exports coverage data of the binaries +\fIBIN\fP,... using the profile data \fIPROFILE\fP in either JSON or lcov trace file +format. +.sp +When exporting JSON, the regions, functions, branches, expansions, and +summaries of the coverage data will be exported. When exporting an lcov trace +file, the line\-based coverage, branch coverage, and summaries will be exported. +.sp +The exported data can optionally be filtered to only export the coverage +for the files listed in \fISOURCES\fP\&. +.sp +For information on compiling programs for coverage and generating profile data, +see \fI\%SHOW COMMAND\fP\&. +.SS OPTIONS +.INDENT 0.0 +.TP +.B \-arch=<name> +If the covered binary is a universal binary, select the architecture to use. +It is an error to specify an architecture that is not included in the +universal binary or to use an architecture that does not match a +non\-universal binary. +.UNINDENT +.INDENT 0.0 +.TP +.B \-format=<FORMAT> +Use the specified output format. The supported formats are: "text" (JSON), +"lcov". +.UNINDENT +.INDENT 0.0 +.TP +.B \-summary\-only +Export only summary information for each file in the coverage data. This mode +will not export coverage information for smaller units such as individual +functions or regions. The result will contain the same information as produced +by the \fBllvm\-cov report\fP command, but presented in JSON or lcov +format rather than text. +.UNINDENT +.INDENT 0.0 +.TP +.B \-ignore\-filename\-regex=<PATTERN> +Skip source code files with file paths that match the given regular expression. +.INDENT 7.0 +.TP +.B \-skip\-expansions +.UNINDENT +.sp +Skip exporting macro expansion coverage data. +.INDENT 7.0 +.TP +.B \-skip\-functions +.UNINDENT +.sp +Skip exporting per\-function coverage data. +.INDENT 7.0 +.TP +.B \-num\-threads=N, \-j=N +.UNINDENT +.sp +Use N threads to export coverage data. When N=0, llvm\-cov auto\-detects an +appropriate number of threads to use. This is the default. +.UNINDENT +.SH AUTHOR +Maintained by the LLVM Team (https://llvm.org/). +.SH COPYRIGHT +2003-2021, LLVM Project +.\" Generated by docutils manpage writer. +. diff --git a/usr.bin/clang/llvm-cxxdump/Makefile b/usr.bin/clang/llvm-cxxdump/Makefile new file mode 100644 index 000000000000..81c695f97759 --- /dev/null +++ b/usr.bin/clang/llvm-cxxdump/Makefile @@ -0,0 +1,10 @@ +# $FreeBSD$ + +PROG_CXX= llvm-cxxdump +MAN= + +SRCDIR= llvm/tools/llvm-cxxdump +SRCS+= Error.cpp +SRCS+= llvm-cxxdump.cpp + +.include "../llvm.prog.mk" diff --git a/usr.bin/clang/llvm-cxxdump/Makefile.depend b/usr.bin/clang/llvm-cxxdump/Makefile.depend new file mode 100644 index 000000000000..1423340957b6 --- /dev/null +++ b/usr.bin/clang/llvm-cxxdump/Makefile.depend @@ -0,0 +1,24 @@ +# $FreeBSD$ +# Autogenerated - do NOT edit! + +DIRDEPS = \ + gnu/lib/csu \ + include \ + include/xlocale \ + lib/${CSU_DIR} \ + lib/clang/libllvm \ + lib/libc \ + lib/libc++ \ + lib/libcompiler_rt \ + lib/libcxxrt \ + lib/libthr \ + lib/libz \ + lib/msun \ + lib/ncurses/ncursesw \ + + +.include <dirdeps.mk> + +.if ${DEP_RELDIR} == ${_DEP_RELDIR} +# local dependencies - needed for -jN in clean tree +.endif diff --git a/usr.bin/clang/llvm-cxxfilt/Makefile b/usr.bin/clang/llvm-cxxfilt/Makefile new file mode 100644 index 000000000000..0036fbe6cf8d --- /dev/null +++ b/usr.bin/clang/llvm-cxxfilt/Makefile @@ -0,0 +1,33 @@ +# $FreeBSD$ + +.include <src.opts.mk> + +PROG_CXX= llvm-cxxfilt + +SRCDIR= llvm/tools/llvm-cxxfilt +SRCS+= llvm-cxxfilt.cpp + +CFLAGS.llvm-cxxfilt.cpp+= -Dllvm_cxxfilt_main=main + +.include "${SRCTOP}/lib/clang/llvm.pre.mk" + +CFLAGS+= -I${.OBJDIR} + +INCFILE= Opts.inc +TDFILE= ${LLVM_BASE}/${SRCDIR}/Opts.td +GENOPT= -gen-opt-parser-defs +${INCFILE}: ${TDFILE} + ${LLVM_TBLGEN} ${GENOPT} -I ${LLVM_SRCS}/include -d ${.TARGET:C/$/.d/} \ + -o ${.TARGET} ${TDFILE} +TGHDRS+= ${INCFILE} + +DEPENDFILES+= ${TGHDRS:C/$/.d/} +DPSRCS+= ${TGHDRS} +CLEANFILES+= ${TGHDRS} ${TGHDRS:C/$/.d/} + +.if ${MK_LLVM_CXXFILT} != "no" +LINKS= ${BINDIR}/llvm-cxxfilt ${BINDIR}/c++filt +MLINKS= llvm-cxxfilt.1 c++filt.1 +.endif + +.include "../llvm.prog.mk" diff --git a/usr.bin/clang/llvm-cxxfilt/Makefile.depend b/usr.bin/clang/llvm-cxxfilt/Makefile.depend new file mode 100644 index 000000000000..1423340957b6 --- /dev/null +++ b/usr.bin/clang/llvm-cxxfilt/Makefile.depend @@ -0,0 +1,24 @@ +# $FreeBSD$ +# Autogenerated - do NOT edit! + +DIRDEPS = \ + gnu/lib/csu \ + include \ + include/xlocale \ + lib/${CSU_DIR} \ + lib/clang/libllvm \ + lib/libc \ + lib/libc++ \ + lib/libcompiler_rt \ + lib/libcxxrt \ + lib/libthr \ + lib/libz \ + lib/msun \ + lib/ncurses/ncursesw \ + + +.include <dirdeps.mk> + +.if ${DEP_RELDIR} == ${_DEP_RELDIR} +# local dependencies - needed for -jN in clean tree +.endif diff --git a/usr.bin/clang/llvm-cxxfilt/llvm-cxxfilt.1 b/usr.bin/clang/llvm-cxxfilt/llvm-cxxfilt.1 new file mode 100644 index 000000000000..8b8cb10f8b83 --- /dev/null +++ b/usr.bin/clang/llvm-cxxfilt/llvm-cxxfilt.1 @@ -0,0 +1,123 @@ +.\" $FreeBSD$ +.\" Man page generated from reStructuredText. +. +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.TH "LLVM-CXXFILT" "1" "2021-06-07" "12" "LLVM" +.SH NAME +llvm-cxxfilt \- LLVM symbol name demangler +.SH SYNOPSIS +.sp +\fBllvm\-cxxfilt\fP [\fIoptions\fP] [\fImangled names...\fP] +.SH DESCRIPTION +.sp +\fBllvm\-cxxfilt\fP is a symbol demangler that can be used as a replacement +for the GNU \fBc++filt\fP tool. It takes a series of symbol names and +prints their demangled form on the standard output stream. If a name cannot be +demangled, it is simply printed as is. +.sp +If no names are specified on the command\-line, names are read interactively from +the standard input stream. When reading names from standard input, each input +line is split on characters that are not part of valid Itanium name manglings, +i.e. characters that are not alphanumeric, \(aq.\(aq, \(aq$\(aq, or \(aq_\(aq. Separators between +names are copied to the output as is. +.SH EXAMPLE +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +$ llvm\-cxxfilt _Z3foov _Z3bari not_mangled +foo() +bar(int) +not_mangled +$ cat input.txt +| _Z3foov *** _Z3bari *** not_mangled | +$ llvm\-cxxfilt < input.txt +| foo() *** bar(int) *** not_mangled | +.ft P +.fi +.UNINDENT +.UNINDENT +.SH OPTIONS +.INDENT 0.0 +.TP +.B \-\-format=<value>, \-s +Mangling scheme to assume. Valid values are \fBauto\fP (default, auto\-detect the +style) and \fBgnu\fP (assume GNU/Itanium style). +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-help, \-h +Print a summary of command line options. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-help\-list +Print an uncategorized summary of command line options. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-no\-strip\-underscore, \-n +Do not strip a leading underscore. This is the default for all platforms +except Mach\-O based hosts. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-strip\-underscore, \-_ +Strip a single leading underscore, if present, from each input name before +demangling. On by default on Mach\-O based platforms. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-types, \-t +Attempt to demangle names as type names as well as function names. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-version +Display the version of the \fBllvm\-cxxfilt\fP executable. +.UNINDENT +.INDENT 0.0 +.TP +.B @<FILE> +Read command\-line options from response file \fI<FILE>\fP\&. +.UNINDENT +.SH EXIT STATUS +.sp +\fBllvm\-cxxfilt\fP returns 0 unless it encounters a usage error, in which +case a non\-zero exit code is returned. +.SH SEE ALSO +.sp +\fBllvm\-nm(1)\fP +.SH AUTHOR +Maintained by the LLVM Team (https://llvm.org/). +.SH COPYRIGHT +2003-2021, LLVM Project +.\" Generated by docutils manpage writer. +. diff --git a/usr.bin/clang/llvm-diff/Makefile b/usr.bin/clang/llvm-diff/Makefile new file mode 100644 index 000000000000..6031f8b2a12d --- /dev/null +++ b/usr.bin/clang/llvm-diff/Makefile @@ -0,0 +1,11 @@ +# $FreeBSD$ + +PROG_CXX= llvm-diff + +SRCDIR= llvm/tools/llvm-diff +SRCS+= lib/DiffConsumer.cpp +SRCS+= lib/DiffLog.cpp +SRCS+= lib/DifferenceEngine.cpp +SRCS+= llvm-diff.cpp + +.include "../llvm.prog.mk" diff --git a/usr.bin/clang/llvm-diff/Makefile.depend b/usr.bin/clang/llvm-diff/Makefile.depend new file mode 100644 index 000000000000..1423340957b6 --- /dev/null +++ b/usr.bin/clang/llvm-diff/Makefile.depend @@ -0,0 +1,24 @@ +# $FreeBSD$ +# Autogenerated - do NOT edit! + +DIRDEPS = \ + gnu/lib/csu \ + include \ + include/xlocale \ + lib/${CSU_DIR} \ + lib/clang/libllvm \ + lib/libc \ + lib/libc++ \ + lib/libcompiler_rt \ + lib/libcxxrt \ + lib/libthr \ + lib/libz \ + lib/msun \ + lib/ncurses/ncursesw \ + + +.include <dirdeps.mk> + +.if ${DEP_RELDIR} == ${_DEP_RELDIR} +# local dependencies - needed for -jN in clean tree +.endif diff --git a/usr.bin/clang/llvm-diff/llvm-diff.1 b/usr.bin/clang/llvm-diff/llvm-diff.1 new file mode 100644 index 000000000000..c5478cde341a --- /dev/null +++ b/usr.bin/clang/llvm-diff/llvm-diff.1 @@ -0,0 +1,77 @@ +.\" $FreeBSD$ +.\" Man page generated from reStructuredText. +. +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.TH "LLVM-DIFF" "1" "2021-06-07" "12" "LLVM" +.SH NAME +llvm-diff \- LLVM structural 'diff' +.SH SYNOPSIS +.sp +\fBllvm\-diff\fP [\fIoptions\fP] \fImodule 1\fP \fImodule 2\fP [\fIglobal name ...\fP] +.SH DESCRIPTION +.sp +\fBllvm\-diff\fP compares the structure of two LLVM modules, primarily +focusing on differences in function definitions. Insignificant +differences, such as changes in the ordering of globals or in the +names of local values, are ignored. +.sp +An input module will be interpreted as an assembly file if its name +ends in \(aq.ll\(aq; otherwise it will be read in as a bitcode file. +.sp +If a list of global names is given, just the values with those names +are compared; otherwise, all global values are compared, and +diagnostics are produced for globals which only appear in one module +or the other. +.sp +\fBllvm\-diff\fP compares two functions by comparing their basic blocks, +beginning with the entry blocks. If the terminators seem to match, +then the corresponding successors are compared; otherwise they are +ignored. This algorithm is very sensitive to changes in control flow, +which tend to stop any downstream changes from being detected. +.sp +\fBllvm\-diff\fP is intended as a debugging tool for writers of LLVM +passes and frontends. It does not have a stable output format. +.SH EXIT STATUS +.sp +If \fBllvm\-diff\fP finds no differences between the modules, it will exit +with 0 and produce no output. Otherwise it will exit with a non\-zero +value. +.SH BUGS +.sp +Many important differences, like changes in linkage or function +attributes, are not diagnosed. +.sp +Changes in memory behavior (for example, coalescing loads) can cause +massive detected differences in blocks. +.SH AUTHOR +Maintained by the LLVM Team (https://llvm.org/). +.SH COPYRIGHT +2003-2021, LLVM Project +.\" Generated by docutils manpage writer. +. diff --git a/usr.bin/clang/llvm-dis/Makefile b/usr.bin/clang/llvm-dis/Makefile new file mode 100644 index 000000000000..d12c3fc9fcb6 --- /dev/null +++ b/usr.bin/clang/llvm-dis/Makefile @@ -0,0 +1,8 @@ +# $FreeBSD$ + +PROG_CXX= llvm-dis + +SRCDIR= llvm/tools/llvm-dis +SRCS+= llvm-dis.cpp + +.include "../llvm.prog.mk" diff --git a/usr.bin/clang/llvm-dis/Makefile.depend b/usr.bin/clang/llvm-dis/Makefile.depend new file mode 100644 index 000000000000..5459b436be4c --- /dev/null +++ b/usr.bin/clang/llvm-dis/Makefile.depend @@ -0,0 +1,23 @@ +# $FreeBSD$ +# Autogenerated - do NOT edit! + +DIRDEPS = \ + gnu/lib/csu \ + include \ + include/xlocale \ + lib/${CSU_DIR} \ + lib/clang/libllvm \ + lib/libc \ + lib/libc++ \ + lib/libcompiler_rt \ + lib/libcxxrt \ + lib/libthr \ + lib/msun \ + lib/ncurses/ncursesw \ + + +.include <dirdeps.mk> + +.if ${DEP_RELDIR} == ${_DEP_RELDIR} +# local dependencies - needed for -jN in clean tree +.endif diff --git a/usr.bin/clang/llvm-dis/llvm-dis.1 b/usr.bin/clang/llvm-dis/llvm-dis.1 new file mode 100644 index 000000000000..eccb1900c1b8 --- /dev/null +++ b/usr.bin/clang/llvm-dis/llvm-dis.1 @@ -0,0 +1,88 @@ +.\" $FreeBSD$ +.\" Man page generated from reStructuredText. +. +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.TH "LLVM-DIS" "1" "2021-06-07" "12" "LLVM" +.SH NAME +llvm-dis \- LLVM disassembler +.SH SYNOPSIS +.sp +\fBllvm\-dis\fP [\fIoptions\fP] [\fIfilename\fP] +.SH DESCRIPTION +.sp +The \fBllvm\-dis\fP command is the LLVM disassembler. It takes an LLVM +bitcode file and converts it into human\-readable LLVM assembly language. +.sp +If filename is omitted or specified as \fB\-\fP, \fBllvm\-dis\fP reads its +input from standard input. +.sp +If the input is being read from standard input, then \fBllvm\-dis\fP +will send its output to standard output by default. Otherwise, the +output will be written to a file named after the input file, with +a \fB\&.ll\fP suffix added (any existing \fB\&.bc\fP suffix will first be +removed). You can override the choice of output file using the +\fB\-o\fP option. +.SH OPTIONS +.sp +\fB\-f\fP +.INDENT 0.0 +.INDENT 3.5 +Enable binary output on terminals. Normally, \fBllvm\-dis\fP will refuse to +write raw bitcode output if the output stream is a terminal. With this option, +\fBllvm\-dis\fP will write raw bitcode regardless of the output device. +.UNINDENT +.UNINDENT +.sp +\fB\-help\fP +.INDENT 0.0 +.INDENT 3.5 +Print a summary of command line options. +.UNINDENT +.UNINDENT +.sp +\fB\-o\fP \fIfilename\fP +.INDENT 0.0 +.INDENT 3.5 +Specify the output file name. If \fIfilename\fP is \-, then the output is sent +to standard output. +.UNINDENT +.UNINDENT +.SH EXIT STATUS +.sp +If \fBllvm\-dis\fP succeeds, it will exit with 0. Otherwise, if an error +occurs, it will exit with a non\-zero value. +.SH SEE ALSO +.sp +\fBllvm\-as(1)\fP +.SH AUTHOR +Maintained by the LLVM Team (https://llvm.org/). +.SH COPYRIGHT +2003-2021, LLVM Project +.\" Generated by docutils manpage writer. +. diff --git a/usr.bin/clang/llvm-dwarfdump/Makefile b/usr.bin/clang/llvm-dwarfdump/Makefile new file mode 100644 index 000000000000..d5aaf812f8c4 --- /dev/null +++ b/usr.bin/clang/llvm-dwarfdump/Makefile @@ -0,0 +1,13 @@ +# $FreeBSD$ + +PROG_CXX= llvm-dwarfdump + +SRCDIR= llvm/tools/llvm-dwarfdump +SRCS+= SectionSizes.cpp +SRCS+= Statistics.cpp +SRCS+= llvm-dwarfdump.cpp + +LIBADD+= z +LIBADD+= zstd + +.include "../llvm.prog.mk" diff --git a/usr.bin/clang/llvm-dwarfdump/Makefile.depend b/usr.bin/clang/llvm-dwarfdump/Makefile.depend new file mode 100644 index 000000000000..1423340957b6 --- /dev/null +++ b/usr.bin/clang/llvm-dwarfdump/Makefile.depend @@ -0,0 +1,24 @@ +# $FreeBSD$ +# Autogenerated - do NOT edit! + +DIRDEPS = \ + gnu/lib/csu \ + include \ + include/xlocale \ + lib/${CSU_DIR} \ + lib/clang/libllvm \ + lib/libc \ + lib/libc++ \ + lib/libcompiler_rt \ + lib/libcxxrt \ + lib/libthr \ + lib/libz \ + lib/msun \ + lib/ncurses/ncursesw \ + + +.include <dirdeps.mk> + +.if ${DEP_RELDIR} == ${_DEP_RELDIR} +# local dependencies - needed for -jN in clean tree +.endif diff --git a/usr.bin/clang/llvm-dwarfdump/llvm-dwarfdump.1 b/usr.bin/clang/llvm-dwarfdump/llvm-dwarfdump.1 new file mode 100644 index 000000000000..c3c9db66a5d3 --- /dev/null +++ b/usr.bin/clang/llvm-dwarfdump/llvm-dwarfdump.1 @@ -0,0 +1,263 @@ +.\" $FreeBSD$ +.\" Man page generated from reStructuredText. +. +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.TH "LLVM-DWARFDUMP" "1" "2021-06-07" "12" "LLVM" +.SH NAME +llvm-dwarfdump \- dump and verify DWARF debug information +.SH SYNOPSIS +.sp +\fBllvm\-dwarfdump\fP [\fIoptions\fP] [\fIfilename ...\fP] +.SH DESCRIPTION +.sp +\fBllvm\-dwarfdump\fP parses DWARF sections in object files, +archives, and \fI\&.dSYM\fP bundles and prints their contents in +human\-readable form. Only the .debug_info section is printed unless one of +the section\-specific options or \fI\%\-\-all\fP is specified. +.sp +If no input file is specified, \fIa.out\fP is used instead. If \fI\-\fP is used as the +input file, \fBllvm\-dwarfdump\fP reads the input from its standard input +stream. +.SH OPTIONS +.INDENT 0.0 +.TP +.B \-a, \-\-all +Dump all supported DWARF sections. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-arch=<arch> +Dump DWARF debug information for the specified CPU architecture. +Architectures may be specified by name or by number. This +option can be specified multiple times, once for each desired +architecture. All CPU architectures will be printed by +default. +.UNINDENT +.INDENT 0.0 +.TP +.B \-c, \-\-show\-children +Show a debug info entry\(aqs children when selectively printing with +the \fI=<offset>\fP argument of \fI\%\-\-debug\-info\fP, or options such +as \fI\%\-\-find\fP or \fI\%\-\-name\fP\&. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-color +Use colors in output. +.UNINDENT +.INDENT 0.0 +.TP +.B \-f <name>, \-\-find=<name> +Search for the exact text <name> in the accelerator tables +and print the matching debug information entries. +When there is no accelerator tables or the name of the DIE +you are looking for is not found in the accelerator tables, +try using the slower but more complete \fI\%\-\-name\fP option. +.UNINDENT +.INDENT 0.0 +.TP +.B \-F, \-\-show\-form +Show DWARF form types after the DWARF attribute types. +.UNINDENT +.INDENT 0.0 +.TP +.B \-h, \-\-help +Show help and usage for this command. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-help\-list +Show help and usage for this command without grouping the options +into categories. +.UNINDENT +.INDENT 0.0 +.TP +.B \-i, \-\-ignore\-case +Ignore case distinctions when using \fI\%\-\-name\fP\&. +.UNINDENT +.INDENT 0.0 +.TP +.B \-n <name>, \-\-name=<name> +Find and print all debug info entries whose name +(\fIDW_AT_name\fP attribute) is <name>. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-lookup=<address> +Look up <address> in the debug information and print out the file, +function, block, and line table details. +.UNINDENT +.INDENT 0.0 +.TP +.B \-o <path> +Redirect output to a file specified by <path>, where \fI\-\fP is the +standard output stream. +.UNINDENT +.INDENT 0.0 +.TP +.B \-p, \-\-show\-parents +Show a debug info entry\(aqs parents when selectively printing with +the \fI=<offset>\fP argument of \fI\%\-\-debug\-info\fP, or options such +as \fI\%\-\-find\fP or \fI\%\-\-name\fP\&. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-parent\-recurse\-depth=<N> +When displaying debug info entry parents, only show them to a +maximum depth of <N>. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-quiet +Use with \fI\%\-\-verify\fP to not emit to \fISTDOUT\fP\&. +.UNINDENT +.INDENT 0.0 +.TP +.B \-r <N>, \-\-recurse\-depth=<N> +When displaying debug info entries, only show children to a maximum +depth of <N>. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-show\-section\-sizes +Show the sizes of all debug sections, expressed in bytes. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-statistics +Collect debug info quality metrics and print the results +as machine\-readable single\-line JSON output. The output +format is described in the section below (\fI\%FORMAT OF STATISTICS OUTPUT\fP). +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-summarize\-types +Abbreviate the description of type unit entries. +.UNINDENT +.INDENT 0.0 +.TP +.B \-x, \-\-regex +Treat any <name> strings as regular expressions when searching +with \fI\%\-\-name\fP\&. If \fI\%\-\-ignore\-case\fP is also specified, +the regular expression becomes case\-insensitive. +.UNINDENT +.INDENT 0.0 +.TP +.B \-u, \-\-uuid +Show the UUID for each architecture. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-diff +Dump the output in a format that is more friendly for comparing +DWARF output from two different files. +.UNINDENT +.INDENT 0.0 +.TP +.B \-v, \-\-verbose +Display verbose information when dumping. This can help to debug +DWARF issues. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-verify +Verify the structure of the DWARF information by verifying the +compile unit chains, DIE relationships graph, address +ranges, and more. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-version +Display the version of the tool. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-debug\-abbrev, \-\-debug\-addr, \-\-debug\-aranges, \-\-debug\-cu\-index, \-\-debug\-frame[=<offset>], \-\-debug\-gnu\-pubnames, \-\-debug\-gnu\-pubtypes, \-\-debug\-info [=<offset>], \-\-debug\-line [=<offset>], \-\-debug\-line\-str, \-\-debug\-loc [=<offset>], \-\-debug\-loclists [=<offset>], \-\-debug\-macro, \-\-debug\-names, \-\-debug\-pubnames, \-\-debug\-pubtypes, \-\-debug\-ranges, \-\-debug\-rnglists, \-\-debug\-str, \-\-debug\-str\-offsets, \-\-debug\-tu\-index, \-\-debug\-types [=<offset>], \-\-eh\-frame [=<offset>], \-\-gdb\-index, \-\-apple\-names, \-\-apple\-types, \-\-apple\-namespaces, \-\-apple\-objc +Dump the specified DWARF section by name. Only the +\fI\&.debug_info\fP section is shown by default. Some entries +support adding an \fI=<offset>\fP as a way to provide an +optional offset of the exact entry to dump within the +respective section. When an offset is provided, only the +entry at that offset will be dumped, else the entire +section will be dumped. +.UNINDENT +.INDENT 0.0 +.TP +.B @<FILE> +Read command\-line options from \fI<FILE>\fP\&. +.UNINDENT +.SH FORMAT OF STATISTICS OUTPUT +.sp +The :\fI\%\-\-statistics\fP option generates single\-line JSON output +representing quality metrics of the processed debug info. These metrics are +useful to compare changes between two compilers, particularly for judging +the effect that a change to the compiler has on the debug info quality. +.sp +The output is formatted as key\-value pairs. The first pair contains a version +number. The following naming scheme is used for the keys: +.INDENT 0.0 +.INDENT 3.5 +.INDENT 0.0 +.IP \(bu 2 +\fIvariables\fP ==> local variables and parameters +.IP \(bu 2 +\fIlocal vars\fP ==> local variables +.IP \(bu 2 +\fIparams\fP ==> formal parameters +.UNINDENT +.UNINDENT +.UNINDENT +.sp +For aggregated values, the following keys are used: +.INDENT 0.0 +.INDENT 3.5 +.INDENT 0.0 +.IP \(bu 2 +\fIsum_of_all_variables(...)\fP ==> the sum applied to all variables +.IP \(bu 2 +\fI#bytes\fP ==> the number of bytes +.IP \(bu 2 +\fI#variables \- entry values ...\fP ==> the number of variables excluding +the entry values etc. +.UNINDENT +.UNINDENT +.UNINDENT +.SH EXIT STATUS +.sp +\fBllvm\-dwarfdump\fP returns 0 if the input files were parsed and dumped +successfully. Otherwise, it returns 1. +.SH SEE ALSO +.sp +\fBdsymutil(1)\fP +.SH AUTHOR +Maintained by the LLVM Team (https://llvm.org/). +.SH COPYRIGHT +2003-2021, LLVM Project +.\" Generated by docutils manpage writer. +. diff --git a/usr.bin/clang/llvm-dwarfutil/Makefile b/usr.bin/clang/llvm-dwarfutil/Makefile new file mode 100644 index 000000000000..0be0eefcea3e --- /dev/null +++ b/usr.bin/clang/llvm-dwarfutil/Makefile @@ -0,0 +1,28 @@ +# $FreeBSD$ + +PROG_CXX= llvm-dwarfutil + +SRCDIR= llvm/tools/llvm-dwarfutil +SRCS+= DebugInfoLinker.cpp +SRCS+= llvm-dwarfutil.cpp + +.include "${SRCTOP}/lib/clang/llvm.pre.mk" + +CFLAGS+= -I${.OBJDIR} + +INCFILE= Options.inc +TDFILE= ${LLVM_BASE}/${SRCDIR}/Options.td +GENOPT= -gen-opt-parser-defs +${INCFILE}: ${TDFILE} + ${LLVM_TBLGEN} ${GENOPT} -I ${LLVM_SRCS}/include -d ${.TARGET:C/$/.d/} \ + -o ${.TARGET} ${TDFILE} +TGHDRS+= ${INCFILE} + +DEPENDFILES+= ${TGHDRS:C/$/.d/} +DPSRCS+= ${TGHDRS} +CLEANFILES+= ${TGHDRS} ${TGHDRS:C/$/.d/} + +LIBADD+= z +LIBADD+= zstd + +.include "../llvm.prog.mk" diff --git a/usr.bin/clang/llvm-dwarfutil/llvm-dwarfutil.1 b/usr.bin/clang/llvm-dwarfutil/llvm-dwarfutil.1 new file mode 100644 index 000000000000..1d14486b0d28 --- /dev/null +++ b/usr.bin/clang/llvm-dwarfutil/llvm-dwarfutil.1 @@ -0,0 +1,168 @@ +.\" Man page generated from reStructuredText. +. +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.TH "LLVM-DWARFUTIL" "1" "2022-07-24" "15" "LLVM" +.SH NAME +llvm-dwarfutil \- A tool to copy and manipulate debug info +.SH SYNOPSIS +.sp +\fBllvm\-dwarfutil\fP [\fIoptions\fP] \fIinput\fP \fIoutput\fP +.SH DESCRIPTION +.sp +\fBllvm\-dwarfutil\fP is a tool to copy and manipulate debug info. +.sp +In basic usage, it makes a semantic copy of the input to the output. If any +options are specified, the output may be modified along the way, e.g. +by removing unused debug info. +.sp +If "\-" is specified for the input file, the input is read from the program\(aqs +standard input stream. If "\-" is specified for the output file, the output +is written to the standard output stream of the program. +.sp +The tool is still in active development. +.SH COMMAND-LINE OPTIONS +.INDENT 0.0 +.TP +.B \-\-garbage\-collection +Removes pieces of debug information related to discarded sections. +When the linker does section garbage collection the abandoned debug info +is left behind. Such abandoned debug info references address ranges using +tombstone values. Thus, when this option is specified, the tool removes +debug info which is marked with the tombstone value. +.sp +That option is enabled by default. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-odr\-deduplication +Remove duplicated types (if "One Definition Rule" is supported by source +language). Keeps first type definition and removes other definitions, +potentially significantly reducing the size of output debug info. +.sp +That option is enabled by default. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-help, \-h +Print a summary of command line options. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-no\-garbage\-collection +Disable \fI\%\-\-garbage\-collection\fP\&. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-no\-odr\-deduplication +Disable \fI\%\-\-odr\-deduplication\fP\&. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-no\-separate\-debug\-file +Disable \fI\%\-\-separate\-debug\-file\fP\&. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-num\-threads=<n>, \-j +Specifies the maximum number (\fIn\fP) of simultaneous threads to use +for processing. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-separate\-debug\-file +Generate separate file containing output debug info. Using +\fBllvm\-dwarfutil\fP with that option equals to the +following set of commands: +.UNINDENT +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +:program:\(gallvm\-objcopy\(ga \-\-only\-keep\-debug in\-file out\-file.debug +:program:\(gallvm\-objcopy\(ga \-\-strip\-debug in\-file out\-file +:program:\(gallvm\-objcopy\(ga \-\-add\-gnu\-debuglink=out\-file.debug out\-file +.ft P +.fi +.UNINDENT +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-tombstone=<value> +<value> can be one of the following values: +.INDENT 7.0 +.INDENT 3.5 +.INDENT 0.0 +.IP \(bu 2 +\fIbfd\fP: zero for all addresses and [1,1] for DWARF v4 (or less) address ranges and exec. +.IP \(bu 2 +\fImaxpc\fP: \-1 for all addresses and \-2 for DWARF v4 (or less) address ranges. +.IP \(bu 2 +\fIuniversal\fP: both \fIbfd\fP and \fImaxpc\fP\&. +.IP \(bu 2 +\fIexec\fP: match with address ranges of executable sections. +.UNINDENT +.sp +The value \fIuniversal\fP is used by default. +.UNINDENT +.UNINDENT +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-verbose +Enable verbose logging. This option disables multi\-thread mode. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-verify +Run the DWARF verifier on the output DWARF debug info. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-version +Print the version of this program. +.UNINDENT +.SH SUPPORTED FORMATS +.sp +The following formats are currently supported by \fBllvm\-dwarfutil\fP: +.sp +ELF +.SH EXIT STATUS +.sp +\fBllvm\-dwarfutil\fP exits with a non\-zero exit code if there is an error. +Otherwise, it exits with code 0. +.SH BUGS +.sp +To report bugs, please visit <\fI\%https://github.com/llvm/llvm\-project/labels/tools:llvm\-dwarfutil/\fP>. +.SH AUTHOR +Maintained by the LLVM Team (https://llvm.org/). +.SH COPYRIGHT +2003-2022, LLVM Project +.\" Generated by docutils manpage writer. +. diff --git a/usr.bin/clang/llvm-dwp/Makefile b/usr.bin/clang/llvm-dwp/Makefile new file mode 100644 index 000000000000..c47729aea678 --- /dev/null +++ b/usr.bin/clang/llvm-dwp/Makefile @@ -0,0 +1,12 @@ +# $FreeBSD$ + +PROG_CXX= llvm-dwp +MAN= + +SRCDIR= llvm/tools/llvm-dwp +SRCS+= llvm-dwp.cpp + +LIBADD+= z +LIBADD+= zstd + +.include "../llvm.prog.mk" diff --git a/usr.bin/clang/llvm-extract/Makefile b/usr.bin/clang/llvm-extract/Makefile new file mode 100644 index 000000000000..7a0a5b205a4f --- /dev/null +++ b/usr.bin/clang/llvm-extract/Makefile @@ -0,0 +1,10 @@ +# $FreeBSD$ + +PROG_CXX= llvm-extract + +SRCDIR= llvm/tools/llvm-extract +SRCS+= llvm-extract.cpp + +LIBADD+= z + +.include "../llvm.prog.mk" diff --git a/usr.bin/clang/llvm-extract/Makefile.depend b/usr.bin/clang/llvm-extract/Makefile.depend new file mode 100644 index 000000000000..1423340957b6 --- /dev/null +++ b/usr.bin/clang/llvm-extract/Makefile.depend @@ -0,0 +1,24 @@ +# $FreeBSD$ +# Autogenerated - do NOT edit! + +DIRDEPS = \ + gnu/lib/csu \ + include \ + include/xlocale \ + lib/${CSU_DIR} \ + lib/clang/libllvm \ + lib/libc \ + lib/libc++ \ + lib/libcompiler_rt \ + lib/libcxxrt \ + lib/libthr \ + lib/libz \ + lib/msun \ + lib/ncurses/ncursesw \ + + +.include <dirdeps.mk> + +.if ${DEP_RELDIR} == ${_DEP_RELDIR} +# local dependencies - needed for -jN in clean tree +.endif diff --git a/usr.bin/clang/llvm-extract/llvm-extract.1 b/usr.bin/clang/llvm-extract/llvm-extract.1 new file mode 100644 index 000000000000..e0c6f3d32ba8 --- /dev/null +++ b/usr.bin/clang/llvm-extract/llvm-extract.1 @@ -0,0 +1,177 @@ +.\" $FreeBSD$ +.\" Man page generated from reStructuredText. +. +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.TH "LLVM-EXTRACT" "1" "2021-06-07" "12" "LLVM" +.SH NAME +llvm-extract \- extract a function from an LLVM module +.SH SYNOPSIS +.sp +\fBllvm\-extract\fP [\fIoptions\fP] \fB\-\-func\fP \fIfunction\-name\fP [\fIfilename\fP] +.SH DESCRIPTION +.sp +The \fBllvm\-extract\fP command takes the name of a function and extracts +it from the specified LLVM bitcode file. It is primarily used as a debugging +tool to reduce test cases from larger programs that are triggering a bug. +.sp +In addition to extracting the bitcode of the specified function, +\fBllvm\-extract\fP will also remove unreachable global variables, +prototypes, and unused types. +.sp +The \fBllvm\-extract\fP command reads its input from standard input if +filename is omitted or if filename is \fB\-\fP\&. The output is always written to +standard output, unless the \fB\-o\fP option is specified (see below). +.SH OPTIONS +.sp +\fB\-\-alias\fP \fIalias\-name\fP +.INDENT 0.0 +.INDENT 3.5 +Extract the alias named \fIfunction\-name\fP from the LLVM bitcode. May be +specified multiple times to extract multiple alias at once. +.UNINDENT +.UNINDENT +.sp +\fB\-\-ralias\fP \fIalias\-regular\-expr\fP +.INDENT 0.0 +.INDENT 3.5 +Extract the alias matching \fIalias\-regular\-expr\fP from the LLVM bitcode. +All alias matching the regular expression will be extracted. May be +specified multiple times. +.UNINDENT +.UNINDENT +.sp +\fB\-\-bb\fP \fIbasic\-block\-specifier\fP +.INDENT 0.0 +.INDENT 3.5 +Extract basic blocks(s) specified in \fIbasic\-block\-specifier\fP\&. May be +specified multiple times. Each <function:bb[;bb]> specifier pair will create +a function. If multiple basic blocks are specified in one pair, the first +block in the sequence should dominate the rest. +.UNINDENT +.UNINDENT +.sp +\fB\-\-delete\fP +.INDENT 0.0 +.INDENT 3.5 +Delete specified Globals from Module. +.UNINDENT +.UNINDENT +.sp +\fB\-f\fP +.INDENT 0.0 +.INDENT 3.5 +Enable binary output on terminals. Normally, \fBllvm\-extract\fP will +refuse to write raw bitcode output if the output stream is a terminal. With +this option, \fBllvm\-extract\fP will write raw bitcode regardless of the +output device. +.UNINDENT +.UNINDENT +.sp +\fB\-\-func\fP \fIfunction\-name\fP +.INDENT 0.0 +.INDENT 3.5 +Extract the function named \fIfunction\-name\fP from the LLVM bitcode. May be +specified multiple times to extract multiple functions at once. +.UNINDENT +.UNINDENT +.sp +\fB\-\-rfunc\fP \fIfunction\-regular\-expr\fP +.INDENT 0.0 +.INDENT 3.5 +Extract the function(s) matching \fIfunction\-regular\-expr\fP from the LLVM bitcode. +All functions matching the regular expression will be extracted. May be +specified multiple times. +.UNINDENT +.UNINDENT +.sp +\fB\-\-glob\fP \fIglobal\-name\fP +.INDENT 0.0 +.INDENT 3.5 +Extract the global variable named \fIglobal\-name\fP from the LLVM bitcode. May be +specified multiple times to extract multiple global variables at once. +.UNINDENT +.UNINDENT +.sp +\fB\-\-rglob\fP \fIglob\-regular\-expr\fP +.INDENT 0.0 +.INDENT 3.5 +Extract the global variable(s) matching \fIglobal\-regular\-expr\fP from the LLVM +bitcode. All global variables matching the regular expression will be +extracted. May be specified multiple times. +.UNINDENT +.UNINDENT +.sp +\fB\-\-keep\-const\-init\fP +.INDENT 0.0 +.INDENT 3.5 +Preserve the values of constant globals. +.UNINDENT +.UNINDENT +.sp +\fB\-\-recursive\fP +.INDENT 0.0 +.INDENT 3.5 +Recursively extract all called functions +.UNINDENT +.UNINDENT +.sp +\fB\-help\fP +.INDENT 0.0 +.INDENT 3.5 +Print a summary of command line options. +.UNINDENT +.UNINDENT +.sp +\fB\-o\fP \fIfilename\fP +.INDENT 0.0 +.INDENT 3.5 +Specify the output filename. If filename is "\-" (the default), then +\fBllvm\-extract\fP sends its output to standard output. +.UNINDENT +.UNINDENT +.sp +\fB\-S\fP +.INDENT 0.0 +.INDENT 3.5 +Write output in LLVM intermediate language (instead of bitcode). +.UNINDENT +.UNINDENT +.SH EXIT STATUS +.sp +If \fBllvm\-extract\fP succeeds, it will exit with 0. Otherwise, if an error +occurs, it will exit with a non\-zero value. +.SH SEE ALSO +.sp +\fBbugpoint(1)\fP +.SH AUTHOR +Maintained by the LLVM Team (https://llvm.org/). +.SH COPYRIGHT +2003-2021, LLVM Project +.\" Generated by docutils manpage writer. +. diff --git a/usr.bin/clang/llvm-link/Makefile b/usr.bin/clang/llvm-link/Makefile new file mode 100644 index 000000000000..5fb3a7a85943 --- /dev/null +++ b/usr.bin/clang/llvm-link/Makefile @@ -0,0 +1,8 @@ +# $FreeBSD$ + +PROG_CXX= llvm-link + +SRCDIR= llvm/tools/llvm-link +SRCS+= llvm-link.cpp + +.include "../llvm.prog.mk" diff --git a/usr.bin/clang/llvm-link/Makefile.depend b/usr.bin/clang/llvm-link/Makefile.depend new file mode 100644 index 000000000000..1423340957b6 --- /dev/null +++ b/usr.bin/clang/llvm-link/Makefile.depend @@ -0,0 +1,24 @@ +# $FreeBSD$ +# Autogenerated - do NOT edit! + +DIRDEPS = \ + gnu/lib/csu \ + include \ + include/xlocale \ + lib/${CSU_DIR} \ + lib/clang/libllvm \ + lib/libc \ + lib/libc++ \ + lib/libcompiler_rt \ + lib/libcxxrt \ + lib/libthr \ + lib/libz \ + lib/msun \ + lib/ncurses/ncursesw \ + + +.include <dirdeps.mk> + +.if ${DEP_RELDIR} == ${_DEP_RELDIR} +# local dependencies - needed for -jN in clean tree +.endif diff --git a/usr.bin/clang/llvm-link/llvm-link.1 b/usr.bin/clang/llvm-link/llvm-link.1 new file mode 100644 index 000000000000..dffceb9d29da --- /dev/null +++ b/usr.bin/clang/llvm-link/llvm-link.1 @@ -0,0 +1,89 @@ +.\" $FreeBSD$ +.\" Man page generated from reStructuredText. +. +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.TH "LLVM-LINK" "1" "2021-06-07" "12" "LLVM" +.SH NAME +llvm-link \- LLVM bitcode linker +.SH SYNOPSIS +.sp +\fBllvm\-link\fP [\fIoptions\fP] \fIfilename ...\fP +.SH DESCRIPTION +.sp +\fBllvm\-link\fP takes several LLVM bitcode files and links them together +into a single LLVM bitcode file. It writes the output file to standard output, +unless the \fI\%\-o\fP option is used to specify a filename. +.SH OPTIONS +.INDENT 0.0 +.TP +.B \-f +Enable binary output on terminals. Normally, \fBllvm\-link\fP will refuse +to write raw bitcode output if the output stream is a terminal. With this +option, \fBllvm\-link\fP will write raw bitcode regardless of the output +device. +.UNINDENT +.INDENT 0.0 +.TP +.B \-o filename +Specify the output file name. If \fBfilename\fP is "\fB\-\fP", then +\fBllvm\-link\fP will write its output to standard output. +.UNINDENT +.INDENT 0.0 +.TP +.B \-S +Write output in LLVM intermediate language (instead of bitcode). +.UNINDENT +.INDENT 0.0 +.TP +.B \-d +If specified, \fBllvm\-link\fP prints a human\-readable version of the +output bitcode file to standard error. +.UNINDENT +.INDENT 0.0 +.TP +.B \-help +Print a summary of command line options. +.UNINDENT +.INDENT 0.0 +.TP +.B \-v +Verbose mode. Print information about what \fBllvm\-link\fP is doing. +This typically includes a message for each bitcode file linked in and for each +library found. +.UNINDENT +.SH EXIT STATUS +.sp +If \fBllvm\-link\fP succeeds, it will exit with 0. Otherwise, if an error +occurs, it will exit with a non\-zero value. +.SH AUTHOR +Maintained by the LLVM Team (https://llvm.org/). +.SH COPYRIGHT +2003-2021, LLVM Project +.\" Generated by docutils manpage writer. +. diff --git a/usr.bin/clang/llvm-lto/Makefile b/usr.bin/clang/llvm-lto/Makefile new file mode 100644 index 000000000000..35e2b87fef3c --- /dev/null +++ b/usr.bin/clang/llvm-lto/Makefile @@ -0,0 +1,12 @@ +# $FreeBSD$ + +PROG_CXX= llvm-lto +MAN= + +SRCDIR= llvm/tools/llvm-lto +SRCS= llvm-lto.cpp + +LIBADD+= z +LIBADD+= zstd + +.include "../llvm.prog.mk" diff --git a/usr.bin/clang/llvm-lto/Makefile.depend b/usr.bin/clang/llvm-lto/Makefile.depend new file mode 100644 index 000000000000..1423340957b6 --- /dev/null +++ b/usr.bin/clang/llvm-lto/Makefile.depend @@ -0,0 +1,24 @@ +# $FreeBSD$ +# Autogenerated - do NOT edit! + +DIRDEPS = \ + gnu/lib/csu \ + include \ + include/xlocale \ + lib/${CSU_DIR} \ + lib/clang/libllvm \ + lib/libc \ + lib/libc++ \ + lib/libcompiler_rt \ + lib/libcxxrt \ + lib/libthr \ + lib/libz \ + lib/msun \ + lib/ncurses/ncursesw \ + + +.include <dirdeps.mk> + +.if ${DEP_RELDIR} == ${_DEP_RELDIR} +# local dependencies - needed for -jN in clean tree +.endif diff --git a/usr.bin/clang/llvm-lto2/Makefile b/usr.bin/clang/llvm-lto2/Makefile new file mode 100644 index 000000000000..37a5e7f794c0 --- /dev/null +++ b/usr.bin/clang/llvm-lto2/Makefile @@ -0,0 +1,12 @@ +# $FreeBSD$ + +PROG_CXX= llvm-lto2 +MAN= + +SRCDIR= llvm/tools/llvm-lto2 +SRCS= llvm-lto2.cpp + +LIBADD+= z +LIBADD+= zstd + +.include "../llvm.prog.mk" diff --git a/usr.bin/clang/llvm-lto2/Makefile.depend b/usr.bin/clang/llvm-lto2/Makefile.depend new file mode 100644 index 000000000000..1423340957b6 --- /dev/null +++ b/usr.bin/clang/llvm-lto2/Makefile.depend @@ -0,0 +1,24 @@ +# $FreeBSD$ +# Autogenerated - do NOT edit! + +DIRDEPS = \ + gnu/lib/csu \ + include \ + include/xlocale \ + lib/${CSU_DIR} \ + lib/clang/libllvm \ + lib/libc \ + lib/libc++ \ + lib/libcompiler_rt \ + lib/libcxxrt \ + lib/libthr \ + lib/libz \ + lib/msun \ + lib/ncurses/ncursesw \ + + +.include <dirdeps.mk> + +.if ${DEP_RELDIR} == ${_DEP_RELDIR} +# local dependencies - needed for -jN in clean tree +.endif diff --git a/usr.bin/clang/llvm-mc/Makefile b/usr.bin/clang/llvm-mc/Makefile new file mode 100644 index 000000000000..cb3080481607 --- /dev/null +++ b/usr.bin/clang/llvm-mc/Makefile @@ -0,0 +1,13 @@ +# $FreeBSD$ + +PROG_CXX= llvm-mc +MAN= + +SRCDIR= llvm/tools/llvm-mc +SRCS+= Disassembler.cpp +SRCS+= llvm-mc.cpp + +LIBADD+= z +LIBADD+= zstd + +.include "../llvm.prog.mk" diff --git a/usr.bin/clang/llvm-mc/Makefile.depend b/usr.bin/clang/llvm-mc/Makefile.depend new file mode 100644 index 000000000000..1423340957b6 --- /dev/null +++ b/usr.bin/clang/llvm-mc/Makefile.depend @@ -0,0 +1,24 @@ +# $FreeBSD$ +# Autogenerated - do NOT edit! + +DIRDEPS = \ + gnu/lib/csu \ + include \ + include/xlocale \ + lib/${CSU_DIR} \ + lib/clang/libllvm \ + lib/libc \ + lib/libc++ \ + lib/libcompiler_rt \ + lib/libcxxrt \ + lib/libthr \ + lib/libz \ + lib/msun \ + lib/ncurses/ncursesw \ + + +.include <dirdeps.mk> + +.if ${DEP_RELDIR} == ${_DEP_RELDIR} +# local dependencies - needed for -jN in clean tree +.endif diff --git a/usr.bin/clang/llvm-mca/Makefile b/usr.bin/clang/llvm-mca/Makefile new file mode 100644 index 000000000000..727651146c52 --- /dev/null +++ b/usr.bin/clang/llvm-mca/Makefile @@ -0,0 +1,25 @@ +# $FreeBSD$ + +PROG_CXX= llvm-mca + +SRCDIR= llvm/tools/llvm-mca +SRCS+= CodeRegion.cpp +SRCS+= CodeRegionGenerator.cpp +SRCS+= PipelinePrinter.cpp +SRCS+= Views/BottleneckAnalysis.cpp +SRCS+= Views/DispatchStatistics.cpp +SRCS+= Views/InstructionInfoView.cpp +SRCS+= Views/InstructionView.cpp +SRCS+= Views/RegisterFileStatistics.cpp +SRCS+= Views/ResourcePressureView.cpp +SRCS+= Views/RetireControlUnitStatistics.cpp +SRCS+= Views/SchedulerStatistics.cpp +SRCS+= Views/SummaryView.cpp +SRCS+= Views/TimelineView.cpp +SRCS+= llvm-mca.cpp + +CFLAGS+= -I${LLVM_BASE}/${SRCDIR} + +LIBADD+= z + +.include "../llvm.prog.mk" diff --git a/usr.bin/clang/llvm-mca/llvm-mca.1 b/usr.bin/clang/llvm-mca/llvm-mca.1 new file mode 100644 index 000000000000..d837c1c558bf --- /dev/null +++ b/usr.bin/clang/llvm-mca/llvm-mca.1 @@ -0,0 +1,1128 @@ +.\" $FreeBSD$ +.\" Man page generated from reStructuredText. +. +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.TH "LLVM-MCA" "1" "2021-06-07" "12" "LLVM" +.SH NAME +llvm-mca \- LLVM Machine Code Analyzer +.SH SYNOPSIS +.sp +\fBllvm\-mca\fP [\fIoptions\fP] [input] +.SH DESCRIPTION +.sp +\fBllvm\-mca\fP is a performance analysis tool that uses information +available in LLVM (e.g. scheduling models) to statically measure the performance +of machine code in a specific CPU. +.sp +Performance is measured in terms of throughput as well as processor resource +consumption. The tool currently works for processors with an out\-of\-order +backend, for which there is a scheduling model available in LLVM. +.sp +The main goal of this tool is not just to predict the performance of the code +when run on the target, but also help with diagnosing potential performance +issues. +.sp +Given an assembly code sequence, \fBllvm\-mca\fP estimates the Instructions +Per Cycle (IPC), as well as hardware resource pressure. The analysis and +reporting style were inspired by the IACA tool from Intel. +.sp +For example, you can compile code with clang, output assembly, and pipe it +directly into \fBllvm\-mca\fP for analysis: +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +$ clang foo.c \-O2 \-target x86_64\-unknown\-unknown \-S \-o \- | llvm\-mca \-mcpu=btver2 +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Or for Intel syntax: +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +$ clang foo.c \-O2 \-target x86_64\-unknown\-unknown \-mllvm \-x86\-asm\-syntax=intel \-S \-o \- | llvm\-mca \-mcpu=btver2 +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +(\fBllvm\-mca\fP detects Intel syntax by the presence of an \fI\&.intel_syntax\fP +directive at the beginning of the input. By default its output syntax matches +that of its input.) +.sp +Scheduling models are not just used to compute instruction latencies and +throughput, but also to understand what processor resources are available +and how to simulate them. +.sp +By design, the quality of the analysis conducted by \fBllvm\-mca\fP is +inevitably affected by the quality of the scheduling models in LLVM. +.sp +If you see that the performance report is not accurate for a processor, +please \fI\%file a bug\fP +against the appropriate backend. +.SH OPTIONS +.sp +If \fBinput\fP is "\fB\-\fP" or omitted, \fBllvm\-mca\fP reads from standard +input. Otherwise, it will read from the specified filename. +.sp +If the \fI\%\-o\fP option is omitted, then \fBllvm\-mca\fP will send its output +to standard output if the input is from standard input. If the \fI\%\-o\fP +option specifies "\fB\-\fP", then the output will also be sent to standard output. +.INDENT 0.0 +.TP +.B \-help +Print a summary of command line options. +.UNINDENT +.INDENT 0.0 +.TP +.B \-o <filename> +Use \fB<filename>\fP as the output filename. See the summary above for more +details. +.UNINDENT +.INDENT 0.0 +.TP +.B \-mtriple=<target triple> +Specify a target triple string. +.UNINDENT +.INDENT 0.0 +.TP +.B \-march=<arch> +Specify the architecture for which to analyze the code. It defaults to the +host default target. +.UNINDENT +.INDENT 0.0 +.TP +.B \-mcpu=<cpuname> +Specify the processor for which to analyze the code. By default, the cpu name +is autodetected from the host. +.UNINDENT +.INDENT 0.0 +.TP +.B \-output\-asm\-variant=<variant id> +Specify the output assembly variant for the report generated by the tool. +On x86, possible values are [0, 1]. A value of 0 (vic. 1) for this flag enables +the AT&T (vic. Intel) assembly format for the code printed out by the tool in +the analysis report. +.UNINDENT +.INDENT 0.0 +.TP +.B \-print\-imm\-hex +Prefer hex format for numeric literals in the output assembly printed as part +of the report. +.UNINDENT +.INDENT 0.0 +.TP +.B \-dispatch=<width> +Specify a different dispatch width for the processor. The dispatch width +defaults to field \(aqIssueWidth\(aq in the processor scheduling model. If width is +zero, then the default dispatch width is used. +.UNINDENT +.INDENT 0.0 +.TP +.B \-register\-file\-size=<size> +Specify the size of the register file. When specified, this flag limits how +many physical registers are available for register renaming purposes. A value +of zero for this flag means "unlimited number of physical registers". +.UNINDENT +.INDENT 0.0 +.TP +.B \-iterations=<number of iterations> +Specify the number of iterations to run. If this flag is set to 0, then the +tool sets the number of iterations to a default value (i.e. 100). +.UNINDENT +.INDENT 0.0 +.TP +.B \-noalias=<bool> +If set, the tool assumes that loads and stores don\(aqt alias. This is the +default behavior. +.UNINDENT +.INDENT 0.0 +.TP +.B \-lqueue=<load queue size> +Specify the size of the load queue in the load/store unit emulated by the tool. +By default, the tool assumes an unbound number of entries in the load queue. +A value of zero for this flag is ignored, and the default load queue size is +used instead. +.UNINDENT +.INDENT 0.0 +.TP +.B \-squeue=<store queue size> +Specify the size of the store queue in the load/store unit emulated by the +tool. By default, the tool assumes an unbound number of entries in the store +queue. A value of zero for this flag is ignored, and the default store queue +size is used instead. +.UNINDENT +.INDENT 0.0 +.TP +.B \-timeline +Enable the timeline view. +.UNINDENT +.INDENT 0.0 +.TP +.B \-timeline\-max\-iterations=<iterations> +Limit the number of iterations to print in the timeline view. By default, the +timeline view prints information for up to 10 iterations. +.UNINDENT +.INDENT 0.0 +.TP +.B \-timeline\-max\-cycles=<cycles> +Limit the number of cycles in the timeline view. By default, the number of +cycles is set to 80. +.UNINDENT +.INDENT 0.0 +.TP +.B \-resource\-pressure +Enable the resource pressure view. This is enabled by default. +.UNINDENT +.INDENT 0.0 +.TP +.B \-register\-file\-stats +Enable register file usage statistics. +.UNINDENT +.INDENT 0.0 +.TP +.B \-dispatch\-stats +Enable extra dispatch statistics. This view collects and analyzes instruction +dispatch events, as well as static/dynamic dispatch stall events. This view +is disabled by default. +.UNINDENT +.INDENT 0.0 +.TP +.B \-scheduler\-stats +Enable extra scheduler statistics. This view collects and analyzes instruction +issue events. This view is disabled by default. +.UNINDENT +.INDENT 0.0 +.TP +.B \-retire\-stats +Enable extra retire control unit statistics. This view is disabled by default. +.UNINDENT +.INDENT 0.0 +.TP +.B \-instruction\-info +Enable the instruction info view. This is enabled by default. +.UNINDENT +.INDENT 0.0 +.TP +.B \-show\-encoding +Enable the printing of instruction encodings within the instruction info view. +.UNINDENT +.INDENT 0.0 +.TP +.B \-all\-stats +Print all hardware statistics. This enables extra statistics related to the +dispatch logic, the hardware schedulers, the register file(s), and the retire +control unit. This option is disabled by default. +.UNINDENT +.INDENT 0.0 +.TP +.B \-all\-views +Enable all the view. +.UNINDENT +.INDENT 0.0 +.TP +.B \-instruction\-tables +Prints resource pressure information based on the static information +available from the processor model. This differs from the resource pressure +view because it doesn\(aqt require that the code is simulated. It instead prints +the theoretical uniform distribution of resource pressure for every +instruction in sequence. +.UNINDENT +.INDENT 0.0 +.TP +.B \-bottleneck\-analysis +Print information about bottlenecks that affect the throughput. This analysis +can be expensive, and it is disabled by default. Bottlenecks are highlighted +in the summary view. +.UNINDENT +.INDENT 0.0 +.TP +.B \-json +Print the requested views in JSON format. The instructions and the processor +resources are printed as members of special top level JSON objects. The +individual views refer to them by index. +.UNINDENT +.SH EXIT STATUS +.sp +\fBllvm\-mca\fP returns 0 on success. Otherwise, an error message is printed +to standard error, and the tool returns 1. +.SH USING MARKERS TO ANALYZE SPECIFIC CODE BLOCKS +.sp +\fBllvm\-mca\fP allows for the optional usage of special code comments to +mark regions of the assembly code to be analyzed. A comment starting with +substring \fBLLVM\-MCA\-BEGIN\fP marks the beginning of a code region. A comment +starting with substring \fBLLVM\-MCA\-END\fP marks the end of a code region. For +example: +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +# LLVM\-MCA\-BEGIN + ... +# LLVM\-MCA\-END +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +If no user\-defined region is specified, then \fBllvm\-mca\fP assumes a +default region which contains every instruction in the input file. Every region +is analyzed in isolation, and the final performance report is the union of all +the reports generated for every code region. +.sp +Code regions can have names. For example: +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +# LLVM\-MCA\-BEGIN A simple example + add %eax, %eax +# LLVM\-MCA\-END +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +The code from the example above defines a region named "A simple example" with a +single instruction in it. Note how the region name doesn\(aqt have to be repeated +in the \fBLLVM\-MCA\-END\fP directive. In the absence of overlapping regions, +an anonymous \fBLLVM\-MCA\-END\fP directive always ends the currently active user +defined region. +.sp +Example of nesting regions: +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +# LLVM\-MCA\-BEGIN foo + add %eax, %edx +# LLVM\-MCA\-BEGIN bar + sub %eax, %edx +# LLVM\-MCA\-END bar +# LLVM\-MCA\-END foo +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Example of overlapping regions: +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +# LLVM\-MCA\-BEGIN foo + add %eax, %edx +# LLVM\-MCA\-BEGIN bar + sub %eax, %edx +# LLVM\-MCA\-END foo + add %eax, %edx +# LLVM\-MCA\-END bar +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Note that multiple anonymous regions cannot overlap. Also, overlapping regions +cannot have the same name. +.sp +There is no support for marking regions from high\-level source code, like C or +C++. As a workaround, inline assembly directives may be used: +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +int foo(int a, int b) { + __asm volatile("# LLVM\-MCA\-BEGIN foo"); + a += 42; + __asm volatile("# LLVM\-MCA\-END"); + a *= b; + return a; +} +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +However, this interferes with optimizations like loop vectorization and may have +an impact on the code generated. This is because the \fB__asm\fP statements are +seen as real code having important side effects, which limits how the code +around them can be transformed. If users want to make use of inline assembly +to emit markers, then the recommendation is to always verify that the output +assembly is equivalent to the assembly generated in the absence of markers. +The \fI\%Clang options to emit optimization reports\fP +can also help in detecting missed optimizations. +.SH HOW LLVM-MCA WORKS +.sp +\fBllvm\-mca\fP takes assembly code as input. The assembly code is parsed +into a sequence of MCInst with the help of the existing LLVM target assembly +parsers. The parsed sequence of MCInst is then analyzed by a \fBPipeline\fP module +to generate a performance report. +.sp +The Pipeline module simulates the execution of the machine code sequence in a +loop of iterations (default is 100). During this process, the pipeline collects +a number of execution related statistics. At the end of this process, the +pipeline generates and prints a report from the collected statistics. +.sp +Here is an example of a performance report generated by the tool for a +dot\-product of two packed float vectors of four elements. The analysis is +conducted for target x86, cpu btver2. The following result can be produced via +the following command using the example located at +\fBtest/tools/llvm\-mca/X86/BtVer2/dot\-product.s\fP: +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +$ llvm\-mca \-mtriple=x86_64\-unknown\-unknown \-mcpu=btver2 \-iterations=300 dot\-product.s +.ft P +.fi +.UNINDENT +.UNINDENT +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +Iterations: 300 +Instructions: 900 +Total Cycles: 610 +Total uOps: 900 + +Dispatch Width: 2 +uOps Per Cycle: 1.48 +IPC: 1.48 +Block RThroughput: 2.0 + + +Instruction Info: +[1]: #uOps +[2]: Latency +[3]: RThroughput +[4]: MayLoad +[5]: MayStore +[6]: HasSideEffects (U) + +[1] [2] [3] [4] [5] [6] Instructions: + 1 2 1.00 vmulps %xmm0, %xmm1, %xmm2 + 1 3 1.00 vhaddps %xmm2, %xmm2, %xmm3 + 1 3 1.00 vhaddps %xmm3, %xmm3, %xmm4 + + +Resources: +[0] \- JALU0 +[1] \- JALU1 +[2] \- JDiv +[3] \- JFPA +[4] \- JFPM +[5] \- JFPU0 +[6] \- JFPU1 +[7] \- JLAGU +[8] \- JMul +[9] \- JSAGU +[10] \- JSTC +[11] \- JVALU0 +[12] \- JVALU1 +[13] \- JVIMUL + + +Resource pressure per iteration: +[0] [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] + \- \- \- 2.00 1.00 2.00 1.00 \- \- \- \- \- \- \- + +Resource pressure by instruction: +[0] [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] Instructions: + \- \- \- \- 1.00 \- 1.00 \- \- \- \- \- \- \- vmulps %xmm0, %xmm1, %xmm2 + \- \- \- 1.00 \- 1.00 \- \- \- \- \- \- \- \- vhaddps %xmm2, %xmm2, %xmm3 + \- \- \- 1.00 \- 1.00 \- \- \- \- \- \- \- \- vhaddps %xmm3, %xmm3, %xmm4 +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +According to this report, the dot\-product kernel has been executed 300 times, +for a total of 900 simulated instructions. The total number of simulated micro +opcodes (uOps) is also 900. +.sp +The report is structured in three main sections. The first section collects a +few performance numbers; the goal of this section is to give a very quick +overview of the performance throughput. Important performance indicators are +\fBIPC\fP, \fBuOps Per Cycle\fP, and \fBBlock RThroughput\fP (Block Reciprocal +Throughput). +.sp +Field \fIDispatchWidth\fP is the maximum number of micro opcodes that are dispatched +to the out\-of\-order backend every simulated cycle. +.sp +IPC is computed dividing the total number of simulated instructions by the total +number of cycles. +.sp +Field \fIBlock RThroughput\fP is the reciprocal of the block throughput. Block +throughput is a theoretical quantity computed as the maximum number of blocks +(i.e. iterations) that can be executed per simulated clock cycle in the absence +of loop carried dependencies. Block throughput is superiorly limited by the +dispatch rate, and the availability of hardware resources. +.sp +In the absence of loop\-carried data dependencies, the observed IPC tends to a +theoretical maximum which can be computed by dividing the number of instructions +of a single iteration by the \fIBlock RThroughput\fP\&. +.sp +Field \(aquOps Per Cycle\(aq is computed dividing the total number of simulated micro +opcodes by the total number of cycles. A delta between Dispatch Width and this +field is an indicator of a performance issue. In the absence of loop\-carried +data dependencies, the observed \(aquOps Per Cycle\(aq should tend to a theoretical +maximum throughput which can be computed by dividing the number of uOps of a +single iteration by the \fIBlock RThroughput\fP\&. +.sp +Field \fIuOps Per Cycle\fP is bounded from above by the dispatch width. That is +because the dispatch width limits the maximum size of a dispatch group. Both IPC +and \(aquOps Per Cycle\(aq are limited by the amount of hardware parallelism. The +availability of hardware resources affects the resource pressure distribution, +and it limits the number of instructions that can be executed in parallel every +cycle. A delta between Dispatch Width and the theoretical maximum uOps per +Cycle (computed by dividing the number of uOps of a single iteration by the +\fIBlock RThroughput\fP) is an indicator of a performance bottleneck caused by the +lack of hardware resources. +In general, the lower the Block RThroughput, the better. +.sp +In this example, \fBuOps per iteration/Block RThroughput\fP is 1.50. Since there +are no loop\-carried dependencies, the observed \fIuOps Per Cycle\fP is expected to +approach 1.50 when the number of iterations tends to infinity. The delta between +the Dispatch Width (2.00), and the theoretical maximum uOp throughput (1.50) is +an indicator of a performance bottleneck caused by the lack of hardware +resources, and the \fIResource pressure view\fP can help to identify the problematic +resource usage. +.sp +The second section of the report is the \fIinstruction info view\fP\&. It shows the +latency and reciprocal throughput of every instruction in the sequence. It also +reports extra information related to the number of micro opcodes, and opcode +properties (i.e., \(aqMayLoad\(aq, \(aqMayStore\(aq, and \(aqHasSideEffects\(aq). +.sp +Field \fIRThroughput\fP is the reciprocal of the instruction throughput. Throughput +is computed as the maximum number of instructions of a same type that can be +executed per clock cycle in the absence of operand dependencies. In this +example, the reciprocal throughput of a vector float multiply is 1 +cycles/instruction. That is because the FP multiplier JFPM is only available +from pipeline JFPU1. +.sp +Instruction encodings are displayed within the instruction info view when flag +\fI\-show\-encoding\fP is specified. +.sp +Below is an example of \fI\-show\-encoding\fP output for the dot\-product kernel: +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +Instruction Info: +[1]: #uOps +[2]: Latency +[3]: RThroughput +[4]: MayLoad +[5]: MayStore +[6]: HasSideEffects (U) +[7]: Encoding Size + +[1] [2] [3] [4] [5] [6] [7] Encodings: Instructions: + 1 2 1.00 4 c5 f0 59 d0 vmulps %xmm0, %xmm1, %xmm2 + 1 4 1.00 4 c5 eb 7c da vhaddps %xmm2, %xmm2, %xmm3 + 1 4 1.00 4 c5 e3 7c e3 vhaddps %xmm3, %xmm3, %xmm4 +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +The \fIEncoding Size\fP column shows the size in bytes of instructions. The +\fIEncodings\fP column shows the actual instruction encodings (byte sequences in +hex). +.sp +The third section is the \fIResource pressure view\fP\&. This view reports +the average number of resource cycles consumed every iteration by instructions +for every processor resource unit available on the target. Information is +structured in two tables. The first table reports the number of resource cycles +spent on average every iteration. The second table correlates the resource +cycles to the machine instruction in the sequence. For example, every iteration +of the instruction vmulps always executes on resource unit [6] +(JFPU1 \- floating point pipeline #1), consuming an average of 1 resource cycle +per iteration. Note that on AMD Jaguar, vector floating\-point multiply can +only be issued to pipeline JFPU1, while horizontal floating\-point additions can +only be issued to pipeline JFPU0. +.sp +The resource pressure view helps with identifying bottlenecks caused by high +usage of specific hardware resources. Situations with resource pressure mainly +concentrated on a few resources should, in general, be avoided. Ideally, +pressure should be uniformly distributed between multiple resources. +.SS Timeline View +.sp +The timeline view produces a detailed report of each instruction\(aqs state +transitions through an instruction pipeline. This view is enabled by the +command line option \fB\-timeline\fP\&. As instructions transition through the +various stages of the pipeline, their states are depicted in the view report. +These states are represented by the following characters: +.INDENT 0.0 +.IP \(bu 2 +D : Instruction dispatched. +.IP \(bu 2 +e : Instruction executing. +.IP \(bu 2 +E : Instruction executed. +.IP \(bu 2 +R : Instruction retired. +.IP \(bu 2 += : Instruction already dispatched, waiting to be executed. +.IP \(bu 2 +\- : Instruction executed, waiting to be retired. +.UNINDENT +.sp +Below is the timeline view for a subset of the dot\-product example located in +\fBtest/tools/llvm\-mca/X86/BtVer2/dot\-product.s\fP and processed by +\fBllvm\-mca\fP using the following command: +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +$ llvm\-mca \-mtriple=x86_64\-unknown\-unknown \-mcpu=btver2 \-iterations=3 \-timeline dot\-product.s +.ft P +.fi +.UNINDENT +.UNINDENT +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +Timeline view: + 012345 +Index 0123456789 + +[0,0] DeeER. . . vmulps %xmm0, %xmm1, %xmm2 +[0,1] D==eeeER . . vhaddps %xmm2, %xmm2, %xmm3 +[0,2] .D====eeeER . vhaddps %xmm3, %xmm3, %xmm4 +[1,0] .DeeE\-\-\-\-\-R . vmulps %xmm0, %xmm1, %xmm2 +[1,1] . D=eeeE\-\-\-R . vhaddps %xmm2, %xmm2, %xmm3 +[1,2] . D====eeeER . vhaddps %xmm3, %xmm3, %xmm4 +[2,0] . DeeE\-\-\-\-\-R . vmulps %xmm0, %xmm1, %xmm2 +[2,1] . D====eeeER . vhaddps %xmm2, %xmm2, %xmm3 +[2,2] . D======eeeER vhaddps %xmm3, %xmm3, %xmm4 + + +Average Wait times (based on the timeline view): +[0]: Executions +[1]: Average time spent waiting in a scheduler\(aqs queue +[2]: Average time spent waiting in a scheduler\(aqs queue while ready +[3]: Average time elapsed from WB until retire stage + + [0] [1] [2] [3] +0. 3 1.0 1.0 3.3 vmulps %xmm0, %xmm1, %xmm2 +1. 3 3.3 0.7 1.0 vhaddps %xmm2, %xmm2, %xmm3 +2. 3 5.7 0.0 0.0 vhaddps %xmm3, %xmm3, %xmm4 + 3 3.3 0.5 1.4 <total> +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +The timeline view is interesting because it shows instruction state changes +during execution. It also gives an idea of how the tool processes instructions +executed on the target, and how their timing information might be calculated. +.sp +The timeline view is structured in two tables. The first table shows +instructions changing state over time (measured in cycles); the second table +(named \fIAverage Wait times\fP) reports useful timing statistics, which should +help diagnose performance bottlenecks caused by long data dependencies and +sub\-optimal usage of hardware resources. +.sp +An instruction in the timeline view is identified by a pair of indices, where +the first index identifies an iteration, and the second index is the +instruction index (i.e., where it appears in the code sequence). Since this +example was generated using 3 iterations: \fB\-iterations=3\fP, the iteration +indices range from 0\-2 inclusively. +.sp +Excluding the first and last column, the remaining columns are in cycles. +Cycles are numbered sequentially starting from 0. +.sp +From the example output above, we know the following: +.INDENT 0.0 +.IP \(bu 2 +Instruction [1,0] was dispatched at cycle 1. +.IP \(bu 2 +Instruction [1,0] started executing at cycle 2. +.IP \(bu 2 +Instruction [1,0] reached the write back stage at cycle 4. +.IP \(bu 2 +Instruction [1,0] was retired at cycle 10. +.UNINDENT +.sp +Instruction [1,0] (i.e., vmulps from iteration #1) does not have to wait in the +scheduler\(aqs queue for the operands to become available. By the time vmulps is +dispatched, operands are already available, and pipeline JFPU1 is ready to +serve another instruction. So the instruction can be immediately issued on the +JFPU1 pipeline. That is demonstrated by the fact that the instruction only +spent 1cy in the scheduler\(aqs queue. +.sp +There is a gap of 5 cycles between the write\-back stage and the retire event. +That is because instructions must retire in program order, so [1,0] has to wait +for [0,2] to be retired first (i.e., it has to wait until cycle 10). +.sp +In the example, all instructions are in a RAW (Read After Write) dependency +chain. Register %xmm2 written by vmulps is immediately used by the first +vhaddps, and register %xmm3 written by the first vhaddps is used by the second +vhaddps. Long data dependencies negatively impact the ILP (Instruction Level +Parallelism). +.sp +In the dot\-product example, there are anti\-dependencies introduced by +instructions from different iterations. However, those dependencies can be +removed at register renaming stage (at the cost of allocating register aliases, +and therefore consuming physical registers). +.sp +Table \fIAverage Wait times\fP helps diagnose performance issues that are caused by +the presence of long latency instructions and potentially long data dependencies +which may limit the ILP. Last row, \fB<total>\fP, shows a global average over all +instructions measured. Note that \fBllvm\-mca\fP, by default, assumes at +least 1cy between the dispatch event and the issue event. +.sp +When the performance is limited by data dependencies and/or long latency +instructions, the number of cycles spent while in the \fIready\fP state is expected +to be very small when compared with the total number of cycles spent in the +scheduler\(aqs queue. The difference between the two counters is a good indicator +of how large of an impact data dependencies had on the execution of the +instructions. When performance is mostly limited by the lack of hardware +resources, the delta between the two counters is small. However, the number of +cycles spent in the queue tends to be larger (i.e., more than 1\-3cy), +especially when compared to other low latency instructions. +.SS Bottleneck Analysis +.sp +The \fB\-bottleneck\-analysis\fP command line option enables the analysis of +performance bottlenecks. +.sp +This analysis is potentially expensive. It attempts to correlate increases in +backend pressure (caused by pipeline resource pressure and data dependencies) to +dynamic dispatch stalls. +.sp +Below is an example of \fB\-bottleneck\-analysis\fP output generated by +\fBllvm\-mca\fP for 500 iterations of the dot\-product example on btver2. +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +Cycles with backend pressure increase [ 48.07% ] +Throughput Bottlenecks: + Resource Pressure [ 47.77% ] + \- JFPA [ 47.77% ] + \- JFPU0 [ 47.77% ] + Data Dependencies: [ 0.30% ] + \- Register Dependencies [ 0.30% ] + \- Memory Dependencies [ 0.00% ] + +Critical sequence based on the simulation: + + Instruction Dependency Information + +\-\-\-\-< 2. vhaddps %xmm3, %xmm3, %xmm4 + | + | < loop carried > + | + | 0. vmulps %xmm0, %xmm1, %xmm2 + +\-\-\-\-> 1. vhaddps %xmm2, %xmm2, %xmm3 ## RESOURCE interference: JFPA [ probability: 74% ] + +\-\-\-\-> 2. vhaddps %xmm3, %xmm3, %xmm4 ## REGISTER dependency: %xmm3 + | + | < loop carried > + | + +\-\-\-\-> 1. vhaddps %xmm2, %xmm2, %xmm3 ## RESOURCE interference: JFPA [ probability: 74% ] +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +According to the analysis, throughput is limited by resource pressure and not by +data dependencies. The analysis observed increases in backend pressure during +48.07% of the simulated run. Almost all those pressure increase events were +caused by contention on processor resources JFPA/JFPU0. +.sp +The \fIcritical sequence\fP is the most expensive sequence of instructions according +to the simulation. It is annotated to provide extra information about critical +register dependencies and resource interferences between instructions. +.sp +Instructions from the critical sequence are expected to significantly impact +performance. By construction, the accuracy of this analysis is strongly +dependent on the simulation and (as always) by the quality of the processor +model in llvm. +.SS Extra Statistics to Further Diagnose Performance Issues +.sp +The \fB\-all\-stats\fP command line option enables extra statistics and performance +counters for the dispatch logic, the reorder buffer, the retire control unit, +and the register file. +.sp +Below is an example of \fB\-all\-stats\fP output generated by \fBllvm\-mca\fP +for 300 iterations of the dot\-product example discussed in the previous +sections. +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +Dynamic Dispatch Stall Cycles: +RAT \- Register unavailable: 0 +RCU \- Retire tokens unavailable: 0 +SCHEDQ \- Scheduler full: 272 (44.6%) +LQ \- Load queue full: 0 +SQ \- Store queue full: 0 +GROUP \- Static restrictions on the dispatch group: 0 + + +Dispatch Logic \- number of cycles where we saw N micro opcodes dispatched: +[# dispatched], [# cycles] + 0, 24 (3.9%) + 1, 272 (44.6%) + 2, 314 (51.5%) + + +Schedulers \- number of cycles where we saw N micro opcodes issued: +[# issued], [# cycles] + 0, 7 (1.1%) + 1, 306 (50.2%) + 2, 297 (48.7%) + +Scheduler\(aqs queue usage: +[1] Resource name. +[2] Average number of used buffer entries. +[3] Maximum number of used buffer entries. +[4] Total number of buffer entries. + + [1] [2] [3] [4] +JALU01 0 0 20 +JFPU01 17 18 18 +JLSAGU 0 0 12 + + +Retire Control Unit \- number of cycles where we saw N instructions retired: +[# retired], [# cycles] + 0, 109 (17.9%) + 1, 102 (16.7%) + 2, 399 (65.4%) + +Total ROB Entries: 64 +Max Used ROB Entries: 35 ( 54.7% ) +Average Used ROB Entries per cy: 32 ( 50.0% ) + + +Register File statistics: +Total number of mappings created: 900 +Max number of mappings used: 35 + +* Register File #1 \-\- JFpuPRF: + Number of physical registers: 72 + Total number of mappings created: 900 + Max number of mappings used: 35 + +* Register File #2 \-\- JIntegerPRF: + Number of physical registers: 64 + Total number of mappings created: 0 + Max number of mappings used: 0 +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +If we look at the \fIDynamic Dispatch Stall Cycles\fP table, we see the counter for +SCHEDQ reports 272 cycles. This counter is incremented every time the dispatch +logic is unable to dispatch a full group because the scheduler\(aqs queue is full. +.sp +Looking at the \fIDispatch Logic\fP table, we see that the pipeline was only able to +dispatch two micro opcodes 51.5% of the time. The dispatch group was limited to +one micro opcode 44.6% of the cycles, which corresponds to 272 cycles. The +dispatch statistics are displayed by either using the command option +\fB\-all\-stats\fP or \fB\-dispatch\-stats\fP\&. +.sp +The next table, \fISchedulers\fP, presents a histogram displaying a count, +representing the number of micro opcodes issued on some number of cycles. In +this case, of the 610 simulated cycles, single opcodes were issued 306 times +(50.2%) and there were 7 cycles where no opcodes were issued. +.sp +The \fIScheduler\(aqs queue usage\fP table shows that the average and maximum number of +buffer entries (i.e., scheduler queue entries) used at runtime. Resource JFPU01 +reached its maximum (18 of 18 queue entries). Note that AMD Jaguar implements +three schedulers: +.INDENT 0.0 +.IP \(bu 2 +JALU01 \- A scheduler for ALU instructions. +.IP \(bu 2 +JFPU01 \- A scheduler floating point operations. +.IP \(bu 2 +JLSAGU \- A scheduler for address generation. +.UNINDENT +.sp +The dot\-product is a kernel of three floating point instructions (a vector +multiply followed by two horizontal adds). That explains why only the floating +point scheduler appears to be used. +.sp +A full scheduler queue is either caused by data dependency chains or by a +sub\-optimal usage of hardware resources. Sometimes, resource pressure can be +mitigated by rewriting the kernel using different instructions that consume +different scheduler resources. Schedulers with a small queue are less resilient +to bottlenecks caused by the presence of long data dependencies. The scheduler +statistics are displayed by using the command option \fB\-all\-stats\fP or +\fB\-scheduler\-stats\fP\&. +.sp +The next table, \fIRetire Control Unit\fP, presents a histogram displaying a count, +representing the number of instructions retired on some number of cycles. In +this case, of the 610 simulated cycles, two instructions were retired during the +same cycle 399 times (65.4%) and there were 109 cycles where no instructions +were retired. The retire statistics are displayed by using the command option +\fB\-all\-stats\fP or \fB\-retire\-stats\fP\&. +.sp +The last table presented is \fIRegister File statistics\fP\&. Each physical register +file (PRF) used by the pipeline is presented in this table. In the case of AMD +Jaguar, there are two register files, one for floating\-point registers (JFpuPRF) +and one for integer registers (JIntegerPRF). The table shows that of the 900 +instructions processed, there were 900 mappings created. Since this dot\-product +example utilized only floating point registers, the JFPuPRF was responsible for +creating the 900 mappings. However, we see that the pipeline only used a +maximum of 35 of 72 available register slots at any given time. We can conclude +that the floating point PRF was the only register file used for the example, and +that it was never resource constrained. The register file statistics are +displayed by using the command option \fB\-all\-stats\fP or +\fB\-register\-file\-stats\fP\&. +.sp +In this example, we can conclude that the IPC is mostly limited by data +dependencies, and not by resource pressure. +.SS Instruction Flow +.sp +This section describes the instruction flow through the default pipeline of +\fBllvm\-mca\fP, as well as the functional units involved in the process. +.sp +The default pipeline implements the following sequence of stages used to +process instructions. +.INDENT 0.0 +.IP \(bu 2 +Dispatch (Instruction is dispatched to the schedulers). +.IP \(bu 2 +Issue (Instruction is issued to the processor pipelines). +.IP \(bu 2 +Write Back (Instruction is executed, and results are written back). +.IP \(bu 2 +Retire (Instruction is retired; writes are architecturally committed). +.UNINDENT +.sp +The default pipeline only models the out\-of\-order portion of a processor. +Therefore, the instruction fetch and decode stages are not modeled. Performance +bottlenecks in the frontend are not diagnosed. \fBllvm\-mca\fP assumes that +instructions have all been decoded and placed into a queue before the simulation +start. Also, \fBllvm\-mca\fP does not model branch prediction. +.SS Instruction Dispatch +.sp +During the dispatch stage, instructions are picked in program order from a +queue of already decoded instructions, and dispatched in groups to the +simulated hardware schedulers. +.sp +The size of a dispatch group depends on the availability of the simulated +hardware resources. The processor dispatch width defaults to the value +of the \fBIssueWidth\fP in LLVM\(aqs scheduling model. +.sp +An instruction can be dispatched if: +.INDENT 0.0 +.IP \(bu 2 +The size of the dispatch group is smaller than processor\(aqs dispatch width. +.IP \(bu 2 +There are enough entries in the reorder buffer. +.IP \(bu 2 +There are enough physical registers to do register renaming. +.IP \(bu 2 +The schedulers are not full. +.UNINDENT +.sp +Scheduling models can optionally specify which register files are available on +the processor. \fBllvm\-mca\fP uses that information to initialize register +file descriptors. Users can limit the number of physical registers that are +globally available for register renaming by using the command option +\fB\-register\-file\-size\fP\&. A value of zero for this option means \fIunbounded\fP\&. By +knowing how many registers are available for renaming, the tool can predict +dispatch stalls caused by the lack of physical registers. +.sp +The number of reorder buffer entries consumed by an instruction depends on the +number of micro\-opcodes specified for that instruction by the target scheduling +model. The reorder buffer is responsible for tracking the progress of +instructions that are "in\-flight", and retiring them in program order. The +number of entries in the reorder buffer defaults to the value specified by field +\fIMicroOpBufferSize\fP in the target scheduling model. +.sp +Instructions that are dispatched to the schedulers consume scheduler buffer +entries. \fBllvm\-mca\fP queries the scheduling model to determine the set +of buffered resources consumed by an instruction. Buffered resources are +treated like scheduler resources. +.SS Instruction Issue +.sp +Each processor scheduler implements a buffer of instructions. An instruction +has to wait in the scheduler\(aqs buffer until input register operands become +available. Only at that point, does the instruction becomes eligible for +execution and may be issued (potentially out\-of\-order) for execution. +Instruction latencies are computed by \fBllvm\-mca\fP with the help of the +scheduling model. +.sp +\fBllvm\-mca\fP\(aqs scheduler is designed to simulate multiple processor +schedulers. The scheduler is responsible for tracking data dependencies, and +dynamically selecting which processor resources are consumed by instructions. +It delegates the management of processor resource units and resource groups to a +resource manager. The resource manager is responsible for selecting resource +units that are consumed by instructions. For example, if an instruction +consumes 1cy of a resource group, the resource manager selects one of the +available units from the group; by default, the resource manager uses a +round\-robin selector to guarantee that resource usage is uniformly distributed +between all units of a group. +.sp +\fBllvm\-mca\fP\(aqs scheduler internally groups instructions into three sets: +.INDENT 0.0 +.IP \(bu 2 +WaitSet: a set of instructions whose operands are not ready. +.IP \(bu 2 +ReadySet: a set of instructions ready to execute. +.IP \(bu 2 +IssuedSet: a set of instructions executing. +.UNINDENT +.sp +Depending on the operands availability, instructions that are dispatched to the +scheduler are either placed into the WaitSet or into the ReadySet. +.sp +Every cycle, the scheduler checks if instructions can be moved from the WaitSet +to the ReadySet, and if instructions from the ReadySet can be issued to the +underlying pipelines. The algorithm prioritizes older instructions over younger +instructions. +.SS Write\-Back and Retire Stage +.sp +Issued instructions are moved from the ReadySet to the IssuedSet. There, +instructions wait until they reach the write\-back stage. At that point, they +get removed from the queue and the retire control unit is notified. +.sp +When instructions are executed, the retire control unit flags the instruction as +"ready to retire." +.sp +Instructions are retired in program order. The register file is notified of the +retirement so that it can free the physical registers that were allocated for +the instruction during the register renaming stage. +.SS Load/Store Unit and Memory Consistency Model +.sp +To simulate an out\-of\-order execution of memory operations, \fBllvm\-mca\fP +utilizes a simulated load/store unit (LSUnit) to simulate the speculative +execution of loads and stores. +.sp +Each load (or store) consumes an entry in the load (or store) queue. Users can +specify flags \fB\-lqueue\fP and \fB\-squeue\fP to limit the number of entries in the +load and store queues respectively. The queues are unbounded by default. +.sp +The LSUnit implements a relaxed consistency model for memory loads and stores. +The rules are: +.INDENT 0.0 +.IP 1. 3 +A younger load is allowed to pass an older load only if there are no +intervening stores or barriers between the two loads. +.IP 2. 3 +A younger load is allowed to pass an older store provided that the load does +not alias with the store. +.IP 3. 3 +A younger store is not allowed to pass an older store. +.IP 4. 3 +A younger store is not allowed to pass an older load. +.UNINDENT +.sp +By default, the LSUnit optimistically assumes that loads do not alias +(\fI\-noalias=true\fP) store operations. Under this assumption, younger loads are +always allowed to pass older stores. Essentially, the LSUnit does not attempt +to run any alias analysis to predict when loads and stores do not alias with +each other. +.sp +Note that, in the case of write\-combining memory, rule 3 could be relaxed to +allow reordering of non\-aliasing store operations. That being said, at the +moment, there is no way to further relax the memory model (\fB\-noalias\fP is the +only option). Essentially, there is no option to specify a different memory +type (e.g., write\-back, write\-combining, write\-through; etc.) and consequently +to weaken, or strengthen, the memory model. +.sp +Other limitations are: +.INDENT 0.0 +.IP \(bu 2 +The LSUnit does not know when store\-to\-load forwarding may occur. +.IP \(bu 2 +The LSUnit does not know anything about cache hierarchy and memory types. +.IP \(bu 2 +The LSUnit does not know how to identify serializing operations and memory +fences. +.UNINDENT +.sp +The LSUnit does not attempt to predict if a load or store hits or misses the L1 +cache. It only knows if an instruction "MayLoad" and/or "MayStore." For +loads, the scheduling model provides an "optimistic" load\-to\-use latency (which +usually matches the load\-to\-use latency for when there is a hit in the L1D). +.sp +\fBllvm\-mca\fP does not know about serializing operations or memory\-barrier +like instructions. The LSUnit conservatively assumes that an instruction which +has both "MayLoad" and unmodeled side effects behaves like a "soft" +load\-barrier. That means, it serializes loads without forcing a flush of the +load queue. Similarly, instructions that "MayStore" and have unmodeled side +effects are treated like store barriers. A full memory barrier is a "MayLoad" +and "MayStore" instruction with unmodeled side effects. This is inaccurate, but +it is the best that we can do at the moment with the current information +available in LLVM. +.sp +A load/store barrier consumes one entry of the load/store queue. A load/store +barrier enforces ordering of loads/stores. A younger load cannot pass a load +barrier. Also, a younger store cannot pass a store barrier. A younger load +has to wait for the memory/load barrier to execute. A load/store barrier is +"executed" when it becomes the oldest entry in the load/store queue(s). That +also means, by construction, all of the older loads/stores have been executed. +.sp +In conclusion, the full set of load/store consistency rules are: +.INDENT 0.0 +.IP 1. 3 +A store may not pass a previous store. +.IP 2. 3 +A store may not pass a previous load (regardless of \fB\-noalias\fP). +.IP 3. 3 +A store has to wait until an older store barrier is fully executed. +.IP 4. 3 +A load may pass a previous load. +.IP 5. 3 +A load may not pass a previous store unless \fB\-noalias\fP is set. +.IP 6. 3 +A load has to wait until an older load barrier is fully executed. +.UNINDENT +.SH AUTHOR +Maintained by the LLVM Team (https://llvm.org/). +.SH COPYRIGHT +2003-2021, LLVM Project +.\" Generated by docutils manpage writer. +. diff --git a/usr.bin/clang/llvm-modextract/Makefile b/usr.bin/clang/llvm-modextract/Makefile new file mode 100644 index 000000000000..4d17e1593359 --- /dev/null +++ b/usr.bin/clang/llvm-modextract/Makefile @@ -0,0 +1,9 @@ +# $FreeBSD$ + +PROG_CXX= llvm-modextract +MAN= + +SRCDIR= llvm/tools/llvm-modextract +SRCS= llvm-modextract.cpp + +.include "../llvm.prog.mk" diff --git a/usr.bin/clang/llvm-modextract/Makefile.depend b/usr.bin/clang/llvm-modextract/Makefile.depend new file mode 100644 index 000000000000..1423340957b6 --- /dev/null +++ b/usr.bin/clang/llvm-modextract/Makefile.depend @@ -0,0 +1,24 @@ +# $FreeBSD$ +# Autogenerated - do NOT edit! + +DIRDEPS = \ + gnu/lib/csu \ + include \ + include/xlocale \ + lib/${CSU_DIR} \ + lib/clang/libllvm \ + lib/libc \ + lib/libc++ \ + lib/libcompiler_rt \ + lib/libcxxrt \ + lib/libthr \ + lib/libz \ + lib/msun \ + lib/ncurses/ncursesw \ + + +.include <dirdeps.mk> + +.if ${DEP_RELDIR} == ${_DEP_RELDIR} +# local dependencies - needed for -jN in clean tree +.endif diff --git a/usr.bin/clang/llvm-nm/Makefile b/usr.bin/clang/llvm-nm/Makefile new file mode 100644 index 000000000000..30071da0e7dc --- /dev/null +++ b/usr.bin/clang/llvm-nm/Makefile @@ -0,0 +1,35 @@ +# $FreeBSD$ + +.include <src.opts.mk> + +PROG_CXX= llvm-nm + +SRCDIR= llvm/tools/llvm-nm +SRCS+= llvm-nm.cpp + +CFLAGS.llvm-nm.cpp+= -Dllvm_nm_main=main + +.include "${SRCTOP}/lib/clang/llvm.pre.mk" + +CFLAGS+= -I${.OBJDIR} + +INCFILE= Opts.inc +TDFILE= ${LLVM_BASE}/${SRCDIR}/Opts.td +GENOPT= -gen-opt-parser-defs +${INCFILE}: ${TDFILE} + ${LLVM_TBLGEN} ${GENOPT} -I ${LLVM_SRCS}/include -d ${.TARGET:C/$/.d/} \ + -o ${.TARGET} ${TDFILE} +TGHDRS+= ${INCFILE} + +DEPENDFILES+= ${TGHDRS:C/$/.d/} +DPSRCS+= ${TGHDRS} +CLEANFILES+= ${TGHDRS} ${TGHDRS:C/$/.d/} + +LIBADD+= z + +.if ${MK_LLVM_BINUTILS} != "no" +LINKS+= ${BINDIR}/llvm-nm ${BINDIR}/nm +MLINKS+= llvm-nm.1 nm.1 +.endif + +.include "../llvm.prog.mk" diff --git a/usr.bin/clang/llvm-nm/Makefile.depend b/usr.bin/clang/llvm-nm/Makefile.depend new file mode 100644 index 000000000000..1423340957b6 --- /dev/null +++ b/usr.bin/clang/llvm-nm/Makefile.depend @@ -0,0 +1,24 @@ +# $FreeBSD$ +# Autogenerated - do NOT edit! + +DIRDEPS = \ + gnu/lib/csu \ + include \ + include/xlocale \ + lib/${CSU_DIR} \ + lib/clang/libllvm \ + lib/libc \ + lib/libc++ \ + lib/libcompiler_rt \ + lib/libcxxrt \ + lib/libthr \ + lib/libz \ + lib/msun \ + lib/ncurses/ncursesw \ + + +.include <dirdeps.mk> + +.if ${DEP_RELDIR} == ${_DEP_RELDIR} +# local dependencies - needed for -jN in clean tree +.endif diff --git a/usr.bin/clang/llvm-nm/llvm-nm.1 b/usr.bin/clang/llvm-nm/llvm-nm.1 new file mode 100644 index 000000000000..2ae1470e2dcf --- /dev/null +++ b/usr.bin/clang/llvm-nm/llvm-nm.1 @@ -0,0 +1,402 @@ +.\" $FreeBSD$ +.\" Man page generated from reStructuredText. +. +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.TH "LLVM-NM" "1" "2021-06-07" "12" "LLVM" +.SH NAME +llvm-nm \- list LLVM bitcode and object file's symbol table +.SH SYNOPSIS +.sp +\fBllvm\-nm\fP [\fIoptions\fP] [\fIfilenames...\fP] +.SH DESCRIPTION +.sp +The \fBllvm\-nm\fP utility lists the names of symbols from LLVM bitcode +files, object files, and archives. Each symbol is listed along with some simple +information about its provenance. If no filename is specified, \fIa.out\fP is used +as the input. If \fI\-\fP is used as a filename, \fBllvm\-nm\fP will read a file +from its standard input stream. +.sp +\fBllvm\-nm\fP\(aqs default output format is the traditional BSD \fBnm\fP +output format. Each such output record consists of an (optional) 8\-digit +hexadecimal address, followed by a type code character, followed by a name, for +each symbol. One record is printed per line; fields are separated by spaces. +When the address is omitted, it is replaced by 8 spaces. +.sp +The supported type code characters are as follows. Where both lower and +upper\-case characters are listed for the same meaning, a lower\-case character +represents a local symbol, whilst an upper\-case character represents a global +(external) symbol: +.sp +a, A +.INDENT 0.0 +.INDENT 3.5 +Absolute symbol. +.UNINDENT +.UNINDENT +.sp +b, B +.INDENT 0.0 +.INDENT 3.5 +Uninitialized data (bss) object. +.UNINDENT +.UNINDENT +.sp +C +.INDENT 0.0 +.INDENT 3.5 +Common symbol. Multiple definitions link together into one definition. +.UNINDENT +.UNINDENT +.sp +d, D +.INDENT 0.0 +.INDENT 3.5 +Writable data object. +.UNINDENT +.UNINDENT +.sp +i, I +.INDENT 0.0 +.INDENT 3.5 +COFF: .idata symbol or symbol in a section with IMAGE_SCN_LNK_INFO set. +.UNINDENT +.UNINDENT +.sp +n +.INDENT 0.0 +.INDENT 3.5 +ELF: local symbol from non\-alloc section. +.sp +COFF: debug symbol. +.UNINDENT +.UNINDENT +.sp +N +.INDENT 0.0 +.INDENT 3.5 +ELF: debug section symbol, or global symbol from non\-alloc section. +.UNINDENT +.UNINDENT +.sp +s, S +.INDENT 0.0 +.INDENT 3.5 +COFF: section symbol. +.sp +Mach\-O: absolute symbol or symbol from a section other than __TEXT_EXEC __text, +__TEXT __text, __DATA __data, or __DATA __bss. +.UNINDENT +.UNINDENT +.sp +r, R +.INDENT 0.0 +.INDENT 3.5 +Read\-only data object. +.UNINDENT +.UNINDENT +.sp +t, T +.INDENT 0.0 +.INDENT 3.5 +Code (text) object. +.UNINDENT +.UNINDENT +.sp +u +.INDENT 0.0 +.INDENT 3.5 +ELF: GNU unique symbol. +.UNINDENT +.UNINDENT +.sp +U +.INDENT 0.0 +.INDENT 3.5 +Named object is undefined in this file. +.UNINDENT +.UNINDENT +.sp +v +.INDENT 0.0 +.INDENT 3.5 +ELF: Undefined weak object. It is not a link failure if the object is not +defined. +.UNINDENT +.UNINDENT +.sp +V +.INDENT 0.0 +.INDENT 3.5 +ELF: Defined weak object symbol. This definition will only be used if no +regular definitions exist in a link. If multiple weak definitions and no +regular definitions exist, one of the weak definitions will be used. +.UNINDENT +.UNINDENT +.sp +w +.INDENT 0.0 +.INDENT 3.5 +Undefined weak symbol other than an ELF object symbol. It is not a link failure +if the symbol is not defined. +.UNINDENT +.UNINDENT +.sp +W +.INDENT 0.0 +.INDENT 3.5 +Defined weak symbol other than an ELF object symbol. This definition will only +be used if no regular definitions exist in a link. If multiple weak definitions +and no regular definitions exist, one of the weak definitions will be used. +.UNINDENT +.UNINDENT +.sp +\- +.INDENT 0.0 +.INDENT 3.5 +Mach\-O: N_STAB symbol. +.UNINDENT +.UNINDENT +.sp +? +.INDENT 0.0 +.INDENT 3.5 +Something unrecognizable. +.UNINDENT +.UNINDENT +.sp +Because LLVM bitcode files typically contain objects that are not considered to +have addresses until they are linked into an executable image or dynamically +compiled "just\-in\-time", \fBllvm\-nm\fP does not print an address for any +symbol in an LLVM bitcode file, even symbols which are defined in the bitcode +file. +.SH OPTIONS +.INDENT 0.0 +.TP +.B \-B +Use BSD output format. Alias for \fB\-\-format=bsd\fP\&. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-debug\-syms, \-a +Show all symbols, even those usually suppressed. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-defined\-only, \-U +Print only symbols defined in this file. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-demangle, \-C +Demangle symbol names. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-dynamic, \-D +Display dynamic symbols instead of normal symbols. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-extern\-only, \-g +Print only symbols whose definitions are external; that is, accessible from +other files. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-format=<format>, \-f +Select an output format; \fIformat\fP may be \fIsysv\fP, \fIposix\fP, \fIdarwin\fP, or \fIbsd\fP\&. +The default is \fIbsd\fP\&. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-help, \-h +Print a summary of command\-line options and their meanings. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-help\-list +Print an uncategorized summary of command\-line options and their meanings. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-just\-symbol\-name, \-j +Print just the symbol names. +.UNINDENT +.INDENT 0.0 +.TP +.B \-m +Use Darwin format. Alias for \fB\-\-format=darwin\fP\&. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-no\-demangle +Don\(aqt demangle symbol names. This is the default. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-no\-llvm\-bc +Disable the LLVM bitcode reader. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-no\-sort, \-p +Show symbols in the order encountered. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-no\-weak, \-W +Don\(aqt print weak symbols. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-numeric\-sort, \-n, \-v +Sort symbols by address. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-portability, \-P +Use POSIX.2 output format. Alias for \fB\-\-format=posix\fP\&. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-print\-armap, \-M +Print the archive symbol table, in addition to the symbols. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-print\-file\-name, \-A, \-o +Precede each symbol with the file it came from. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-print\-size, \-S +Show symbol size as well as address (not applicable for Mach\-O). +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-radix=<RADIX>, \-t +Specify the radix of the symbol address(es). Values accepted are \fId\fP (decimal), +\fIx\fP (hexadecimal) and \fIo\fP (octal). +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-reverse\-sort, \-r +Sort symbols in reverse order. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-size\-sort +Sort symbols by size. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-special\-syms +Do not filter special symbols from the output. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-undefined\-only, \-u +Print only undefined symbols. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-version +Display the version of the \fBllvm\-nm\fP executable. Does not stack with +other commands. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-without\-aliases +Exclude aliases from the output. +.UNINDENT +.INDENT 0.0 +.TP +.B @<FILE> +Read command\-line options from response file \fI<FILE>\fP\&. +.UNINDENT +.SH MACH-O SPECIFIC OPTIONS +.INDENT 0.0 +.TP +.B \-\-add\-dyldinfo +Add symbols from the dyldinfo, if they are not already in the symbol table. +This is the default. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-add\-inlinedinfo +Add symbols from the inlined libraries, TBD file inputs only. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-arch=<arch1[,arch2,...]> +Dump the symbols from the specified architecture(s). +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-dyldinfo\-only +Dump only symbols from the dyldinfo. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-no\-dyldinfo +Do not add any symbols from the dyldinfo. +.UNINDENT +.INDENT 0.0 +.TP +.B \-s=<segment section> +Dump only symbols from this segment and section name. +.UNINDENT +.INDENT 0.0 +.TP +.B \-x +Print symbol entry in hex. +.UNINDENT +.SH BUGS +.INDENT 0.0 +.INDENT 3.5 +.INDENT 0.0 +.IP \(bu 2 +\fBllvm\-nm\fP does not support the full set of arguments that GNU +\fBnm\fP does. +.UNINDENT +.UNINDENT +.UNINDENT +.SH EXIT STATUS +.sp +\fBllvm\-nm\fP exits with an exit code of zero. +.SH SEE ALSO +.sp +\fBllvm\-ar(1)\fP, \fBllvm\-objdump(1)\fP, \fBllvm\-readelf(1)\fP, +\fBllvm\-readobj(1)\fP +.SH AUTHOR +Maintained by the LLVM Team (https://llvm.org/). +.SH COPYRIGHT +2003-2021, LLVM Project +.\" Generated by docutils manpage writer. +. diff --git a/usr.bin/clang/llvm-objcopy/Makefile b/usr.bin/clang/llvm-objcopy/Makefile new file mode 100644 index 000000000000..335badf81ed9 --- /dev/null +++ b/usr.bin/clang/llvm-objcopy/Makefile @@ -0,0 +1,42 @@ +# $FreeBSD$ + +.include <src.opts.mk> + +PROG_CXX= llvm-objcopy + +SRCDIR= llvm/tools/llvm-objcopy +SRCS+= ObjcopyOptions.cpp +SRCS+= llvm-objcopy.cpp + +CFLAGS.llvm-objcopy.cpp+= -Dllvm_objcopy_main=main + +.include "${SRCTOP}/lib/clang/llvm.pre.mk" + +CFLAGS+= -I${.OBJDIR} +CFLAGS+= -I${LLVM_BASE}/${SRCDIR} + +.for hdr in BitcodeStripOpts InstallNameToolOpts ObjcopyOpts StripOpts +${hdr}.inc: ${LLVM_BASE}/${SRCDIR}/${hdr}.td + ${LLVM_TBLGEN} -gen-opt-parser-defs \ + -I ${LLVM_SRCS}/tools/llvm-objcopy -I ${LLVM_SRCS}/include \ + -d ${.TARGET}.d -o ${.TARGET} ${LLVM_BASE}/${SRCDIR}/${hdr}.td +TGHDRS+= ${hdr}.inc +.endfor + +DEPENDFILES+= ${TGHDRS:C/$/.d/} +DPSRCS+= ${TGHDRS} +CLEANFILES+= ${TGHDRS} ${TGHDRS:C/$/.d/} + +LIBADD+= z +LIBADD+= zstd + +LINKS= ${BINDIR}/llvm-objcopy ${BINDIR}/llvm-strip + +.if ${MK_LLVM_BINUTILS} != "no" +LINKS+= ${BINDIR}/llvm-objcopy ${BINDIR}/objcopy \ + ${BINDIR}/llvm-strip ${BINDIR}/strip +MLINKS= llvm-objcopy.1 objcopy.1 \ + llvm-objcopy.1 strip.1 +.endif + +.include "../llvm.prog.mk" diff --git a/usr.bin/clang/llvm-objcopy/llvm-objcopy.1 b/usr.bin/clang/llvm-objcopy/llvm-objcopy.1 new file mode 100644 index 000000000000..3a0149402027 --- /dev/null +++ b/usr.bin/clang/llvm-objcopy/llvm-objcopy.1 @@ -0,0 +1,745 @@ +.\" $FreeBSD$ +.\" Man page generated from reStructuredText. +. +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.TH "LLVM-OBJCOPY" "1" "2021-06-07" "12" "LLVM" +.SH NAME +llvm-objcopy \- object copying and editing tool +.SH SYNOPSIS +.sp +\fBllvm\-objcopy\fP [\fIoptions\fP] \fIinput\fP [\fIoutput\fP] +.SH DESCRIPTION +.sp +\fBllvm\-objcopy\fP is a tool to copy and manipulate objects. In basic +usage, it makes a semantic copy of the input to the output. If any options are +specified, the output may be modified along the way, e.g. by removing sections. +.sp +If no output file is specified, the input file is modified in\-place. If "\-" is +specified for the input file, the input is read from the program\(aqs standard +input stream. If "\-" is specified for the output file, the output is written to +the standard output stream of the program. +.sp +If the input is an archive, any requested operations will be applied to each +archive member individually. +.sp +The tool is still in active development, but in most scenarios it works as a +drop\-in replacement for GNU\(aqs \fBobjcopy\fP\&. +.SH GENERIC AND CROSS-PLATFORM OPTIONS +.sp +The following options are either agnostic of the file format, or apply to +multiple file formats. +.INDENT 0.0 +.TP +.B \-\-add\-gnu\-debuglink <debug\-file> +Add a .gnu_debuglink section for \fB<debug\-file>\fP to the output. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-add\-section <section=file> +Add a section named \fB<section>\fP with the contents of \fB<file>\fP to the +output. For ELF objects the section will be of type \fISHT_NOTE\fP, if the name +starts with ".note". Otherwise, it will have type \fISHT_PROGBITS\fP\&. Can be +specified multiple times to add multiple sections. +.sp +For MachO objects, \fB<section>\fP must be formatted as +\fB<segment name>,<section name>\fP\&. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-binary\-architecture <arch>, \-B +Ignored for compatibility. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-disable\-deterministic\-archives, \-U +Use real values for UIDs, GIDs and timestamps when updating archive member +headers. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-discard\-all, \-x +Remove most local symbols from the output. Different file formats may limit +this to a subset of the local symbols. For example, file and section symbols in +ELF objects will not be discarded. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-dump\-section <section>=<file> +Dump the contents of section \fB<section>\fP into the file \fB<file>\fP\&. Can be +specified multiple times to dump multiple sections to different files. +\fB<file>\fP is unrelated to the input and output files provided to +\fBllvm\-objcopy\fP and as such the normal copying and editing +operations will still be performed. No operations are performed on the sections +prior to dumping them. +.sp +For MachO objects, \fB<section>\fP must be formatted as +\fB<segment name>,<section name>\fP\&. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-enable\-deterministic\-archives, \-D +Enable deterministic mode when copying archives, i.e. use 0 for archive member +header UIDs, GIDs and timestamp fields. On by default. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-help, \-h +Print a summary of command line options. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-only\-keep\-debug +Produce a debug file as the output that only preserves contents of sections +useful for debugging purposes. +.sp +For ELF objects, this removes the contents of \fISHF_ALLOC\fP sections that are not +\fISHT_NOTE\fP by making them \fISHT_NOBITS\fP and shrinking the program headers where +possible. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-only\-section <section>, \-j +Remove all sections from the output, except for sections named \fB<section>\fP\&. +Can be specified multiple times to keep multiple sections. +.sp +For MachO objects, \fB<section>\fP must be formatted as +\fB<segment name>,<section name>\fP\&. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-redefine\-sym <old>=<new> +Rename symbols called \fB<old>\fP to \fB<new>\fP in the output. Can be specified +multiple times to rename multiple symbols. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-redefine\-syms <filename> +Rename symbols in the output as described in the file \fB<filename>\fP\&. In the +file, each line represents a single symbol to rename, with the old name and new +name separated by whitespace. Leading and trailing whitespace is ignored, as is +anything following a \(aq#\(aq. Can be specified multiple times to read names from +multiple files. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-regex +If specified, symbol and section names specified by other switches are treated +as extended POSIX regular expression patterns. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-remove\-section <section>, \-R +Remove the specified section from the output. Can be specified multiple times +to remove multiple sections simultaneously. +.sp +For MachO objects, \fB<section>\fP must be formatted as +\fB<segment name>,<section name>\fP\&. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-set\-section\-alignment <section>=<align> +Set the alignment of section \fB<section>\fP to \fI<align>\(ga\fP\&. Can be specified +multiple times to update multiple sections. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-set\-section\-flags <section>=<flag>[,<flag>,...] +Set section properties in the output of section \fB<section>\fP based on the +specified \fB<flag>\fP values. Can be specified multiple times to update multiple +sections. +.sp +Supported flag names are \fIalloc\fP, \fIload\fP, \fInoload\fP, \fIreadonly\fP, \fIexclude\fP, +\fIdebug\fP, \fIcode\fP, \fIdata\fP, \fIrom\fP, \fIshare\fP, \fIcontents\fP, \fImerge\fP and \fIstrings\fP\&. Not +all flags are meaningful for all object file formats. +.sp +For ELF objects, the flags have the following effects: +.INDENT 7.0 +.IP \(bu 2 +\fIalloc\fP = add the \fISHF_ALLOC\fP flag. +.IP \(bu 2 +\fIload\fP = if the section has \fISHT_NOBITS\fP type, mark it as a \fISHT_PROGBITS\fP +section. +.IP \(bu 2 +\fIreadonly\fP = if this flag is not specified, add the \fISHF_WRITE\fP flag. +.IP \(bu 2 +\fIexclude\fP = add the \fISHF_EXCLUDE\fP flag. +.IP \(bu 2 +\fIcode\fP = add the \fISHF_EXECINSTR\fP flag. +.IP \(bu 2 +\fImerge\fP = add the \fISHF_MERGE\fP flag. +.IP \(bu 2 +\fIstrings\fP = add the \fISHF_STRINGS\fP flag. +.IP \(bu 2 +\fIcontents\fP = if the section has \fISHT_NOBITS\fP type, mark it as a \fISHT_PROGBITS\fP +section. +.UNINDENT +.sp +For COFF objects, the flags have the following effects: +.INDENT 7.0 +.IP \(bu 2 +\fIalloc\fP = add the \fIIMAGE_SCN_CNT_UNINITIALIZED_DATA\fP and \fIIMAGE_SCN_MEM_READ\fP +flags, unless the \fIload\fP flag is specified. +.IP \(bu 2 +\fInoload\fP = add the \fIIMAGE_SCN_LNK_REMOVE\fP and \fIIMAGE_SCN_MEM_READ\fP flags. +.IP \(bu 2 +\fIreadonly\fP = if this flag is not specified, add the \fIIMAGE_SCN_MEM_WRITE\fP +flag. +.IP \(bu 2 +\fIexclude\fP = add the \fIIMAGE_SCN_LNK_REMOVE\fP and \fIIMAGE_SCN_MEM_READ\fP flags. +.IP \(bu 2 +\fIdebug\fP = add the \fIIMAGE_SCN_CNT_INITIALIZED_DATA\fP, +\fIIMAGE_SCN_MEM_DISCARDABLE\fP and \fIIMAGE_SCN_MEM_READ\fP flags. +.IP \(bu 2 +\fIcode\fP = add the \fIIMAGE_SCN_CNT_CODE\fP, \fIIMAGE_SCN_MEM_EXECUTE\fP and +\fIIMAGE_SCN_MEM_READ\fP flags. +.IP \(bu 2 +\fIdata\fP = add the \fIIMAGE_SCN_CNT_INITIALIZED_DATA\fP and \fIIMAGE_SCN_MEM_READ\fP +flags. +.IP \(bu 2 +\fIshare\fP = add the \fIIMAGE_SCN_MEM_SHARED\fP and \fIIMAGE_SCN_MEM_READ\fP flags. +.UNINDENT +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-strip\-all\-gnu +Remove all symbols, debug sections and relocations from the output. This option +is equivalent to GNU \fBobjcopy\fP\(aqs \fB\-\-strip\-all\fP switch. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-strip\-all, \-S +For ELF objects, remove from the output all symbols and non\-alloc sections not +within segments, except for .gnu.warning, .ARM.attribute sections and the +section name table. +.sp +For COFF and Mach\-O objects, remove all symbols, debug sections, and +relocations from the output. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-strip\-debug, \-g +Remove all debug sections from the output. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-strip\-symbol <symbol>, \-N +Remove all symbols named \fB<symbol>\fP from the output. Can be specified +multiple times to remove multiple symbols. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-strip\-symbols <filename> +Remove all symbols whose names appear in the file \fB<filename>\fP, from the +output. In the file, each line represents a single symbol name, with leading +and trailing whitespace ignored, as is anything following a \(aq#\(aq. Can be +specified multiple times to read names from multiple files. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-strip\-unneeded\-symbol <symbol> +Remove from the output all symbols named \fB<symbol>\fP that are local or +undefined and are not required by any relocation. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-strip\-unneeded\-symbols <filename> +Remove all symbols whose names appear in the file \fB<filename>\fP, from the +output, if they are local or undefined and are not required by any relocation. +In the file, each line represents a single symbol name, with leading and +trailing whitespace ignored, as is anything following a \(aq#\(aq. Can be specified +multiple times to read names from multiple files. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-strip\-unneeded +Remove from the output all local or undefined symbols that are not required by +relocations. Also remove all debug sections. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-version, \-V +Display the version of the \fBllvm\-objcopy\fP executable. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-wildcard, \-w +Allow wildcard syntax for symbol\-related flags. On by default for +section\-related flags. Incompatible with \-\-regex. +.sp +Wildcard syntax allows the following special symbols: +.TS +center; +|l|l|l|. +_ +T{ +Character +T} T{ +Meaning +T} T{ +Equivalent +T} +_ +T{ +\fB*\fP +T} T{ +Any number of characters +T} T{ +\fB\&.*\fP +T} +_ +T{ +\fB?\fP +T} T{ +Any single character +T} T{ +\fB\&.\fP +T} +_ +T{ +\fB\e\fP +T} T{ +Escape the next character +T} T{ +\fB\e\fP +T} +_ +T{ +\fB[a\-z]\fP +T} T{ +Character class +T} T{ +\fB[a\-z]\fP +T} +_ +T{ +\fB[!a\-z]\fP, \fB[^a\-z]\fP +T} T{ +Negated character class +T} T{ +\fB[^a\-z]\fP +T} +_ +.TE +.sp +Additionally, starting a wildcard with \(aq!\(aq will prevent a match, even if +another flag matches. For example \fB\-w \-N \(aq*\(aq \-N \(aq!x\(aq\fP will strip all symbols +except for \fBx\fP\&. +.sp +The order of wildcards does not matter. For example, \fB\-w \-N \(aq*\(aq \-N \(aq!x\(aq\fP is +the same as \fB\-w \-N \(aq!x\(aq \-N \(aq*\(aq\fP\&. +.UNINDENT +.INDENT 0.0 +.TP +.B @<FILE> +Read command\-line options and commands from response file \fI<FILE>\fP\&. +.UNINDENT +.SH ELF-SPECIFIC OPTIONS +.sp +The following options are implemented only for ELF objects. If used with other +objects, \fBllvm\-objcopy\fP will either emit an error or silently ignore +them. +.INDENT 0.0 +.TP +.B \-\-add\-symbol <name>=[<section>:]<value>[,<flags>] +Add a new symbol called \fB<name>\fP to the output symbol table, in the section +named \fB<section>\fP, with value \fB<value>\fP\&. If \fB<section>\fP is not specified, +the symbol is added as an absolute symbol. The \fB<flags>\fP affect the symbol +properties. Accepted values are: +.INDENT 7.0 +.IP \(bu 2 +\fIglobal\fP = the symbol will have global binding. +.IP \(bu 2 +\fIlocal\fP = the symbol will have local binding. +.IP \(bu 2 +\fIweak\fP = the symbol will have weak binding. +.IP \(bu 2 +\fIdefault\fP = the symbol will have default visibility. +.IP \(bu 2 +\fIhidden\fP = the symbol will have hidden visibility. +.IP \(bu 2 +\fIprotected\fP = the symbol will have protected visibility. +.IP \(bu 2 +\fIfile\fP = the symbol will be an \fISTT_FILE\fP symbol. +.IP \(bu 2 +\fIsection\fP = the symbol will be an \fISTT_SECTION\fP symbol. +.IP \(bu 2 +\fIobject\fP = the symbol will be an \fISTT_OBJECT\fP symbol. +.IP \(bu 2 +\fIfunction\fP = the symbol will be an \fISTT_FUNC\fP symbol. +.IP \(bu 2 +\fIindirect\-function\fP = the symbol will be an \fISTT_GNU_IFUNC\fP symbol. +.UNINDENT +.sp +Additionally, the following flags are accepted but ignored: \fIdebug\fP, +\fIconstructor\fP, \fIwarning\fP, \fIindirect\fP, \fIsynthetic\fP, \fIunique\-object\fP, \fIbefore\fP\&. +.sp +Can be specified multiple times to add multiple symbols. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-allow\-broken\-links +Allow \fBllvm\-objcopy\fP to remove sections even if it would leave invalid +section references. Any invalid sh_link fields will be set to zero. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-build\-id\-link\-dir <dir> +Set the directory used by \fI\%\-\-build\-id\-link\-input\fP and +\fI\%\-\-build\-id\-link\-output\fP\&. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-build\-id\-link\-input <suffix> +Hard\-link the input to \fB<dir>/xx/xxx<suffix>\fP, where \fB<dir>\fP is the directory +specified by \fI\%\-\-build\-id\-link\-dir\fP\&. The path used is derived from the +hex build ID. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-build\-id\-link\-output <suffix> +Hard\-link the output to \fB<dir>/xx/xxx<suffix>\fP, where \fB<dir>\fP is the directory +specified by \fI\%\-\-build\-id\-link\-dir\fP\&. The path used is derived from the +hex build ID. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-change\-start <incr>, \-\-adjust\-start +Add \fB<incr>\fP to the program\(aqs start address. Can be specified multiple +times, in which case the values will be applied cumulatively. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-compress\-debug\-sections [<style>] +Compress DWARF debug sections in the output, using the specified style. +Supported styles are \fIzlib\-gnu\fP and \fIzlib\fP\&. Defaults to \fIzlib\fP if no style is +specified. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-decompress\-debug\-sections +Decompress any compressed DWARF debug sections in the output. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-discard\-locals, \-X +Remove local symbols starting with ".L" from the output. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-extract\-dwo +Remove all sections that are not DWARF .dwo sections from the output. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-extract\-main\-partition +Extract the main partition from the output. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-extract\-partition <name> +Extract the named partition from the output. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-globalize\-symbol <symbol> +Mark any defined symbols named \fB<symbol>\fP as global symbols in the output. +Can be specified multiple times to mark multiple symbols. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-globalize\-symbols <filename> +Read a list of names from the file \fB<filename>\fP and mark defined symbols with +those names as global in the output. In the file, each line represents a single +symbol, with leading and trailing whitespace ignored, as is anything following +a \(aq#\(aq. Can be specified multiple times to read names from multiple files. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-input\-target <format>, \-I +Read the input as the specified format. See \fI\%SUPPORTED FORMATS\fP for a list of +valid \fB<format>\fP values. If unspecified, \fBllvm\-objcopy\fP will attempt +to determine the format automatically. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-keep\-file\-symbols +Keep symbols of type \fISTT_FILE\fP, even if they would otherwise be stripped. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-keep\-global\-symbol <symbol> +Make all symbols local in the output, except for symbols with the name +\fB<symbol>\fP\&. Can be specified multiple times to ignore multiple symbols. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-keep\-global\-symbols <filename> +Make all symbols local in the output, except for symbols named in the file +\fB<filename>\fP\&. In the file, each line represents a single symbol, with leading +and trailing whitespace ignored, as is anything following a \(aq#\(aq. Can be +specified multiple times to read names from multiple files. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-keep\-section <section> +When removing sections from the output, do not remove sections named +\fB<section>\fP\&. Can be specified multiple times to keep multiple sections. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-keep\-symbol <symbol>, \-K +When removing symbols from the output, do not remove symbols named +\fB<symbol>\fP\&. Can be specified multiple times to keep multiple symbols. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-keep\-symbols <filename> +When removing symbols from the output do not remove symbols named in the file +\fB<filename>\fP\&. In the file, each line represents a single symbol, with leading +and trailing whitespace ignored, as is anything following a \(aq#\(aq. Can be +specified multiple times to read names from multiple files. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-localize\-hidden +Make all symbols with hidden or internal visibility local in the output. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-localize\-symbol <symbol>, \-L +Mark any defined non\-common symbol named \fB<symbol>\fP as a local symbol in the +output. Can be specified multiple times to mark multiple symbols as local. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-localize\-symbols <filename> +Read a list of names from the file \fB<filename>\fP and mark defined non\-common +symbols with those names as local in the output. In the file, each line +represents a single symbol, with leading and trailing whitespace ignored, as is +anything following a \(aq#\(aq. Can be specified multiple times to read names from +multiple files. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-new\-symbol\-visibility <visibility> +Specify the visibility of the symbols automatically created when using binary +input or \fI\%\-\-add\-symbol\fP\&. Valid options are: +.INDENT 7.0 +.IP \(bu 2 +\fIdefault\fP +.IP \(bu 2 +\fIhidden\fP +.IP \(bu 2 +\fIinternal\fP +.IP \(bu 2 +\fIprotected\fP +.UNINDENT +.sp +The default is \fIdefault\fP\&. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-output\-target <format>, \-O +Write the output as the specified format. See \fI\%SUPPORTED FORMATS\fP for a list +of valid \fB<format>\fP values. If unspecified, the output format is assumed to +be the same as the value specified for \fI\%\-\-input\-target\fP or the input +file\(aqs format if that option is also unspecified. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-prefix\-alloc\-sections <prefix> +Add \fB<prefix>\fP to the front of the names of all allocatable sections in the +output. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-prefix\-symbols <prefix> +Add \fB<prefix>\fP to the front of every symbol name in the output. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-preserve\-dates, \-p +Preserve access and modification timestamps in the output. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-rename\-section <old>=<new>[,<flag>,...] +Rename sections called \fB<old>\fP to \fB<new>\fP in the output, and apply any +specified \fB<flag>\fP values. See \fI\%\-\-set\-section\-flags\fP for a list of +supported flags. Can be specified multiple times to rename multiple sections. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-set\-start\-addr <addr> +Set the start address of the output to \fB<addr>\fP\&. Overrides any previously +specified \fI\%\-\-change\-start\fP or \fI\%\-\-adjust\-start\fP options. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-split\-dwo <dwo\-file> +Equivalent to running \fBllvm\-objcopy\fP with \fI\%\-\-extract\-dwo\fP and +\fB<dwo\-file>\fP as the output file and no other options, and then with +\fI\%\-\-strip\-dwo\fP on the input file. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-strip\-dwo +Remove all DWARF .dwo sections from the output. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-strip\-non\-alloc +Remove from the output all non\-allocatable sections that are not within +segments. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-strip\-sections +Remove from the output all section headers and all section data not within +segments. Note that many tools will not be able to use an object without +section headers. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-target <format>, \-F +Equivalent to \fI\%\-\-input\-target\fP and \fI\%\-\-output\-target\fP for the +specified format. See \fI\%SUPPORTED FORMATS\fP for a list of valid \fB<format>\fP +values. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-weaken\-symbol <symbol>, \-W +Mark any global symbol named \fB<symbol>\fP as a weak symbol in the output. Can +be specified multiple times to mark multiple symbols as weak. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-weaken\-symbols <filename> +Read a list of names from the file \fB<filename>\fP and mark global symbols with +those names as weak in the output. In the file, each line represents a single +symbol, with leading and trailing whitespace ignored, as is anything following +a \(aq#\(aq. Can be specified multiple times to read names from multiple files. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-weaken +Mark all defined global symbols as weak in the output. +.UNINDENT +.SH SUPPORTED FORMATS +.sp +The following values are currently supported by \fBllvm\-objcopy\fP for the +\fI\%\-\-input\-target\fP, \fI\%\-\-output\-target\fP, and \fI\%\-\-target\fP +options. For GNU \fBobjcopy\fP compatibility, the values are all bfdnames. +.INDENT 0.0 +.IP \(bu 2 +\fIbinary\fP +.IP \(bu 2 +\fIihex\fP +.IP \(bu 2 +\fIelf32\-i386\fP +.IP \(bu 2 +\fIelf32\-x86\-64\fP +.IP \(bu 2 +\fIelf64\-x86\-64\fP +.IP \(bu 2 +\fIelf32\-iamcu\fP +.IP \(bu 2 +\fIelf32\-littlearm\fP +.IP \(bu 2 +\fIelf64\-aarch64\fP +.IP \(bu 2 +\fIelf64\-littleaarch64\fP +.IP \(bu 2 +\fIelf32\-littleriscv\fP +.IP \(bu 2 +\fIelf64\-littleriscv\fP +.IP \(bu 2 +\fIelf32\-powerpc\fP +.IP \(bu 2 +\fIelf32\-powerpcle\fP +.IP \(bu 2 +\fIelf64\-powerpc\fP +.IP \(bu 2 +\fIelf64\-powerpcle\fP +.IP \(bu 2 +\fIelf32\-bigmips\fP +.IP \(bu 2 +\fIelf32\-ntradbigmips\fP +.IP \(bu 2 +\fIelf32\-ntradlittlemips\fP +.IP \(bu 2 +\fIelf32\-tradbigmips\fP +.IP \(bu 2 +\fIelf32\-tradlittlemips\fP +.IP \(bu 2 +\fIelf64\-tradbigmips\fP +.IP \(bu 2 +\fIelf64\-tradlittlemips\fP +.IP \(bu 2 +\fIelf32\-sparc\fP +.IP \(bu 2 +\fIelf32\-sparcel\fP +.UNINDENT +.sp +Additionally, all targets except \fIbinary\fP and \fIihex\fP can have \fI\-freebsd\fP as a +suffix. +.SH BINARY INPUT AND OUTPUT +.sp +If \fIbinary\fP is used as the value for \fI\%\-\-input\-target\fP, the input file +will be embedded as a data section in an ELF relocatable object, with symbols +\fB_binary_<file_name>_start\fP, \fB_binary_<file_name>_end\fP, and +\fB_binary_<file_name>_size\fP representing the start, end and size of the data, +where \fB<file_name>\fP is the path of the input file as specified on the command +line with non\-alphanumeric characters converted to \fB_\fP\&. +.sp +If \fIbinary\fP is used as the value for \fI\%\-\-output\-target\fP, the output file +will be a raw binary file, containing the memory image of the input file. +Symbols and relocation information will be discarded. The image will start at +the address of the first loadable section in the output. +.SH EXIT STATUS +.sp +\fBllvm\-objcopy\fP exits with a non\-zero exit code if there is an error. +Otherwise, it exits with code 0. +.SH BUGS +.sp +To report bugs, please visit <\fI\%https://bugs.llvm.org/\fP>. +.sp +There is a known issue with \fI\%\-\-input\-target\fP and \fI\%\-\-target\fP +causing only \fBbinary\fP and \fBihex\fP formats to have any effect. Other values +will be ignored and \fBllvm\-objcopy\fP will attempt to guess the input +format. +.SH SEE ALSO +.sp +\fBllvm\-strip(1)\fP +.SH AUTHOR +Maintained by the LLVM Team (https://llvm.org/). +.SH COPYRIGHT +2003-2021, LLVM Project +.\" Generated by docutils manpage writer. +. diff --git a/usr.bin/clang/llvm-objdump/Makefile b/usr.bin/clang/llvm-objdump/Makefile new file mode 100644 index 000000000000..d8d80443d965 --- /dev/null +++ b/usr.bin/clang/llvm-objdump/Makefile @@ -0,0 +1,39 @@ +# $FreeBSD$ + +.include <src.opts.mk> + +PROG_CXX= llvm-objdump + +SRCDIR= llvm/tools/llvm-objdump +SRCS+= COFFDump.cpp +SRCS+= ELFDump.cpp +SRCS+= MachODump.cpp +SRCS+= OffloadDump.cpp +SRCS+= SourcePrinter.cpp +SRCS+= WasmDump.cpp +SRCS+= XCOFFDump.cpp +SRCS+= llvm-objdump.cpp + +.include "${SRCTOP}/lib/clang/llvm.pre.mk" + +CFLAGS+= -I${.OBJDIR} + +.for hdr in ObjdumpOpts OtoolOpts +${hdr}.inc: ${LLVM_BASE}/${SRCDIR}/${hdr}.td + ${LLVM_TBLGEN} -gen-opt-parser-defs \ + -I ${LLVM_SRCS}/tools/llvm-objcopy -I ${LLVM_SRCS}/include \ + -d ${.TARGET}.d -o ${.TARGET} ${LLVM_BASE}/${SRCDIR}/${hdr}.td +TGHDRS+= ${hdr}.inc +.endfor + +DEPENDFILES+= ${TGHDRS:C/$/.d/} +DPSRCS+= ${TGHDRS} +CLEANFILES+= ${TGHDRS} ${TGHDRS:C/$/.d/} + +LIBADD+= z +LIBADD+= zstd + +LINKS= ${BINDIR}/llvm-objdump ${BINDIR}/objdump +MLINKS= llvm-objdump.1 objdump.1 + +.include "../llvm.prog.mk" diff --git a/usr.bin/clang/llvm-objdump/Makefile.depend b/usr.bin/clang/llvm-objdump/Makefile.depend new file mode 100644 index 000000000000..1423340957b6 --- /dev/null +++ b/usr.bin/clang/llvm-objdump/Makefile.depend @@ -0,0 +1,24 @@ +# $FreeBSD$ +# Autogenerated - do NOT edit! + +DIRDEPS = \ + gnu/lib/csu \ + include \ + include/xlocale \ + lib/${CSU_DIR} \ + lib/clang/libllvm \ + lib/libc \ + lib/libc++ \ + lib/libcompiler_rt \ + lib/libcxxrt \ + lib/libthr \ + lib/libz \ + lib/msun \ + lib/ncurses/ncursesw \ + + +.include <dirdeps.mk> + +.if ${DEP_RELDIR} == ${_DEP_RELDIR} +# local dependencies - needed for -jN in clean tree +.endif diff --git a/usr.bin/clang/llvm-objdump/llvm-objdump.1 b/usr.bin/clang/llvm-objdump/llvm-objdump.1 new file mode 100644 index 000000000000..5f7f448cc49f --- /dev/null +++ b/usr.bin/clang/llvm-objdump/llvm-objdump.1 @@ -0,0 +1,493 @@ +.\" $FreeBSD$ +.\" Man page generated from reStructuredText. +. +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.TH "LLVM-OBJDUMP" "1" "2021-06-07" "12" "LLVM" +.SH NAME +llvm-objdump \- LLVM's object file dumper +.SH SYNOPSIS +.sp +\fBllvm\-objdump\fP [\fIcommands\fP] [\fIoptions\fP] [\fIfilenames...\fP] +.SH DESCRIPTION +.sp +The \fBllvm\-objdump\fP utility prints the contents of object files and +final linked images named on the command line. If no file name is specified, +\fBllvm\-objdump\fP will attempt to read from \fIa.out\fP\&. If \fI\-\fP is used as a +file name, \fBllvm\-objdump\fP will process a file on its standard input +stream. +.SH COMMANDS +.sp +At least one of the following commands are required, and some commands can be +combined with other commands: +.INDENT 0.0 +.TP +.B \-a, \-\-archive\-headers +Display the information contained within an archive\(aqs headers. +.UNINDENT +.INDENT 0.0 +.TP +.B \-d, \-\-disassemble +Disassemble all text sections found in the input files. +.UNINDENT +.INDENT 0.0 +.TP +.B \-D, \-\-disassemble\-all +Disassemble all sections found in the input files. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-disassemble\-symbols=<symbol1[,symbol2,...]> +Disassemble only the specified symbols. Takes demangled symbol names when +\fI\%\-\-demangle\fP is specified, otherwise takes mangled symbol names. +Implies \fI\%\-\-disassemble\fP\&. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-dwarf=<value> +Dump the specified DWARF debug sections. The supported values are: +.sp +\fIframes\fP \- .debug_frame +.UNINDENT +.INDENT 0.0 +.TP +.B \-f, \-\-file\-headers +Display the contents of the overall file header. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-fault\-map\-section +Display the content of the fault map section. +.UNINDENT +.INDENT 0.0 +.TP +.B \-h, \-\-headers, \-\-section\-headers +Display summaries of the headers for each section. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-help +Display usage information and exit. Does not stack with other commands. +.UNINDENT +.INDENT 0.0 +.TP +.B \-p, \-\-private\-headers +Display format\-specific file headers. +.UNINDENT +.INDENT 0.0 +.TP +.B \-r, \-\-reloc +Display the relocation entries in the file. +.UNINDENT +.INDENT 0.0 +.TP +.B \-R, \-\-dynamic\-reloc +Display the dynamic relocation entries in the file. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-raw\-clang\-ast +Dump the raw binary contents of the clang AST section. +.UNINDENT +.INDENT 0.0 +.TP +.B \-s, \-\-full\-contents +Display the contents of each section. +.UNINDENT +.INDENT 0.0 +.TP +.B \-t, \-\-syms +Display the symbol table. +.UNINDENT +.INDENT 0.0 +.TP +.B \-T, \-\-dynamic\-syms +Display the contents of the dynamic symbol table. +.UNINDENT +.INDENT 0.0 +.TP +.B \-u, \-\-unwind\-info +Display the unwind info of the input(s). +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-version +Display the version of the \fBllvm\-objdump\fP executable. Does not stack +with other commands. +.UNINDENT +.INDENT 0.0 +.TP +.B \-x, \-\-all\-headers +Display all available header information. Equivalent to specifying +\fI\%\-\-archive\-headers\fP, \fI\%\-\-file\-headers\fP, +\fI\%\-\-private\-headers\fP, \fI\%\-\-reloc\fP, \fI\%\-\-section\-headers\fP, +and \fI\%\-\-syms\fP\&. +.UNINDENT +.SH OPTIONS +.sp +\fBllvm\-objdump\fP supports the following options: +.INDENT 0.0 +.TP +.B \-\-adjust\-vma=<offset> +Increase the displayed address in disassembly or section header printing by +the specified offset. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-arch\-name=<string> +Specify the target architecture when disassembling. Use \fI\%\-\-version\fP +for a list of available targets. +.UNINDENT +.INDENT 0.0 +.TP +.B \-C, \-\-demangle +Demangle symbol names in the output. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-debug\-vars=<format> +Print the locations (in registers or memory) of source\-level variables +alongside disassembly. \fBformat\fP may be \fBunicode\fP or \fBascii\fP, defaulting +to \fBunicode\fP if omitted. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-debug\-vars\-indent=<width> +Distance to indent the source\-level variable display, relative to the start +of the disassembly. Defaults to 40 characters. +.UNINDENT +.INDENT 0.0 +.TP +.B \-j, \-\-section=<section1[,section2,...]> +Perform commands on the specified sections only. For Mach\-O use +\fIsegment,section\fP to specify the section name. +.UNINDENT +.INDENT 0.0 +.TP +.B \-l, \-\-line\-numbers +When disassembling, display source line numbers. Implies +\fI\%\-\-disassemble\fP\&. +.UNINDENT +.INDENT 0.0 +.TP +.B \-M, \-\-disassembler\-options=<opt1[,opt2,...]> +Pass target\-specific disassembler options. Currently supported for ARM targets +only. Available options are \fBreg\-names\-std\fP and \fBreg\-names\-raw\fP\&. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-mcpu=<cpu\-name> +Target a specific CPU type for disassembly. Specify \fB\-\-mcpu=help\fP to display +available CPUs. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-mattr=<a1,+a2,\-a3,...> +Enable/disable target\-specific attributes. Specify \fB\-\-mattr=help\fP to display +the available attributes. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-no\-leading\-addr +When disassembling, do not print leading addresses. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-no\-show\-raw\-insn +When disassembling, do not print the raw bytes of each instruction. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-prefix=<prefix> +When disassembling with the \fI\%\-\-source\fP option, prepend \fBprefix\fP to +absolute paths. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-print\-imm\-hex +Use hex format when printing immediate values in disassembly output. +.UNINDENT +.INDENT 0.0 +.TP +.B \-S, \-\-source +When disassembling, display source interleaved with the disassembly. Implies +\fI\%\-\-disassemble\fP\&. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-show\-lma +Display the LMA column when dumping ELF section headers. Defaults to off +unless any section has different VMA and LMAs. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-start\-address=<address> +When disassembling, only disassemble from the specified address. +.sp +When printing relocations, only print the relocations patching offsets from at least \fBaddress\fP\&. +.sp +When printing symbols, only print symbols with a value of at least \fBaddress\fP\&. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-stop\-address=<address> +When disassembling, only disassemble up to, but not including the specified address. +.sp +When printing relocations, only print the relocations patching offsets up to \fBaddress\fP\&. +.sp +When printing symbols, only print symbols with a value up to \fBaddress\fP\&. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-symbolize\-operands +When disassembling, symbolize a branch target operand to print a label instead of a real address. +.sp +When printing a PC\-relative global symbol reference, print it as an offset from the leading symbol. +.sp +Only works with an X86 linked image. +.INDENT 7.0 +.TP +.B Example: +A non\-symbolized branch instruction with a local target and pc\-relative memory access like +.UNINDENT +.INDENT 7.0 +.INDENT 3.5 +.sp +.nf +.ft C +cmp eax, dword ptr [rip + 4112] +jge 0x20117e <_start+0x25> +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +might become +.INDENT 7.0 +.INDENT 3.5 +.sp +.nf +.ft C +<L0>: + cmp eax, dword ptr <g> + jge <L0> +.ft P +.fi +.UNINDENT +.UNINDENT +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-triple=<string> +Target triple to disassemble for, see \fB\-\-version\fP for available targets. +.UNINDENT +.INDENT 0.0 +.TP +.B \-w, \-\-wide +Ignored for compatibility with GNU objdump. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-x86\-asm\-syntax=<style> +When used with \fI\%\-\-disassemble\fP, choose style of code to emit from +X86 backend. Supported values are: +.INDENT 7.0 +.INDENT 3.5 +.INDENT 0.0 +.TP +.B att +AT&T\-style assembly +.UNINDENT +.INDENT 0.0 +.TP +.B intel +Intel\-style assembly +.UNINDENT +.UNINDENT +.UNINDENT +.sp +The default disassembly style is \fBatt\fP\&. +.UNINDENT +.INDENT 0.0 +.TP +.B \-z, \-\-disassemble\-zeroes +Do not skip blocks of zeroes when disassembling. +.UNINDENT +.INDENT 0.0 +.TP +.B @<FILE> +Read command\-line options and commands from response file \fI<FILE>\fP\&. +.UNINDENT +.SH MACH-O ONLY OPTIONS AND COMMANDS +.INDENT 0.0 +.TP +.B \-\-arch=<architecture> +Specify the architecture to disassemble. see \fB\-\-version\fP for available +architectures. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-archive\-member\-offsets +Print the offset to each archive member for Mach\-O archives (requires +\fI\%\-\-archive\-headers\fP). +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-bind +Display binding info +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-cfg +Create a CFG for every symbol in the object file and write it to a graphviz +file. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-data\-in\-code +Display the data in code table. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-dis\-symname=<name> +Disassemble just the specified symbol\(aqs instructions. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-dylibs\-used +Display the shared libraries used for linked files. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-dsym=<string> +Use .dSYM file for debug info. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-dylib\-id +Display the shared library\(aqs ID for dylib files. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-exports\-trie +Display exported symbols. +.UNINDENT +.INDENT 0.0 +.TP +.B \-g +Print line information from debug info if available. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-full\-leading\-addr +Print the full leading address when disassembling. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-indirect\-symbols +Display the indirect symbol table. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-info\-plist +Display the info plist section as strings. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-lazy\-bind +Display lazy binding info. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-link\-opt\-hints +Display the linker optimization hints. +.UNINDENT +.INDENT 0.0 +.TP +.B \-m, \-\-macho +Use Mach\-O specific object file parser. Commands and other options may behave +differently when used with \fB\-\-macho\fP\&. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-no\-leading\-headers +Do not print any leading headers. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-no\-symbolic\-operands +Do not print symbolic operands when disassembling. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-non\-verbose +Display the information for Mach\-O objects in non\-verbose or numeric form. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-objc\-meta\-data +Display the Objective\-C runtime meta data. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-private\-header +Display only the first format specific file header. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-rebase +Display rebasing information. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-universal\-headers +Display universal headers. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-weak\-bind +Display weak binding information. +.UNINDENT +.SH XCOFF ONLY OPTIONS AND COMMANDS +.INDENT 0.0 +.TP +.B \-\-symbol\-description +Add symbol description to disassembly output. +.UNINDENT +.SH BUGS +.sp +To report bugs, please visit <\fI\%https://bugs.llvm.org/\fP>. +.SH SEE ALSO +.sp +\fBllvm\-nm(1)\fP, \fBllvm\-readelf(1)\fP, \fBllvm\-readobj(1)\fP +.SH AUTHOR +Maintained by the LLVM Team (https://llvm.org/). +.SH COPYRIGHT +2003-2021, LLVM Project +.\" Generated by docutils manpage writer. +. diff --git a/usr.bin/clang/llvm-pdbutil/Makefile b/usr.bin/clang/llvm-pdbutil/Makefile new file mode 100644 index 000000000000..5036955f775a --- /dev/null +++ b/usr.bin/clang/llvm-pdbutil/Makefile @@ -0,0 +1,29 @@ +# $FreeBSD$ + +PROG_CXX= llvm-pdbutil + +SRCDIR= llvm/tools/llvm-pdbutil +SRCS+= BytesOutputStyle.cpp +SRCS+= DumpOutputStyle.cpp +SRCS+= ExplainOutputStyle.cpp +SRCS+= MinimalSymbolDumper.cpp +SRCS+= MinimalTypeDumper.cpp +SRCS+= PdbYaml.cpp +SRCS+= PrettyBuiltinDumper.cpp +SRCS+= PrettyClassDefinitionDumper.cpp +SRCS+= PrettyClassLayoutGraphicalDumper.cpp +SRCS+= PrettyCompilandDumper.cpp +SRCS+= PrettyEnumDumper.cpp +SRCS+= PrettyExternalSymbolDumper.cpp +SRCS+= PrettyFunctionDumper.cpp +SRCS+= PrettyTypeDumper.cpp +SRCS+= PrettyTypedefDumper.cpp +SRCS+= PrettyVariableDumper.cpp +SRCS+= StreamUtil.cpp +SRCS+= TypeReferenceTracker.cpp +SRCS+= YAMLOutputStyle.cpp +SRCS+= llvm-pdbutil.cpp + +LIBADD+= z + +.include "../llvm.prog.mk" diff --git a/usr.bin/clang/llvm-pdbutil/Makefile.depend b/usr.bin/clang/llvm-pdbutil/Makefile.depend new file mode 100644 index 000000000000..5459b436be4c --- /dev/null +++ b/usr.bin/clang/llvm-pdbutil/Makefile.depend @@ -0,0 +1,23 @@ +# $FreeBSD$ +# Autogenerated - do NOT edit! + +DIRDEPS = \ + gnu/lib/csu \ + include \ + include/xlocale \ + lib/${CSU_DIR} \ + lib/clang/libllvm \ + lib/libc \ + lib/libc++ \ + lib/libcompiler_rt \ + lib/libcxxrt \ + lib/libthr \ + lib/msun \ + lib/ncurses/ncursesw \ + + +.include <dirdeps.mk> + +.if ${DEP_RELDIR} == ${_DEP_RELDIR} +# local dependencies - needed for -jN in clean tree +.endif diff --git a/usr.bin/clang/llvm-pdbutil/llvm-pdbutil.1 b/usr.bin/clang/llvm-pdbutil/llvm-pdbutil.1 new file mode 100644 index 000000000000..1d46862be19b --- /dev/null +++ b/usr.bin/clang/llvm-pdbutil/llvm-pdbutil.1 @@ -0,0 +1,745 @@ +.\" $FreeBSD$ +.\" Man page generated from reStructuredText. +. +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.TH "LLVM-PDBUTIL" "1" "2021-06-07" "12" "LLVM" +.SH NAME +llvm-pdbutil \- PDB File forensics and diagnostics +.INDENT 0.0 +.IP \(bu 2 +\fI\%Synopsis\fP +.IP \(bu 2 +\fI\%Description\fP +.IP \(bu 2 +\fI\%Subcommands\fP +.INDENT 2.0 +.IP \(bu 2 +\fI\%pretty\fP +.INDENT 2.0 +.IP \(bu 2 +\fI\%Summary\fP +.IP \(bu 2 +\fI\%Options\fP +.INDENT 2.0 +.IP \(bu 2 +\fI\%Filtering and Sorting Options\fP +.IP \(bu 2 +\fI\%Symbol Type Options\fP +.IP \(bu 2 +\fI\%Other Options\fP +.UNINDENT +.UNINDENT +.IP \(bu 2 +\fI\%dump\fP +.INDENT 2.0 +.IP \(bu 2 +\fI\%Summary\fP +.IP \(bu 2 +\fI\%Options\fP +.INDENT 2.0 +.IP \(bu 2 +\fI\%MSF Container Options\fP +.IP \(bu 2 +\fI\%Module & File Options\fP +.IP \(bu 2 +\fI\%Symbol Options\fP +.IP \(bu 2 +\fI\%Type Record Options\fP +.IP \(bu 2 +\fI\%Miscellaneous Options\fP +.UNINDENT +.UNINDENT +.IP \(bu 2 +\fI\%bytes\fP +.INDENT 2.0 +.IP \(bu 2 +\fI\%Summary\fP +.IP \(bu 2 +\fI\%Options\fP +.INDENT 2.0 +.IP \(bu 2 +\fI\%MSF File Options\fP +.IP \(bu 2 +\fI\%PDB Stream Options\fP +.IP \(bu 2 +\fI\%DBI Stream Options\fP +.IP \(bu 2 +\fI\%Module Options\fP +.IP \(bu 2 +\fI\%Type Record Options\fP +.UNINDENT +.UNINDENT +.IP \(bu 2 +\fI\%pdb2yaml\fP +.INDENT 2.0 +.IP \(bu 2 +\fI\%Summary\fP +.IP \(bu 2 +\fI\%Options\fP +.UNINDENT +.IP \(bu 2 +\fI\%yaml2pdb\fP +.INDENT 2.0 +.IP \(bu 2 +\fI\%Summary\fP +.IP \(bu 2 +\fI\%Options\fP +.UNINDENT +.IP \(bu 2 +\fI\%merge\fP +.INDENT 2.0 +.IP \(bu 2 +\fI\%Summary\fP +.IP \(bu 2 +\fI\%Options\fP +.UNINDENT +.UNINDENT +.UNINDENT +.SH SYNOPSIS +.sp +\fBllvm\-pdbutil\fP [\fIsubcommand\fP] [\fIoptions\fP] +.SH DESCRIPTION +.sp +Display types, symbols, CodeView records, and other information from a +PDB file, as well as manipulate and create PDB files. \fBllvm\-pdbutil\fP +is normally used by FileCheck\-based tests to test LLVM\(aqs PDB reading and +writing functionality, but can also be used for general PDB file investigation +and forensics, or as a replacement for cvdump. +.SH SUBCOMMANDS +.sp +\fBllvm\-pdbutil\fP is separated into several subcommands each tailored to +a different purpose. A brief summary of each command follows, with more detail +in the sections that follow. +.INDENT 0.0 +.INDENT 3.5 +.INDENT 0.0 +.IP \(bu 2 +\fI\%pretty\fP \- Dump symbol and type information in a format that +tries to look as much like the original source code as possible. +.IP \(bu 2 +\fI\%dump\fP \- Dump low level types and structures from the PDB +file, including CodeView records, hash tables, PDB streams, etc. +.IP \(bu 2 +\fI\%bytes\fP \- Dump data from the PDB file\(aqs streams, records, +types, symbols, etc as raw bytes. +.IP \(bu 2 +\fI\%yaml2pdb\fP \- Given a yaml description of a PDB file, produce +a valid PDB file that matches that description. +.IP \(bu 2 +\fI\%pdb2yaml\fP \- For a given PDB file, produce a YAML +description of some or all of the file in a way that the PDB can be +reconstructed. +.IP \(bu 2 +\fI\%merge\fP \- Given two PDBs, produce a third PDB that is the +result of merging the two input PDBs. +.UNINDENT +.UNINDENT +.UNINDENT +.SS pretty +.sp +\fBIMPORTANT:\fP +.INDENT 0.0 +.INDENT 3.5 +The \fBpretty\fP subcommand is built on the Windows DIA SDK, and as such is not +supported on non\-Windows platforms. +.UNINDENT +.UNINDENT +.sp +USAGE: \fBllvm\-pdbutil\fP pretty [\fIoptions\fP] <input PDB file> +.SS Summary +.sp +The \fIpretty\fP subcommand displays a very high level representation of your +program\(aqs debug info. Since it is built on the Windows DIA SDK which is the +standard API that Windows tools and debuggers query debug information, it +presents a more authoritative view of how a debugger is going to interpret your +debug information than a mode which displays low\-level CodeView records. +.SS Options +.SS Filtering and Sorting Options +.sp +\fBNOTE:\fP +.INDENT 0.0 +.INDENT 3.5 +\fIexclude\fP filters take priority over \fIinclude\fP filters. So if a filter +matches both an include and an exclude rule, then it is excluded. +.UNINDENT +.UNINDENT +.INDENT 0.0 +.TP +.B \-exclude\-compilands=<string> +When dumping compilands, compiland source\-file contributions, or per\-compiland +symbols, this option instructs \fBllvm\-pdbutil\fP to omit any compilands that +match the specified regular expression. +.UNINDENT +.INDENT 0.0 +.TP +.B \-exclude\-symbols=<string> +When dumping global, public, or per\-compiland symbols, this option instructs +\fBllvm\-pdbutil\fP to omit any symbols that match the specified regular +expression. +.UNINDENT +.INDENT 0.0 +.TP +.B \-exclude\-types=<string> +When dumping types, this option instructs \fBllvm\-pdbutil\fP to omit any types +that match the specified regular expression. +.UNINDENT +.INDENT 0.0 +.TP +.B \-include\-compilands=<string> +When dumping compilands, compiland source\-file contributions, or per\-compiland +symbols, limit the initial search to only those compilands that match the +specified regular expression. +.UNINDENT +.INDENT 0.0 +.TP +.B \-include\-symbols=<string> +When dumping global, public, or per\-compiland symbols, limit the initial +search to only those symbols that match the specified regular expression. +.UNINDENT +.INDENT 0.0 +.TP +.B \-include\-types=<string> +When dumping types, limit the initial search to only those types that match +the specified regular expression. +.UNINDENT +.INDENT 0.0 +.TP +.B \-min\-class\-padding=<uint> +Only display types that have at least the specified amount of alignment +padding, accounting for padding in base classes and aggregate field members. +.UNINDENT +.INDENT 0.0 +.TP +.B \-min\-class\-padding\-imm=<uint> +Only display types that have at least the specified amount of alignment +padding, ignoring padding in base classes and aggregate field members. +.UNINDENT +.INDENT 0.0 +.TP +.B \-min\-type\-size=<uint> +Only display types T where sizeof(T) is greater than or equal to the specified +amount. +.UNINDENT +.INDENT 0.0 +.TP +.B \-no\-compiler\-generated +Don\(aqt show compiler generated types and symbols +.UNINDENT +.INDENT 0.0 +.TP +.B \-no\-enum\-definitions +When dumping an enum, don\(aqt show the full enum (e.g. the individual enumerator +values). +.UNINDENT +.INDENT 0.0 +.TP +.B \-no\-system\-libs +Don\(aqt show symbols from system libraries +.UNINDENT +.SS Symbol Type Options +.INDENT 0.0 +.TP +.B \-all +Implies all other options in this category. +.UNINDENT +.INDENT 0.0 +.TP +.B \-class\-definitions=<format> +Displays class definitions in the specified format. +.INDENT 7.0 +.INDENT 3.5 +.sp +.nf +.ft C +=all \- Display all class members including data, constants, typedefs, functions, etc (default) +=layout \- Only display members that contribute to class size. +=none \- Don\(aqt display class definitions (e.g. only display the name and base list) +.ft P +.fi +.UNINDENT +.UNINDENT +.UNINDENT +.INDENT 0.0 +.TP +.B \-class\-order +Displays classes in the specified order. +.INDENT 7.0 +.INDENT 3.5 +.sp +.nf +.ft C +=none \- Undefined / no particular sort order (default) +=name \- Sort classes by name +=size \- Sort classes by size +=padding \- Sort classes by amount of padding +=padding\-pct \- Sort classes by percentage of space consumed by padding +=padding\-imm \- Sort classes by amount of immediate padding +=padding\-pct\-imm \- Sort classes by percentage of space consumed by immediate padding +.ft P +.fi +.UNINDENT +.UNINDENT +.UNINDENT +.INDENT 0.0 +.TP +.B \-class\-recurse\-depth=<uint> +When dumping class definitions, stop after recursing the specified number of times. The +default is 0, which is no limit. +.UNINDENT +.INDENT 0.0 +.TP +.B \-classes +Display classes +.UNINDENT +.INDENT 0.0 +.TP +.B \-compilands +Display compilands (e.g. object files) +.UNINDENT +.INDENT 0.0 +.TP +.B \-enums +Display enums +.UNINDENT +.INDENT 0.0 +.TP +.B \-externals +Dump external (e.g. exported) symbols +.UNINDENT +.INDENT 0.0 +.TP +.B \-globals +Dump global symbols +.UNINDENT +.INDENT 0.0 +.TP +.B \-lines +Dump the mappings between source lines and code addresses. +.UNINDENT +.INDENT 0.0 +.TP +.B \-module\-syms +Display symbols (variables, functions, etc) for each compiland +.UNINDENT +.INDENT 0.0 +.TP +.B \-sym\-types=<types> +Type of symbols to dump when \-globals, \-externals, or \-module\-syms is +specified. (default all) +.INDENT 7.0 +.INDENT 3.5 +.sp +.nf +.ft C +=thunks \- Display thunk symbols +=data \- Display data symbols +=funcs \- Display function symbols +=all \- Display all symbols (default) +.ft P +.fi +.UNINDENT +.UNINDENT +.UNINDENT +.INDENT 0.0 +.TP +.B \-symbol\-order=<order> +For symbols dumped via the \-module\-syms, \-globals, or \-externals options, sort +the results in specified order. +.INDENT 7.0 +.INDENT 3.5 +.sp +.nf +.ft C +=none \- Undefined / no particular sort order +=name \- Sort symbols by name +=size \- Sort symbols by size +.ft P +.fi +.UNINDENT +.UNINDENT +.UNINDENT +.INDENT 0.0 +.TP +.B \-typedefs +Display typedef types +.UNINDENT +.INDENT 0.0 +.TP +.B \-types +Display all types (implies \-classes, \-enums, \-typedefs) +.UNINDENT +.SS Other Options +.INDENT 0.0 +.TP +.B \-color\-output +Force color output on or off. By default, color if used if outputting to a +terminal. +.UNINDENT +.INDENT 0.0 +.TP +.B \-load\-address=<uint> +When displaying relative virtual addresses, assume the process is loaded at the +given address and display what would be the absolute address. +.UNINDENT +.SS dump +.sp +USAGE: \fBllvm\-pdbutil\fP dump [\fIoptions\fP] <input PDB file> +.SS Summary +.sp +The \fBdump\fP subcommand displays low level information about the structure of a +PDB file. It is used heavily by LLVM\(aqs testing infrastructure, but can also be +used for PDB forensics. It serves a role similar to that of Microsoft\(aqs +\fIcvdump\fP tool. +.sp +\fBNOTE:\fP +.INDENT 0.0 +.INDENT 3.5 +The \fBdump\fP subcommand exposes internal details of the file format. As +such, the reader should be familiar with /PDB/index before using this +command. +.UNINDENT +.UNINDENT +.SS Options +.SS MSF Container Options +.INDENT 0.0 +.TP +.B \-streams +dump a summary of all of the streams in the PDB file. +.UNINDENT +.INDENT 0.0 +.TP +.B \-stream\-blocks +In conjunction with \fI\%\-streams\fP, add information to the output about +what blocks the specified stream occupies. +.UNINDENT +.INDENT 0.0 +.TP +.B \-summary +Dump MSF and PDB header information. +.UNINDENT +.SS Module & File Options +.INDENT 0.0 +.TP +.B \-modi=<uint> +For all options that dump information from each module/compiland, limit to +the specified module. +.UNINDENT +.INDENT 0.0 +.TP +.B \-files +Dump the source files that contribute to each displayed module. +.UNINDENT +.INDENT 0.0 +.TP +.B \-il +Dump inlinee line information (DEBUG_S_INLINEELINES CodeView subsection) +.UNINDENT +.INDENT 0.0 +.TP +.B \-l +Dump line information (DEBUG_S_LINES CodeView subsection) +.UNINDENT +.INDENT 0.0 +.TP +.B \-modules +Dump compiland information +.UNINDENT +.INDENT 0.0 +.TP +.B \-xme +Dump cross module exports (DEBUG_S_CROSSSCOPEEXPORTS CodeView subsection) +.UNINDENT +.INDENT 0.0 +.TP +.B \-xmi +Dump cross module imports (DEBUG_S_CROSSSCOPEIMPORTS CodeView subsection) +.UNINDENT +.SS Symbol Options +.INDENT 0.0 +.TP +.B \-globals +dump global symbol records +.UNINDENT +.INDENT 0.0 +.TP +.B \-global\-extras +dump additional information about the globals, such as hash buckets and hash +values. +.UNINDENT +.INDENT 0.0 +.TP +.B \-publics +dump public symbol records +.UNINDENT +.INDENT 0.0 +.TP +.B \-public\-extras +dump additional information about the publics, such as hash buckets and hash +values. +.UNINDENT +.INDENT 0.0 +.TP +.B \-symbols +dump symbols (functions, variables, etc) for each module dumped. +.UNINDENT +.INDENT 0.0 +.TP +.B \-sym\-data +For each symbol record dumped as a result of the \fI\%\-symbols\fP option, +display the full bytes of the record in binary as well. +.UNINDENT +.SS Type Record Options +.INDENT 0.0 +.TP +.B \-types +Dump CodeView type records from TPI stream +.UNINDENT +.INDENT 0.0 +.TP +.B \-type\-extras +Dump additional information from the TPI stream, such as hashes and the type +index offsets array. +.UNINDENT +.INDENT 0.0 +.TP +.B \-type\-data +For each type record dumped, display the full bytes of the record in binary as +well. +.UNINDENT +.INDENT 0.0 +.TP +.B \-type\-index=<uint> +Only dump types with the specified type index. +.UNINDENT +.INDENT 0.0 +.TP +.B \-ids +Dump CodeView type records from IPI stream. +.UNINDENT +.INDENT 0.0 +.TP +.B \-id\-extras +Dump additional information from the IPI stream, such as hashes and the type +index offsets array. +.UNINDENT +.INDENT 0.0 +.TP +.B \-id\-data +For each ID record dumped, display the full bytes of the record in binary as +well. +.UNINDENT +.INDENT 0.0 +.TP +.B \-id\-index=<uint> +only dump ID records with the specified hexadecimal type index. +.UNINDENT +.INDENT 0.0 +.TP +.B \-dependents +When used in conjunction with \fI\%\-type\-index\fP or \fI\%\-id\-index\fP, +dumps the entire dependency graph for the specified index instead of just the +single record with the specified index. For example, if type index 0x4000 is +a function whose return type has index 0x3000, and you specify +\fI\-dependents=0x4000\fP, then this would dump both records (as well as any other +dependents in the tree). +.UNINDENT +.SS Miscellaneous Options +.INDENT 0.0 +.TP +.B \-all +Implies most other options. +.UNINDENT +.INDENT 0.0 +.TP +.B \-section\-contribs +Dump section contributions. +.UNINDENT +.INDENT 0.0 +.TP +.B \-section\-headers +Dump image section headers. +.UNINDENT +.INDENT 0.0 +.TP +.B \-section\-map +Dump section map. +.UNINDENT +.INDENT 0.0 +.TP +.B \-string\-table +Dump PDB string table. +.UNINDENT +.SS bytes +.sp +USAGE: \fBllvm\-pdbutil\fP bytes [\fIoptions\fP] <input PDB file> +.SS Summary +.sp +Like the \fBdump\fP subcommand, the \fBbytes\fP subcommand displays low level +information about the structure of a PDB file, but it is used for even deeper +forensics. The \fBbytes\fP subcommand finds various structures in a PDB file +based on the command line options specified, and dumps them in hex. Someone +working on support for emitting PDBs would use this heavily, for example, to +compare one PDB against another PDB to ensure byte\-for\-byte compatibility. It +is not enough to simply compare the bytes of an entire file, or an entire stream +because it\(aqs perfectly fine for the same structure to exist at different +locations in two different PDBs, and "finding" the structure is half the battle. +.SS Options +.SS MSF File Options +.INDENT 0.0 +.TP +.B \-block\-range=<start[\-end]> +Dump binary data from specified range of MSF file blocks. +.UNINDENT +.INDENT 0.0 +.TP +.B \-byte\-range=<start[\-end]> +Dump binary data from specified range of bytes in the file. +.UNINDENT +.INDENT 0.0 +.TP +.B \-fpm +Dump the MSF free page map. +.UNINDENT +.INDENT 0.0 +.TP +.B \-stream\-data=<string> +Dump binary data from the specified streams. Format is SN[:Start][@Size]. +For example, \fI\-stream\-data=7:3@12\fP dumps 12 bytes from stream 7, starting +at offset 3 in the stream. +.UNINDENT +.SS PDB Stream Options +.INDENT 0.0 +.TP +.B \-name\-map +Dump bytes of PDB Name Map +.UNINDENT +.SS DBI Stream Options +.INDENT 0.0 +.TP +.B \-ec +Dump the edit and continue map substream of the DBI stream. +.UNINDENT +.INDENT 0.0 +.TP +.B \-files +Dump the file info substream of the DBI stream. +.UNINDENT +.INDENT 0.0 +.TP +.B \-modi +Dump the modi substream of the DBI stream. +.UNINDENT +.INDENT 0.0 +.TP +.B \-sc +Dump section contributions substream of the DBI stream. +.UNINDENT +.INDENT 0.0 +.TP +.B \-sm +Dump the section map from the DBI stream. +.UNINDENT +.INDENT 0.0 +.TP +.B \-type\-server +Dump the type server map from the DBI stream. +.UNINDENT +.SS Module Options +.INDENT 0.0 +.TP +.B \-mod=<uint> +Limit all options in this category to the specified module index. By default, +options in this category will dump bytes from all modules. +.UNINDENT +.INDENT 0.0 +.TP +.B \-chunks +Dump the bytes of each module\(aqs C13 debug subsection. +.UNINDENT +.INDENT 0.0 +.TP +.B \-split\-chunks +When specified with \fI\%\-chunks\fP, split the C13 debug subsection into a +separate chunk for each subsection type, and dump them separately. +.UNINDENT +.INDENT 0.0 +.TP +.B \-syms +Dump the symbol record substream from each module. +.UNINDENT +.SS Type Record Options +.INDENT 0.0 +.TP +.B \-id=<uint> +Dump the record from the IPI stream with the given type index. +.UNINDENT +.INDENT 0.0 +.TP +.B \-type=<uint> +Dump the record from the TPI stream with the given type index. +.UNINDENT +.SS pdb2yaml +.sp +USAGE: \fBllvm\-pdbutil\fP pdb2yaml [\fIoptions\fP] <input PDB file> +.SS Summary +.SS Options +.SS yaml2pdb +.sp +USAGE: \fBllvm\-pdbutil\fP yaml2pdb [\fIoptions\fP] <input YAML file> +.SS Summary +.sp +Generate a PDB file from a YAML description. The YAML syntax is not described +here. Instead, use \fI\%llvm\-pdbutil pdb2yaml\fP and +examine the output for an example starting point. +.SS Options +.INDENT 0.0 +.TP +.B \-pdb=<file\-name> +.UNINDENT +.sp +Write the resulting PDB to the specified file. +.SS merge +.sp +USAGE: \fBllvm\-pdbutil\fP merge [\fIoptions\fP] <input PDB file 1> <input PDB file 2> +.SS Summary +.sp +Merge two PDB files into a single file. +.SS Options +.INDENT 0.0 +.TP +.B \-pdb=<file\-name> +.UNINDENT +.sp +Write the resulting PDB to the specified file. +.SH AUTHOR +Maintained by the LLVM Team (https://llvm.org/). +.SH COPYRIGHT +2003-2021, LLVM Project +.\" Generated by docutils manpage writer. +. diff --git a/usr.bin/clang/llvm-profdata/Makefile b/usr.bin/clang/llvm-profdata/Makefile new file mode 100644 index 000000000000..b3b0d63346de --- /dev/null +++ b/usr.bin/clang/llvm-profdata/Makefile @@ -0,0 +1,13 @@ +# $FreeBSD$ + +PROG_CXX= llvm-profdata + +SRCDIR= llvm/tools/llvm-profdata +SRCS+= llvm-profdata.cpp + +CFLAGS.llvm-profdata.cpp+= -Dllvm_profdata_main=main + +LIBADD+= z +LIBADD+= zstd + +.include "../llvm.prog.mk" diff --git a/usr.bin/clang/llvm-profdata/Makefile.depend b/usr.bin/clang/llvm-profdata/Makefile.depend new file mode 100644 index 000000000000..1423340957b6 --- /dev/null +++ b/usr.bin/clang/llvm-profdata/Makefile.depend @@ -0,0 +1,24 @@ +# $FreeBSD$ +# Autogenerated - do NOT edit! + +DIRDEPS = \ + gnu/lib/csu \ + include \ + include/xlocale \ + lib/${CSU_DIR} \ + lib/clang/libllvm \ + lib/libc \ + lib/libc++ \ + lib/libcompiler_rt \ + lib/libcxxrt \ + lib/libthr \ + lib/libz \ + lib/msun \ + lib/ncurses/ncursesw \ + + +.include <dirdeps.mk> + +.if ${DEP_RELDIR} == ${_DEP_RELDIR} +# local dependencies - needed for -jN in clean tree +.endif diff --git a/usr.bin/clang/llvm-profdata/llvm-profdata.1 b/usr.bin/clang/llvm-profdata/llvm-profdata.1 new file mode 100644 index 000000000000..04bfbd7b3c11 --- /dev/null +++ b/usr.bin/clang/llvm-profdata/llvm-profdata.1 @@ -0,0 +1,432 @@ +.\" $FreeBSD$ +.\" Man page generated from reStructuredText. +. +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.TH "LLVM-PROFDATA" "1" "2021-06-07" "12" "LLVM" +.SH NAME +llvm-profdata \- Profile data tool +.SH SYNOPSIS +.sp +\fBllvm\-profdata\fP \fIcommand\fP [\fIargs...\fP] +.SH DESCRIPTION +.sp +The \fBllvm\-profdata\fP tool is a small utility for working with profile +data files. +.SH COMMANDS +.INDENT 0.0 +.IP \(bu 2 +\fI\%merge\fP +.IP \(bu 2 +\fI\%show\fP +.IP \(bu 2 +\fI\%overlap\fP +.UNINDENT +.SH MERGE +.SS SYNOPSIS +.sp +\fBllvm\-profdata merge\fP [\fIoptions\fP] [\fIfilename...\fP] +.SS DESCRIPTION +.sp +\fBllvm\-profdata merge\fP takes several profile data files +generated by PGO instrumentation and merges them together into a single +indexed profile data file. +.sp +By default profile data is merged without modification. This means that the +relative importance of each input file is proportional to the number of samples +or counts it contains. In general, the input from a longer training run will be +interpreted as relatively more important than a shorter run. Depending on the +nature of the training runs it may be useful to adjust the weight given to each +input file by using the \fB\-weighted\-input\fP option. +.sp +Profiles passed in via \fB\-weighted\-input\fP, \fB\-input\-files\fP, or via positional +arguments are processed once for each time they are seen. +.SS OPTIONS +.INDENT 0.0 +.TP +.B \-help +Print a summary of command line options. +.UNINDENT +.INDENT 0.0 +.TP +.B \-output=output, \-o=output +Specify the output file name. \fIOutput\fP cannot be \fB\-\fP as the resulting +indexed profile data can\(aqt be written to standard output. +.UNINDENT +.INDENT 0.0 +.TP +.B \-weighted\-input=weight,filename +Specify an input file name along with a weight. The profile counts of the +supplied \fBfilename\fP will be scaled (multiplied) by the supplied +\fBweight\fP, where \fBweight\fP is a decimal integer >= 1. +Input files specified without using this option are assigned a default +weight of 1. Examples are shown below. +.UNINDENT +.INDENT 0.0 +.TP +.B \-input\-files=path, \-f=path +Specify a file which contains a list of files to merge. The entries in this +file are newline\-separated. Lines starting with \(aq#\(aq are skipped. Entries may +be of the form <filename> or <weight>,<filename>. +.UNINDENT +.INDENT 0.0 +.TP +.B \-remapping\-file=path, \-r=path +Specify a file which contains a remapping from symbol names in the input +profile to the symbol names that should be used in the output profile. The +file should consist of lines of the form \fB<input\-symbol> <output\-symbol>\fP\&. +Blank lines and lines starting with \fB#\fP are skipped. +.sp +The llvm\-cxxmap tool can be used to generate the symbol +remapping file. +.UNINDENT +.INDENT 0.0 +.TP +.B \-instr (default) +Specify that the input profile is an instrumentation\-based profile. +.UNINDENT +.INDENT 0.0 +.TP +.B \-sample +Specify that the input profile is a sample\-based profile. +.sp +The format of the generated file can be generated in one of three ways: +.INDENT 7.0 +.TP +.B \-binary (default) +.UNINDENT +.sp +Emit the profile using a binary encoding. For instrumentation\-based profile +the output format is the indexed binary format. +.INDENT 7.0 +.TP +.B \-extbinary +.UNINDENT +.sp +Emit the profile using an extensible binary encoding. This option can only +be used with sample\-based profile. The extensible binary encoding can be +more compact with compression enabled and can be loaded faster than the +default binary encoding. +.INDENT 7.0 +.TP +.B \-text +.UNINDENT +.sp +Emit the profile in text mode. This option can also be used with both +sample\-based and instrumentation\-based profile. When this option is used +the profile will be dumped in the text format that is parsable by the profile +reader. +.INDENT 7.0 +.TP +.B \-gcc +.UNINDENT +.sp +Emit the profile using GCC\(aqs gcov format (Not yet supported). +.UNINDENT +.INDENT 0.0 +.TP +.B \-sparse[=true|false] +Do not emit function records with 0 execution count. Can only be used in +conjunction with \-instr. Defaults to false, since it can inhibit compiler +optimization during PGO. +.UNINDENT +.INDENT 0.0 +.TP +.B \-num\-threads=N, \-j=N +Use N threads to perform profile merging. When N=0, llvm\-profdata auto\-detects +an appropriate number of threads to use. This is the default. +.UNINDENT +.INDENT 0.0 +.TP +.B \-failure\-mode=[any|all] +Set the failure mode. There are two options: \(aqany\(aq causes the merge command to +fail if any profiles are invalid, and \(aqall\(aq causes the merge command to fail +only if all profiles are invalid. If \(aqall\(aq is set, information from any +invalid profiles is excluded from the final merged product. The default +failure mode is \(aqany\(aq. +.UNINDENT +.INDENT 0.0 +.TP +.B \-prof\-sym\-list=path +Specify a file which contains a list of symbols to generate profile symbol +list in the profile. This option can only be used with sample\-based profile +in extbinary format. The entries in this file are newline\-separated. +.UNINDENT +.INDENT 0.0 +.TP +.B \-compress\-all\-sections=[true|false] +Compress all sections when writing the profile. This option can only be used +with sample\-based profile in extbinary format. +.UNINDENT +.INDENT 0.0 +.TP +.B \-use\-md5=[true|false] +Use MD5 to represent string in name table when writing the profile. +This option can only be used with sample\-based profile in extbinary format. +.UNINDENT +.INDENT 0.0 +.TP +.B \-gen\-partial\-profile=[true|false] +Mark the profile to be a partial profile which only provides partial profile +coverage for the optimized target. This option can only be used with +sample\-based profile in extbinary format. +.UNINDENT +.INDENT 0.0 +.TP +.B \-supplement\-instr\-with\-sample=path_to_sample_profile +Supplement an instrumentation profile with sample profile. The sample profile +is the input of the flag. Output will be in instrumentation format (only works +with \-instr). +.UNINDENT +.INDENT 0.0 +.TP +.B \-zero\-counter\-threshold=threshold_float_number +For the function which is cold in instr profile but hot in sample profile, if +the ratio of the number of zero counters divided by the the total number of +counters is above the threshold, the profile of the function will be regarded +as being harmful for performance and will be dropped. +.UNINDENT +.INDENT 0.0 +.TP +.B \-instr\-prof\-cold\-threshold=threshold_int_number +User specified cold threshold for instr profile which will override the cold +threshold got from profile summary. +.UNINDENT +.INDENT 0.0 +.TP +.B \-suppl\-min\-size\-threshold=threshold_int_number +If the size of a function is smaller than the threshold, assume it can be +inlined by PGO early inliner and it will not be adjusted based on sample +profile. +.UNINDENT +.SS EXAMPLES +.SS Basic Usage +.sp +Merge three profiles: +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +llvm\-profdata merge foo.profdata bar.profdata baz.profdata \-output merged.profdata +.ft P +.fi +.UNINDENT +.UNINDENT +.SS Weighted Input +.sp +The input file \fIfoo.profdata\fP is especially important, multiply its counts by 10: +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +llvm\-profdata merge \-weighted\-input=10,foo.profdata bar.profdata baz.profdata \-output merged.profdata +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Exactly equivalent to the previous invocation (explicit form; useful for programmatic invocation): +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +llvm\-profdata merge \-weighted\-input=10,foo.profdata \-weighted\-input=1,bar.profdata \-weighted\-input=1,baz.profdata \-output merged.profdata +.ft P +.fi +.UNINDENT +.UNINDENT +.SH SHOW +.SS SYNOPSIS +.sp +\fBllvm\-profdata show\fP [\fIoptions\fP] [\fIfilename\fP] +.SS DESCRIPTION +.sp +\fBllvm\-profdata show\fP takes a profile data file and displays the +information about the profile counters for this file and +for any of the specified function(s). +.sp +If \fIfilename\fP is omitted or is \fB\-\fP, then \fBllvm\-profdata show\fP reads its +input from standard input. +.SS OPTIONS +.INDENT 0.0 +.TP +.B \-all\-functions +Print details for every function. +.UNINDENT +.INDENT 0.0 +.TP +.B \-counts +Print the counter values for the displayed functions. +.UNINDENT +.INDENT 0.0 +.TP +.B \-function=string +Print details for a function if the function\(aqs name contains the given string. +.UNINDENT +.INDENT 0.0 +.TP +.B \-help +Print a summary of command line options. +.UNINDENT +.INDENT 0.0 +.TP +.B \-output=output, \-o=output +Specify the output file name. If \fIoutput\fP is \fB\-\fP or it isn\(aqt specified, +then the output is sent to standard output. +.UNINDENT +.INDENT 0.0 +.TP +.B \-instr (default) +Specify that the input profile is an instrumentation\-based profile. +.UNINDENT +.INDENT 0.0 +.TP +.B \-text +Instruct the profile dumper to show profile counts in the text format of the +instrumentation\-based profile data representation. By default, the profile +information is dumped in a more human readable form (also in text) with +annotations. +.UNINDENT +.INDENT 0.0 +.TP +.B \-topn=n +Instruct the profile dumper to show the top \fBn\fP functions with the +hottest basic blocks in the summary section. By default, the topn functions +are not dumped. +.UNINDENT +.INDENT 0.0 +.TP +.B \-sample +Specify that the input profile is a sample\-based profile. +.UNINDENT +.INDENT 0.0 +.TP +.B \-memop\-sizes +Show the profiled sizes of the memory intrinsic calls for shown functions. +.UNINDENT +.INDENT 0.0 +.TP +.B \-value\-cutoff=n +Show only those functions whose max count values are greater or equal to \fBn\fP\&. +By default, the value\-cutoff is set to 0. +.UNINDENT +.INDENT 0.0 +.TP +.B \-list\-below\-cutoff +Only output names of functions whose max count value are below the cutoff +value. +.UNINDENT +.INDENT 0.0 +.TP +.B \-showcs +Only show context sensitive profile counts. The default is to filter all +context sensitive profile counts. +.UNINDENT +.INDENT 0.0 +.TP +.B \-show\-prof\-sym\-list=[true|false] +Show profile symbol list if it exists in the profile. This option is only +meaningful for sample\-based profile in extbinary format. +.UNINDENT +.INDENT 0.0 +.TP +.B \-show\-sec\-info\-only=[true|false] +Show basic information about each section in the profile. This option is +only meaningful for sample\-based profile in extbinary format. +.UNINDENT +.SH OVERLAP +.SS SYNOPSIS +.sp +\fBllvm\-profdata overlap\fP [\fIoptions\fP] [\fIbase profile file\fP] [\fItest profile file\fP] +.SS DESCRIPTION +.sp +\fBllvm\-profdata overlap\fP takes two profile data files and displays the +\fIoverlap\fP of counter distribution between the whole files and between any of the +specified functions. +.sp +In this command, \fIoverlap\fP is defined as follows: +Suppose \fIbase profile file\fP has the following counts: +{c1_1, c1_2, ..., c1_n, c1_u_1, c2_u_2, ..., c2_u_s}, +and \fItest profile file\fP has +{c2_1, c2_2, ..., c2_n, c2_v_1, c2_v_2, ..., c2_v_t}. +Here c{1|2}_i (i = 1 .. n) are matched counters and c1_u_i (i = 1 .. s) and +c2_v_i (i = 1 .. v) are unmatched counters (or counters only existing in) +\fIbase profile file\fP and \fItest profile file\fP, respectively. +Let sum_1 = c1_1 + c1_2 + ... + c1_n + c1_u_1 + c2_u_2 + ... + c2_u_s, and +sum_2 = c2_1 + c2_2 + ... + c2_n + c2_v_1 + c2_v_2 + ... + c2_v_t. +\fIoverlap\fP = min(c1_1/sum_1, c2_1/sum_2) + min(c1_2/sum_1, c2_2/sum_2) + ... ++ min(c1_n/sum_1, c2_n/sum_2). +.sp +The result overlap distribution is a percentage number, ranging from 0.0% to +100.0%, where 0.0% means there is no overlap and 100.0% means a perfect +overlap. +.sp +Here is an example, if \fIbase profile file\fP has counts of {400, 600}, and +\fItest profile file\fP has matched counts of {60000, 40000}. The \fIoverlap\fP is 80%. +.SS OPTIONS +.INDENT 0.0 +.TP +.B \-function=string +Print details for a function if the function\(aqs name contains the given string. +.UNINDENT +.INDENT 0.0 +.TP +.B \-help +Print a summary of command line options. +.UNINDENT +.INDENT 0.0 +.TP +.B \-o=output or \-o output +Specify the output file name. If \fIoutput\fP is \fB\-\fP or it isn\(aqt specified, +then the output is sent to standard output. +.UNINDENT +.INDENT 0.0 +.TP +.B \-value\-cutoff=n +Show only those functions whose max count values are greater or equal to \fBn\fP\&. +By default, the value\-cutoff is set to max of unsigned long long. +.UNINDENT +.INDENT 0.0 +.TP +.B \-cs +Only show overlap for the context sensitive profile counts. The default is to show +non\-context sensitive profile counts. +.UNINDENT +.SH EXIT STATUS +.sp +\fBllvm\-profdata\fP returns 1 if the command is omitted or is invalid, +if it cannot read input files, or if there is a mismatch between their data. +.SH AUTHOR +Maintained by the LLVM Team (https://llvm.org/). +.SH COPYRIGHT +2003-2021, LLVM Project +.\" Generated by docutils manpage writer. +. diff --git a/usr.bin/clang/llvm-readobj/Makefile b/usr.bin/clang/llvm-readobj/Makefile new file mode 100644 index 000000000000..d47cdfa329fc --- /dev/null +++ b/usr.bin/clang/llvm-readobj/Makefile @@ -0,0 +1,49 @@ +# $FreeBSD$ + +.include <src.opts.mk> + +PROG_CXX= llvm-readobj +MAN= llvm-readobj.1 llvm-readelf.1 + +SRCDIR= llvm/tools/llvm-readobj +SRCS+= ARMWinEHPrinter.cpp +SRCS+= COFFDumper.cpp +SRCS+= COFFImportDumper.cpp +SRCS+= ELFDumper.cpp +SRCS+= llvm-readobj.cpp +SRCS+= MachODumper.cpp +SRCS+= ObjDumper.cpp +SRCS+= WasmDumper.cpp +SRCS+= Win64EHDumper.cpp +SRCS+= WindowsResourceDumper.cpp +SRCS+= XCOFFDumper.cpp + +CFLAGS.llvm-readobj.cpp+= -Dllvm_readobj_main=main + +.include "${SRCTOP}/lib/clang/llvm.pre.mk" + +CFLAGS+= -I${.OBJDIR} + +INCFILE= Opts.inc +TDFILE= ${LLVM_BASE}/${SRCDIR}/Opts.td +GENOPT= -gen-opt-parser-defs +${INCFILE}: ${TDFILE} + ${LLVM_TBLGEN} ${GENOPT} -I ${LLVM_SRCS}/include -d ${.TARGET:C/$/.d/} \ + -o ${.TARGET} ${TDFILE} +TGHDRS+= ${INCFILE} + +DEPENDFILES+= ${TGHDRS:C/$/.d/} +DPSRCS+= ${TGHDRS} +CLEANFILES+= ${TGHDRS} ${TGHDRS:C/$/.d/} + +LIBADD+= z +LIBADD+= zstd + +LINKS+= ${BINDIR}/llvm-readobj ${BINDIR}/llvm-readelf + +.if ${MK_LLVM_BINUTILS} != "no" +LINKS+= ${BINDIR}/llvm-readelf ${BINDIR}/readelf +MLINKS+= llvm-readelf.1 readelf.1 +.endif + +.include "../llvm.prog.mk" diff --git a/usr.bin/clang/llvm-readobj/llvm-readelf.1 b/usr.bin/clang/llvm-readobj/llvm-readelf.1 new file mode 100644 index 000000000000..9bfaf88409d7 --- /dev/null +++ b/usr.bin/clang/llvm-readobj/llvm-readelf.1 @@ -0,0 +1,272 @@ +.\" Man page generated from reStructuredText. +. +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.TH "LLVM-READELF" "1" "2021-09-22" "12" "LLVM" +.SH NAME +llvm-readelf \- GNU-style LLVM Object Reader +.SH SYNOPSIS +.sp +\fBllvm\-readelf\fP [\fIoptions\fP] [\fIinput...\fP] +.SH DESCRIPTION +.sp +The \fBllvm\-readelf\fP tool displays low\-level format\-specific information +about one or more object files. +.sp +If \fBinput\fP is "\fB\-\fP", \fBllvm\-readelf\fP reads from standard +input. Otherwise, it will read from the specified \fBfilenames\fP\&. +.SH OPTIONS +.INDENT 0.0 +.TP +.B \-\-all +Equivalent to specifying all the main display options. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-addrsig +Display the address\-significance table. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-arch\-specific, \-A +Display architecture\-specific information, e.g. the ARM attributes section on ARM. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-color +Use colors in the output for warnings and errors. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-demangle, \-C +Display demangled symbol names in the output. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-dyn\-relocations +Display the dynamic relocation entries. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-dyn\-symbols, \-\-dyn\-syms +Display the dynamic symbol table. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-dynamic\-table, \-\-dynamic, \-d +Display the dynamic table. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-cg\-profile +Display the callgraph profile section. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-elf\-hash\-histogram, \-\-histogram, \-I +Display a bucket list histogram for dynamic symbol hash tables. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-elf\-linker\-options +Display the linker options section. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-elf\-output\-style=<value> +Format ELF information in the specified style. Valid options are \fBLLVM\fP and +\fBGNU\fP\&. \fBLLVM\fP output is an expanded and structured format, whilst \fBGNU\fP +(the default) output mimics the equivalent GNU \fBreadelf\fP output. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-elf\-section\-groups, \-\-section\-groups, \-g +Display section groups. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-expand\-relocs +When used with \fI\%\-\-relocations\fP, display each relocation in an expanded +multi\-line format. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-file\-headers, \-h +Display file headers. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-gnu\-hash\-table +Display the GNU hash table for dynamic symbols. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-hash\-symbols +Display the expanded hash table with dynamic symbol data. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-hash\-table +Display the hash table for dynamic symbols. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-headers, \-e +Equivalent to setting: \fI\%\-\-file\-headers\fP, \fI\%\-\-program\-headers\fP, +and \fI\%\-\-sections\fP\&. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-help +Display a summary of command line options. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-help\-list +Display an uncategorized summary of command line options. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-hex\-dump=<section[,section,...]>, \-x +Display the specified section(s) as hexadecimal bytes. \fBsection\fP may be a +section index or section name. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-needed\-libs +Display the needed libraries. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-notes, \-n +Display all notes. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-program\-headers, \-\-segments, \-l +Display the program headers. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-raw\-relr +Do not decode relocations in RELR relocation sections when displaying them. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-relocations, \-\-relocs, \-r +Display the relocation entries in the file. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-sections, \-\-section\-headers, \-S +Display all sections. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-section\-data +When used with \fI\%\-\-sections\fP, display section data for each section +shown. This option has no effect for GNU style output. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-section\-details, \-t +Display all section details. Used as an alternative to \fI\%\-\-sections\fP\&. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-section\-mapping +Display the section to segment mapping. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-section\-relocations +When used with \fI\%\-\-sections\fP, display relocations for each section +shown. This option has no effect for GNU style output. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-section\-symbols +When used with \fI\%\-\-sections\fP, display symbols for each section shown. +This option has no effect for GNU style output. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-stackmap +Display contents of the stackmap section. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-stack\-sizes +Display the contents of the stack sizes section(s), i.e. pairs of function +names and the size of their stack frames. Currently only implemented for GNU +style output. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-string\-dump=<section[,section,...]>, \-p +Display the specified section(s) as a list of strings. \fBsection\fP may be a +section index or section name. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-symbols, \-\-syms, \-s +Display the symbol table. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-unwind, \-u +Display unwind information. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-version +Display the version of the \fBllvm\-readelf\fP executable. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-version\-info, \-V +Display version sections. +.UNINDENT +.INDENT 0.0 +.TP +.B @<FILE> +Read command\-line options from response file \fI<FILE>\fP\&. +.UNINDENT +.SH EXIT STATUS +.sp +\fBllvm\-readelf\fP returns 0 under normal operation. It returns a non\-zero +exit code if there were any errors. +.SH SEE ALSO +.sp +\fBllvm\-nm(1)\fP, \fBllvm\-objdump(1)\fP, \fBllvm\-readobj(1)\fP +.SH AUTHOR +Maintained by the LLVM Team (https://llvm.org/). +.SH COPYRIGHT +2003-2021, LLVM Project +.\" Generated by docutils manpage writer. +. diff --git a/usr.bin/clang/llvm-readobj/llvm-readobj.1 b/usr.bin/clang/llvm-readobj/llvm-readobj.1 new file mode 100644 index 000000000000..5b0597e22048 --- /dev/null +++ b/usr.bin/clang/llvm-readobj/llvm-readobj.1 @@ -0,0 +1,403 @@ +.\" Man page generated from reStructuredText. +. +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.TH "LLVM-READOBJ" "1" "2021-09-22" "12" "LLVM" +.SH NAME +llvm-readobj \- LLVM Object Reader +.SH SYNOPSIS +.sp +\fBllvm\-readobj\fP [\fIoptions\fP] [\fIinput...\fP] +.SH DESCRIPTION +.sp +The \fBllvm\-readobj\fP tool displays low\-level format\-specific information +about one or more object files. +.sp +If \fBinput\fP is "\fB\-\fP", \fBllvm\-readobj\fP reads from standard +input. Otherwise, it will read from the specified \fBfilenames\fP\&. +.SH DIFFERENCES TO LLVM-READELF +.sp +\fBllvm\-readelf\fP is an alias for the \fBllvm\-readobj\fP tool with a +slightly different command\-line interface and output that is GNU compatible. +Following is a list of differences between \fBllvm\-readelf\fP and +\fBllvm\-readobj\fP: +.INDENT 0.0 +.IP \(bu 2 +\fBllvm\-readelf\fP uses \fIGNU\fP for the \fI\%\-\-elf\-output\-style\fP option +by default. \fBllvm\-readobj\fP uses \fILLVM\fP\&. +.IP \(bu 2 +\fBllvm\-readelf\fP allows single\-letter grouped flags (e.g. +\fBllvm\-readelf \-SW\fP is the same as \fBllvm\-readelf \-S \-W\fP). +\fBllvm\-readobj\fP does not allow grouping. +.IP \(bu 2 +\fBllvm\-readelf\fP provides \fI\%\-s\fP as an alias for +\fI\%\-\-symbols\fP, for GNU \fBreadelf\fP compatibility, whereas it is +an alias for \fI\%\-\-section\-headers\fP in \fBllvm\-readobj\fP\&. +.IP \(bu 2 +\fBllvm\-readobj\fP provides \fB\-t\fP as an alias for \fI\%\-\-symbols\fP\&. +\fBllvm\-readelf\fP does not. +.IP \(bu 2 +\fBllvm\-readobj\fP provides \fB\-\-sr\fP, \fB\-\-sd\fP, \fB\-\-st\fP and \fB\-\-dt\fP as +aliases for \fI\%\-\-section\-relocations\fP, \fI\%\-\-section\-data\fP, +\fI\%\-\-section\-symbols\fP and \fI\%\-\-dyn\-symbols\fP respectively. +\fBllvm\-readelf\fP does not provide these aliases, to avoid conflicting +with grouped flags. +.UNINDENT +.SH GENERAL AND MULTI-FORMAT OPTIONS +.sp +These options are applicable to more than one file format, or are unrelated to +file formats. +.INDENT 0.0 +.TP +.B \-\-all +Equivalent to specifying all the main display options relevant to the file +format. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-addrsig +Display the address\-significance table. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-color +Use colors in the output for warnings and errors. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-expand\-relocs +When used with \fI\%\-\-relocations\fP, display each relocation in an expanded +multi\-line format. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-file\-headers, \-h +Display file headers. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-headers, \-e +Equivalent to setting: \fI\%\-\-file\-headers\fP, \fI\%\-\-program\-headers\fP, +and \fI\%\-\-sections\fP\&. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-help +Display a summary of command line options. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-help\-list +Display an uncategorized summary of command line options. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-hex\-dump=<section[,section,...]>, \-x +Display the specified section(s) as hexadecimal bytes. \fBsection\fP may be a +section index or section name. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-needed\-libs +Display the needed libraries. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-relocations, \-\-relocs, \-r +Display the relocation entries in the file. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-sections, \-\-section\-headers, \-s, \-S +Display all sections. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-section\-data, \-\-sd +When used with \fI\%\-\-sections\fP, display section data for each section +shown. This option has no effect for GNU style output. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-section\-relocations, \-\-sr +When used with \fI\%\-\-sections\fP, display relocations for each section +shown. This option has no effect for GNU style output. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-section\-symbols, \-\-st +When used with \fI\%\-\-sections\fP, display symbols for each section shown. +This option has no effect for GNU style output. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-stackmap +Display contents of the stackmap section. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-string\-dump=<section[,section,...]>, \-p +Display the specified section(s) as a list of strings. \fBsection\fP may be a +section index or section name. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-symbols, \-\-syms, \-t +Display the symbol table. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-unwind, \-u +Display unwind information. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-version +Display the version of the \fBllvm\-readobj\fP executable. +.UNINDENT +.INDENT 0.0 +.TP +.B @<FILE> +Read command\-line options from response file \fI<FILE>\fP\&. +.UNINDENT +.SH ELF SPECIFIC OPTIONS +.sp +The following options are implemented only for the ELF file format. +.INDENT 0.0 +.TP +.B \-\-arch\-specific, \-A +Display architecture\-specific information, e.g. the ARM attributes section on ARM. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-demangle, \-C +Display demangled symbol names in the output. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-dependent\-libraries +Display the dependent libraries section. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-dyn\-relocations +Display the dynamic relocation entries. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-dyn\-symbols, \-\-dyn\-syms, \-\-dt +Display the dynamic symbol table. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-dynamic\-table, \-\-dynamic, \-d +Display the dynamic table. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-cg\-profile +Display the callgraph profile section. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-elf\-hash\-histogram, \-\-histogram, \-I +Display a bucket list histogram for dynamic symbol hash tables. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-elf\-linker\-options +Display the linker options section. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-elf\-output\-style=<value> +Format ELF information in the specified style. Valid options are \fBLLVM\fP and +\fBGNU\fP\&. \fBLLVM\fP output (the default) is an expanded and structured format, +whilst \fBGNU\fP output mimics the equivalent GNU \fBreadelf\fP output. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-elf\-section\-groups, \-\-section\-groups, \-g +Display section groups. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-gnu\-hash\-table +Display the GNU hash table for dynamic symbols. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-hash\-symbols +Display the expanded hash table with dynamic symbol data. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-hash\-table +Display the hash table for dynamic symbols. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-notes, \-n +Display all notes. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-program\-headers, \-\-segments, \-l +Display the program headers. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-raw\-relr +Do not decode relocations in RELR relocation sections when displaying them. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-section\-mapping +Display the section to segment mapping. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-stack\-sizes +Display the contents of the stack sizes section(s), i.e. pairs of function +names and the size of their stack frames. Currently only implemented for GNU +style output. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-version\-info, \-V +Display version sections. +.UNINDENT +.SH MACH-O SPECIFIC OPTIONS +.sp +The following options are implemented only for the Mach\-O file format. +.INDENT 0.0 +.TP +.B \-\-macho\-data\-in\-code +Display the Data in Code command. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-macho\-dsymtab +Display the Dsymtab command. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-macho\-indirect\-symbols +Display indirect symbols. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-macho\-linker\-options +Display the Mach\-O\-specific linker options. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-macho\-segment +Display the Segment command. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-macho\-version\-min +Display the version min command. +.UNINDENT +.SH PE/COFF SPECIFIC OPTIONS +.sp +The following options are implemented only for the PE/COFF file format. +.INDENT 0.0 +.TP +.B \-\-codeview +Display CodeView debug information. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-codeview\-ghash +Enable global hashing for CodeView type stream de\-duplication. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-codeview\-merged\-types +Display the merged CodeView type stream. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-codeview\-subsection\-bytes +Dump raw contents of CodeView debug sections and records. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-coff\-basereloc +Display the .reloc section. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-coff\-debug\-directory +Display the debug directory. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-coff\-tls\-directory +Display the TLS directory. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-coff\-directives +Display the .drectve section. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-coff\-exports +Display the export table. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-coff\-imports +Display the import table. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-coff\-load\-config +Display the load config. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-coff\-resources +Display the .rsrc section. +.UNINDENT +.SH EXIT STATUS +.sp +\fBllvm\-readobj\fP returns 0 under normal operation. It returns a non\-zero +exit code if there were any errors. +.SH SEE ALSO +.sp +\fBllvm\-nm(1)\fP, \fBllvm\-objdump(1)\fP, \fBllvm\-readelf(1)\fP +.SH AUTHOR +Maintained by the LLVM Team (https://llvm.org/). +.SH COPYRIGHT +2003-2021, LLVM Project +.\" Generated by docutils manpage writer. +. diff --git a/usr.bin/clang/llvm-rtdyld/Makefile b/usr.bin/clang/llvm-rtdyld/Makefile new file mode 100644 index 000000000000..6c7bd97f4bd0 --- /dev/null +++ b/usr.bin/clang/llvm-rtdyld/Makefile @@ -0,0 +1,12 @@ +# $FreeBSD$ + +PROG_CXX= llvm-rtdyld +MAN= + +SRCDIR= llvm/tools/llvm-rtdyld +SRCS+= llvm-rtdyld.cpp + +LIBADD+= z +LIBADD+= zstd + +.include "../llvm.prog.mk" diff --git a/usr.bin/clang/llvm-rtdyld/Makefile.depend b/usr.bin/clang/llvm-rtdyld/Makefile.depend new file mode 100644 index 000000000000..1423340957b6 --- /dev/null +++ b/usr.bin/clang/llvm-rtdyld/Makefile.depend @@ -0,0 +1,24 @@ +# $FreeBSD$ +# Autogenerated - do NOT edit! + +DIRDEPS = \ + gnu/lib/csu \ + include \ + include/xlocale \ + lib/${CSU_DIR} \ + lib/clang/libllvm \ + lib/libc \ + lib/libc++ \ + lib/libcompiler_rt \ + lib/libcxxrt \ + lib/libthr \ + lib/libz \ + lib/msun \ + lib/ncurses/ncursesw \ + + +.include <dirdeps.mk> + +.if ${DEP_RELDIR} == ${_DEP_RELDIR} +# local dependencies - needed for -jN in clean tree +.endif diff --git a/usr.bin/clang/llvm-size/Makefile b/usr.bin/clang/llvm-size/Makefile new file mode 100644 index 000000000000..59b9dac68ec3 --- /dev/null +++ b/usr.bin/clang/llvm-size/Makefile @@ -0,0 +1,33 @@ +# $FreeBSD$ + +.include <src.opts.mk> + +PROG_CXX= llvm-size + +SRCDIR= llvm/tools/llvm-size +SRCS+= llvm-size.cpp + +CFLAGS.llvm-size.cpp+= -Dllvm_size_main=main + +.include "${SRCTOP}/lib/clang/llvm.pre.mk" + +CFLAGS+= -I${.OBJDIR} + +INCFILE= Opts.inc +TDFILE= ${LLVM_BASE}/${SRCDIR}/Opts.td +GENOPT= -gen-opt-parser-defs +${INCFILE}: ${TDFILE} + ${LLVM_TBLGEN} ${GENOPT} -I ${LLVM_SRCS}/include -d ${.TARGET:C/$/.d/} \ + -o ${.TARGET} ${TDFILE} +TGHDRS+= ${INCFILE} + +DEPENDFILES+= ${TGHDRS:C/$/.d/} +DPSRCS+= ${TGHDRS} +CLEANFILES+= ${TGHDRS} ${TGHDRS:C/$/.d/} + +.if ${MK_LLVM_BINUTILS} != "no" +LINKS+= ${BINDIR}/llvm-size ${BINDIR}/size +MLINKS+= llvm-size.1 size.1 +.endif + +.include "../llvm.prog.mk" diff --git a/usr.bin/clang/llvm-size/llvm-size.1 b/usr.bin/clang/llvm-size/llvm-size.1 new file mode 100644 index 000000000000..daeb5be3bfba --- /dev/null +++ b/usr.bin/clang/llvm-size/llvm-size.1 @@ -0,0 +1,275 @@ +.\" $FreeBSD$ +.\" Man page generated from reStructuredText. +. +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.TH "LLVM-SIZE" "1" "2021-06-07" "12" "LLVM" +.SH NAME +llvm-size \- print size information +.SH SYNOPSIS +.sp +\fBllvm\-size\fP [\fIoptions\fP] [\fIinput...\fP] +.SH DESCRIPTION +.sp +\fBllvm\-size\fP is a tool that prints size information for binary files. +It is intended to be a drop\-in replacement for GNU\(aqs \fBsize\fP\&. +.sp +The tool prints size information for each \fBinput\fP specified. If no input is +specified, the program prints size information for \fBa.out\fP\&. If "\fB\-\fP" is +specified as an input file, \fBllvm\-size\fP reads a file from the standard +input stream. If an input is an archive, size information will be displayed for +all its members. +.SH OPTIONS +.INDENT 0.0 +.TP +.B \-A +Equivalent to \fI\%\-\-format\fP with a value of \fBsysv\fP\&. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-arch=<arch> +Architecture(s) from Mach\-O universal binaries to display information for. +.UNINDENT +.INDENT 0.0 +.TP +.B \-B +Equivalent to \fI\%\-\-format\fP with a value of \fBberkeley\fP\&. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-common +Include ELF common symbol sizes in bss size for \fBberkeley\fP output format, or +as a separate section entry for \fBsysv\fP output. If not specified, these +symbols are ignored. +.UNINDENT +.INDENT 0.0 +.TP +.B \-d +Equivalent to \fI\%\-\-radix\fP with a value of \fB10\fP\&. +.UNINDENT +.INDENT 0.0 +.TP +.B \-l +Display verbose address and offset information for segments and sections in +Mach\-O files in \fBdarwin\fP format. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-format=<format> +Set the output format to the \fB<format>\fP specified. Available \fB<format>\fP +options are \fBberkeley\fP (the default), \fBsysv\fP and \fBdarwin\fP\&. +.sp +Berkeley output summarises text, data and bss sizes in each file, as shown +below for a typical pair of ELF files: +.INDENT 7.0 +.INDENT 3.5 +.sp +.nf +.ft C +$ llvm\-size \-\-format=berkeley test.o test2.o + text data bss dec hex filename + 182 16 5 203 cb test.elf + 82 8 1 91 5b test2.o +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +For Mach\-O files, the output format is slightly different: +.INDENT 7.0 +.INDENT 3.5 +.sp +.nf +.ft C +$ llvm\-size \-\-format=berkeley macho.obj macho2.obj +__TEXT __DATA __OBJC others dec hex +4 8 0 0 12 c macho.obj +16 32 0 0 48 30 macho2.obj +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Sysv output displays size and address information for most sections, with each +file being listed separately: +.INDENT 7.0 +.INDENT 3.5 +.sp +.nf +.ft C +$ llvm\-size \-\-format=sysv test.elf test2.o + test.elf : + section size addr + .eh_frame 92 2097496 + .text 90 2101248 + .data 16 2105344 + .bss 5 2105360 + .comment 209 0 + Total 412 + + test2.o : + section size addr + .text 26 0 + .data 8 0 + .bss 1 0 + .comment 106 0 + .note.GNU\-stack 0 0 + .eh_frame 56 0 + .llvm_addrsig 2 0 + Total 199 +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +\fBdarwin\fP format only affects Mach\-O input files. If an input of a different +file format is specified, \fBllvm\-size\fP falls back to \fBberkeley\fP +format. When producing \fBdarwin\fP format, the tool displays information about +segments and sections: +.INDENT 7.0 +.INDENT 3.5 +.sp +.nf +.ft C +$ llvm\-size \-\-format=darwin macho.obj macho2.obj + macho.obj: + Segment : 12 + Section (__TEXT, __text): 4 + Section (__DATA, __data): 8 + total 12 + total 12 + macho2.obj: + Segment : 48 + Section (__TEXT, __text): 16 + Section (__DATA, __data): 32 + total 48 + total 48 +.ft P +.fi +.UNINDENT +.UNINDENT +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-help, \-h +Display a summary of command line options. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-help\-list +Display an uncategorized summary of command line options. +.UNINDENT +.INDENT 0.0 +.TP +.B \-m +Equivalent to \fI\%\-\-format\fP with a value of \fBdarwin\fP\&. +.UNINDENT +.INDENT 0.0 +.TP +.B \-o +Equivalent to \fI\%\-\-radix\fP with a value of \fB8\fP\&. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-radix=<value> +Display size information in the specified radix. Permitted values are \fB8\fP, +\fB10\fP (the default) and \fB16\fP for octal, decimal and hexadecimal output +respectively. +.sp +Example: +.INDENT 7.0 +.INDENT 3.5 +.sp +.nf +.ft C +$ llvm\-size \-\-radix=8 test.o + text data bss oct hex filename + 0152 04 04 162 72 test.o + +$ llvm\-size \-\-radix=10 test.o + text data bss dec hex filename + 106 4 4 114 72 test.o + +$ llvm\-size \-\-radix=16 test.o + text data bss dec hex filename + 0x6a 0x4 0x4 114 72 test.o +.ft P +.fi +.UNINDENT +.UNINDENT +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-totals, \-t +Applies only to \fBberkeley\fP output format. Display the totals for all listed +fields, in addition to the individual file listings. +.sp +Example: +.INDENT 7.0 +.INDENT 3.5 +.sp +.nf +.ft C +$ llvm\-size \-\-totals test.elf test2.o + text data bss dec hex filename + 182 16 5 203 cb test.elf + 82 8 1 91 5b test2.o + 264 24 6 294 126 (TOTALS) +.ft P +.fi +.UNINDENT +.UNINDENT +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-version +Display the version of the \fBllvm\-size\fP executable. +.UNINDENT +.INDENT 0.0 +.TP +.B \-x +Equivalent to \fI\%\-\-radix\fP with a value of \fB16\fP\&. +.UNINDENT +.INDENT 0.0 +.TP +.B @<FILE> +Read command\-line options from response file \fB<FILE>\fP\&. +.UNINDENT +.SH EXIT STATUS +.sp +\fBllvm\-size\fP exits with a non\-zero exit code if there is an error. +Otherwise, it exits with code 0. +.SH BUGS +.sp +To report bugs, please visit <\fI\%https://bugs.llvm.org/\fP>. +.SH AUTHOR +Maintained by the LLVM Team (https://llvm.org/). +.SH COPYRIGHT +2003-2021, LLVM Project +.\" Generated by docutils manpage writer. +. diff --git a/usr.bin/clang/llvm-strings/Makefile b/usr.bin/clang/llvm-strings/Makefile new file mode 100644 index 000000000000..589c866820c4 --- /dev/null +++ b/usr.bin/clang/llvm-strings/Makefile @@ -0,0 +1,31 @@ +# $FreeBSD$ + +.include <src.opts.mk> + +PROG_CXX= llvm-strings + +SRCDIR= llvm/tools/llvm-strings +SRCS+= llvm-strings.cpp + +.include "${SRCTOP}/lib/clang/llvm.pre.mk" + +CFLAGS+= -I${.OBJDIR} + +INCFILE= Opts.inc +TDFILE= ${LLVM_BASE}/${SRCDIR}/Opts.td +GENOPT= -gen-opt-parser-defs +${INCFILE}: ${TDFILE} + ${LLVM_TBLGEN} ${GENOPT} -I ${LLVM_SRCS}/include -d ${.TARGET:C/$/.d/} \ + -o ${.TARGET} ${TDFILE} +TGHDRS+= ${INCFILE} + +DEPENDFILES+= ${TGHDRS:C/$/.d/} +DPSRCS+= ${TGHDRS} +CLEANFILES+= ${TGHDRS} ${TGHDRS:C/$/.d/} + +.if ${MK_LLVM_BINUTILS} != "no" +LINKS+= ${BINDIR}/llvm-strings ${BINDIR}/strings +MLINKS+= llvm-strings.1 strings.1 +.endif + +.include "../llvm.prog.mk" diff --git a/usr.bin/clang/llvm-strings/llvm-strings.1 b/usr.bin/clang/llvm-strings/llvm-strings.1 new file mode 100644 index 000000000000..69bf7581a249 --- /dev/null +++ b/usr.bin/clang/llvm-strings/llvm-strings.1 @@ -0,0 +1,179 @@ +.\" $FreeBSD$ +.\" Man page generated from reStructuredText. +. +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.TH "LLVM-STRINGS" "1" "2021-06-07" "12" "LLVM" +.SH NAME +llvm-strings \- print strings +.SH SYNOPSIS +.sp +\fBllvm\-strings\fP [\fIoptions\fP] [\fIinput...\fP] +.SH DESCRIPTION +.sp +\fBllvm\-strings\fP is a tool intended as a drop\-in replacement for GNU\(aqs +\fBstrings\fP, which looks for printable strings in files and writes them +to the standard output stream. A printable string is any sequence of four (by +default) or more printable ASCII characters. The end of the file, or any other +byte, terminates the current sequence. +.sp +\fBllvm\-strings\fP looks for strings in each \fBinput\fP file specified. +Unlike GNU \fBstrings\fP it looks in the entire input file, regardless of +file format, rather than restricting the search to certain sections of object +files. If "\fB\-\fP" is specified as an \fBinput\fP, or no \fBinput\fP is specified, +the program reads from the standard input stream. +.SH EXAMPLE +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +$ cat input.txt +bars +foo +wibble blob +$ llvm\-strings input.txt +bars +wibble blob +.ft P +.fi +.UNINDENT +.UNINDENT +.SH OPTIONS +.INDENT 0.0 +.TP +.B \-\-all, \-a +Silently ignored. Present for GNU \fBstrings\fP compatibility. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-bytes=<length>, \-n +Set the minimum number of printable ASCII characters required for a sequence of +bytes to be considered a string. The default value is 4. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-help, \-h +Display a summary of command line options. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-help\-list +Display an uncategorized summary of command line options. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-print\-file\-name, \-f +Display the name of the containing file before each string. +.sp +Example: +.INDENT 7.0 +.INDENT 3.5 +.sp +.nf +.ft C +$ llvm\-strings \-\-print\-file\-name test.o test.elf +test.o: _Z5hellov +test.o: some_bss +test.o: test.cpp +test.o: main +test.elf: test.cpp +test.elf: test2.cpp +test.elf: _Z5hellov +test.elf: main +test.elf: some_bss +.ft P +.fi +.UNINDENT +.UNINDENT +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-radix=<radix>, \-t +Display the offset within the file of each string, before the string and using +the specified radix. Valid \fB<radix>\fP values are \fBo\fP, \fBd\fP and \fBx\fP for +octal, decimal and hexadecimal respectively. +.sp +Example: +.INDENT 7.0 +.INDENT 3.5 +.sp +.nf +.ft C +$ llvm\-strings \-\-radix=o test.o + 1054 _Z5hellov + 1066 .rela.text + 1101 .comment + 1112 some_bss + 1123 .bss + 1130 test.cpp + 1141 main +$ llvm\-strings \-\-radix=d test.o + 556 _Z5hellov + 566 .rela.text + 577 .comment + 586 some_bss + 595 .bss + 600 test.cpp + 609 main +$ llvm\-strings \-t x test.o + 22c _Z5hellov + 236 .rela.text + 241 .comment + 24a some_bss + 253 .bss + 258 test.cpp + 261 main +.ft P +.fi +.UNINDENT +.UNINDENT +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-version +Display the version of the \fBllvm\-strings\fP executable. +.UNINDENT +.INDENT 0.0 +.TP +.B @<FILE> +Read command\-line options from response file \fB<FILE>\fP\&. +.UNINDENT +.SH EXIT STATUS +.sp +\fBllvm\-strings\fP exits with a non\-zero exit code if there is an error. +Otherwise, it exits with code 0. +.SH BUGS +.sp +To report bugs, please visit <\fI\%https://bugs.llvm.org/\fP>. +.SH AUTHOR +Maintained by the LLVM Team (https://llvm.org/). +.SH COPYRIGHT +2003-2021, LLVM Project +.\" Generated by docutils manpage writer. +. diff --git a/usr.bin/clang/llvm-symbolizer/Makefile b/usr.bin/clang/llvm-symbolizer/Makefile new file mode 100644 index 000000000000..0308b58bba55 --- /dev/null +++ b/usr.bin/clang/llvm-symbolizer/Makefile @@ -0,0 +1,37 @@ +# $FreeBSD$ + +.include <src.opts.mk> + +PROG_CXX= llvm-symbolizer +MAN= llvm-symbolizer.1 llvm-addr2line.1 + +SRCDIR= llvm/tools/llvm-symbolizer +SRCS+= llvm-symbolizer.cpp + +.include "${SRCTOP}/lib/clang/llvm.pre.mk" + +CFLAGS+= -I${.OBJDIR} + +INCFILE= Opts.inc +TDFILE= ${LLVM_BASE}/${SRCDIR}/Opts.td +GENOPT= -gen-opt-parser-defs +${INCFILE}: ${TDFILE} + ${LLVM_TBLGEN} ${GENOPT} -I ${LLVM_SRCS}/include -d ${.TARGET:C/$/.d/} \ + -o ${.TARGET} ${TDFILE} +TGHDRS+= ${INCFILE} + +DEPENDFILES+= ${TGHDRS:C/$/.d/} +DPSRCS+= ${TGHDRS} +CLEANFILES+= ${TGHDRS} ${TGHDRS:C/$/.d/} + +LIBADD+= z +LIBADD+= zstd + +LINKS+= ${BINDIR}/llvm-symbolizer ${BINDIR}/llvm-addr2line + +.if ${MK_LLVM_BINUTILS} != "no" +LINKS+= ${BINDIR}/llvm-symbolizer ${BINDIR}/addr2line +MLINKS+= llvm-addr2line.1 addr2line.1 +.endif + +.include "../llvm.prog.mk" diff --git a/usr.bin/clang/llvm-symbolizer/Makefile.depend b/usr.bin/clang/llvm-symbolizer/Makefile.depend new file mode 100644 index 000000000000..1423340957b6 --- /dev/null +++ b/usr.bin/clang/llvm-symbolizer/Makefile.depend @@ -0,0 +1,24 @@ +# $FreeBSD$ +# Autogenerated - do NOT edit! + +DIRDEPS = \ + gnu/lib/csu \ + include \ + include/xlocale \ + lib/${CSU_DIR} \ + lib/clang/libllvm \ + lib/libc \ + lib/libc++ \ + lib/libcompiler_rt \ + lib/libcxxrt \ + lib/libthr \ + lib/libz \ + lib/msun \ + lib/ncurses/ncursesw \ + + +.include <dirdeps.mk> + +.if ${DEP_RELDIR} == ${_DEP_RELDIR} +# local dependencies - needed for -jN in clean tree +.endif diff --git a/usr.bin/clang/llvm-symbolizer/llvm-addr2line.1 b/usr.bin/clang/llvm-symbolizer/llvm-addr2line.1 new file mode 100644 index 000000000000..67281fedc5a3 --- /dev/null +++ b/usr.bin/clang/llvm-symbolizer/llvm-addr2line.1 @@ -0,0 +1,73 @@ +.\" $FreeBSD$ +.\" Man page generated from reStructuredText. +. +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.TH "LLVM-ADDR2LINE" "1" "2021-06-07" "12" "LLVM" +.SH NAME +llvm-addr2line \- a drop-in replacement for addr2line +.SH SYNOPSIS +.sp +\fBllvm\-addr2line\fP [\fIoptions\fP] +.SH DESCRIPTION +.sp +\fBllvm\-addr2line\fP is an alias for the \fBllvm\-symbolizer(1)\fP +tool with different defaults. The goal is to make it a drop\-in replacement for +GNU\(aqs \fBaddr2line\fP\&. +.sp +Here are some of those differences: +.INDENT 0.0 +.IP \(bu 2 +\fBllvm\-addr2line\fP interprets all addresses as hexadecimal and ignores an +optional \fB0x\fP prefix, whereas \fBllvm\-symbolizer\fP attempts to determine +the base from the literal\(aqs prefix and defaults to decimal if there is no +prefix. +.IP \(bu 2 +\fBllvm\-addr2line\fP defaults not to print function names. Use \fI\%\-f\fP to enable +that. +.IP \(bu 2 +\fBllvm\-addr2line\fP defaults not to demangle function names. Use \fI\%\-C\fP to +switch the demangling on. +.IP \(bu 2 +\fBllvm\-addr2line\fP defaults not to print inlined frames. Use \fI\%\-i\fP to show +inlined frames for a source code location in an inlined function. +.IP \(bu 2 +\fBllvm\-addr2line\fP uses \fI\%\-\-output\-style=GNU\fP by default. +.IP \(bu 2 +\fBllvm\-addr2line\fP parses options from the environment variable +\fBLLVM_ADDR2LINE_OPTS\fP instead of from \fBLLVM_SYMBOLIZER_OPTS\fP\&. +.UNINDENT +.SH SEE ALSO +.sp +\fBllvm\-symbolizer(1)\fP +.SH AUTHOR +Maintained by the LLVM Team (https://llvm.org/). +.SH COPYRIGHT +2003-2021, LLVM Project +.\" Generated by docutils manpage writer. +. diff --git a/usr.bin/clang/llvm-symbolizer/llvm-symbolizer.1 b/usr.bin/clang/llvm-symbolizer/llvm-symbolizer.1 new file mode 100644 index 000000000000..f16b06ebbd79 --- /dev/null +++ b/usr.bin/clang/llvm-symbolizer/llvm-symbolizer.1 @@ -0,0 +1,522 @@ +.\" $FreeBSD$ +.\" Man page generated from reStructuredText. +. +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.TH "LLVM-SYMBOLIZER" "1" "2021-06-07" "12" "LLVM" +.SH NAME +llvm-symbolizer \- convert addresses into source code locations +.SH SYNOPSIS +.sp +\fBllvm\-symbolizer\fP [\fIoptions\fP] [\fIaddresses...\fP] +.SH DESCRIPTION +.sp +\fBllvm\-symbolizer\fP reads object file names and addresses from the +command\-line and prints corresponding source code locations to standard output. +.sp +If no address is specified on the command\-line, it reads the addresses from +standard input. If no object file is specified on the command\-line, but +addresses are, or if at any time an input value is not recognized, the input is +simply echoed to the output. +.sp +A positional argument or standard input value can be preceded by "DATA" or +"CODE" to indicate that the address should be symbolized as data or executable +code respectively. If neither is specified, "CODE" is assumed. DATA is +symbolized as address and symbol size rather than line number. +.sp +Object files can be specified together with the addresses either on standard +input or as positional arguments on the command\-line, following any "DATA" or +"CODE" prefix. +.sp +\fBllvm\-symbolizer\fP parses options from the environment variable +\fBLLVM_SYMBOLIZER_OPTS\fP after parsing options from the command line. +\fBLLVM_SYMBOLIZER_OPTS\fP is primarily useful for supplementing the command\-line +options when \fBllvm\-symbolizer\fP is invoked by another program or +runtime. +.SH EXAMPLES +.sp +All of the following examples use the following two source files as input. They +use a mixture of C\-style and C++\-style linkage to illustrate how these names are +printed differently (see \fI\%\-\-demangle\fP). +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +// test.h +extern "C" inline int foz() { + return 1234; +} +.ft P +.fi +.UNINDENT +.UNINDENT +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +// test.cpp +#include "test.h" +int bar=42; + +int foo() { + return bar; +} + +int baz() { + volatile int k = 42; + return foz() + k; +} + +int main() { + return foo() + baz(); +} +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +These files are built as follows: +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +$ clang \-g test.cpp \-o test.elf +$ clang \-g \-O2 test.cpp \-o inlined.elf +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Example 1 \- addresses and object on command\-line: +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +$ llvm\-symbolizer \-\-obj=test.elf 0x4004d0 0x400490 +foz +/tmp/test.h:1:0 + +baz() +/tmp/test.cpp:11:0 +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Example 2 \- addresses on standard input: +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +$ cat addr.txt +0x4004a0 +0x400490 +0x4004d0 +$ llvm\-symbolizer \-\-obj=test.elf < addr.txt +main +/tmp/test.cpp:15:0 + +baz() +/tmp/test.cpp:11:0 + +foz +/tmp/./test.h:1:0 +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Example 3 \- object specified with address: +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +$ llvm\-symbolizer "test.elf 0x400490" "inlined.elf 0x400480" +baz() +/tmp/test.cpp:11:0 + +foo() +/tmp/test.cpp:8:10 + +$ cat addr2.txt +test.elf 0x4004a0 +inlined.elf 0x400480 + +$ llvm\-symbolizer < addr2.txt +main +/tmp/test.cpp:15:0 + +foo() +/tmp/test.cpp:8:10 +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Example 4 \- CODE and DATA prefixes: +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +$ llvm\-symbolizer \-\-obj=test.elf "CODE 0x400490" "DATA 0x601028" +baz() +/tmp/test.cpp:11:0 + +bar +6295592 4 + +$ cat addr3.txt +CODE test.elf 0x4004a0 +DATA inlined.elf 0x601028 + +$ llvm\-symbolizer < addr3.txt +main +/tmp/test.cpp:15:0 + +bar +6295592 4 +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Example 5 \- path\-style options: +.sp +This example uses the same source file as above, but the source file\(aqs +full path is /tmp/foo/test.cpp and is compiled as follows. The first case +shows the default absolute path, the second \-\-basenames, and the third +shows \-\-relativenames. +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +$ pwd +/tmp +$ clang \-g foo/test.cpp \-o test.elf +$ llvm\-symbolizer \-\-obj=test.elf 0x4004a0 +main +/tmp/foo/test.cpp:15:0 +$ llvm\-symbolizer \-\-obj=test.elf 0x4004a0 \-\-basenames +main +test.cpp:15:0 +$ llvm\-symbolizer \-\-obj=test.elf 0x4004a0 \-\-relativenames +main +foo/test.cpp:15:0 +.ft P +.fi +.UNINDENT +.UNINDENT +.SH OPTIONS +.INDENT 0.0 +.TP +.B \-\-adjust\-vma <offset> +Add the specified offset to object file addresses when performing lookups. +This can be used to perform lookups as if the object were relocated by the +offset. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-basenames, \-s +Print just the file\(aqs name without any directories, instead of the +absolute path. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-demangle, \-C +Print demangled function names, if the names are mangled (e.g. the mangled +name \fI_Z3bazv\fP becomes \fIbaz()\fP, whilst the non\-mangled name \fIfoz\fP is printed +as is). Defaults to true. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-dwp <path> +Use the specified DWP file at \fB<path>\fP for any CUs that have split DWARF +debug data. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-fallback\-debug\-path <path> +When a separate file contains debug data, and is referenced by a GNU debug +link section, use the specified path as a basis for locating the debug data if +it cannot be found relative to the object. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-functions [=<none|short|linkage>], \-f +Specify the way function names are printed (omit function name, print short +function name, or print full linkage name, respectively). Defaults to +\fBlinkage\fP\&. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-help, \-h +Show help and usage for this command. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-inlining, \-\-inlines, \-i +If a source code location is in an inlined function, prints all the inlined +frames. This is the default. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-no\-inlines +Don\(aqt print inlined frames. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-no\-demangle +Don\(aqt print demangled function names. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-obj <path>, \-\-exe, \-e +Path to object file to be symbolized. If \fB\-\fP is specified, read the object +directly from the standard input stream. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-output\-style <LLVM|GNU> +Specify the preferred output style. Defaults to \fBLLVM\fP\&. When the output +style is set to \fBGNU\fP, the tool follows the style of GNU\(aqs \fBaddr2line\fP\&. +The differences from the \fBLLVM\fP style are: +.INDENT 7.0 +.IP \(bu 2 +Does not print the column of a source code location. +.IP \(bu 2 +Does not add an empty line after the report for an address. +.IP \(bu 2 +Does not replace the name of an inlined function with the name of the +topmost caller when inlined frames are not shown and \fI\%\-\-use\-symbol\-table\fP +is on. +.IP \(bu 2 +Prints an address\(aqs debug\-data discriminator when it is non\-zero. One way to +produce discriminators is to compile with clang\(aqs \-fdebug\-info\-for\-profiling. +.UNINDENT +.INDENT 7.0 +.INDENT 3.5 +.sp +.nf +.ft C +$ llvm\-symbolizer \-\-obj=inlined.elf 0x4004be 0x400486 \-p +baz() at /tmp/test.cpp:11:18 + (inlined by) main at /tmp/test.cpp:15:0 + +foo() at /tmp/test.cpp:6:3 + +$ llvm\-symbolizer \-\-output\-style=LLVM \-\-obj=inlined.elf 0x4004be 0x400486 \-p \-\-no\-inlines +main at /tmp/test.cpp:11:18 + +foo() at /tmp/test.cpp:6:3 + +$ llvm\-symbolizer \-\-output\-style=GNU \-\-obj=inlined.elf 0x4004be 0x400486 \-p \-\-no\-inlines +baz() at /tmp/test.cpp:11 +foo() at /tmp/test.cpp:6 + +$ clang \-g \-fdebug\-info\-for\-profiling test.cpp \-o profiling.elf +$ llvm\-symbolizer \-\-output\-style=GNU \-\-obj=profiling.elf 0x401167 \-p \-\-no\-inlines +main at /tmp/test.cpp:15 (discriminator 2) +.ft P +.fi +.UNINDENT +.UNINDENT +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-pretty\-print, \-p +Print human readable output. If \fI\%\-\-inlining\fP is specified, the +enclosing scope is prefixed by (inlined by). +.INDENT 7.0 +.INDENT 3.5 +.sp +.nf +.ft C +$ llvm\-symbolizer \-\-obj=inlined.elf 0x4004be \-\-inlining \-\-pretty\-print +baz() at /tmp/test.cpp:11:18 + (inlined by) main at /tmp/test.cpp:15:0 +.ft P +.fi +.UNINDENT +.UNINDENT +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-print\-address, \-\-addresses, \-a +Print address before the source code location. Defaults to false. +.INDENT 7.0 +.INDENT 3.5 +.sp +.nf +.ft C +$ llvm\-symbolizer \-\-obj=inlined.elf \-\-print\-address 0x4004be +0x4004be +baz() +/tmp/test.cpp:11:18 +main +/tmp/test.cpp:15:0 + +$ llvm\-symbolizer \-\-obj=inlined.elf 0x4004be \-\-pretty\-print \-\-print\-address +0x4004be: baz() at /tmp/test.cpp:11:18 + (inlined by) main at /tmp/test.cpp:15:0 +.ft P +.fi +.UNINDENT +.UNINDENT +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-print\-source\-context\-lines <N> +Print \fBN\fP lines of source context for each symbolized address. +.INDENT 7.0 +.INDENT 3.5 +.sp +.nf +.ft C +$ llvm\-symbolizer \-\-obj=test.elf 0x400490 \-\-print\-source\-context\-lines=2 +baz() +/tmp/test.cpp:11:0 +10 : volatile int k = 42; +11 >: return foz() + k; +12 : } +.ft P +.fi +.UNINDENT +.UNINDENT +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-relativenames +Print the file\(aqs path relative to the compilation directory, instead +of the absolute path. If the command\-line to the compiler included +the full path, this will be the same as the default. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-use\-symbol\-table +Prefer function names stored in symbol table to function names in debug info +sections. Defaults to true. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-verbose +Print verbose line and column information. +.INDENT 7.0 +.INDENT 3.5 +.sp +.nf +.ft C +$ llvm\-symbolizer \-\-obj=inlined.elf \-\-verbose 0x4004be +baz() + Filename: /tmp/test.cpp +Function start line: 9 + Line: 11 + Column: 18 +main + Filename: /tmp/test.cpp +Function start line: 14 + Line: 15 + Column: 0 +.ft P +.fi +.UNINDENT +.UNINDENT +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-version, \-v +Print version information for the tool. +.UNINDENT +.INDENT 0.0 +.TP +.B @<FILE> +Read command\-line options from response file \fI<FILE>\fP\&. +.UNINDENT +.SH WINDOWS/PDB SPECIFIC OPTIONS +.INDENT 0.0 +.TP +.B \-\-dia +Use the Windows DIA SDK for symbolization. If the DIA SDK is not found, +llvm\-symbolizer will fall back to the native implementation. +.UNINDENT +.SH MACH-O SPECIFIC OPTIONS +.INDENT 0.0 +.TP +.B \-\-default\-arch <arch> +If a binary contains object files for multiple architectures (e.g. it is a +Mach\-O universal binary), symbolize the object file for a given architecture. +You can also specify the architecture by writing \fBbinary_name:arch_name\fP in +the input (see example below). If the architecture is not specified in either +way, the address will not be symbolized. Defaults to empty string. +.INDENT 7.0 +.INDENT 3.5 +.sp +.nf +.ft C +$ cat addr.txt +/tmp/mach_universal_binary:i386 0x1f84 +/tmp/mach_universal_binary:x86_64 0x100000f24 + +$ llvm\-symbolizer < addr.txt +_main +/tmp/source_i386.cc:8 + +_main +/tmp/source_x86_64.cc:8 +.ft P +.fi +.UNINDENT +.UNINDENT +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-dsym\-hint <path/to/file.dSYM> +If the debug info for a binary isn\(aqt present in the default location, look for +the debug info at the .dSYM path provided via this option. This flag can be +used multiple times. +.UNINDENT +.SH EXIT STATUS +.sp +\fBllvm\-symbolizer\fP returns 0. Other exit codes imply an internal program +error. +.SH SEE ALSO +.sp +\fBllvm\-addr2line(1)\fP +.SH AUTHOR +Maintained by the LLVM Team (https://llvm.org/). +.SH COPYRIGHT +2003-2021, LLVM Project +.\" Generated by docutils manpage writer. +. diff --git a/usr.bin/clang/llvm-tblgen/Makefile b/usr.bin/clang/llvm-tblgen/Makefile new file mode 100644 index 000000000000..bd2859e162d6 --- /dev/null +++ b/usr.bin/clang/llvm-tblgen/Makefile @@ -0,0 +1,71 @@ +# $FreeBSD$ + +PROG_CXX= llvm-tblgen + +SRCDIR= llvm/utils/TableGen +SRCS+= AsmMatcherEmitter.cpp +SRCS+= AsmWriterEmitter.cpp +SRCS+= AsmWriterInst.cpp +SRCS+= Attributes.cpp +SRCS+= CTagsEmitter.cpp +SRCS+= CallingConvEmitter.cpp +SRCS+= CodeEmitterGen.cpp +SRCS+= CodeGenDAGPatterns.cpp +SRCS+= CodeGenHwModes.cpp +SRCS+= CodeGenInstruction.cpp +SRCS+= CodeGenMapTable.cpp +SRCS+= CodeGenRegisters.cpp +SRCS+= CodeGenSchedule.cpp +SRCS+= CodeGenTarget.cpp +SRCS+= CompressInstEmitter.cpp +SRCS+= DAGISelEmitter.cpp +SRCS+= DAGISelMatcher.cpp +SRCS+= DAGISelMatcherEmitter.cpp +SRCS+= DAGISelMatcherGen.cpp +SRCS+= DAGISelMatcherOpt.cpp +SRCS+= DFAEmitter.cpp +SRCS+= DFAPacketizerEmitter.cpp +SRCS+= DXILEmitter.cpp +SRCS+= DecoderEmitter.cpp +SRCS+= DirectiveEmitter.cpp +SRCS+= DisassemblerEmitter.cpp +SRCS+= ExegesisEmitter.cpp +SRCS+= FastISelEmitter.cpp +SRCS+= GICombinerEmitter.cpp +SRCS+= GlobalISel/CodeExpander.cpp +SRCS+= GlobalISel/GIMatchDag.cpp +SRCS+= GlobalISel/GIMatchDagEdge.cpp +SRCS+= GlobalISel/GIMatchDagInstr.cpp +SRCS+= GlobalISel/GIMatchDagOperands.cpp +SRCS+= GlobalISel/GIMatchDagPredicate.cpp +SRCS+= GlobalISel/GIMatchDagPredicateDependencyEdge.cpp +SRCS+= GlobalISel/GIMatchTree.cpp +SRCS+= GlobalISelEmitter.cpp +SRCS+= InfoByHwMode.cpp +SRCS+= InstrDocsEmitter.cpp +SRCS+= InstrInfoEmitter.cpp +SRCS+= IntrinsicEmitter.cpp +SRCS+= OptEmitter.cpp +SRCS+= OptParserEmitter.cpp +SRCS+= OptRSTEmitter.cpp +SRCS+= PredicateExpander.cpp +SRCS+= PseudoLoweringEmitter.cpp +SRCS+= RISCVTargetDefEmitter.cpp +SRCS+= RegisterBankEmitter.cpp +SRCS+= RegisterInfoEmitter.cpp +SRCS+= SDNodeProperties.cpp +SRCS+= SearchableTableEmitter.cpp +SRCS+= SubtargetEmitter.cpp +SRCS+= SubtargetFeatureInfo.cpp +SRCS+= TableGen.cpp +SRCS+= Types.cpp +SRCS+= VarLenCodeEmitterGen.cpp +SRCS+= WebAssemblyDisassemblerEmitter.cpp +SRCS+= X86DisassemblerTables.cpp +SRCS+= X86EVEX2VEXTablesEmitter.cpp +SRCS+= X86FoldTablesEmitter.cpp +SRCS+= X86MnemonicTables.cpp +SRCS+= X86ModRMFilters.cpp +SRCS+= X86RecognizableInstr.cpp + +.include "../llvm.prog.mk" diff --git a/usr.bin/clang/llvm-tblgen/Makefile.depend b/usr.bin/clang/llvm-tblgen/Makefile.depend new file mode 100644 index 000000000000..5459b436be4c --- /dev/null +++ b/usr.bin/clang/llvm-tblgen/Makefile.depend @@ -0,0 +1,23 @@ +# $FreeBSD$ +# Autogenerated - do NOT edit! + +DIRDEPS = \ + gnu/lib/csu \ + include \ + include/xlocale \ + lib/${CSU_DIR} \ + lib/clang/libllvm \ + lib/libc \ + lib/libc++ \ + lib/libcompiler_rt \ + lib/libcxxrt \ + lib/libthr \ + lib/msun \ + lib/ncurses/ncursesw \ + + +.include <dirdeps.mk> + +.if ${DEP_RELDIR} == ${_DEP_RELDIR} +# local dependencies - needed for -jN in clean tree +.endif diff --git a/usr.bin/clang/llvm-tblgen/Makefile.depend.host b/usr.bin/clang/llvm-tblgen/Makefile.depend.host new file mode 100644 index 000000000000..fc72483f0f06 --- /dev/null +++ b/usr.bin/clang/llvm-tblgen/Makefile.depend.host @@ -0,0 +1,12 @@ +# $FreeBSD$ +# Autogenerated - do NOT edit! + +DIRDEPS = \ + lib/clang/libllvmminimal \ + + +.include <dirdeps.mk> + +.if ${DEP_RELDIR} == ${_DEP_RELDIR} +# local dependencies - needed for -jN in clean tree +.endif diff --git a/usr.bin/clang/llvm-tblgen/llvm-tblgen.1 b/usr.bin/clang/llvm-tblgen/llvm-tblgen.1 new file mode 100644 index 000000000000..ee5a146b3cb4 --- /dev/null +++ b/usr.bin/clang/llvm-tblgen/llvm-tblgen.1 @@ -0,0 +1,888 @@ +.\" $FreeBSD$ +.\" Man page generated from reStructuredText. +. +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.TH "XXX-TBLGEN" "1" "2021-06-07" "12" "LLVM" +.SH NAME +xxx-tblgen \- Target Description to C++ Code +.SH SYNOPSIS +.sp +\fBxxx\-tblgen\fP [\fIoptions\fP] [\fIfilename\fP] +.SH DESCRIPTION +.sp +\fBxxx\-tblgen\fP is a family of programs that translates target +description (\fB\&.td\fP) files into C++ code and other output formats. Most +users of LLVM will not need to use this program. It is used only for +writing parts of the compiler or LLVM target backends. +.sp +The details of the input and output of \fBxxx\-tblgen\fP is beyond the +scope of this short introduction; please see the TableGen Overview for an introduction and for references to additional +TableGen documents. +.sp +The \fIfilename\fP argument specifies the name of the Target Description (\fB\&.td\fP) +file that TableGen processes. +.SH OPTIONS +.SS General Options +.INDENT 0.0 +.TP +.B \-help +Print a description of the command line options. +.UNINDENT +.INDENT 0.0 +.TP +.B \-help\-list +Print a description of the command line options in a simple list format. +.UNINDENT +.INDENT 0.0 +.TP +.B \-D=macroname +Specify the name of a macro to be defined. The name is defined, but it +has no particular value. +.UNINDENT +.INDENT 0.0 +.TP +.B \-d=filename +Specify the name of the dependency filename. +.UNINDENT +.INDENT 0.0 +.TP +.B \-debug +Enable debug output. +.UNINDENT +.INDENT 0.0 +.TP +.B \-dump\-json +Print a JSON representation of all records, suitable for further +automated processing. +.UNINDENT +.INDENT 0.0 +.TP +.B \-I directory +Specify where to find other target description files for inclusion. The +\fBdirectory\fP value should be a full or partial path to a directory that +contains target description files. +.UNINDENT +.INDENT 0.0 +.TP +.B \-null\-backend +Parse the source files and build the records, but do not run any +backend. This is useful for timing the frontend. +.UNINDENT +.INDENT 0.0 +.TP +.B \-o filename +Specify the output file name. If \fBfilename\fP is \fB\-\fP, then +\fBxxx\-tblgen\fP sends its output to standard output. +.UNINDENT +.INDENT 0.0 +.TP +.B \-print\-records +Print all classes and records to standard output (default backend option). +.UNINDENT +.INDENT 0.0 +.TP +.B \-print\-detailed\-records +Print a detailed report of all global variables, classes, and records +to standard output. +.UNINDENT +.INDENT 0.0 +.TP +.B \-stats +Print a report with any statistics collected by the backend. +.UNINDENT +.INDENT 0.0 +.TP +.B \-time\-phases +Time the parser and backend phases and print a report. +.UNINDENT +.INDENT 0.0 +.TP +.B \-version +Show the version number of the program. +.UNINDENT +.INDENT 0.0 +.TP +.B \-write\-if\-changed +Write the output file only if it is new or has changed. +.UNINDENT +.SS llvm\-tblgen Options +.INDENT 0.0 +.TP +.B \-gen\-asm\-matcher +Generate assembly instruction matcher. +.UNINDENT +.INDENT 0.0 +.TP +.B \-match\-prefix=prefix +Make \-gen\-asm\-matcher match only instructions with the given \fIprefix\fP\&. +.UNINDENT +.INDENT 0.0 +.TP +.B \-gen\-asm\-parser +Generate assembly instruction parser. +.UNINDENT +.INDENT 0.0 +.TP +.B \-asmparsernum=n +Make \-gen\-asm\-parser emit assembly parser number \fIn\fP\&. +.UNINDENT +.INDENT 0.0 +.TP +.B \-gen\-asm\-writer +Generate assembly writer. +.UNINDENT +.INDENT 0.0 +.TP +.B \-asmwriternum=n +Make \-gen\-asm\-writer emit assembly writer number \fIn\fP\&. +.UNINDENT +.INDENT 0.0 +.TP +.B \-gen\-attrs +Geneerate attributes. +.UNINDENT +.INDENT 0.0 +.TP +.B \-gen\-automata +Generate generic automata. +.UNINDENT +.INDENT 0.0 +.TP +.B \-gen\-callingconv +Generate calling convention descriptions. +.UNINDENT +.INDENT 0.0 +.TP +.B \-gen\-compress\-inst\-emitter +Generate RISCV compressed instructions. +.UNINDENT +.INDENT 0.0 +.TP +.B \-gen\-ctags +Generate ctags\-compatible index. +.UNINDENT +.INDENT 0.0 +.TP +.B \-gen\-dag\-isel +Generate a DAG (directed acyclic graph) instruction selector. +.UNINDENT +.INDENT 0.0 +.TP +.B \-instrument\-coverage +Make \-gen\-dag\-isel generate tables to help identify the patterns matched. +.UNINDENT +.INDENT 0.0 +.TP +.B \-omit\-comments +Make \-gen\-dag\-isel omit comments. The default is false. +.UNINDENT +.INDENT 0.0 +.TP +.B \-gen\-dfa\-packetizer +Generate DFA Packetizer for VLIW targets. +.UNINDENT +.INDENT 0.0 +.TP +.B \-gen\-directive\-decl +Generate directive related declaration code (header file). +.UNINDENT +.INDENT 0.0 +.TP +.B \-gen\-directive\-gen +Generate directive related implementation code part. +.UNINDENT +.INDENT 0.0 +.TP +.B \-gen\-directive\-impl +Generate directive related implementation code. +.UNINDENT +.INDENT 0.0 +.TP +.B \-gen\-disassembler +Generate disassembler. +.UNINDENT +.INDENT 0.0 +.TP +.B \-gen\-emitter +Generate machine code emitter. +.UNINDENT +.INDENT 0.0 +.TP +.B \-gen\-exegesis +Generate llvm\-exegesis tables. +.UNINDENT +.INDENT 0.0 +.TP +.B \-gen\-fast\-isel +Generate a "fast" instruction selector. +.UNINDENT +.INDENT 0.0 +.TP +.B \-gen\-global\-isel +Generate GlobalISel selector. +.UNINDENT +.INDENT 0.0 +.TP +.B \-gisel\-coverage\-file=filename +Specify the file from which to retrieve coverage information. +.UNINDENT +.INDENT 0.0 +.TP +.B \-instrument\-gisel\-coverage +Make \-gen\-global\-isel generate coverage instrumentation. +.UNINDENT +.INDENT 0.0 +.TP +.B \-optimize\-match\-table +Make \-gen\-global\-isel generate an optimized version of the match table. +.UNINDENT +.INDENT 0.0 +.TP +.B \-warn\-on\-skipped\-patterns +Make \-gen\-global\-isel explain why a pattern was skipped for inclusion. +.UNINDENT +.INDENT 0.0 +.TP +.B \-gen\-global\-isel\-combiner +Generate GlobalISel combiner. +.UNINDENT +.INDENT 0.0 +.TP +.B \-combiners=list +Make \-gen\-global\-isel\-combiner emit the specified combiners. +.UNINDENT +.INDENT 0.0 +.TP +.B \-gicombiner\-show\-expansions +Make \-gen\-global\-isel\-combiner use C++ comments to indicate occurences +of code expansion. +.UNINDENT +.INDENT 0.0 +.TP +.B \-gicombiner\-stop\-after\-build +Make \-gen\-global\-isel\-combiner stop processing after building the match tree. +.UNINDENT +.INDENT 0.0 +.TP +.B \-gicombiner\-stop\-after\-parse +Make \-gen\-global\-isel\-combiner stop processing after parsing rules +and dump state. +.UNINDENT +.INDENT 0.0 +.TP +.B \-gen\-instr\-info +Generate instruction descriptions. +.UNINDENT +.INDENT 0.0 +.TP +.B \-gen\-instr\-docs +Generate instruction documentation. +.UNINDENT +.INDENT 0.0 +.TP +.B \-gen\-intrinsic\-enums +Generate intrinsic enums. +.UNINDENT +.INDENT 0.0 +.TP +.B \-intrinsic\-prefix=prefix +Make \-gen\-intrinsic\-enums generate intrinsics with this target \fIprefix\fP\&. +.UNINDENT +.INDENT 0.0 +.TP +.B \-gen\-intrinsic\-impl +Generate intrinsic information. +.UNINDENT +.INDENT 0.0 +.TP +.B \-gen\-opt\-parser\-defs +Generate options definitions. +.UNINDENT +.INDENT 0.0 +.TP +.B \-gen\-opt\-rst +Generate option RST. +.UNINDENT +.INDENT 0.0 +.TP +.B \-gen\-pseudo\-lowering +Generate pseudo instruction lowering. +.UNINDENT +.INDENT 0.0 +.TP +.B \-gen\-register\-bank +Generate register bank descriptions. +.UNINDENT +.INDENT 0.0 +.TP +.B \-gen\-register\-info +Generate registers and register classes info. +.UNINDENT +.INDENT 0.0 +.TP +.B \-register\-info\-debug +Make \-gen\-register\-info dump register information for debugging. +.UNINDENT +.INDENT 0.0 +.TP +.B \-gen\-searchable\-tables +Generate generic searchable tables. See TableGen BackEnds +for a detailed description. +.UNINDENT +.INDENT 0.0 +.TP +.B \-gen\-subtarget +Generate subtarget enumerations. +.UNINDENT +.INDENT 0.0 +.TP +.B \-gen\-x86\-EVEX2VEX\-tables +Generate X86 EVEX to VEX compress tables. +.UNINDENT +.INDENT 0.0 +.TP +.B \-gen\-x86\-fold\-tables +Generate X86 fold tables. +.UNINDENT +.INDENT 0.0 +.TP +.B \-long\-string\-literals +When emitting large string tables, prefer string literals over +comma\-separated char literals. This can be a readability and +compile\-time performance win, but upsets some compilers. +.UNINDENT +.INDENT 0.0 +.TP +.B \-print\-enums +Print enumeration values for a class. +.UNINDENT +.INDENT 0.0 +.TP +.B \-class=classname +Make \-print\-enums print the enumeration list for the specified class. +.UNINDENT +.INDENT 0.0 +.TP +.B \-print\-sets +Print expanded sets for testing DAG exprs. +.UNINDENT +.SS clang\-tblgen Options +.INDENT 0.0 +.TP +.B \-gen\-clang\-attr\-classes +Generate Clang attribute clases. +.UNINDENT +.INDENT 0.0 +.TP +.B \-gen\-clang\-attr\-parser\-string\-switches +Generate all parser\-related attribute string switches. +.UNINDENT +.INDENT 0.0 +.TP +.B \-gen\-clang\-attr\-subject\-match\-rules\-parser\-string\-switches +Generate all parser\-related attribute subject match rule string switches. +.UNINDENT +.INDENT 0.0 +.TP +.B \-gen\-clang\-attr\-impl +Generate Clang attribute implementations. +.UNINDENT +.INDENT 0.0 +.TP +.B \-gen\-clang\-attr\-list" +Generate a Clang attribute list. +.UNINDENT +.INDENT 0.0 +.TP +.B \-gen\-clang\-attr\-subject\-match\-rule\-list +Generate a Clang attribute subject match rule list. +.UNINDENT +.INDENT 0.0 +.TP +.B \-gen\-clang\-attr\-pch\-read +Generate Clang PCH attribute reader. +.UNINDENT +.INDENT 0.0 +.TP +.B \-gen\-clang\-attr\-pch\-write +Generate Clang PCH attribute writer. +.UNINDENT +.INDENT 0.0 +.TP +.B \-gen\-clang\-attr\-has\-attribute\-impl +Generate a Clang attribute spelling list. +.UNINDENT +.INDENT 0.0 +.TP +.B \-gen\-clang\-attr\-spelling\-index +Generate a Clang attribute spelling index. +.UNINDENT +.INDENT 0.0 +.TP +.B \-gen\-clang\-attr\-ast\-visitor +Generate a recursive AST visitor for Clang attributes. +.UNINDENT +.INDENT 0.0 +.TP +.B \-gen\-clang\-attr\-template\-instantiate +Generate a Clang template instantiate code. +.UNINDENT +.INDENT 0.0 +.TP +.B \-gen\-clang\-attr\-parsed\-attr\-list +Generate a Clang parsed attribute list. +.UNINDENT +.INDENT 0.0 +.TP +.B \-gen\-clang\-attr\-parsed\-attr\-impl +Generate the Clang parsed attribute helpers. +.UNINDENT +.INDENT 0.0 +.TP +.B \-gen\-clang\-attr\-parsed\-attr\-kinds +Generate a Clang parsed attribute kinds. +.UNINDENT +.INDENT 0.0 +.TP +.B \-gen\-clang\-attr\-text\-node\-dump +Generate Clang attribute text node dumper. +.UNINDENT +.INDENT 0.0 +.TP +.B \-gen\-clang\-attr\-node\-traverse +Generate Clang attribute traverser. +.UNINDENT +.INDENT 0.0 +.TP +.B \-gen\-clang\-diags\-defs +Generate Clang diagnostics definitions. +.UNINDENT +.INDENT 0.0 +.TP +.B \-clang\-component component +Only use warnings from specified component. +.UNINDENT +.INDENT 0.0 +.TP +.B \-gen\-clang\-diag\-groups +Generate Clang diagnostic groups. +.UNINDENT +.INDENT 0.0 +.TP +.B \-gen\-clang\-diags\-index\-name +Generate Clang diagnostic name index. +.UNINDENT +.INDENT 0.0 +.TP +.B \-gen\-clang\-basic\-reader +Generate Clang BasicReader classes. +.UNINDENT +.INDENT 0.0 +.TP +.B \-gen\-clang\-basic\-writer +Generate Clang BasicWriter classes. +.UNINDENT +.INDENT 0.0 +.TP +.B \-gen\-clang\-comment\-nodes +Generate Clang AST comment nodes. +.UNINDENT +.INDENT 0.0 +.TP +.B \-gen\-clang\-decl\-nodes +Generate Clang AST declaration nodes. +.UNINDENT +.INDENT 0.0 +.TP +.B \-gen\-clang\-stmt\-nodes +Generate Clang AST statement nodes. +.UNINDENT +.INDENT 0.0 +.TP +.B \-gen\-clang\-type\-nodes +Generate Clang AST type nodes. +.UNINDENT +.INDENT 0.0 +.TP +.B \-gen\-clang\-type\-reader +Generate Clang AbstractTypeReader class. +.UNINDENT +.INDENT 0.0 +.TP +.B \-gen\-clang\-type\-writer +Generate Clang AbstractTypeWriter class. +.UNINDENT +.INDENT 0.0 +.TP +.B \-gen\-clang\-opcodes +Generate Clang constexpr interpreter opcodes. +.UNINDENT +.INDENT 0.0 +.TP +.B \-gen\-clang\-sa\-checkers +Generate Clang static analyzer checkers. +.UNINDENT +.INDENT 0.0 +.TP +.B \-gen\-clang\-comment\-html\-tags +Generate efficient matchers for HTML tag names that are used in +documentation comments. +.UNINDENT +.INDENT 0.0 +.TP +.B \-gen\-clang\-comment\-html\-tags\-properties +Generate efficient matchers for HTML tag properties. +.UNINDENT +.INDENT 0.0 +.TP +.B \-gen\-clang\-comment\-html\-named\-character\-references +Generate function to translate named character references to UTF\-8 sequences. +.UNINDENT +.INDENT 0.0 +.TP +.B \-gen\-clang\-comment\-command\-info +Generate command properties for commands that are used in documentation comments. +.UNINDENT +.INDENT 0.0 +.TP +.B \-gen\-clang\-comment\-command\-list +Generate list of commands that are used in documentation comments. +.UNINDENT +.INDENT 0.0 +.TP +.B \-gen\-clang\-opencl\-builtins +Generate OpenCL builtin declaration handlers. +.UNINDENT +.INDENT 0.0 +.TP +.B \-gen\-arm\-neon +Generate \fBarm_neon.h\fP for Clang. +.UNINDENT +.INDENT 0.0 +.TP +.B \-gen\-arm\-fp16 +Generate \fBarm_fp16.h\fP for Clang. +.UNINDENT +.INDENT 0.0 +.TP +.B \-gen\-arm\-bf16 +Generate \fBarm_bf16.h\fP for Clang. +.UNINDENT +.INDENT 0.0 +.TP +.B \-gen\-arm\-neon\-sema +Generate ARM NEON sema support for Clang. +.UNINDENT +.INDENT 0.0 +.TP +.B \-gen\-arm\-neon\-test +Generate ARM NEON tests for Clang. +.UNINDENT +.INDENT 0.0 +.TP +.B \-gen\-arm\-sve\-header +Generate \fBarm_sve.h\fP for Clang. +.UNINDENT +.INDENT 0.0 +.TP +.B \-gen\-arm\-sve\-builtins +Generate \fBarm_sve_builtins.inc\fP for Clang. +.UNINDENT +.INDENT 0.0 +.TP +.B \-gen\-arm\-sve\-builtin\-codegen +Generate \fBarm_sve_builtin_cg_map.inc\fP for Clang. +.UNINDENT +.INDENT 0.0 +.TP +.B \-gen\-arm\-sve\-typeflags +Generate \fBarm_sve_typeflags.inc\fP for Clang. +.UNINDENT +.INDENT 0.0 +.TP +.B \-gen\-arm\-sve\-sema\-rangechecks +Generate \fBarm_sve_sema_rangechecks.inc\fP for Clang. +.UNINDENT +.INDENT 0.0 +.TP +.B \-gen\-arm\-mve\-header +Generate \fBarm_mve.h\fP for Clang. +.UNINDENT +.INDENT 0.0 +.TP +.B \-gen\-arm\-mve\-builtin\-def +Generate ARM MVE builtin definitions for Clang. +.UNINDENT +.INDENT 0.0 +.TP +.B \-gen\-arm\-mve\-builtin\-sema +Generate ARM MVE builtin sema checks for Clang. +.UNINDENT +.INDENT 0.0 +.TP +.B \-gen\-arm\-mve\-builtin\-codegen +Generate ARM MVE builtin code\-generator for Clang. +.UNINDENT +.INDENT 0.0 +.TP +.B \-gen\-arm\-mve\-builtin\-aliases +Generate list of valid ARM MVE builtin aliases for Clang. +.UNINDENT +.INDENT 0.0 +.TP +.B \-gen\-arm\-cde\-header +Generate \fBarm_cde.h\fP for Clang. +.UNINDENT +.INDENT 0.0 +.TP +.B \-gen\-arm\-cde\-builtin\-def +Generate ARM CDE builtin definitions for Clang. +.UNINDENT +.INDENT 0.0 +.TP +.B \-gen\-arm\-cde\-builtin\-sema +Generate ARM CDE builtin sema checks for Clang. +.UNINDENT +.INDENT 0.0 +.TP +.B \-gen\-arm\-cde\-builtin\-codegen +Generate ARM CDE builtin code\-generator for Clang. +.UNINDENT +.INDENT 0.0 +.TP +.B \-gen\-arm\-cde\-builtin\-aliases +Generate list of valid ARM CDE builtin aliases for Clang. +.UNINDENT +.INDENT 0.0 +.TP +.B \-gen\-attr\-docs +Generate attribute documentation. +.UNINDENT +.INDENT 0.0 +.TP +.B \-gen\-diag\-docs +Generate diagnostic documentation. +.UNINDENT +.INDENT 0.0 +.TP +.B \-gen\-opt\-docs +Generate option documentation. +.UNINDENT +.INDENT 0.0 +.TP +.B \-gen\-clang\-data\-collectors +Generate data collectors for AST nodes. +.UNINDENT +.INDENT 0.0 +.TP +.B \-gen\-clang\-test\-pragma\-attribute\-supported\-attributes +Generate a list of attributes supported by \fB#pragma\fP Clang attribute for +testing purposes. +.UNINDENT +.SS mlir\-tblgen Options +.INDENT 0.0 +.TP +.B \-gen\-avail\-interface\-decls +Generate availability interface declarations. +.UNINDENT +.INDENT 0.0 +.TP +.B \-gen\-avail\-interface\-defs +Generate op interface definitions. +.UNINDENT +.INDENT 0.0 +.TP +.B \-gen\-dialect\-doc +Generate dialect documentation. +.UNINDENT +.INDENT 0.0 +.TP +.B \-dialect +The dialect to generate. +.UNINDENT +.INDENT 0.0 +.TP +.B \-gen\-directive\-decl +Generate declarations for directives (OpenMP, etc.). +.UNINDENT +.INDENT 0.0 +.TP +.B \-gen\-enum\-decls +Generate enum utility declarations. +.UNINDENT +.INDENT 0.0 +.TP +.B \-gen\-enum\-defs +Generate enum utility definitions. +.UNINDENT +.INDENT 0.0 +.TP +.B \-gen\-enum\-from\-llvmir\-conversions +Generate conversions of EnumAttrs from LLVM IR. +.UNINDENT +.INDENT 0.0 +.TP +.B \-gen\-enum\-to\-llvmir\-conversions +Generate conversions of EnumAttrs to LLVM IR. +.UNINDENT +.INDENT 0.0 +.TP +.B \-gen\-llvmir\-conversions +Generate LLVM IR conversions. +.UNINDENT +.INDENT 0.0 +.TP +.B \-gen\-llvmir\-intrinsics +Generate LLVM IR intrinsics. +.UNINDENT +.INDENT 0.0 +.TP +.B \-llvmir\-intrinsics\-filter +Only keep the intrinsics with the specified substring in their record name. +.UNINDENT +.INDENT 0.0 +.TP +.B \-dialect\-opclass\-base +The base class for the ops in the dialect we are to emit. +.UNINDENT +.INDENT 0.0 +.TP +.B \-gen\-op\-decls +Generate operation declarations. +.UNINDENT +.INDENT 0.0 +.TP +.B \-gen\-op\-defs +Generate operation definitions. +.UNINDENT +.INDENT 0.0 +.TP +.B \-asmformat\-error\-is\-fatal +Emit a fatal error if format parsing fails. +.UNINDENT +.INDENT 0.0 +.TP +.B \-op\-exclude\-regex +Regular expression of name of ops to exclude (no filter if empty). +.UNINDENT +.INDENT 0.0 +.TP +.B \-op\-include\-regex +Regular expression of name of ops to include (no filter if empty). +.UNINDENT +.INDENT 0.0 +.TP +.B \-gen\-op\-doc +Generate operation documentation. +.UNINDENT +.INDENT 0.0 +.TP +.B \-gen\-pass\-decls +Generate operation documentation. +.UNINDENT +.INDENT 0.0 +.TP +.B \-name namestring +The name of this group of passes. +.UNINDENT +.INDENT 0.0 +.TP +.B \-gen\-pass\-doc +Generate pass documentation. +.UNINDENT +.INDENT 0.0 +.TP +.B \-gen\-rewriters +Generate pattern rewriters. +.UNINDENT +.INDENT 0.0 +.TP +.B \-gen\-spirv\-avail\-impls +Generate SPIR\-V operation utility definitions. +.UNINDENT +.INDENT 0.0 +.TP +.B \-gen\-spirv\-capability\-implication +Generate utility function to return implied capabilities for a given capability. +.UNINDENT +.INDENT 0.0 +.TP +.B \-gen\-spirv\-enum\-avail\-decls +Generate SPIR\-V enum availability declarations. +.UNINDENT +.INDENT 0.0 +.TP +.B \-gen\-spirv\-enum\-avail\-defs +Generate SPIR\-V enum availability definitions. +.UNINDENT +.INDENT 0.0 +.TP +.B \-gen\-spirv\-op\-utils +Generate SPIR\-V operation utility definitions. +.UNINDENT +.INDENT 0.0 +.TP +.B \-gen\-spirv\-serialization +Generate SPIR\-V (de)serialization utilities and functions. +.UNINDENT +.INDENT 0.0 +.TP +.B \-gen\-struct\-attr\-decls +Generate struct utility declarations. +.UNINDENT +.INDENT 0.0 +.TP +.B \-gen\-struct\-attr\-defs +Generate struct utility definitions. +.UNINDENT +.INDENT 0.0 +.TP +.B \-gen\-typedef\-decls +Generate TypeDef declarations. +.UNINDENT +.INDENT 0.0 +.TP +.B \-gen\-typedef\-defs +Generate TypeDef definitions. +.UNINDENT +.INDENT 0.0 +.TP +.B \-typedefs\-dialect name +Generate types for this dialect. +.UNINDENT +.SH EXIT STATUS +.sp +If \fBxxx\-tblgen\fP succeeds, it will exit with 0. Otherwise, if an error +occurs, it will exit with a non\-zero value. +.SH AUTHOR +Maintained by the LLVM Team (https://llvm.org/). +.SH COPYRIGHT +2003-2021, LLVM Project +.\" Generated by docutils manpage writer. +. diff --git a/usr.bin/clang/llvm-xray/Makefile b/usr.bin/clang/llvm-xray/Makefile new file mode 100644 index 000000000000..1be3eb059e81 --- /dev/null +++ b/usr.bin/clang/llvm-xray/Makefile @@ -0,0 +1,21 @@ +# $FreeBSD$ + +PROG_CXX= llvm-xray +MAN= + +SRCDIR= llvm/tools/llvm-xray +SRCS+= func-id-helper.cpp +SRCS+= llvm-xray.cpp +SRCS+= xray-account.cpp +SRCS+= xray-color-helper.cpp +SRCS+= xray-converter.cpp +SRCS+= xray-extract.cpp +SRCS+= xray-graph-diff.cpp +SRCS+= xray-graph.cpp +SRCS+= xray-registry.cpp +SRCS+= xray-stacks.cpp + +LIBADD+= z +LIBADD+= zstd + +.include "../llvm.prog.mk" diff --git a/usr.bin/clang/llvm-xray/Makefile.depend b/usr.bin/clang/llvm-xray/Makefile.depend new file mode 100644 index 000000000000..1423340957b6 --- /dev/null +++ b/usr.bin/clang/llvm-xray/Makefile.depend @@ -0,0 +1,24 @@ +# $FreeBSD$ +# Autogenerated - do NOT edit! + +DIRDEPS = \ + gnu/lib/csu \ + include \ + include/xlocale \ + lib/${CSU_DIR} \ + lib/clang/libllvm \ + lib/libc \ + lib/libc++ \ + lib/libcompiler_rt \ + lib/libcxxrt \ + lib/libthr \ + lib/libz \ + lib/msun \ + lib/ncurses/ncursesw \ + + +.include <dirdeps.mk> + +.if ${DEP_RELDIR} == ${_DEP_RELDIR} +# local dependencies - needed for -jN in clean tree +.endif diff --git a/usr.bin/clang/llvm.prog.mk b/usr.bin/clang/llvm.prog.mk new file mode 100644 index 000000000000..3a708805d3ea --- /dev/null +++ b/usr.bin/clang/llvm.prog.mk @@ -0,0 +1,31 @@ +# $FreeBSD$ + +.include "${SRCTOP}/lib/clang/llvm.pre.mk" + +CFLAGS+= -I${OBJTOP}/lib/clang/libllvm + +.include "${SRCTOP}/lib/clang/llvm.build.mk" + +# Special case for the bootstrap-tools phase. +.if (defined(TOOLS_PREFIX) || ${MACHINE} == "host") && \ + (${PROG_CXX} == "clang-tblgen" || ${PROG_CXX} == "lldb-tblgen" || \ + ${PROG_CXX} == "llvm-tblgen") +LIBDEPS+= llvmminimal +.else +LIBDEPS+= llvm +.endif + +.for lib in ${LIBDEPS} +DPADD+= ${OBJTOP}/lib/clang/lib${lib}/lib${lib}.a +LDADD+= ${OBJTOP}/lib/clang/lib${lib}/lib${lib}.a +.endfor + +PACKAGE= clang + +.if ${.MAKE.OS} == "FreeBSD" || !defined(BOOTSTRAPPING) +LIBADD+= execinfo +LIBADD+= tinfow +.endif +LIBADD+= pthread + +.include <bsd.prog.mk> diff --git a/usr.bin/clang/opt/Makefile b/usr.bin/clang/opt/Makefile new file mode 100644 index 000000000000..27e0395942f6 --- /dev/null +++ b/usr.bin/clang/opt/Makefile @@ -0,0 +1,14 @@ +# $FreeBSD$ + +PROG_CXX= opt + +SRCDIR= llvm/tools/opt +SRCS+= AnalysisWrappers.cpp +SRCS+= BreakpointPrinter.cpp +SRCS+= NewPMDriver.cpp +SRCS+= opt.cpp + +LIBADD+= z +LIBADD+= zstd + +.include "../llvm.prog.mk" diff --git a/usr.bin/clang/opt/Makefile.depend b/usr.bin/clang/opt/Makefile.depend new file mode 100644 index 000000000000..1423340957b6 --- /dev/null +++ b/usr.bin/clang/opt/Makefile.depend @@ -0,0 +1,24 @@ +# $FreeBSD$ +# Autogenerated - do NOT edit! + +DIRDEPS = \ + gnu/lib/csu \ + include \ + include/xlocale \ + lib/${CSU_DIR} \ + lib/clang/libllvm \ + lib/libc \ + lib/libc++ \ + lib/libcompiler_rt \ + lib/libcxxrt \ + lib/libthr \ + lib/libz \ + lib/msun \ + lib/ncurses/ncursesw \ + + +.include <dirdeps.mk> + +.if ${DEP_RELDIR} == ${_DEP_RELDIR} +# local dependencies - needed for -jN in clean tree +.endif diff --git a/usr.bin/clang/opt/opt.1 b/usr.bin/clang/opt/opt.1 new file mode 100644 index 000000000000..30c106814f03 --- /dev/null +++ b/usr.bin/clang/opt/opt.1 @@ -0,0 +1,170 @@ +.\" $FreeBSD$ +.\" Man page generated from reStructuredText. +. +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.TH "OPT" "1" "2021-06-07" "12" "LLVM" +.SH NAME +opt \- LLVM optimizer +.SH SYNOPSIS +.sp +\fBopt\fP [\fIoptions\fP] [\fIfilename\fP] +.SH DESCRIPTION +.sp +The \fBopt\fP command is the modular LLVM optimizer and analyzer. It +takes LLVM source files as input, runs the specified optimizations or analyses +on it, and then outputs the optimized file or the analysis results. The +function of \fBopt\fP depends on whether the \fI\-analyze\fP option is +given. +.sp +When \fI\-analyze\fP is specified, \fBopt\fP performs various analyses +of the input source. It will usually print the results on standard output, but +in a few cases, it will print output to standard error or generate a file with +the analysis output, which is usually done when the output is meant for another +program. +.sp +While \fI\-analyze\fP is \fInot\fP given, \fBopt\fP attempts to produce an +optimized output file. The optimizations available via \fBopt\fP depend +upon what libraries were linked into it as well as any additional libraries +that have been loaded with the \fI\%\-load\fP option. Use the \fI\%\-help\fP +option to determine what optimizations you can use. +.sp +If \fBfilename\fP is omitted from the command line or is "\fB\-\fP", \fBopt\fP +reads its input from standard input. Inputs can be in either the LLVM assembly +language format (\fB\&.ll\fP) or the LLVM bitcode format (\fB\&.bc\fP). +.sp +If an output filename is not specified with the \fI\%\-o\fP option, +\fBopt\fP writes its output to the standard output. +.SH OPTIONS +.INDENT 0.0 +.TP +.B \-f +Enable binary output on terminals. Normally, \fBopt\fP will refuse to +write raw bitcode output if the output stream is a terminal. With this option, +\fBopt\fP will write raw bitcode regardless of the output device. +.UNINDENT +.INDENT 0.0 +.TP +.B \-help +Print a summary of command line options. +.UNINDENT +.INDENT 0.0 +.TP +.B \-o <filename> +Specify the output filename. +.UNINDENT +.INDENT 0.0 +.TP +.B \-S +Write output in LLVM intermediate language (instead of bitcode). +.UNINDENT +.INDENT 0.0 +.TP +.B \-{passname} +\fBopt\fP provides the ability to run any of LLVM\(aqs optimization or +analysis passes in any order. The \fI\%\-help\fP option lists all the passes +available. The order in which the options occur on the command line are the +order in which they are executed (within pass constraints). +.UNINDENT +.INDENT 0.0 +.TP +.B \-disable\-inlining +This option simply removes the inlining pass from the standard list. +.UNINDENT +.INDENT 0.0 +.TP +.B \-disable\-opt +This option is only meaningful when \fI\-std\-link\-opts\fP is given. It +disables most passes. +.UNINDENT +.INDENT 0.0 +.TP +.B \-strip\-debug +This option causes opt to strip debug information from the module before +applying other optimizations. It is essentially the same as \fI\-strip\fP +but it ensures that stripping of debug information is done first. +.UNINDENT +.INDENT 0.0 +.TP +.B \-verify\-each +This option causes opt to add a verify pass after every pass otherwise +specified on the command line (including \fI\-verify\fP). This is useful +for cases where it is suspected that a pass is creating an invalid module but +it is not clear which pass is doing it. +.UNINDENT +.INDENT 0.0 +.TP +.B \-stats +Print statistics. +.UNINDENT +.INDENT 0.0 +.TP +.B \-time\-passes +Record the amount of time needed for each pass and print it to standard +error. +.UNINDENT +.INDENT 0.0 +.TP +.B \-debug +If this is a debug build, this option will enable debug printouts from passes +which use the \fBLLVM_DEBUG()\fP macro. See the \fI\%LLVM Programmer\(aqs Manual\fP, section \fB#DEBUG\fP for more information. +.UNINDENT +.INDENT 0.0 +.TP +.B \-load=<plugin> +Load the dynamic object \fBplugin\fP\&. This object should register new +optimization or analysis passes. Once loaded, the object will add new command +line options to enable various optimizations or analyses. To see the new +complete list of optimizations, use the \fI\%\-help\fP and \fI\%\-load\fP +options together. For example: +.INDENT 7.0 +.INDENT 3.5 +.sp +.nf +.ft C +opt \-load=plugin.so \-help +.ft P +.fi +.UNINDENT +.UNINDENT +.UNINDENT +.INDENT 0.0 +.TP +.B \-p +Print module after each transformation. +.UNINDENT +.SH EXIT STATUS +.sp +If \fBopt\fP succeeds, it will exit with 0. Otherwise, if an error +occurs, it will exit with a non\-zero value. +.SH AUTHOR +Maintained by the LLVM Team (https://llvm.org/). +.SH COPYRIGHT +2003-2021, LLVM Project +.\" Generated by docutils manpage writer. +. |