75 lines · plain
1====================2Clang nvlink Wrapper3====================4 5.. contents::6 :local:7 8.. _clang-nvlink-wrapper:9 10Introduction11============12 13This tool works as a wrapper around the NVIDIA ``nvlink`` linker. The purpose14of this wrapper is to provide an interface similar to the ``ld.lld`` linker15while still relying on NVIDIA's proprietary linker to produce the final output.16 17``nvlink`` has a number of known quirks that make it difficult to use in a18unified offloading setting. For example, it does not accept ``.o`` files as they19must be named ``.cubin``. Static archives do not work, so passing a ``.a`` will20provide a linker error. ``nvlink`` also does not support link time optimization21and ignores many standard linker arguments. This tool works around these issues.22 23Usage24=====25 26This tool can be used with the following options. Any arguments not intended27only for the linker wrapper will be forwarded to ``nvlink``.28 29.. code-block:: console30 31 OVERVIEW: A utility that wraps around the NVIDIA 'nvlink' linker.32 This enables static linking and LTO handling for NVPTX targets.33 34 USAGE: clang-nvlink-wrapper [options] <options to passed to nvlink>35 36 OPTIONS:37 --arch <value> Specify the 'sm_' name of the target architecture.38 --cuda-path=<dir> Set the system CUDA path39 --dry-run Print generated commands without running.40 --feature <value> Specify the '+ptx' feature to use for LTO.41 -g Specify that this was a debug compile.42 -help-hidden Display all available options43 -help Display available options (--help-hidden for more)44 -L <dir> Add <dir> to the library search path45 -l <libname> Search for library <libname>46 -mllvm <arg> Arguments passed to LLVM, including Clang invocations,47 for which the '-mllvm' prefix is preserved. Use '-mllvm48 --help' for a list of options.49 -o <path> Path to file to write output50 --plugin-opt=jobs=<value>51 Number of LTO codegen partitions52 --plugin-opt=lto-partitions=<value>53 Number of LTO codegen partitions54 --plugin-opt=O<O0, O1, O2, or O3>55 Optimization level for LTO56 --plugin-opt=thinlto<value>57 Enable the thin-lto backend58 --plugin-opt=<value> Arguments passed to LLVM, including Clang invocations,59 for which the '-mllvm' prefix is preserved. Use '-mllvm60 --help' for a list of options.61 --save-temps Save intermediate results62 --version Display the version number and exit63 -v Print verbose information64 65Example66=======67 68This tool is intended to be invoked when targeting the NVPTX toolchain directly69as a cross-compiling target. This can be used to create standalone GPU70executables with normal linking semantics similar to standard compilation.71 72.. code-block:: console73 74 clang --target=nvptx64-nvidia-cuda -march=native -flto=full input.c75