Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 221bdb6

Browse filesBrowse files
committed
Auto merge of #98212 - petrochenkov:addlinkargs, r=lqd
rustc_target: Add convenience functions for adding linker arguments They ensure that lld and non-lld linker flavors get the same set of arguments. The second commit also adds some tests checking for linker argument inconsistencies, and tweaks some arguments to fix those inconsistencies.
2 parents 3b0d481 + 456f65e commit 221bdb6
Copy full SHA for 221bdb6

File tree

76 files changed

+459
-443
lines changed
Filter options

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Dismiss banner

76 files changed

+459
-443
lines changed

‎compiler/rustc_target/src/lib.rs

Copy file name to clipboardExpand all lines: compiler/rustc_target/src/lib.rs
+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
//! LLVM.
99
1010
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
11+
#![feature(assert_matches)]
1112
#![feature(associated_type_bounds)]
1213
#![feature(exhaustive_patterns)]
1314
#![feature(let_else)]

‎compiler/rustc_target/src/spec/aarch64_apple_darwin.rs

Copy file name to clipboardExpand all lines: compiler/rustc_target/src/spec/aarch64_apple_darwin.rs
+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ pub fn target() -> Target {
88
// FIXME: The leak sanitizer currently fails the tests, see #88132.
99
base.supported_sanitizers = SanitizerSet::ADDRESS | SanitizerSet::CFI | SanitizerSet::THREAD;
1010

11-
base.pre_link_args.insert(LinkerFlavor::Gcc, vec!["-arch".into(), "arm64".into()]);
11+
base.add_pre_link_args(LinkerFlavor::Gcc, &["-arch", "arm64"]);
1212
base.link_env_remove.to_mut().extend(super::apple_base::macos_link_env_remove());
1313

1414
// Clang automatically chooses a more specific target based on

‎compiler/rustc_target/src/spec/aarch64_unknown_uefi.rs

Copy file name to clipboardExpand all lines: compiler/rustc_target/src/spec/aarch64_unknown_uefi.rs
+2-9
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,13 @@
22
// uefi-base module for generic UEFI options.
33

44
use super::uefi_msvc_base;
5-
use crate::spec::{LinkerFlavor, LldFlavor, Target};
5+
use crate::spec::{LinkerFlavor, Target};
66

77
pub fn target() -> Target {
88
let mut base = uefi_msvc_base::opts();
99

1010
base.max_atomic_width = Some(64);
11-
12-
let pre_link_args_msvc = vec!["/machine:arm64".into()];
13-
14-
base.pre_link_args.get_mut(&LinkerFlavor::Msvc).unwrap().extend(pre_link_args_msvc.clone());
15-
base.pre_link_args
16-
.get_mut(&LinkerFlavor::Lld(LldFlavor::Link))
17-
.unwrap()
18-
.extend(pre_link_args_msvc);
11+
base.add_pre_link_args(LinkerFlavor::Msvc, &["/machine:arm64"]);
1912

2013
Target {
2114
llvm_target: "aarch64-unknown-windows".into(),

‎compiler/rustc_target/src/spec/armv6k_nintendo_3ds.rs

Copy file name to clipboardExpand all lines: compiler/rustc_target/src/spec/armv6k_nintendo_3ds.rs
+3-9
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,13 @@
1-
use crate::spec::{cvs, LinkArgs, LinkerFlavor, RelocModel, Target, TargetOptions};
1+
use crate::spec::{cvs, LinkerFlavor, RelocModel, Target, TargetOptions};
22

33
/// A base target for Nintendo 3DS devices using the devkitARM toolchain.
44
///
55
/// Requires the devkitARM toolchain for 3DS targets on the host system.
66
77
pub fn target() -> Target {
8-
let mut pre_link_args = LinkArgs::new();
9-
pre_link_args.insert(
8+
let pre_link_args = TargetOptions::link_args(
109
LinkerFlavor::Gcc,
11-
vec![
12-
"-specs=3dsx.specs".into(),
13-
"-mtune=mpcore".into(),
14-
"-mfloat-abi=hard".into(),
15-
"-mtp=soft".into(),
16-
],
10+
&["-specs=3dsx.specs", "-mtune=mpcore", "-mfloat-abi=hard", "-mtp=soft"],
1711
);
1812

1913
Target {

‎compiler/rustc_target/src/spec/armv7_linux_androideabi.rs

Copy file name to clipboardExpand all lines: compiler/rustc_target/src/spec/armv7_linux_androideabi.rs
+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use crate::spec::{LinkerFlavor, SanitizerSet, Target, TargetOptions};
1010

1111
pub fn target() -> Target {
1212
let mut base = super::android_base::opts();
13-
base.pre_link_args.entry(LinkerFlavor::Gcc).or_default().push("-march=armv7-a".into());
13+
base.add_pre_link_args(LinkerFlavor::Gcc, &["-march=armv7-a"]);
1414
Target {
1515
llvm_target: "armv7-none-linux-android".into(),
1616
pointer_width: 32,

‎compiler/rustc_target/src/spec/asmjs_unknown_emscripten.rs

Copy file name to clipboardExpand all lines: compiler/rustc_target/src/spec/asmjs_unknown_emscripten.rs
+1-5
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,6 @@ use super::{wasm32_unknown_emscripten, LinkerFlavor, Target};
22

33
pub fn target() -> Target {
44
let mut target = wasm32_unknown_emscripten::target();
5-
target.post_link_args.entry(LinkerFlavor::Em).or_default().extend(vec![
6-
"-sWASM=0".into(),
7-
"--memory-init-file".into(),
8-
"0".into(),
9-
]);
5+
target.add_post_link_args(LinkerFlavor::Em, &["-sWASM=0", "--memory-init-file", "0"]);
106
target
117
}

‎compiler/rustc_target/src/spec/avr_gnu_base.rs

Copy file name to clipboardExpand all lines: compiler/rustc_target/src/spec/avr_gnu_base.rs
+4-5
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ use crate::spec::{LinkerFlavor, Target, TargetOptions};
33
/// A base target for AVR devices using the GNU toolchain.
44
///
55
/// Requires GNU avr-gcc and avr-binutils on the host system.
6-
pub fn target(target_cpu: &'static str) -> Target {
6+
/// FIXME: Remove the second parameter when const string concatenation is possible.
7+
pub fn target(target_cpu: &'static str, mmcu: &'static str) -> Target {
78
Target {
89
arch: "avr".into(),
910
data_layout: "e-P1-p:16:8-i8:8-i16:8-i32:8-i64:8-f32:8-f64:8-n8-a:8".into(),
@@ -17,10 +18,8 @@ pub fn target(target_cpu: &'static str) -> Target {
1718
linker: Some("avr-gcc".into()),
1819
executables: true,
1920
eh_frame_header: false,
20-
pre_link_args: [(LinkerFlavor::Gcc, vec![format!("-mmcu={}", target_cpu).into()])]
21-
.into_iter()
22-
.collect(),
23-
late_link_args: [(LinkerFlavor::Gcc, vec!["-lgcc".into()])].into_iter().collect(),
21+
pre_link_args: TargetOptions::link_args(LinkerFlavor::Gcc, &[mmcu]),
22+
late_link_args: TargetOptions::link_args(LinkerFlavor::Gcc, &["-lgcc"]),
2423
max_atomic_width: Some(0),
2524
atomic_cas: false,
2625
..TargetOptions::default()
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use crate::spec::Target;
22

33
pub fn target() -> Target {
4-
super::avr_gnu_base::target("atmega328")
4+
super::avr_gnu_base::target("atmega328", "-mmcu=atmega328")
55
}

‎compiler/rustc_target/src/spec/fuchsia_base.rs

Copy file name to clipboardExpand all lines: compiler/rustc_target/src/spec/fuchsia_base.rs
+15-18
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,20 @@
1-
use crate::spec::{
2-
crt_objects, cvs, LinkArgs, LinkOutputKind, LinkerFlavor, LldFlavor, TargetOptions,
3-
};
1+
use crate::spec::{crt_objects, cvs, LinkOutputKind, LinkerFlavor, LldFlavor, TargetOptions};
42

53
pub fn opts() -> TargetOptions {
6-
let mut pre_link_args = LinkArgs::new();
7-
pre_link_args.insert(
8-
LinkerFlavor::Lld(LldFlavor::Ld),
9-
vec![
10-
"--build-id".into(),
11-
"--hash-style=gnu".into(),
12-
"-z".into(),
13-
"max-page-size=4096".into(),
14-
"-z".into(),
15-
"now".into(),
16-
"-z".into(),
17-
"rodynamic".into(),
18-
"-z".into(),
19-
"separate-loadable-segments".into(),
20-
"--pack-dyn-relocs=relr".into(),
4+
let pre_link_args = TargetOptions::link_args(
5+
LinkerFlavor::Ld,
6+
&[
7+
"--build-id",
8+
"--hash-style=gnu",
9+
"-z",
10+
"max-page-size=4096",
11+
"-z",
12+
"now",
13+
"-z",
14+
"rodynamic",
15+
"-z",
16+
"separate-loadable-segments",
17+
"--pack-dyn-relocs=relr",
2118
],
2219
);
2320

‎compiler/rustc_target/src/spec/hermit_base.rs

Copy file name to clipboardExpand all lines: compiler/rustc_target/src/spec/hermit_base.rs
+4-5
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1-
use crate::spec::{LinkArgs, LinkerFlavor, LldFlavor, PanicStrategy, TargetOptions, TlsModel};
1+
use crate::spec::{LinkerFlavor, LldFlavor, PanicStrategy, TargetOptions, TlsModel};
22

33
pub fn opts() -> TargetOptions {
4-
let mut pre_link_args = LinkArgs::new();
5-
pre_link_args.insert(
6-
LinkerFlavor::Lld(LldFlavor::Ld),
7-
vec!["--build-id".into(), "--hash-style=gnu".into(), "--Bstatic".into()],
4+
let pre_link_args = TargetOptions::link_args(
5+
LinkerFlavor::Ld,
6+
&["--build-id", "--hash-style=gnu", "--Bstatic"],
87
);
98

109
TargetOptions {

‎compiler/rustc_target/src/spec/i686_apple_darwin.rs

Copy file name to clipboardExpand all lines: compiler/rustc_target/src/spec/i686_apple_darwin.rs
+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ pub fn target() -> Target {
44
let mut base = super::apple_base::opts("macos");
55
base.cpu = "yonah".into();
66
base.max_atomic_width = Some(64);
7-
base.pre_link_args.insert(LinkerFlavor::Gcc, vec!["-m32".into()]);
7+
base.add_pre_link_args(LinkerFlavor::Gcc, &["-m32"]);
88
base.link_env_remove.to_mut().extend(super::apple_base::macos_link_env_remove());
99
// don't use probe-stack=inline-asm until rust#83139 and rust#84667 are resolved
1010
base.stack_probes = StackProbeType::Call;

‎compiler/rustc_target/src/spec/i686_pc_windows_gnu.rs

Copy file name to clipboardExpand all lines: compiler/rustc_target/src/spec/i686_pc_windows_gnu.rs
+3-6
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,16 @@
1-
use crate::spec::{FramePointer, LinkerFlavor, LldFlavor, Target};
1+
use crate::spec::{FramePointer, LinkerFlavor, Target};
22

33
pub fn target() -> Target {
44
let mut base = super::windows_gnu_base::opts();
55
base.cpu = "pentium4".into();
6-
base.pre_link_args.insert(LinkerFlavor::Lld(LldFlavor::Ld), vec!["-m".into(), "i386pe".into()]);
76
base.max_atomic_width = Some(64);
87
base.frame_pointer = FramePointer::Always; // Required for backtraces
98
base.linker = Some("i686-w64-mingw32-gcc".into());
109

1110
// Mark all dynamic libraries and executables as compatible with the larger 4GiB address
1211
// space available to x86 Windows binaries on x86_64.
13-
base.pre_link_args
14-
.entry(LinkerFlavor::Gcc)
15-
.or_default()
16-
.push("-Wl,--large-address-aware".into());
12+
base.add_pre_link_args(LinkerFlavor::Ld, &["-m", "i386pe", "--large-address-aware"]);
13+
base.add_pre_link_args(LinkerFlavor::Gcc, &["-Wl,--large-address-aware"]);
1714

1815
Target {
1916
llvm_target: "i686-pc-windows-gnu".into(),

‎compiler/rustc_target/src/spec/i686_pc_windows_msvc.rs

Copy file name to clipboardExpand all lines: compiler/rustc_target/src/spec/i686_pc_windows_msvc.rs
+13-15
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,22 @@
1-
use crate::spec::{LinkerFlavor, LldFlavor, Target};
1+
use crate::spec::{LinkerFlavor, Target};
22

33
pub fn target() -> Target {
44
let mut base = super::windows_msvc_base::opts();
55
base.cpu = "pentium4".into();
66
base.max_atomic_width = Some(64);
77

8-
let pre_link_args_msvc = vec![
9-
// Mark all dynamic libraries and executables as compatible with the larger 4GiB address
10-
// space available to x86 Windows binaries on x86_64.
11-
"/LARGEADDRESSAWARE".into(),
12-
// Ensure the linker will only produce an image if it can also produce a table of
13-
// the image's safe exception handlers.
14-
// https://docs.microsoft.com/en-us/cpp/build/reference/safeseh-image-has-safe-exception-handlers
15-
"/SAFESEH".into(),
16-
];
17-
base.pre_link_args.entry(LinkerFlavor::Msvc).or_default().extend(pre_link_args_msvc.clone());
18-
base.pre_link_args
19-
.entry(LinkerFlavor::Lld(LldFlavor::Link))
20-
.or_default()
21-
.extend(pre_link_args_msvc);
8+
base.add_pre_link_args(
9+
LinkerFlavor::Msvc,
10+
&[
11+
// Mark all dynamic libraries and executables as compatible with the larger 4GiB address
12+
// space available to x86 Windows binaries on x86_64.
13+
"/LARGEADDRESSAWARE",
14+
// Ensure the linker will only produce an image if it can also produce a table of
15+
// the image's safe exception handlers.
16+
// https://docs.microsoft.com/en-us/cpp/build/reference/safeseh-image-has-safe-exception-handlers
17+
"/SAFESEH",
18+
],
19+
);
2220
// Workaround for #95429
2321
base.has_thread_local = false;
2422

‎compiler/rustc_target/src/spec/i686_unknown_freebsd.rs

Copy file name to clipboardExpand all lines: compiler/rustc_target/src/spec/i686_unknown_freebsd.rs
+1-3
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,7 @@ pub fn target() -> Target {
44
let mut base = super::freebsd_base::opts();
55
base.cpu = "pentium4".into();
66
base.max_atomic_width = Some(64);
7-
let pre_link_args = base.pre_link_args.entry(LinkerFlavor::Gcc).or_default();
8-
pre_link_args.push("-m32".into());
9-
pre_link_args.push("-Wl,-znotext".into());
7+
base.add_pre_link_args(LinkerFlavor::Gcc, &["-m32", "-Wl,-znotext"]);
108
// don't use probe-stack=inline-asm until rust#83139 and rust#84667 are resolved
119
base.stack_probes = StackProbeType::Call;
1210

‎compiler/rustc_target/src/spec/i686_unknown_haiku.rs

Copy file name to clipboardExpand all lines: compiler/rustc_target/src/spec/i686_unknown_haiku.rs
+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ pub fn target() -> Target {
44
let mut base = super::haiku_base::opts();
55
base.cpu = "pentium4".into();
66
base.max_atomic_width = Some(64);
7-
base.pre_link_args.insert(LinkerFlavor::Gcc, vec!["-m32".into()]);
7+
base.add_pre_link_args(LinkerFlavor::Gcc, &["-m32"]);
88
// don't use probe-stack=inline-asm until rust#83139 and rust#84667 are resolved
99
base.stack_probes = StackProbeType::Call;
1010

‎compiler/rustc_target/src/spec/i686_unknown_linux_gnu.rs

Copy file name to clipboardExpand all lines: compiler/rustc_target/src/spec/i686_unknown_linux_gnu.rs
+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ pub fn target() -> Target {
44
let mut base = super::linux_gnu_base::opts();
55
base.cpu = "pentium4".into();
66
base.max_atomic_width = Some(64);
7-
base.pre_link_args.entry(LinkerFlavor::Gcc).or_default().push("-m32".into());
7+
base.add_pre_link_args(LinkerFlavor::Gcc, &["-m32"]);
88
// don't use probe-stack=inline-asm until rust#83139 and rust#84667 are resolved
99
base.stack_probes = StackProbeType::Call;
1010

‎compiler/rustc_target/src/spec/i686_unknown_linux_musl.rs

Copy file name to clipboardExpand all lines: compiler/rustc_target/src/spec/i686_unknown_linux_musl.rs
+1-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@ pub fn target() -> Target {
44
let mut base = super::linux_musl_base::opts();
55
base.cpu = "pentium4".into();
66
base.max_atomic_width = Some(64);
7-
base.pre_link_args.entry(LinkerFlavor::Gcc).or_default().push("-m32".into());
8-
base.pre_link_args.entry(LinkerFlavor::Gcc).or_default().push("-Wl,-melf_i386".into());
7+
base.add_pre_link_args(LinkerFlavor::Gcc, &["-m32", "-Wl,-melf_i386"]);
98
// don't use probe-stack=inline-asm until rust#83139 and rust#84667 are resolved
109
base.stack_probes = StackProbeType::Call;
1110

‎compiler/rustc_target/src/spec/i686_unknown_netbsd.rs

Copy file name to clipboardExpand all lines: compiler/rustc_target/src/spec/i686_unknown_netbsd.rs
+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ pub fn target() -> Target {
44
let mut base = super::netbsd_base::opts();
55
base.cpu = "pentium4".into();
66
base.max_atomic_width = Some(64);
7-
base.pre_link_args.entry(LinkerFlavor::Gcc).or_default().push("-m32".into());
7+
base.add_pre_link_args(LinkerFlavor::Gcc, &["-m32"]);
88
// don't use probe-stack=inline-asm until rust#83139 and rust#84667 are resolved
99
base.stack_probes = StackProbeType::Call;
1010

‎compiler/rustc_target/src/spec/i686_unknown_openbsd.rs

Copy file name to clipboardExpand all lines: compiler/rustc_target/src/spec/i686_unknown_openbsd.rs
+1-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@ pub fn target() -> Target {
44
let mut base = super::openbsd_base::opts();
55
base.cpu = "pentium4".into();
66
base.max_atomic_width = Some(64);
7-
base.pre_link_args.entry(LinkerFlavor::Gcc).or_default().push("-m32".into());
8-
base.pre_link_args.entry(LinkerFlavor::Gcc).or_default().push("-fuse-ld=lld".into());
7+
base.add_pre_link_args(LinkerFlavor::Gcc, &["-m32", "-fuse-ld=lld"]);
98
// don't use probe-stack=inline-asm until rust#83139 and rust#84667 are resolved
109
base.stack_probes = StackProbeType::Call;
1110

‎compiler/rustc_target/src/spec/i686_uwp_windows_gnu.rs

Copy file name to clipboardExpand all lines: compiler/rustc_target/src/spec/i686_uwp_windows_gnu.rs
+3-6
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,15 @@
1-
use crate::spec::{FramePointer, LinkerFlavor, LldFlavor, Target};
1+
use crate::spec::{FramePointer, LinkerFlavor, Target};
22

33
pub fn target() -> Target {
44
let mut base = super::windows_uwp_gnu_base::opts();
55
base.cpu = "pentium4".into();
6-
base.pre_link_args.insert(LinkerFlavor::Lld(LldFlavor::Ld), vec!["-m".into(), "i386pe".into()]);
76
base.max_atomic_width = Some(64);
87
base.frame_pointer = FramePointer::Always; // Required for backtraces
98

109
// Mark all dynamic libraries and executables as compatible with the larger 4GiB address
1110
// space available to x86 Windows binaries on x86_64.
12-
base.pre_link_args
13-
.entry(LinkerFlavor::Gcc)
14-
.or_default()
15-
.push("-Wl,--large-address-aware".into());
11+
base.add_pre_link_args(LinkerFlavor::Ld, &["-m", "i386pe", "--large-address-aware"]);
12+
base.add_pre_link_args(LinkerFlavor::Gcc, &["-Wl,--large-address-aware"]);
1613

1714
Target {
1815
llvm_target: "i686-pc-windows-gnu".into(),

‎compiler/rustc_target/src/spec/i686_wrs_vxworks.rs

Copy file name to clipboardExpand all lines: compiler/rustc_target/src/spec/i686_wrs_vxworks.rs
+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ pub fn target() -> Target {
44
let mut base = super::vxworks_base::opts();
55
base.cpu = "pentium4".into();
66
base.max_atomic_width = Some(64);
7-
base.pre_link_args.entry(LinkerFlavor::Gcc).or_default().push("-m32".into());
7+
base.add_pre_link_args(LinkerFlavor::Gcc, &["-m32"]);
88
// don't use probe-stack=inline-asm until rust#83139 and rust#84667 are resolved
99
base.stack_probes = StackProbeType::Call;
1010

‎compiler/rustc_target/src/spec/illumos_base.rs

Copy file name to clipboardExpand all lines: compiler/rustc_target/src/spec/illumos_base.rs
+5-6
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1-
use crate::spec::{cvs, FramePointer, LinkArgs, LinkerFlavor, TargetOptions};
1+
use crate::spec::{cvs, FramePointer, LinkerFlavor, TargetOptions};
22

33
pub fn opts() -> TargetOptions {
4-
let mut late_link_args = LinkArgs::new();
5-
late_link_args.insert(
4+
let late_link_args = TargetOptions::link_args(
65
LinkerFlavor::Gcc,
7-
vec![
6+
&[
87
// The illumos libc contains a stack unwinding implementation, as
98
// does libgcc_s. The latter implementation includes several
109
// additional symbols that are not always in base libc. To force
@@ -15,13 +14,13 @@ pub fn opts() -> TargetOptions {
1514
// FIXME: This should be replaced by a more complete and generic
1615
// mechanism for controlling the order of library arguments passed
1716
// to the linker.
18-
"-lc".into(),
17+
"-lc",
1918
// LLVM will insert calls to the stack protector functions
2019
// "__stack_chk_fail" and "__stack_chk_guard" into code in native
2120
// object files. Some platforms include these symbols directly in
2221
// libc, but at least historically these have been provided in
2322
// libssp.so on illumos and Solaris systems.
24-
"-lssp".into(),
23+
"-lssp",
2524
],
2625
);
2726

‎compiler/rustc_target/src/spec/mipsel_sony_psp.rs

Copy file name to clipboardExpand all lines: compiler/rustc_target/src/spec/mipsel_sony_psp.rs
+2-4
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
use crate::spec::{cvs, Target, TargetOptions};
2-
use crate::spec::{LinkArgs, LinkerFlavor, LldFlavor, RelocModel};
2+
use crate::spec::{LinkerFlavor, LldFlavor, RelocModel};
33

44
// The PSP has custom linker requirements.
55
const LINKER_SCRIPT: &str = include_str!("./mipsel_sony_psp_linker_script.ld");
66

77
pub fn target() -> Target {
8-
let mut pre_link_args = LinkArgs::new();
9-
pre_link_args
10-
.insert(LinkerFlavor::Lld(LldFlavor::Ld), vec!["--emit-relocs".into(), "--nmagic".into()]);
8+
let pre_link_args = TargetOptions::link_args(LinkerFlavor::Ld, &["--emit-relocs", "--nmagic"]);
119

1210
Target {
1311
llvm_target: "mipsel-sony-psp".into(),

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.