Skip to content

Commit a8bd19c

Browse files
committed
Switch back to building as a binary.
1 parent 619b2e6 commit a8bd19c

File tree

5 files changed

+11
-31
lines changed

5 files changed

+11
-31
lines changed

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,3 @@ target
22
.vagrant/
33
.swp
44
.*.swp
5-
build/

Cargo.toml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,6 @@ authors = ["cbiffle <code@cliffle.com>"]
66
[dependencies]
77
rust-libcore = "*"
88

9-
[lib]
10-
crate-type = ["staticlib"]
11-
129
[profile.dev]
1310
panic = "abort"
1411

Makefile

Lines changed: 0 additions & 26 deletions
This file was deleted.

notes/20160916-entry.mkdn

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,10 @@ complain.
5656
Disabling the `staticlib` crate type doesn't seem to matter. The crate type
5757
being passed on the commandline is probably winning.
5858

59+
Okay, yes. This project is actually building as a binary, and the apparent
60+
crate type declaration is ignored. The actual trick being used here is the fake
61+
start item.
62+
5963

6064
`#[no_mangle]` appears to affect external symbol visibility in staticlibs. If I
6165
remove it from `ISR_VECTORS` the symbol is no longer visible in the object file

src/emb1.rs renamed to src/main.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#![no_std]
2-
#![feature(lang_items)]
2+
#![feature(lang_items,start)]
33

44
extern {
55
/// This symbol is exported by the linker script, and defines the initial
@@ -73,3 +73,9 @@ extern fn panic_fmt() -> ! {loop {}}
7373
#[no_mangle]
7474
pub extern "C" fn abort() -> ! { loop {} }
7575

76+
/// This is included to mollify the compiler, but is not actually used and
77+
/// doesn't wind up getting linked into the output.
78+
#[start]
79+
fn _start(_: isize, _: *const *const u8) -> isize {
80+
unsafe { (ISR_VECTORS.reset)() }
81+
}

0 commit comments

Comments
 (0)