CodeGen: support an extension to pass linker options on ELF

Introduce an extension to support passing linker options to the linker.
These would be ignored by older linkers, but newer linkers which support
this feature would be able to process the linker.

Emit a special discarded section `.linker-option`.  The content of this
section is a pair of strings (key, value).  The key is a type identifier for
the parameter.  This allows for an argument free parameter that will be
processed by the linker with the value being the parameter.  As an example,
`lib` identifies a library to be linked against, traditionally the `-l`
argument for Unix-based linkers with the parameter being the library name.

Thanks to James Henderson, Cary Coutant, Rafael Espinolda, Sean Silva
for the valuable discussion on the design of this feature.

llvm-svn: 323783
diff --git a/llvm/docs/Extensions.rst b/llvm/docs/Extensions.rst
index 32eeadd..46189a3 100644
--- a/llvm/docs/Extensions.rst
+++ b/llvm/docs/Extensions.rst
@@ -221,6 +221,44 @@
         .section .foo,"a",@progbits
         .section .bar,"ao",@progbits,.foo
 
+``.linker-options`` Section (linker options)
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+In order to support passing linker options from the frontend to the linker, a
+special section of type ``SHT_LLVM_LINKER_OPTIONS`` (usually named
+``.linker-options`` though the name is not significant as it is identified by
+the type).  The contents of this section is a simple pair-wise encoding of
+options for consideration by the linker.  The strings are encoded as standard
+null-terminated UTF-8 strings.  They are emitted inline to avoid having the
+linker to traverse the object file for retrieving the value.  The linker is
+permitted to not honour the option and instead provide a warning/error to the
+user that the requested option was not honoured.
+
+The section is marked as ``SHT_LLVM_LINKER_OPTIONS`` and has the ``SHF_EXCLUDE``
+flag to ensure that the section is treated as opaque by linkers which do not
+support the feature and will not be emitted into the final linked binary.
+
+This would be equivalent to the follow raw assembly:
+
+.. code-block:: gas
+
+  .section ".linker-options","e",@llvm_linker_options
+  .asciz "option 1"
+  .asciz "value 1"
+  .asciz "option 2"
+  .asciz "value 2"
+
+LLVM emits the following options:
+  - lib
+
+    The parameter identifies a library to be linked against.  The library will
+    be looked up in the default and any specified library search paths
+    (specified to this point).
+
+  - path
+
+    The paramter identifies an additional library search path to be considered
+    when looking up libraries after the inclusion of this option.
 
 Target Specific Behaviour
 =========================