Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
llvm-watermarker
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nagayama15
llvm-watermarker
Commits
7927eed4
Commit
7927eed4
authored
Dec 28, 2018
by
nagayama15
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cargoプロジェクトからLLVM IRを生成するデモを追加
parent
088a6bba
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
165 additions
and
0 deletions
+165
-0
Makefile
example/Makefile
+2
-0
.gitignore
example/numguess-rs/.gitignore
+1
-0
Cargo.lock
example/numguess-rs/Cargo.lock
+80
-0
Cargo.toml
example/numguess-rs/Cargo.toml
+8
-0
Makefile
example/numguess-rs/Makefile
+19
-0
probestack.s
example/numguess-rs/probestack.s
+19
-0
main.rs
example/numguess-rs/src/main.rs
+36
-0
No files found.
example/Makefile
View file @
7927eed4
...
...
@@ -5,9 +5,11 @@ all:
${
MAKE
}
-C
8cc all
${
MAKE
}
-C
zlib all
${
MAKE
}
-C
fizzbuzz-rs all
${
MAKE
}
-C
numguess-rs all
test
:
${
MAKE
}
-C
fizzbuzz
test
${
MAKE
}
-C
8cc
test
${
MAKE
}
-C
zlib
test
${
MAKE
}
-C
fizzbuzz-rs
test
${
MAKE
}
-C
numguess-rs
test
example/numguess-rs/.gitignore
0 → 100644
View file @
7927eed4
target/
example/numguess-rs/Cargo.lock
0 → 100644
View file @
7927eed4
[[package]]
name = "bitflags"
version = "1.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "fuchsia-zircon"
version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
"fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "fuchsia-zircon-sys"
version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "libc"
version = "0.2.45"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "numguess-rs"
version = "1.0.0"
dependencies = [
"rand 0.3.22 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "rand"
version = "0.3.22"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)",
"rand 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "rand"
version = "0.4.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)",
"winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "winapi"
version = "0.3.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "winapi-i686-pc-windows-gnu"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "winapi-x86_64-pc-windows-gnu"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
[metadata]
"checksum bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "228047a76f468627ca71776ecdebd732a3423081fcf5125585bcd7c49886ce12"
"checksum fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2e9763c69ebaae630ba35f74888db465e49e259ba1bc0eda7d06f4a067615d82"
"checksum fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7"
"checksum libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)" = "2d2857ec59fadc0773853c664d2d18e7198e83883e7060b63c924cb077bd5c74"
"checksum rand 0.3.22 (registry+https://github.com/rust-lang/crates.io-index)" = "15a732abf9d20f0ad8eeb6f909bf6868722d9a06e1e50802b6a70351f40b4eb1"
"checksum rand 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "8356f47b32624fef5b3301c1be97e5944ecdd595409cc5da11d05f211db6cfbd"
"checksum winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "92c1eb33641e276cfa214a0522acad57be5c56b10cb348b3c5117db75f3ac4b0"
"checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
"checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
example/numguess-rs/Cargo.toml
0 → 100644
View file @
7927eed4
[package]
name
=
"numguess-rs"
version
=
"1.0.0"
authors
=
[
"NagayamaRyoga <nagayama15@sec.is.kit.ac.jp>"
]
edition
=
"2018"
[dependencies]
rand
=
"0.3.0"
example/numguess-rs/Makefile
0 → 100644
View file @
7927eed4
include
../../common.mk
LDFLAGS
:=
\
-pthread
\
-lbacktrace
\
-ldl
\
-ljemalloc
all
:
${BIN_DIR}/numguess.out
test
:
${BIN_DIR}/numguess.out
clean
:
cargo clean
${BIN_DIR}/numguess.out
:
@
mkdir
-p
${
@D
}
cargo rustc
--release
-v
--
-Clto
--emit
=
llvm-ir
clang
-o
$@
target/release/deps/
*
.ll probestack.s
${
LDFLAGS
}
example/numguess-rs/probestack.s
0 → 100644
View file @
7927eed4
# To avoid undefined reference to `__rust_probestack`.
# From https://github.com/rust-lang-nursery/compiler-builtins/blob/master/src/probestack.rs
.global __rust_probestack
__rust_probestack:
mov %rax, %r11
cmp $0x1000, %r11
jna 3f
2:
sub $0x1000, %rsp
test %rsp, 8(%rsp)
sub $0x1000, %r11
cmp $0x1000, %r11
ja 2b
3:
sub %r11, %rsp
test %rsp, 8(%rsp)
add %rax, %rsp
ret
example/numguess-rs/src/main.rs
0 → 100644
View file @
7927eed4
extern
crate
rand
;
use
std
::
io
;
use
std
::
cmp
::
Ordering
;
use
rand
::
Rng
;
fn
main
()
{
println!
(
"Guess the number!"
);
let
secret_number
=
rand
::
thread_rng
()
.gen_range
(
1
,
101
);
loop
{
println!
(
"Please input your guess."
);
let
mut
guess
=
String
::
new
();
io
::
stdin
()
.read_line
(
&
mut
guess
)
.expect
(
"failed to read line"
);
let
guess
:
u32
=
match
guess
.trim
()
.parse
()
{
Ok
(
num
)
=>
num
,
Err
(
_
)
=>
continue
,
};
println!
(
"You guessed: {}"
,
guess
);
match
guess
.cmp
(
&
secret_number
)
{
Ordering
::
Less
=>
println!
(
"Too small!"
),
Ordering
::
Greater
=>
println!
(
"Too big!"
),
Ordering
::
Equal
=>
{
println!
(
"You win!"
);
break
;
}
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment