How do I disable all libaries (including runtime)?
Posted: Sun Nov 11, 2012 4:05 pm
My operating system so far has been written entirely in assembly and has grown a bit of dust actually...I haven't touched it in months.
Anyway, I've screwed around a lot on my pc since then and ended up deleting my old cross compiler, and now I'm wanting to rewrite the kernel part in C. I don't feel like waiting 8 hours to install cygwin and rebuild it, and I'm also wanting to create my own binary format.
The plan is to disable all libraries (including runtime) and just build the application with MinGW, and then use a program that converts a PE binary to my own format.
The problem is I can't turn off the libraries -_-
here's the options I've been passing to the compiler:
-nostdlib -fno-builtin -nostartfiles -nodefaultlibs -Wl,-n,-S,--strip-discarded,-dn,--gc-sections,-nostdlib,-rpath,.,-rpath-link,.,--file-alignment,0,--section-alignment,0,--disable-runtime-pseudo-reloc
The kernel itself it just an empty main function right now, and the binary is 3KB in size. Looking at it in a hex editor, there are symbols like "___RUNTIME_PSEUDO_RELOC_LIST__" which shouldn't be there because I'm using "--disable-runtime-pseudo-reloc".
If I strip all symbols the image size goes down to 1KB, but there's still 2 sections that shouldn't be there called ".eh_fram8" and ".idata".
Can someone please tell me how to disable this stupid runtime library?
PS. Please don't tell me to just make a cross compiler or just use elf files for my binaries. I want to use my own binary format for my own personal reasons, and if I'm going to have to convert the binaries anyway, it doesn't make much sense to waste my time making a cross compiler when I already have a perfectly good i586 compiler installed.
Anyway, I've screwed around a lot on my pc since then and ended up deleting my old cross compiler, and now I'm wanting to rewrite the kernel part in C. I don't feel like waiting 8 hours to install cygwin and rebuild it, and I'm also wanting to create my own binary format.
The plan is to disable all libraries (including runtime) and just build the application with MinGW, and then use a program that converts a PE binary to my own format.
The problem is I can't turn off the libraries -_-
here's the options I've been passing to the compiler:
-nostdlib -fno-builtin -nostartfiles -nodefaultlibs -Wl,-n,-S,--strip-discarded,-dn,--gc-sections,-nostdlib,-rpath,.,-rpath-link,.,--file-alignment,0,--section-alignment,0,--disable-runtime-pseudo-reloc
The kernel itself it just an empty main function right now, and the binary is 3KB in size. Looking at it in a hex editor, there are symbols like "___RUNTIME_PSEUDO_RELOC_LIST__" which shouldn't be there because I'm using "--disable-runtime-pseudo-reloc".
If I strip all symbols the image size goes down to 1KB, but there's still 2 sections that shouldn't be there called ".eh_fram8" and ".idata".
Can someone please tell me how to disable this stupid runtime library?
PS. Please don't tell me to just make a cross compiler or just use elf files for my binaries. I want to use my own binary format for my own personal reasons, and if I'm going to have to convert the binaries anyway, it doesn't make much sense to waste my time making a cross compiler when I already have a perfectly good i586 compiler installed.