From 8e39bcd9c37f7d35cf34dd78e7b57b7fbc2b4312 Mon Sep 17 00:00:00 2001 From: Mingming Liu Date: Sun, 7 Dec 2025 22:01:02 -0800 Subject: [PATCH] [lld][docs] Document two linker-script related options for lld ELF (#166313) This is a follow up of the discussions in https://github.com/llvm/llvm-project/pull/163497 --- lld/docs/ELF/linker_script.rst | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/lld/docs/ELF/linker_script.rst b/lld/docs/ELF/linker_script.rst index c9cb47fc0553..edbb78ef7a2a 100644 --- a/lld/docs/ELF/linker_script.rst +++ b/lld/docs/ELF/linker_script.rst @@ -17,6 +17,25 @@ possible. We reserve the right to make different implementation choices where it is appropriate for LLD. Intentional deviations will be documented in this file. +Linker Script Specification +~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +There are two lld options related to setting the linker script, +`--script=` and `--default-script=`. The usage are illustrated below. + +:: + + # `-T` is the alias for `--script` option. + lld -T linker_script.lds + + # `-dT` is the alias for `--default-script` option. + lld -dT linker_script.lds + +When both options are given, `--script=` takes precedence. +The intended use case of `--default-script` is to be used by toolchain +configurations, and users can override the script by specifying `--script` if +needed. + Symbol assignment ~~~~~~~~~~~~~~~~~