public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] ld: Document -pie -Ttext-segment=ORG generates ET_EXEC
@ 2024-05-25 14:38 H.J. Lu
  0 siblings, 0 replies; only message in thread
From: H.J. Lu @ 2024-05-25 14:38 UTC (permalink / raw)
  To: binutils; +Cc: mintsuki

-Ttext-segment=ORG is used to set the address of the first byte of the
text segment to ORG.  When -pie is used with -Ttext-segment=ORG, the
output executable is marked ET_EXEC so that the address of the first
byte of the text segment will be ORG at run-time.  Otherwise, kernel
may load ET_DYN executable at some random addresses.

	PR ld/31795
	* ld.texi: Document -pie -Ttext-segment=ORG generates ET_EXEC.

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

diff --git a/ld/ld.texi b/ld/ld.texi
index dd0af8e4f5e..1f383dd37a4 100644
--- a/ld/ld.texi
+++ b/ld/ld.texi
@@ -2694,7 +2694,10 @@ Same as @option{--section-start}, with @code{.bss}, @code{.data} or
 @item -Ttext-segment=@var{org}
 @cindex text segment origin, cmd line
 When creating an ELF executable, it will set the address of the first
-byte of the text segment.
+byte of the text segment.  Note that when @option{-pie} is used with
+@option{-Ttext-segment=@var{org}}, the output executable is marked
+ET_EXEC so that the address of the first byte of the text segment will
+be @var{org} at run time.
 
 @kindex -Trodata-segment=@var{org}
 @item -Trodata-segment=@var{org}
-- 
2.45.1


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-05-25 14:38 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-25 14:38 [PATCH] ld: Document -pie -Ttext-segment=ORG generates ET_EXEC H.J. Lu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).