rust-kernel
Rustbelt: a hobby x86_64 kernel written in Rust
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 | /*
* piehello.c -- stage 19: "hello" as a static PIE, built with the stock
* `musl-gcc -static-pie` (no special flags). The file's addresses start
* at 0; the kernel loads it at a random base and tells us where through
* the auxiliary vector. musl's start-up code (rcrt1.o) then fixes up the
* program's own pointers before main runs.
*
* Exit code = number of failed checks. `piehello where` prints the load
* address of main (tests/static_pie.rs runs it twice: different bases).
*/
static int fails;
/* Pointers in data: these need fixing up (relocating) at start-up. */
static const char *greeting = "hello from a static PIE";
static = puts;
extern char _start;
extern const Elf64_Ehdr __ehdr_start; /* the linker's name for our ELF header */
int
|