From b235cc9e703c323a3ae01951980c776e916ea34e Mon Sep 17 00:00:00 2001 From: Noratrieb <48135649+Noratrieb@users.noreply.github.com> Date: Wed, 25 Dec 2024 16:59:55 +0100 Subject: [PATCH] Document x86_64-unknown-linux-none is PIE by default --- .../rustc/src/platform-support/x86_64-unknown-linux-none.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/doc/rustc/src/platform-support/x86_64-unknown-linux-none.md b/src/doc/rustc/src/platform-support/x86_64-unknown-linux-none.md index 5608b5cb7781..965d6aea9318 100644 --- a/src/doc/rustc/src/platform-support/x86_64-unknown-linux-none.md +++ b/src/doc/rustc/src/platform-support/x86_64-unknown-linux-none.md @@ -14,6 +14,11 @@ This target is cross compiled and can be built from any host. This target has no support for host tools, std, or alloc. +One of the primary motivations of the target is to write a dynamic linker and libc in Rust. +For that, the target defaults to position-independent code and position-independent executables (PIE) by default. +PIE binaries need relocation at runtime. This is usually done by the dynamic linker or libc. +You can use `-Crelocation-model=static` to create a position-dependent binary that does not need relocation at runtime. + ## Building the target The target can be built by enabling it for a `rustc` build: