summaryrefslogtreecommitdiffstats
path: root/lld/docs/Driver.rst
diff options
context:
space:
mode:
authorNick Kledzik <kledzik@apple.com>2013-04-04 18:59:24 +0000
committerNick Kledzik <kledzik@apple.com>2013-04-04 18:59:24 +0000
commitc314b46e718bb5f23ca257af2331c120891361b2 (patch)
treeb0c6c6a9688cadb233589dc5e317df5d05d89cba /lld/docs/Driver.rst
parent83f1be1bfc3112d0edba33ed6d8e1a751844b06f (diff)
downloadbcm5719-llvm-c314b46e718bb5f23ca257af2331c120891361b2.tar.gz
bcm5719-llvm-c314b46e718bb5f23ca257af2331c120891361b2.zip
This is my Driver refactoring patch.
The major changes are: 1) LinkerOptions has been merged into TargetInfo 2) LinkerInvocation has been merged into Driver 3) Drivers no longer convert arguments into an intermediate (core) argument list, but instead create a TargetInfo object and call setter methods on it. This is only how in-process linking would work. That is, you can programmatically set up a TargetInfo object which controls the linking. 4) Lots of tweaks to test suite to work with driver changes 5) Add the DarwinDriver 6) I heavily doxygen commented TargetInfo.h Things to do after this patch is committed: a) Consider renaming TargetInfo, given its new roll. b) Consider pulling the list of input files out of TargetInfo. This will enable in-process clients to create one TargetInfo the re-use it with different input file lists. c) Work out a way for Drivers to format the warnings and error done in core linking. llvm-svn: 178776
Diffstat (limited to 'lld/docs/Driver.rst')
-rw-r--r--lld/docs/Driver.rst73
1 files changed, 22 insertions, 51 deletions
diff --git a/lld/docs/Driver.rst b/lld/docs/Driver.rst
index b65ff94f771..c96cd952a92 100644
--- a/lld/docs/Driver.rst
+++ b/lld/docs/Driver.rst
@@ -16,18 +16,18 @@ Overview
========
The lld driver is designed to support a number of different command line
-interfaces. The main interfaces we plan to support are binutils ld, Apple's
-ld64, and Microsoft's link.exe.
+interfaces. The main interfaces we plan to support are binutils' ld, Apple's
+ld, and Microsoft's link.exe.
Flavors
-------
Each of these different interfaces is referred to as a flavor. There is also an
-extra flavor for ``lld -core``. This is equivalent to ``-cc1`` in clang.
-The current flavors are.
+extra flavor "core" which is used to exercise the core functionality of the
+linker it the test suite.
-* ld
-* ld64
+* gnu
+* darwin
* link
* core
@@ -39,70 +39,41 @@ order, so the second overrides the first. The first is to symlink :program:`lld`
as :program:`lld-{flavor}` or just :program:`{flavor}`. You can also specify
it as the first command line argument using ``-flavor``::
- $ lld -flavor ld
+ $ lld -flavor gnu
There is a shortcut for ``-flavor core`` as ``-core``.
-Argument translation and lld -core
-----------------------------------
-Due to the different driver flavors and the need to write portable tests, there
-is ``lld -core``. Driver flavors translate options into ``lld -core`` options.
-These options are then forwarded to ``lld -core`` to run the actual link. The
-options passed to ``lld -core`` can be seen by passing ``-###`` to any driver
-flavor.
-
-Targets
--------
-
-The ``-target <llvm-triple>`` option can be passed to any driver flavor to
-link for a specific target. You can also prefix the :program:`lld` symlink with
-a target triple to default to that target. If neither of these is set, the
-default target is the target LLVM was configured for.
-
-Adding an Option
-================
+Adding an Option to an existing Flavor
+======================================
#. Add the option to the desired :file:`lib/Driver/{flavor}Options.td`.
-#. If there is no ``lld -core`` option, add the option to
- :file:`lib/Driver/CoreOptions.td`. All ``lld -core`` start with a single -
- and if they have a value, it is joined with a =. ``lld -core`` options should
- have sensible, non-abbreviated names and should be shared between flavors
- where possible.
+#. Add to :cpp:class:`lld::FlavorTargetInfo` a getter and setter method
+ for the option.
+
+#. Modify :cpp:func:`lld::FlavorDriver::parse` in :file:
+ `lib/Driver/{Flavor}Driver.cpp` to call the targetInfo setter
+ for corresponding to the option.
-#. Modify the ``{flavor}Driver::transform`` function to transform the added
- option into one or more core options.
+#. Modify {Flavor}Reader and {Flavor}Writer to use the new targtInfo option.
-#. Add the option to :cpp:class:`lld::LinkerOptions` in
- :file:`include/lld/Driver/LinkerOptions.h` and modify the move constructor to
- move the option value.
-
-#. Modify :cpp:func:`lld::parseCoreArgs` in :file:`lib/Driver/Drivers.cpp` to
- fill the :cpp:class:`lld::LinkerOptions` with the new option.
-
-#. Modify lld to use the new option.
Adding a Flavor
===============
#. Add an entry for the flavor in :file:`include/lld/Driver/Driver.h` to
- :cpp:class:`lld::Driver::Flavor`.
+ :cpp:class:`lld::UniversalDriver::Flavor`.
-#. Add an entry in :file:`tools/lld/lld.cpp` to
- :cpp:func:`lld::Driver::strToFlavor`. This allows the
- flavor to be selected via symlink and :option:`-flavor`.
+#. Add an entry in :file:`lib/Driver/UniversalDriver.cpp` to
+ :cpp:func:`lld::Driver::strToFlavor` and
+ :cpp:func:`lld::UniversalDriver::link`.
+ This allows the flavor to be selected via symlink and :option:`-flavor`.
#. Add a tablegen file called :file:`lib/Driver/{flavor}Options.td` that
describes the options. If the options are a superset of another driver, that
driver's td file can simply be included. The :file:`{flavor}Options.td` file
must also be added to :file:`lib/Driver/CMakeLists.txt`.
-#. Add a ``{flavor}::{flavor}OptTable`` as a subclass of
- :cpp:class:`llvm::opt::OptTable` in :file:`lib/Driver/Drivers.cpp`.
-
#. Add a ``{flavor}Driver`` as a subclass of :cpp:class:`lld::Driver`
- in :file:`lib/Driver/Drivers.cpp`. It must have a :cpp:func:`transform`
- function which takes argc/argv and returns a ``lld -core`` ArgList.
-
-#. Modify :cpp:func:`Driver::create` to create an instance of the new driver.
+ in :file:`lib/Driver/{flavor}Driver.cpp`.
OpenPOWER on IntegriCloud