Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
690bb8af
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,发现更多精彩内容 >>
提交
690bb8af
编写于
5月 06, 2016
作者:
J
Jake Goulding
提交者:
Dylan McKay
6月 09, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[AVR] Add AVR platform support
上级
5d39f1fa
变更
21
隐藏空白更改
内联
并排
Showing
21 changed file
with
158 addition
and
2 deletion
+158
-2
config.toml.example
config.toml.example
+1
-1
src/bootstrap/native.rs
src/bootstrap/native.rs
+1
-1
src/librustc_ast_passes/feature_gate.rs
src/librustc_ast_passes/feature_gate.rs
+8
-0
src/librustc_codegen_llvm/abi.rs
src/librustc_codegen_llvm/abi.rs
+2
-0
src/librustc_codegen_llvm/llvm/ffi.rs
src/librustc_codegen_llvm/llvm/ffi.rs
+2
-0
src/librustc_feature/active.rs
src/librustc_feature/active.rs
+3
-0
src/librustc_llvm/build.rs
src/librustc_llvm/build.rs
+1
-0
src/librustc_llvm/lib.rs
src/librustc_llvm/lib.rs
+8
-0
src/librustc_middle/ty/layout.rs
src/librustc_middle/ty/layout.rs
+2
-0
src/librustc_span/symbol.rs
src/librustc_span/symbol.rs
+1
-0
src/librustc_target/abi/call/avr.rs
src/librustc_target/abi/call/avr.rs
+33
-0
src/librustc_target/abi/call/mod.rs
src/librustc_target/abi/call/mod.rs
+4
-0
src/librustc_target/spec/abi.rs
src/librustc_target/spec/abi.rs
+8
-0
src/librustc_target/spec/avr_unknown_unknown.rs
src/librustc_target/spec/avr_unknown_unknown.rs
+17
-0
src/librustc_target/spec/mod.rs
src/librustc_target/spec/mod.rs
+3
-0
src/librustc_target/spec/none_base.rs
src/librustc_target/spec/none_base.rs
+30
-0
src/libstd/env.rs
src/libstd/env.rs
+6
-0
src/rustllvm/PassWrapper.cpp
src/rustllvm/PassWrapper.cpp
+7
-0
src/test/ui/feature-gates/feature-gate-abi-avr-interrupt.rs
src/test/ui/feature-gates/feature-gate-abi-avr-interrupt.rs
+9
-0
src/test/ui/feature-gates/feature-gate-abi-avr-interrupt.stderr
...st/ui/feature-gates/feature-gate-abi-avr-interrupt.stderr
+11
-0
src/tools/compiletest/src/util.rs
src/tools/compiletest/src/util.rs
+1
-0
未找到文件。
config.toml.example
浏览文件 @
690bb8af
...
...
@@ -69,7 +69,7 @@
# the same format as above, but since these targets are experimental, they are
# not built by default and the experimental Rust compilation targets that depend
# on them will not work unless the user opts in to building them.
#experimental-targets = ""
#experimental-targets = "
AVR
"
# Cap the number of parallel linker invocations when compiling LLVM.
# This can be useful when building LLVM with debug info, which significantly
...
...
src/bootstrap/native.rs
浏览文件 @
690bb8af
...
...
@@ -144,7 +144,7 @@ fn run(self, builder: &Builder<'_>) -> PathBuf {
let
llvm_exp_targets
=
match
builder
.config.llvm_experimental_targets
{
Some
(
ref
s
)
=>
s
,
None
=>
""
,
None
=>
"
AVR
"
,
};
let
assertions
=
if
builder
.config.llvm_assertions
{
"ON"
}
else
{
"OFF"
};
...
...
src/librustc_ast_passes/feature_gate.rs
浏览文件 @
690bb8af
...
...
@@ -121,6 +121,14 @@ fn check_abi(&self, abi: ast::StrLit) {
"amdgpu-kernel ABI is experimental and subject to change"
);
}
"avr-interrupt"
|
"avr-non-blocking-interrupt"
=>
{
gate_feature_post!
(
&
self
,
abi_avr_interrupt
,
span
,
"avr-interrupt and avr-non-blocking-interrupt ABIs are experimental and subject to change"
);
}
"efiapi"
=>
{
gate_feature_post!
(
&
self
,
...
...
src/librustc_codegen_llvm/abi.rs
浏览文件 @
690bb8af
...
...
@@ -375,6 +375,8 @@ fn llvm_cconv(&self) -> llvm::CallConv {
match
self
.conv
{
Conv
::
C
|
Conv
::
Rust
=>
llvm
::
CCallConv
,
Conv
::
AmdGpuKernel
=>
llvm
::
AmdGpuKernel
,
Conv
::
AvrInterrupt
=>
llvm
::
AvrInterrupt
,
Conv
::
AvrNonBlockingInterrupt
=>
llvm
::
AvrNonBlockingInterrupt
,
Conv
::
ArmAapcs
=>
llvm
::
ArmAapcsCallConv
,
Conv
::
Msp430Intr
=>
llvm
::
Msp430Intr
,
Conv
::
PtxKernel
=>
llvm
::
PtxKernel
,
...
...
src/librustc_codegen_llvm/llvm/ffi.rs
浏览文件 @
690bb8af
...
...
@@ -45,6 +45,8 @@ pub enum CallConv {
X86_64_Win64
=
79
,
X86_VectorCall
=
80
,
X86_Intr
=
83
,
AvrNonBlockingInterrupt
=
84
,
AvrInterrupt
=
85
,
AmdGpuKernel
=
91
,
}
...
...
src/librustc_feature/active.rs
浏览文件 @
690bb8af
...
...
@@ -347,6 +347,9 @@ pub fn set(&self, features: &mut Features, span: Span) {
/// Allows `extern "msp430-interrupt" fn()`.
(
active
,
abi_msp430_interrupt
,
"1.16.0"
,
Some
(
38487
),
None
),
/// Allows `extern "avr-interrupt" fn()` and `extern "avr-non-blocking-interrupt" fn()`.
(
active
,
abi_avr_interrupt
,
"1.41.0"
,
None
,
None
),
/// Allows declarative macros 2.0 (`macro`).
(
active
,
decl_macro
,
"1.17.0"
,
Some
(
39412
),
None
),
...
...
src/librustc_llvm/build.rs
浏览文件 @
690bb8af
...
...
@@ -78,6 +78,7 @@ fn main() {
"arm"
,
"aarch64"
,
"amdgpu"
,
"avr"
,
"mips"
,
"powerpc"
,
"systemz"
,
...
...
src/librustc_llvm/lib.rs
浏览文件 @
690bb8af
...
...
@@ -76,6 +76,14 @@ fn init() { }
LLVMInitializeAMDGPUAsmPrinter
,
LLVMInitializeAMDGPUAsmParser
);
init_target!
(
llvm_component
=
"avr"
,
LLVMInitializeAVRTargetInfo
,
LLVMInitializeAVRTarget
,
LLVMInitializeAVRTargetMC
,
LLVMInitializeAVRAsmPrinter
,
LLVMInitializeAVRAsmParser
);
init_target!
(
llvm_component
=
"mips"
,
LLVMInitializeMipsTargetInfo
,
...
...
src/librustc_middle/ty/layout.rs
浏览文件 @
690bb8af
...
...
@@ -2529,6 +2529,8 @@ fn new_internal(
Msp430Interrupt
=>
Conv
::
Msp430Intr
,
X86Interrupt
=>
Conv
::
X86Intr
,
AmdGpuKernel
=>
Conv
::
AmdGpuKernel
,
AvrInterrupt
=>
Conv
::
AvrInterrupt
,
AvrNonBlockingInterrupt
=>
Conv
::
AvrNonBlockingInterrupt
,
// These API constants ought to be more specific...
Cdecl
=>
Conv
::
C
,
...
...
src/librustc_span/symbol.rs
浏览文件 @
690bb8af
...
...
@@ -120,6 +120,7 @@
abi_unadjusted
,
abi_vectorcall
,
abi_x86_interrupt
,
abi_avr_interrupt
,
abort
,
aborts
,
address
,
...
...
src/librustc_target/abi/call/avr.rs
0 → 100644
浏览文件 @
690bb8af
#![allow(non_upper_case_globals)]
use
crate
::
abi
::
call
::{
ArgAbi
,
FnAbi
};
fn
classify_ret_ty
<
Ty
>
(
ret
:
&
mut
ArgAbi
<
'_
,
Ty
>
)
{
if
ret
.layout
.is_aggregate
()
{
ret
.make_indirect
();
}
else
{
ret
.extend_integer_width_to
(
8
);
// Is 8 correct?
}
}
fn
classify_arg_ty
<
Ty
>
(
arg
:
&
mut
ArgAbi
<
'_
,
Ty
>
)
{
if
arg
.layout
.is_aggregate
()
{
arg
.make_indirect
();
}
else
{
arg
.extend_integer_width_to
(
8
);
}
}
pub
fn
compute_abi_info
<
Ty
>
(
fty
:
&
mut
FnAbi
<
'_
,
Ty
>
)
{
if
!
fty
.ret
.is_ignore
()
{
classify_ret_ty
(
&
mut
fty
.ret
);
}
for
arg
in
&
mut
fty
.args
{
if
arg
.is_ignore
()
{
continue
;
}
classify_arg_ty
(
arg
);
}
}
src/librustc_target/abi/call/mod.rs
浏览文件 @
690bb8af
...
...
@@ -5,6 +5,7 @@
mod
aarch64
;
mod
amdgpu
;
mod
arm
;
mod
avr
;
mod
hexagon
;
mod
mips
;
mod
mips64
;
...
...
@@ -525,6 +526,8 @@ pub enum Conv {
X86_64Win64
,
AmdGpuKernel
,
AvrInterrupt
,
AvrNonBlockingInterrupt
,
}
/// Metadata describing how the arguments to a native function
...
...
@@ -580,6 +583,7 @@ pub fn adjust_for_cabi<C>(&mut self, cx: &C, abi: spec::abi::Abi) -> Result<(),
"aarch64"
=>
aarch64
::
compute_abi_info
(
cx
,
self
),
"amdgpu"
=>
amdgpu
::
compute_abi_info
(
cx
,
self
),
"arm"
=>
arm
::
compute_abi_info
(
cx
,
self
),
"avr"
=>
avr
::
compute_abi_info
(
self
),
"mips"
=>
mips
::
compute_abi_info
(
cx
,
self
),
"mips64"
=>
mips64
::
compute_abi_info
(
cx
,
self
),
"powerpc"
=>
powerpc
::
compute_abi_info
(
self
),
...
...
src/librustc_target/spec/abi.rs
浏览文件 @
690bb8af
...
...
@@ -34,6 +34,8 @@ pub enum Abi {
X86Interrupt
,
AmdGpuKernel
,
EfiApi
,
AvrInterrupt
,
AvrNonBlockingInterrupt
,
// Multiplatform / generic ABIs
System
,
...
...
@@ -73,6 +75,12 @@ pub struct AbiData {
AbiData
{
abi
:
Abi
::
X86Interrupt
,
name
:
"x86-interrupt"
,
generic
:
false
},
AbiData
{
abi
:
Abi
::
AmdGpuKernel
,
name
:
"amdgpu-kernel"
,
generic
:
false
},
AbiData
{
abi
:
Abi
::
EfiApi
,
name
:
"efiapi"
,
generic
:
false
},
AbiData
{
abi
:
Abi
::
AvrInterrupt
,
name
:
"avr-interrupt"
,
generic
:
false
},
AbiData
{
abi
:
Abi
::
AvrNonBlockingInterrupt
,
name
:
"avr-non-blocking-interrupt"
,
generic
:
false
,
},
// Cross-platform ABIs
AbiData
{
abi
:
Abi
::
System
,
name
:
"system"
,
generic
:
true
},
AbiData
{
abi
:
Abi
::
RustIntrinsic
,
name
:
"rust-intrinsic"
,
generic
:
true
},
...
...
src/librustc_target/spec/avr_unknown_unknown.rs
0 → 100644
浏览文件 @
690bb8af
use
crate
::
spec
::{
LinkerFlavor
,
Target
,
TargetResult
};
pub
fn
target
()
->
TargetResult
{
Ok
(
Target
{
llvm_target
:
"avr-unknown-unknown"
.to_string
(),
target_endian
:
"little"
.to_string
(),
target_pointer_width
:
"16"
.to_string
(),
data_layout
:
"e-P1-p:16:8-i8:8-i16:8-i32:8-i64:8-f32:8-f64:8-n8-a:8"
.to_string
(),
arch
:
"avr"
.to_string
(),
linker_flavor
:
LinkerFlavor
::
Gcc
,
target_os
:
"unknown"
.to_string
(),
target_env
:
""
.to_string
(),
target_vendor
:
"unknown"
.to_string
(),
target_c_int_width
:
16
.to_string
(),
options
:
super
::
none_base
::
opts
(),
})
}
src/librustc_target/spec/mod.rs
浏览文件 @
690bb8af
...
...
@@ -65,6 +65,7 @@
mod
linux_musl_base
;
mod
msvc_base
;
mod
netbsd_base
;
mod
none_base
;
mod
openbsd_base
;
mod
redox_base
;
mod
riscv_base
;
...
...
@@ -579,6 +580,8 @@ fn $module() {
(
"aarch64-fuchsia"
,
aarch64_fuchsia
),
(
"x86_64-fuchsia"
,
x86_64_fuchsia
),
(
"avr-unknown-unknown"
,
avr_unknown_unknown
),
(
"x86_64-unknown-l4re-uclibc"
,
x86_64_unknown_l4re_uclibc
),
(
"aarch64-unknown-redox"
,
aarch64_unknown_redox
),
...
...
src/librustc_target/spec/none_base.rs
0 → 100644
浏览文件 @
690bb8af
use
crate
::
spec
::{
LinkArgs
,
LinkerFlavor
,
TargetOptions
};
use
std
::
default
::
Default
;
pub
fn
opts
()
->
TargetOptions
{
let
mut
args
=
LinkArgs
::
new
();
args
.insert
(
LinkerFlavor
::
Gcc
,
vec!
[
// We want to be able to strip as much executable code as possible
// from the linker command line, and this flag indicates to the
// linker that it can avoid linking in dynamic libraries that don't
// actually satisfy any symbols up to that point (as with many other
// resolutions the linker does). This option only applies to all
// following libraries so we're sure to pass it as one of the first
// arguments.
"-Wl,--as-needed"
.to_string
(),
],
);
TargetOptions
{
dynamic_linking
:
false
,
executables
:
true
,
linker_is_gnu
:
true
,
has_rpath
:
false
,
pre_link_args
:
args
,
position_independent_executables
:
false
,
..
Default
::
default
()
}
}
src/libstd/env.rs
浏览文件 @
690bb8af
...
...
@@ -874,6 +874,7 @@ pub mod consts {
/// - x86_64
/// - arm
/// - aarch64
/// - avr
/// - mips
/// - mips64
/// - powerpc
...
...
@@ -986,6 +987,11 @@ mod arch {
pub
const
ARCH
:
&
str
=
"aarch64"
;
}
#[cfg(target_arch
=
"avr"
)]
mod
arch
{
pub
const
ARCH
:
&
'static
str
=
"avr"
;
}
#[cfg(target_arch
=
"mips"
)]
mod
arch
{
pub
const
ARCH
:
&
str
=
"mips"
;
...
...
src/rustllvm/PassWrapper.cpp
浏览文件 @
690bb8af
...
...
@@ -203,6 +203,12 @@ void LLVMRustAddLastExtensionPasses(
#define SUBTARGET_AARCH64
#endif
#ifdef LLVM_COMPONENT_AVR
#define SUBTARGET_AVR SUBTARGET(AVR)
#else
#define SUBTARGET_AVR
#endif
#ifdef LLVM_COMPONENT_MIPS
#define SUBTARGET_MIPS SUBTARGET(Mips)
#else
...
...
@@ -249,6 +255,7 @@ void LLVMRustAddLastExtensionPasses(
SUBTARGET_X86 \
SUBTARGET_ARM \
SUBTARGET_AARCH64 \
SUBTARGET_AVR \
SUBTARGET_MIPS \
SUBTARGET_PPC \
SUBTARGET_SYSTEMZ \
...
...
src/test/ui/feature-gates/feature-gate-abi-avr-interrupt.rs
0 → 100644
浏览文件 @
690bb8af
// Test that the AVR interrupt ABI cannot be used when avr_interrupt
// feature gate is not used.
extern
"avr-interrupt"
fn
foo
()
{}
//~^ ERROR avr-interrupt and avr-non-blocking-interrupt ABIs are experimental and subject to change
fn
main
()
{
foo
();
}
src/test/ui/feature-gates/feature-gate-abi-avr-interrupt.stderr
0 → 100644
浏览文件 @
690bb8af
error[E0658]: avr-interrupt and avr-non-blocking-interrupt ABIs are experimental and subject to change
--> $DIR/feature-gate-abi-avr-interrupt.rs:14:1
|
LL | extern "avr-interrupt" fn foo() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: add #![feature(abi_avr_interrupt)] to the crate attributes to enable
error: aborting due to previous error
For more information about this error, try `rustc --explain E0658`.
src/tools/compiletest/src/util.rs
浏览文件 @
690bb8af
...
...
@@ -47,6 +47,7 @@
(
"armv7"
,
"arm"
),
(
"armv7s"
,
"arm"
),
(
"asmjs"
,
"asmjs"
),
(
"avr"
,
"avr"
),
(
"hexagon"
,
"hexagon"
),
(
"i386"
,
"x86"
),
(
"i586"
,
"x86"
),
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录