Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
I recently changes to openbsd and attempted to compile my little OS, after much modification to the make file. When it finally did compile, I attempted to use the basic video libary I had, only to have it failing in the linking phase. The exact output is
This was attempted on openBSD 5.5 on an amd64 computer. In case anyone wants to build the version that ran on linux, here is the git repository for it: https://github.com/Jebes/gensokyo-os
Last edited by jebes on Sun Jun 29, 2014 7:18 am, edited 1 time in total.
You're using OpenBSD's system compiler, don't do that. It's only meant to compile software for OpenBSD, several things are enabled by default like PIE (Position Independent Executables) and other security extensions as documented in gcc-local(1).
The same rules apply, follow the GCC_Cross-Compiler tutorial on the Wiki.
Note: You're clobbering your disk image with disklabel(8), just use vnd0c with newfs -t msdos. A pseudo label will be generated by the kernel. Note 2: There's plenty more to pick apart, but it's already turd polishing.
Twitter: @canadianbryan. Award by smcerm, I stole it. Original was larger.
OpenBSD is great and all that. Its gcc has a lot of awesome protections enabled by default. However, you must use a cross-compiler regardless of what the host compiler does. In the long run it certainly would be useful to support such security measures in your operating system - but that's not important now. It looks like you have been following bad osdev tutorials that suggest using the host compiler and give a lot of other bad advise.
The osdev tutorials you have been following suggest you pass a lot of bad options, some unnecessary options, and might not be passing important options. Please follow the http://wiki.osdev.org/Bare_Bones tutorial and compile and link the files exactly as suggested there, adding only options not mentioned if you truly understand them and why you want to use it. You can safely delete options like -fpic -nostdinc -fno-builtin -fno-stack-protector -m32 -melf_i386 -static when using a cross-compiler. The -nostdlib option should only be passed when linking. You are not linking in libgcc.