Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
b1fbafdd
R
Rust
项目概览
int
/
Rust
11 个月 前同步成功
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
Rust
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
b1fbafdd
编写于
11月 29, 2021
作者:
M
Maxim Cournoyer
提交者:
Mark Rousskov
12月 31, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
rustbuild: Add support for a per-target default-linker option.
上级
a09f775e
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
17 addition
and
5 deletion
+17
-5
config.toml.example
config.toml.example
+6
-3
src/bootstrap/compile.rs
src/bootstrap/compile.rs
+9
-2
src/bootstrap/config.rs
src/bootstrap/config.rs
+2
-0
未找到文件。
config.toml.example
浏览文件 @
b1fbafdd
...
...
@@ -488,9 +488,12 @@ changelog-seen = 2
# FIXME(#75760): Some UI tests fail when this option is enabled.
#parallel-compiler = false
# The default linker that will be hard-coded into the generated compiler for
# targets that don't specify linker explicitly in their target specifications.
# Note that this is not the linker used to link said compiler.
# The default linker that will be hard-coded into the generated
# compiler for targets that don't specify a default linker explicitly
# in their target specifications. Note that this is not the linker
# used to link said compiler. It can also be set per-target (via the
# `[target.<triple>]` block), which may be useful in a cross-compilation
# setting.
#
# See https://doc.rust-lang.org/rustc/codegen-options/index.html#linker for more information.
#default-linker = <none> (path)
...
...
src/bootstrap/compile.rs
浏览文件 @
b1fbafdd
...
...
@@ -662,6 +662,8 @@ pub fn rustc_cargo_env(builder: &Builder<'_>, cargo: &mut Cargo, target: TargetS
.env
(
"CFG_VERSION"
,
builder
.rust_version
());
let
libdir_relative
=
builder
.config
.libdir_relative
()
.unwrap_or_else
(||
Path
::
new
(
"lib"
));
let
target_config
=
builder
.config.target_config
.get
(
&
target
);
cargo
.env
(
"CFG_LIBDIR_RELATIVE"
,
libdir_relative
);
if
let
Some
(
ref
ver_date
)
=
builder
.rust_info
.commit_date
()
{
...
...
@@ -673,9 +675,15 @@ pub fn rustc_cargo_env(builder: &Builder<'_>, cargo: &mut Cargo, target: TargetS
if
!
builder
.unstable_features
()
{
cargo
.env
(
"CFG_DISABLE_UNSTABLE_FEATURES"
,
"1"
);
}
if
let
Some
(
ref
s
)
=
builder
.config.rustc_default_linker
{
// Prefer the current target's own default_linker, else a globally
// specified one.
if
let
Some
(
s
)
=
target_config
.and_then
(|
c
|
c
.default_linker
.as_ref
())
{
cargo
.env
(
"CFG_DEFAULT_LINKER"
,
s
);
}
else
if
let
Some
(
ref
s
)
=
builder
.config.rustc_default_linker
{
cargo
.env
(
"CFG_DEFAULT_LINKER"
,
s
);
}
if
builder
.config.rustc_parallel
{
cargo
.rustflag
(
"--cfg=parallel_compiler"
);
cargo
.rustdocflag
(
"--cfg=parallel_compiler"
);
...
...
@@ -700,7 +708,6 @@ pub fn rustc_cargo_env(builder: &Builder<'_>, cargo: &mut Cargo, target: TargetS
}
let
llvm_config
=
builder
.ensure
(
native
::
Llvm
{
target
});
cargo
.env
(
"LLVM_CONFIG"
,
&
llvm_config
);
let
target_config
=
builder
.config.target_config
.get
(
&
target
);
if
let
Some
(
s
)
=
target_config
.and_then
(|
c
|
c
.llvm_config
.as_ref
())
{
cargo
.env
(
"CFG_LLVM_ROOT"
,
s
);
}
...
...
src/bootstrap/config.rs
浏览文件 @
b1fbafdd
...
...
@@ -294,6 +294,7 @@ pub struct Target {
pub
cxx
:
Option
<
PathBuf
>
,
pub
ar
:
Option
<
PathBuf
>
,
pub
ranlib
:
Option
<
PathBuf
>
,
pub
default_linker
:
Option
<
PathBuf
>
,
pub
linker
:
Option
<
PathBuf
>
,
pub
ndk
:
Option
<
PathBuf
>
,
pub
sanitizers
:
Option
<
bool
>
,
...
...
@@ -531,6 +532,7 @@ struct TomlTarget {
cxx
:
Option
<
String
>
,
ar
:
Option
<
String
>
,
ranlib
:
Option
<
String
>
,
default_linker
:
Option
<
PathBuf
>
,
linker
:
Option
<
String
>
,
llvm_config
:
Option
<
String
>
,
llvm_filecheck
:
Option
<
String
>
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录