aboutsummaryrefslogtreecommitdiffstats
path: root/elf/hello_ref.c
blob: f7b798b4d496c262cd74ac718428fea447e3a460 (plain)
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
// A simple Hello World ELF module

// TODO: Define some macros that would put the initialization and termination
// functions in a separate section (suggestion: .init and .fini)

// Undefined symbol
extern int undef_symbol;

int exported_symbol;

// Undefined function
extern void undef_func(int param);

int test_func(void) {
	return undef_symbol++;
}

static int hello_init(void) {
	undef_symbol++;
	
	return 0;
}

static void hello_exit(void) {
	undef_func(undef_symbol);
}