[llvm] [RISCV][docs] GP Relaxation and Small Data Limit (PR #108592)

Sam Elliott via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 13 10:27:24 PDT 2024


================
@@ -431,3 +431,26 @@ line.  This currently applies to the following extensions:
 * ``Zvksg``
 * ``Zvksh``
 * ``Zvkt``
+
+Global Pointer (GP) Relaxation and the Small Data Limit
+=======================================================
+
+Some of the RISC-V psABIs reserve ``gp`` (``x3``) for use as a "Global Pointer", to make generating data addresses more efficient.
+
+To use this functionality, you need to:
+* not be using the ``gp`` register for any other uses -- some platforms use it for other things;
+* compile your objects with Clang's ``-mrelax`` option, to enable relaxation annotations on relocatable objects; and
+* be compiling for an executable (not a shared library); and
+* use LLD's ``--relax-gp`` option.
----------------
lenary wrote:

There was a slight mix of "this is what is currently implemented" vs "this is the broad strokes of what is allowed" in this version. I'm going to try to err towards the former with the next set of edits, on the understanding we need to keep docs up to date if we make improvements to LLD's relaxation or PIE support.

https://github.com/llvm/llvm-project/pull/108592


More information about the llvm-commits mailing list