[lld] [lld/ELF] Add documentation on large sections (PR #82560)

Arthur Eubanks via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 22 13:41:39 PST 2024


================
@@ -0,0 +1,42 @@
+Large sections
+==============
+
+When linking very large binaries, lld may report relocation overflows like
+
+::
+
+  relocation R_X86_64_PC32 out of range: 2158227201 is not in [-2147483648, 2147483647]
+
+This happens when running into architectural limitations. For example, in x86-64
+PIC code, a reference to a static global variable is typically done with a
+``R_X86_64_PC32`` relocation, which is a 32-bit signed offset from the PC. That
+means if the global is laid out further than 2GB (2^31 bytes) from the
+instruction referencing it, we run into a relocation overflow.
+
+Some code models offer a tradeoff between relocation pressure and performance.
+For example, x86-64's medium code model splits globals into small and large
----------------
aeubanks wrote:

better?

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


More information about the llvm-commits mailing list