Skip to content

Commit 56080df

Browse files
committed
wip
1 parent 38b6fcf commit 56080df

File tree

29 files changed

+984
-745
lines changed

29 files changed

+984
-745
lines changed

packages/std/Cargo.lock

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

packages/std/Cargo.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ itertools = "0.14"
3535
libc = "0.2"
3636
serde = { version = "1", features = ["derive"] }
3737
serde_json = "1"
38-
tangram_client = { default-features = false, git = "https://github.com/tangramdotdev/tangram", rev = "b3c56f4a986afbbc62863aeaa9a7a98ffbec8e39" }
39-
tangram_serialize = { default-features = false, git = "https://github.com/tangramdotdev/tangram", rev = "b3c56f4a986afbbc62863aeaa9a7a98ffbec8e39" }
38+
tangram_client = { default-features = false, git = "https://github.com/tangramdotdev/tangram", rev = "58527c57de3217c82d0c54e3dacaba6394245fec" }
39+
tangram_serialize = { default-features = false, git = "https://github.com/tangramdotdev/tangram", rev = "58527c57de3217c82d0c54e3dacaba6394245fec" }
4040
tempfile = "3"
4141
tokio = { version = "1", default-features = false, features = [
4242
"rt",
@@ -91,3 +91,4 @@ tracing-subscriber = { workspace = true, optional = true }
9191

9292
[features]
9393
tracing = ["dep:tracing", "dep:tracing-subscriber"]
94+
default = ["tracing"]

packages/std/a.out

69 KB
Binary file not shown.

packages/std/cctest/a.out

65.5 KB
Binary file not shown.

packages/std/cctest/main.c

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
#include <elf.h>
2+
#include <stdio.h>
3+
#include <stdbool.h>
4+
#include <sys/mman.h>
5+
6+
#define eprintf(...) fprintf(stderr, __VA_ARGS__)
7+
8+
int main(int argc, const char** argv) {
9+
if (argc != 3) {
10+
return 111;
11+
}
12+
const char* input = argv[0];
13+
const char* output = argv[1];
14+
int status = 0;
15+
16+
int in = open(input, O_RDONLY);
17+
int out = open(output, O_RDWR | O_CREAT, 0o755);
18+
if (in < 0 || out < 0) {
19+
perror("failed to open in/out/files");
20+
return 1;
21+
}
22+
off_t size = lseek(in, 0, SEEK_END);
23+
if (size < 0) {
24+
perror("failed to seek to the end of the input");
25+
status = 1;
26+
goto cleanup;
27+
}
28+
29+
uint8_t* elf = (uint8_t*)mmap(
30+
NULL,
31+
(size_t)size,
32+
PROT_READ,
33+
MAP_ANONYMOUS | MAP_PRIVATE,
34+
in,
35+
0
36+
);
37+
38+
Elf64_Ehdr* ehdr = (Elf64_Ehdr*)elf;
39+
Elf64_Phdr* phdr = (Elf64_Phr*)(elf + ehdr->e_phoff);
40+
41+
bool copied = false
42+
for (int i = 0; i < ehdr->e_phnum) {
43+
if (phdr[i].p_type != PT_LOAD) {
44+
continue;
45+
}
46+
if (copied) {
47+
status = 1;
48+
eprintf("expected a single loadable segment");
49+
goto cleanup;
50+
}
51+
52+
}
53+
cleanup:
54+
munmap(elf, size);
55+
close(in);
56+
close(out);
57+
return status;
58+
}

packages/std/cctest/output.o

832 Bytes
Binary file not shown.

packages/std/cctest/script.ld

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
SECTIONS
2+
{
3+
. = 0x0;
4+
.text : {
5+
*(.text.start)
6+
}
7+
}

packages/std/cctest/start.bin

16 Bytes
Binary file not shown.

packages/std/cctest/start.elf

64.5 KB
Binary file not shown.

packages/std/cctest/start.o

832 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)