Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
32aeb22f
R
Rust
项目概览
int
/
Rust
接近 1 年 前同步成功
通知
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,发现更多精彩内容 >>
提交
32aeb22f
编写于
4月 25, 2017
作者:
M
Michael Wu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Avoid the hexagon backend on old versions of LLVM
上级
c558a2ae
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
38 addition
and
28 deletion
+38
-28
src/librustc_llvm/build.rs
src/librustc_llvm/build.rs
+38
-28
未找到文件。
src/librustc_llvm/build.rs
浏览文件 @
32aeb22f
...
...
@@ -17,30 +17,24 @@
use
build_helper
::
output
;
fn
detect_llvm_link
(
llvm_config
:
&
Path
)
->
(
&
'static
str
,
Option
<&
'static
str
>
)
{
let
mut
version_cmd
=
Command
::
new
(
llvm_config
);
version_cmd
.arg
(
"--version"
);
let
version_output
=
output
(
&
mut
version_cmd
);
let
mut
parts
=
version_output
.split
(
'.'
)
.take
(
2
)
.filter_map
(|
s
|
s
.parse
::
<
u32
>
()
.ok
());
if
let
(
Some
(
major
),
Some
(
minor
))
=
(
parts
.next
(),
parts
.next
())
{
if
major
>
3
||
(
major
==
3
&&
minor
>=
9
)
{
// Force the link mode we want, preferring static by default, but
// possibly overridden by `configure --enable-llvm-link-shared`.
if
env
::
var_os
(
"LLVM_LINK_SHARED"
)
.is_some
()
{
return
(
"dylib"
,
Some
(
"--link-shared"
));
}
else
{
return
(
"static"
,
Some
(
"--link-static"
));
}
}
else
if
major
==
3
&&
minor
==
8
{
// Find out LLVM's default linking mode.
let
mut
mode_cmd
=
Command
::
new
(
llvm_config
);
mode_cmd
.arg
(
"--shared-mode"
);
if
output
(
&
mut
mode_cmd
)
.trim
()
==
"shared"
{
return
(
"dylib"
,
None
);
}
else
{
return
(
"static"
,
None
);
}
fn
detect_llvm_link
(
major
:
u32
,
minor
:
u32
,
llvm_config
:
&
Path
)
->
(
&
'static
str
,
Option
<&
'static
str
>
)
{
if
major
>
3
||
(
major
==
3
&&
minor
>=
9
)
{
// Force the link mode we want, preferring static by default, but
// possibly overridden by `configure --enable-llvm-link-shared`.
if
env
::
var_os
(
"LLVM_LINK_SHARED"
)
.is_some
()
{
return
(
"dylib"
,
Some
(
"--link-shared"
));
}
else
{
return
(
"static"
,
Some
(
"--link-static"
));
}
}
else
if
major
==
3
&&
minor
==
8
{
// Find out LLVM's default linking mode.
let
mut
mode_cmd
=
Command
::
new
(
llvm_config
);
mode_cmd
.arg
(
"--shared-mode"
);
if
output
(
&
mut
mode_cmd
)
.trim
()
==
"shared"
{
return
(
"dylib"
,
None
);
}
else
{
return
(
"static"
,
None
);
}
}
(
"static"
,
None
)
...
...
@@ -92,9 +86,25 @@ fn main() {
let
host
=
env
::
var
(
"HOST"
)
.expect
(
"HOST was not set"
);
let
is_crossed
=
target
!=
host
;
let
optional_components
=
[
"x86"
,
"arm"
,
"aarch64"
,
"mips"
,
"powerpc"
,
"pnacl"
,
"systemz"
,
"jsbackend"
,
"msp430"
,
"sparc"
,
"nvptx"
,
"hexagon"
];
let
mut
optional_components
=
vec!
[
"x86"
,
"arm"
,
"aarch64"
,
"mips"
,
"powerpc"
,
"pnacl"
,
"systemz"
,
"jsbackend"
,
"msp430"
,
"sparc"
,
"nvptx"
];
let
mut
version_cmd
=
Command
::
new
(
&
llvm_config
);
version_cmd
.arg
(
"--version"
);
let
version_output
=
output
(
&
mut
version_cmd
);
let
mut
parts
=
version_output
.split
(
'.'
)
.take
(
2
)
.filter_map
(|
s
|
s
.parse
::
<
u32
>
()
.ok
());
let
(
major
,
minor
)
=
if
let
(
Some
(
major
),
Some
(
minor
))
=
(
parts
.next
(),
parts
.next
())
{
(
major
,
minor
)
}
else
{
(
3
,
7
)
};
if
major
>
3
{
optional_components
.push
(
"hexagon"
);
}
// FIXME: surely we don't need all these components, right? Stuff like mcjit
// or interpreter the compiler itself never uses.
...
...
@@ -158,7 +168,7 @@ fn main() {
.cpp_link_stdlib
(
None
)
// we handle this below
.compile
(
"librustllvm.a"
);
let
(
llvm_kind
,
llvm_link_arg
)
=
detect_llvm_link
(
&
llvm_config
);
let
(
llvm_kind
,
llvm_link_arg
)
=
detect_llvm_link
(
major
,
minor
,
&
llvm_config
);
// Link in all LLVM libraries, if we're uwring the "wrong" llvm-config then
// we don't pick up system libs because unfortunately they're for the host
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录