The idea is to build the kernel as a shared library, and resolve all symbols within the kernel. This will still leave the dynamic symbol table around. I've run into a problem for which I've created a minimal test case which fails:
tmp.c:
Code: Select all
int foo(const char* s)
{
return 0;
}
int main()
{
return foo("bar");
}
Code: Select all
000000000000000f <main>:
f: 55 push %rbp
10: 48 89 e5 mov %rsp,%rbp
13: bf 00 00 00 00 mov $0x0,%edi
14: R_X86_64_32 .rodata
18: e8 00 00 00 00 callq 1d <main+0xe>
19: R_X86_64_PC32 foo-0x4
1d: 5d pop %rbp
1e: c3 retq
Code: Select all
CC -Wl,-Bsymbolic -Wl,-z,defs -Wl,-shared test.o
Code: Select all
relocation R_X86_64_32 against `.rodata' can not be used when making a shared object; recompile with -fPIC