LLVM-LD(1)

NAME
llvm-ld - LLVM linker

SYNOPSIS
llvm-ld <options> <files>

DESCRIPTION
The llvm-ld command is similar to the common Unix utility, "ld". It links together bytecode modules to produce an executable program.

OPTIONS

  Input/Output Options

-o filename
    This overrides the default output file and specifies the name of the file that should be generated by the linker. By default, llvm-ld generates a file named a.out for compatibility with ld. The output will be written to filename.

-lname
    This option specifies the name of a library to search when resolving symbols for the program. Only the base name should be specified as name, without a lib prefix or any suffix.

-LPath
    This option tells llvm-ld to look in Path to find any library subsequently specified with the -l option. The paths will be searched in the order in which they are specified on the command line. If the library is still not found, a small set of system specific directories will also be searched. Note that libraries specified with the -l option that occur before any -L options will not search the paths given by the -L options following it.

-link-as-library
    Link the bytecode files together as a library, not an executable. In this mode, undefined symbols will be permitted.

-r  An alias for -link-as-library.

-march="target"
    Specifies the kind of machine for which code or assembly should be generated.

-native
    Generate a native binary instead of a shell script that runs the JIT from bytecode.

-native-cbe
    Generate a native binary with the C back end and compilation with GCC.

-disable-compression
    Do not compress bytecode files.

  Optimization Options

-O0 An alias for the -O1 option.

-O1 Optimize for linking speed, not execution speed. The optimizer will attempt to reduce the size of the linked program to reduce I/O but will not otherwise perform any link-time optimizations.

-O2 Perform only the minimal or required set of scalar optimizations.

-03 An alias for the -O2 option.

-04 Perform the standard link time inter-procedural optimizations. This will attempt to optimize the program taking the entire program into consideration.

-O5 Perform aggressive link time optimizations. This is the same as -O4 but works more aggressively to optimize the program.

-disable-inlining
    Do not run the inlining pass. Functions will not be inlined into other functions.

-disable-opt
    Completely disable optimization. The various -On options will be ignored and no link time optimization passes will be run.

-disable-internalize
    Do not mark all symbols as internal.

-verify
    Run the verification pass after each of the passes to verify intermediate results.

-s  Strip symbol info from the executable to make it smaller.

-export-dynamic
    An alias for -disable-internalize

-load module
    Load an optimization module, module, which is expected to be a dynamic library that provides the function name "RunOptimizations". This function will be passed the PassManager, and the optimization level (values 0-5 based on the -On option). This function may add passes to the PassManager that should be run. This feature allows the optimization passes of llvm-ld to be extended.

-post-link-optPath
    Run post-link optimization program. After linking is completed a bytecode file will be generated. It will be passed to the program specified by Path as the first argument. The second argument to the program will be the name of a temporary file into which the program should place its optimized output. For example, the "no-op optimization" would be a simple shell script:

        #!/bin/bash cp $1 $2

  Miscellaneous Options

-v  Specifies verbose mode. In this mode the linker will print additional information about the actions it takes, programs it executes, etc.

EXIT STATUS
If llvm-ld succeeds, it will exit with 0 return code. If an error occurs, it will exit with a non-zero return code.

ENVIRONMENT
The "LLVM_LIB_SEARCH_PATH" environment variable is used to find bytecode libraries. Any paths specified in this variable will be searched after the "-L" options.

SEE ALSO
llvm-ar

AUTHORS
Maintained by the LLVM Team (<http://llvm.org>).