[v4,2/3] ld: Document mixing LTO and non-LTO objects for -r

Message ID 20250112220244.597636-3-hjl.tools@gmail.com
State New
Headers
Series Add lto and none-lto output support for ld -r |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_binutils_build--master-arm success Build passed
linaro-tcwg-bot/tcwg_binutils_build--master-aarch64 success Build passed
linaro-tcwg-bot/tcwg_binutils_check--master-aarch64 success Test passed
linaro-tcwg-bot/tcwg_binutils_check--master-arm success Test passed

Commit Message

H.J. Lu Jan. 12, 2025, 10:02 p.m. UTC
  * ld.texi: Document mixing LTO and non-LTO relocatable files for
	"ld -r".

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
---
 ld/ld.texi | 12 ++++++++++++
 1 file changed, 12 insertions(+)
  

Patch

diff --git a/ld/ld.texi b/ld/ld.texi
index da714a20855..d1787453f57 100644
--- a/ld/ld.texi
+++ b/ld/ld.texi
@@ -1126,6 +1126,18 @@  relocations.  Different output formats can have further restrictions; for
 example some @code{a.out}-based formats do not support partial linking
 with input files in other formats at all.
 
+On ELF platforms, when the relocatable output contains both contents
+which require link-time optimization (LTO) and contents which don't
+require LTO, a .gnu_object_only section will be created to contain a
+relocatable object file, as if @samp{-r} is applied to all relocatable
+inputs which don't require LTO.  When processing a relocatable input
+with a .gnu_object_only section, the linker will extract the
+.gnu_object_only section as a separate input.
+
+Note that since @samp{-r} groups some sections from different input files
+together, there may be negative impacts on code size and locality in
+final executable or shared library.
+
 This option does the same thing as @samp{-i}.
 
 @kindex -R @var{file}