Skip to content

Commit 26f472d

Browse files
committed
add armv7a-vex-v5 target
1 parent 249df9e commit 26f472d

File tree

3 files changed

+88
-0
lines changed

3 files changed

+88
-0
lines changed

compiler/rustc_target/src/spec/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1913,6 +1913,8 @@ supported_targets! {
19131913

19141914
("armv7-sony-vita-newlibeabihf", armv7_sony_vita_newlibeabihf),
19151915

1916+
("armv7a-vex-v5", armv7a_vex_v5),
1917+
19161918
("armv7-unknown-linux-uclibceabi", armv7_unknown_linux_uclibceabi),
19171919
("armv7-unknown-linux-uclibceabihf", armv7_unknown_linux_uclibceabihf),
19181920

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
use crate::spec::{Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetOptions};
2+
3+
const LINK_SCRIPT: &str = include_str!("./armv7a_vex_v5_linker_script.ld");
4+
5+
pub(crate) fn target() -> Target {
6+
Target {
7+
llvm_target: "armv7a-none-eabi".into(),
8+
metadata: crate::spec::TargetMetadata {
9+
description: None,
10+
tier: None,
11+
host_tools: None,
12+
std: None,
13+
},
14+
pointer_width: 32,
15+
data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(),
16+
arch: "arm".into(),
17+
options: TargetOptions {
18+
abi: "eabi".into(),
19+
linker_flavor: LinkerFlavor::Gnu(Cc::No, Lld::Yes),
20+
linker: Some("rust-lld".into()),
21+
link_script: Some(LINK_SCRIPT.into()),
22+
features: "+v7,+thumb2,+soft-float,-neon,+strict-align".into(),
23+
relocation_model: RelocModel::Static,
24+
disable_redzone: true,
25+
max_atomic_width: Some(64),
26+
panic_strategy: PanicStrategy::Abort,
27+
emit_debug_gdb_scripts: false,
28+
c_enum_min_bits: Some(8),
29+
os: "vexos".into(),
30+
vendor: "vex".into(),
31+
..Default::default()
32+
},
33+
}
34+
}
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
OUTPUT_FORMAT("elf32-littlearm")
2+
3+
ENTRY(_start)
4+
5+
__cold_start = 0x03800000;
6+
__cold_length = 0x04800000;
7+
__cold_end = __cold_start + __cold_length;
8+
9+
MEMORY {
10+
COLD : ORIGIN = __cold_start, LENGTH = __cold_length
11+
}
12+
13+
__stack_length = 0x400000;
14+
/*
15+
I'm not sure why subtracting anything is necessary, but it fixes memory permission errors.
16+
0x1000 is an arbitrary number that works.
17+
*/
18+
__heap_end = __cold_end - __stack_length - 0x1000;
19+
20+
SECTIONS {
21+
.code_signature {
22+
KEEP(*(.code_signature))
23+
. = __cold_start + 0x20;
24+
} > COLD
25+
.text : {
26+
KEEP(*(.text.boot))
27+
*(.text .text.*)
28+
} > COLD
29+
.rodata : {
30+
__rodata_start = .;
31+
*(.rodata1 .rodata1.*)
32+
__rodata_end = .;
33+
} > COLD
34+
.data : {
35+
*(.data .data.*)
36+
*(.data1 .data1.*)
37+
} > COLD
38+
.bss : {
39+
__bss_start = .;
40+
*(.bss .bss.*)
41+
__bss_end = .;
42+
} > COLD
43+
.heap (NOLOAD) : ALIGN(4) {
44+
__heap_start = .;
45+
. = __heap_end;
46+
} > COLD
47+
.stack (NOLOAD) : ALIGN(8) {
48+
__stack_end = .;
49+
. += __stack_length;
50+
__stack_start = .;
51+
} > COLD
52+
}

0 commit comments

Comments
 (0)