[lld] [lld][docs] Document two linker-script related options for lld ELF (PR #166313)
Mingming Liu via llvm-commits
llvm-commits at lists.llvm.org
Fri Dec 5 13:46:22 PST 2025
https://github.com/mingmingl-llvm updated https://github.com/llvm/llvm-project/pull/166313
>From 86370161c0c3a0fb5fc346e20208fc7acf35c74e Mon Sep 17 00:00:00 2001
From: mingmingl <mingmingl at google.com>
Date: Mon, 3 Nov 2025 21:52:26 -0800
Subject: [PATCH 1/2] lld docs
---
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 c9cb47fc0553e..2946e0156583e 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=<file>` and `--default-script=<file>`. The usage are illustrated below.
+
+::
+
+ # This sets `--script=<file>` option under the hood.
+ lld -T linker_script.lds
+
+ # This sets `--default-script=<file>` option under the hood.
+ lld -dT linker_script.lds
+
+When both options are given, `--script=<file>` 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
~~~~~~~~~~~~~~~~~
>From f04fe66d28f35ac0929b8b78b49d21b8b9fb90a2 Mon Sep 17 00:00:00 2001
From: mingmingl <mingmingl at google.com>
Date: Fri, 5 Dec 2025 13:45:41 -0800
Subject: [PATCH 2/2] apply suggestions
---
lld/docs/ELF/linker_script.rst | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/lld/docs/ELF/linker_script.rst b/lld/docs/ELF/linker_script.rst
index 2946e0156583e..edbb78ef7a2ae 100644
--- a/lld/docs/ELF/linker_script.rst
+++ b/lld/docs/ELF/linker_script.rst
@@ -25,10 +25,10 @@ There are two lld options related to setting the linker script,
::
- # This sets `--script=<file>` option under the hood.
+ # `-T` is the alias for `--script` option.
lld -T linker_script.lds
- # This sets `--default-script=<file>` option under the hood.
+ # `-dT` is the alias for `--default-script` option.
lld -dT linker_script.lds
When both options are given, `--script=<file>` takes precedence.
More information about the llvm-commits
mailing list