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