Skip to content

Commit 30c951a

Browse files
committed
feat(*): initial commit
0 parents  commit 30c951a

110 files changed

Lines changed: 7005 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/tester.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: tests
2+
3+
on:
4+
push:
5+
branches: [main, develop]
6+
pull_request:
7+
branches: [main, develop]
8+
9+
jobs:
10+
tests:
11+
runs-on: macos-15
12+
13+
steps:
14+
- name: Checkout code
15+
uses: actions/checkout@v4
16+
17+
- name: Install dependencies (macOS)
18+
run: |
19+
brew update
20+
brew install coreutils
21+
22+
- name: Build execvm_example
23+
working-directory: example
24+
run: |
25+
make
26+
27+
- name: Run tester.sh
28+
working-directory: test
29+
run: |
30+
mv ../example/execvm_example .
31+
chmod +x run.sh
32+
chmod +x execvm_example
33+
./run.sh

.gitignore

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
target
2+
*.DS_Store
3+
test/outfiles/
4+
test/_binaries/**/*.dylib
5+
test/binaries/**/hello_world
6+
example/srcs/_shell.c
7+
.auto-run.lldb
8+
cxx_libtlv/.objs
9+
cxx_libtlv/libtlv.a
10+
execvm_example
11+
.objs/
12+
a.out
13+
example/libvector/libvector.a

Cargo.lock

Lines changed: 104 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
[package]
2+
name = "execvm"
3+
version = "0.0.1"
4+
edition = "2024"
5+
6+
[lib]
7+
name = "execvm"
8+
crate-type = ["cdylib", "rlib"]
9+
10+
[workspace]
11+
resolver = "2"
12+
members = [
13+
"libs/*",
14+
]
15+
16+
[dependencies]
17+
kernutils = { path = "libs/kernutils" }
18+
debug_println = { path = "libs/debug_println" }
19+
ptrauth = { path = "libs/ptrauth" }
20+
jump = { path = "libs/jump" }
21+
macho = { path = "libs/macho" }
22+
libc = "0.2.178"

build.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
use std::env;
2+
use std::path::PathBuf;
3+
4+
fn main() {
5+
let manifest_dir = env::var("CARGO_MANIFEST_DIR").unwrap();
6+
let mut lib_path = PathBuf::from(manifest_dir);
7+
8+
lib_path.push("cxx_libtlv");
9+
10+
println!("cargo:rustc-link-search=native={}", lib_path.display());
11+
println!("cargo:rustc-link-lib=static=tlv");
12+
println!("cargo:rerun-if-changed=cxx_libtlv/libtlv.a");
13+
}

cxx_libtlv/Makefile

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
NAME := libtlv.a
2+
CC := clang
3+
SRCS_DIR := .
4+
OBJS_DIR := .objs
5+
BUILD_DIR := build
6+
INCS_DIR := incs
7+
CFLAGS := \
8+
-Wall \
9+
-Wextra \
10+
-Werror \
11+
-pedantic
12+
13+
CFLAGS_DBG := \
14+
-g3 \
15+
-O0 \
16+
-fsanitize=address \
17+
-fsanitize=undefined \
18+
-fno-omit-frame-pointer \
19+
-fstack-protector-strong \
20+
-fno-optimize-sibling-calls
21+
22+
SRCS := \
23+
thread_local_variables.c \
24+
thread_local_helpers.s
25+
26+
27+
SRCS_OBJS := $(patsubst %.c,$(OBJS_DIR)/%.o,$(filter %.c,$(SRCS))) \
28+
$(patsubst %.s,$(OBJS_DIR)/%.o,$(filter %.s,$(SRCS)))
29+
30+
$(OBJS_DIR)/%.o:$(SRCS_DIR)/%.c
31+
@mkdir -vp $(dir $@)
32+
$(CC) \
33+
$(CFLAGS) \
34+
-MMD \
35+
-MP \
36+
-o $@ \
37+
-c $< \
38+
-I $(INCS_DIR)
39+
40+
$(OBJS_DIR)/%.o:$(SRCS_DIR)/%.s
41+
@mkdir -vp $(dir $@)
42+
$(CC) \
43+
$(CFLAGS) \
44+
-o $@ \
45+
-c $<
46+
47+
all: $(NAME)
48+
49+
-include $(SRCS_OBJS:.o=.d)
50+
51+
$(NAME): $(SRCS_OBJS)
52+
ar rc \
53+
$(NAME) \
54+
$(SRCS_OBJS)
55+
56+
g: CFLAGS += $(CFLAGS_DBG)
57+
g: all
58+
59+
clean:
60+
rm -rf $(OBJS_DIR)
61+
rm -rf .cache
62+
rm -rf .dSYM
63+
64+
fclean: clean
65+
rm -rf $(NAME)
66+
67+
re: fclean all
68+
69+
.PHONY : all clean g fclean re

0 commit comments

Comments
 (0)