Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
5914fb7
Stabilize `num_midpoint_signed` feature
Urgau Dec 15, 2024
2445dd7
Persist target features used for codegen beyond tcx
Feb 9, 2025
831d9f3
Pass through of target features to llvm-bitcode-linker and handling them
Feb 5, 2025
35febd7
Fix `*-win7-windows-msvc` target since 26eeac1a1e9fe46ffd80dd0d3dafdd…
QianNangong Feb 19, 2025
78ddabf
Create a generic AVR target: avr-none
Patryk27 Oct 13, 2024
81ab20f
Update references to cc_detect.rs
jmqd Feb 20, 2025
c23bf48
infer linker flavor by linker name if it's sufficiently specific
usamoi Feb 3, 2025
d5128f9
avr-rjmp-offset: Explain `.target_cpu()`
Patryk27 Feb 20, 2025
18c210c
Workaround Cranelift not yet properly supporting vectors smaller than…
bjorn3 Feb 20, 2025
c2aed39
Update docs for default features of wasm targets
alexcrichton Feb 20, 2025
32a1ff1
Make x86 QNX target name consistent with other Rust targets
flba-eb Feb 20, 2025
7ba3d7b
Remove `BackendRepr::Uninhabited`, replaced with an `uninhabited: boo…
zachs18 Jan 26, 2025
c33fb5a
Update ui tests with `LayoutData { uninhabited: ... }` etc
zachs18 Jan 26, 2025
bcfde13
Update check to reflect that non-ZST uninhabited types should not be …
zachs18 Jan 28, 2025
58ebf6a
Add test that uninhabited repr(transparent) type has same function re…
zachs18 Feb 13, 2025
6493cd8
Adjust LayoutData::uninhabited doc comment.
zachs18 Feb 18, 2025
e3f5db0
fine-tune comment
RalfJung Feb 18, 2025
9535151
Improve error message when a submodule directory is missing completely
Kobzol Feb 20, 2025
d2203ad
skip submodule updating logics on tarballs
onur-ozkan Feb 20, 2025
c0bea5d
Add a notice about missing GCC sources in source tarballs
Kobzol Feb 20, 2025
9de94b4
Rollup merge of #131651 - Patryk27:avr-unknown-unknown, r=tgross35
workingjubilee Feb 20, 2025
480a72d
Rollup merge of #134340 - Urgau:stabilize-num_midpoint_signed, r=scot…
workingjubilee Feb 20, 2025
921ef32
Rollup merge of #136473 - usamoi:infer_linker_hints, r=petrochenkov
workingjubilee Feb 20, 2025
6d74563
Rollup merge of #136608 - kulst:ptx_target_features, r=bjorn3
workingjubilee Feb 20, 2025
8c9e374
Rollup merge of #136985 - zachs18:backend-repr-remove-uninhabited, r=…
workingjubilee Feb 20, 2025
f24b140
Rollup merge of #137270 - QianNangong:master, r=ChrisDenton
workingjubilee Feb 20, 2025
0d47366
Rollup merge of #137312 - jmqd:master, r=clubby789
workingjubilee Feb 20, 2025
8d5eb73
Rollup merge of #137318 - bjorn3:cg_clif_abi_workaround, r=workingjub…
workingjubilee Feb 20, 2025
3d5e773
Rollup merge of #137322 - alexcrichton:update-wasm-docs, r=jieyouxu
workingjubilee Feb 20, 2025
8aa75f5
Rollup merge of #137324 - flba-eb:rename_qnx_target_name_i586, r=work…
workingjubilee Feb 20, 2025
02ceb5f
Rollup merge of #137338 - onur-ozkan:137332, r=Kobzol
workingjubilee Feb 20, 2025
4d479f9
Rollup merge of #137340 - Kobzol:bootstrap-dir-check, r=onur-ozkan
workingjubilee Feb 20, 2025
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
Prev Previous commit
Next Next commit
Pass through of target features to llvm-bitcode-linker and handling them
The .ptx version produced by llc can be specified by passing it with --mattr. Currently it is not possible to specify the .ptx version with -Ctarget-feature because these are not passed through to llvm-bitcode-linker and handled by it. This commit adds both.
--target-feature and -mattr are passed with equals to mitigate issues when the value starts with a - (minus).
  • Loading branch information
kulst committed Feb 16, 2025
commit 831d9f39e9c330934b7c4f35010477ba4a738d96
6 changes: 6 additions & 0 deletions compiler/rustc_codegen_ssa/src/back/link.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2518,6 +2518,12 @@ fn add_order_independent_options(
"--target-cpu",
&codegen_results.crate_info.target_cpu,
]);
if codegen_results.crate_info.target_features.len() > 0 {
cmd.link_arg(&format!(
"--target-feature={}",
&codegen_results.crate_info.target_features.join(",")
));
}
} else if flavor == LinkerFlavor::Ptx {
cmd.link_args(&["--fallback-arch", &codegen_results.crate_info.target_cpu]);
} else if flavor == LinkerFlavor::Bpf {
Expand Down
6 changes: 5 additions & 1 deletion src/tools/llvm-bitcode-linker/src/bin/llvm-bitcode-linker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ pub struct Args {
#[arg(long)]
target_cpu: Option<String>,

/// The target features
#[arg(long)]
target_feature: Option<String>,

/// Write output to the filename
#[arg(short, long)]
output: PathBuf,
Expand All @@ -49,7 +53,7 @@ fn main() -> anyhow::Result<()> {

let args = Args::parse();

let mut linker = Session::new(args.target, args.target_cpu, args.output);
let mut linker = Session::new(args.target, args.target_cpu, args.target_feature, args.output);

linker.add_exported_symbols(args.export_symbol);

Expand Down
13 changes: 12 additions & 1 deletion src/tools/llvm-bitcode-linker/src/linker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ use crate::{Optimization, Target};
pub struct Session {
target: Target,
cpu: Option<String>,
feature: Option<String>,
symbols: Vec<String>,

/// A file that `llvm-link` supports, like a bitcode file or an archive.
Expand All @@ -21,14 +22,20 @@ pub struct Session {
}

impl Session {
pub fn new(target: crate::Target, cpu: Option<String>, out_path: PathBuf) -> Self {
pub fn new(
target: crate::Target,
cpu: Option<String>,
feature: Option<String>,
out_path: PathBuf,
) -> Self {
let link_path = out_path.with_extension("o");
let opt_path = out_path.with_extension("optimized.o");
let sym_path = out_path.with_extension("symbols.txt");

Session {
target,
cpu,
feature,
symbols: Vec::new(),
files: Vec::new(),
link_path,
Expand Down Expand Up @@ -134,6 +141,10 @@ impl Session {
lcc_command.arg("--mcpu").arg(mcpu);
}

if let Some(mattr) = &self.feature {
lcc_command.arg(&format!("--mattr={}", mattr));
}

let lcc_output = lcc_command
.arg(&self.opt_path)
.arg("-o").arg(&self.out_path)
Expand Down
Loading