xref: /freebsd/contrib/llvm-project/lld/docs/error_handling_script.rst (revision e6bfd18d21b225af6a0ed67ceeaf1293b7b9eba5)
1=====================
2Error Handling Script
3=====================
4
5LLD provides the ability to hook into some error handling routines through a
6user-provided script specified with ``--error-handling-script=<path to the script>``
7when certain errors are encountered. This document specifies the requirements of
8such a script.
9
10Generic Requirements
11====================
12
13The script is expected to be available in the ``PATH`` or to be provided using a
14full path. It must be executable. It is executed in the same environment as the
15parent process.
16
17Arguments
18=========
19
20LLD calls the error handling script using the following arguments::
21
22    error-handling-script <tag> <tag-specific-arguments...>
23
24The following tags are supported:
25
26- ``missing-lib``: indicates that LLD failed to find a library. The library name
27  is specified as the second argument, e.g. ``error-handling-script missing-lib
28  mylib``
29
30- ``undefined-symbol``: indicates that given symbol is marked as undefined. The
31  unmangled symbol name is specified as the second argument, e.g.
32  ``error-handling-script undefined-symbol mysymbol``
33
34Return Value
35============
36
37Upon success, the script is expected to return 0. A non-zero value is
38interpreted as an error and reported to the user. In both cases, LLD still
39reports the original error.
40