Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve default target options for x86_64-unknown-linux-none #134765

Merged
merged 2 commits into from
Dec 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::spec::{Cc, LinkerFlavor, Lld, StackProbeType, Target, base};
use crate::spec::{Cc, LinkerFlavor, Lld, PanicStrategy, StackProbeType, Target, base};

pub(crate) fn target() -> Target {
let mut base = base::linux::opts();
Expand All @@ -7,14 +7,15 @@ pub(crate) fn target() -> Target {
base.stack_probes = StackProbeType::Inline;
base.linker_flavor = LinkerFlavor::Gnu(Cc::No, Lld::Yes);
base.linker = Some("rust-lld".into());
base.panic_strategy = PanicStrategy::Abort;

Target {
llvm_target: "x86_64-unknown-linux-none".into(),
metadata: crate::spec::TargetMetadata {
description: None,
tier: None,
host_tools: None,
std: Some(true),
std: Some(false),
},
pointer_width: 64,
data_layout:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Loading