Skip to content

Commit 979c8d8

Browse files
committed
Upgrade to Rust 1.30-nightly
The object file in the rlib has been renamed again, and the name now includes now gibberish. The assembly now has an extra instruction due to rust-lang/rust#45920 but despite this the final executable is actually smaller than before. (There doesn't appear to be a way to disable the unreachable() trap.)
1 parent af2d172 commit 979c8d8

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@
33
/payload.bin
44
/tinyrust
55
/tinyrust.ll
6-
/tinyrust.0.o
6+
/*.o
77
/libtinyrust.rlib

build.sh

+6-4
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ for d in rustc git cargo ar ld objcopy nasm hexdump; do
66
which $d >/dev/null || (echo "Can't find $d, needed to build"; exit 1)
77
done
88

9-
printf "Tested on rustc 1.16.0-nightly (df8debf6d 2017-01-25)\n You have "
9+
printf "Tested on rustc 1.30.0-nightly (f8d34596f 2018-08-30)\n You have "
1010
rustc --version
1111
echo
1212

@@ -22,12 +22,14 @@ rustc tinyrust.rs \
2222
-O -C relocation-model=static \
2323
-L syscall.rs/target/release
2424

25-
ar x libtinyrust.rlib tinyrust.0.o
25+
# tinyrust.tinyrust.3a1fbbbh-cgu.0.rcgu.o
26+
OBJECT=$(ar t libtinyrust.rlib | grep '.o$')
27+
ar x libtinyrust.rlib "$OBJECT"
2628

27-
objdump -dr tinyrust.0.o
29+
objdump -dr "$OBJECT"
2830
echo
2931

30-
ld --gc-sections -e main -T script.ld -o payload tinyrust.0.o
32+
ld --gc-sections -e main -T script.ld -o payload "$OBJECT"
3133
objcopy -j combined -O binary payload payload.bin
3234

3335
ENTRY=$(nm --format=posix payload | grep '^main ' | awk '{print $3}')

0 commit comments

Comments
 (0)