Hi I am attempting to port Solo5 to OpenBSD (Virtio only), I think i have the kernel and test_hello compiling but when it comes to linking test_hello i get the following error.
/home/asteen/devl/solo5/kernel/virtio/solo5.o: relocation R_X86_64_32 against 'a local symbol' can not be used when making a shared object; recompile with -fPIC [1] adding -fPIC to HOST_CFLAGS doesn't seem to help (HOST_CFLAGS="-fPIC -nostdlibinc") My changes to the configure script are located (https://github.com/Solo5/solo5/compare/master...adamsteen:master) Could anyone point me right direction to get this working? The full build log is attached. Cheers Adam PS I am new to c and make files, but i had to pick somewhere to start, and solo5 has piqued my interest. [1] clang -fPIC -nostdlibinc -ffreestanding -mno-red-zone -isystem /home/asteen/devl/solo5/include-host -std=gnu99 -Wall -Wextra -Werror -O2 -g -I/home/asteen/devl/solo5/kernel -c test_hello.c -o test_hello.o ld -T /home/asteen/devl/solo5/kernel/virtio/solo5.lds \ -nostdlib -z max-page-size=0x1000 -static -o test_hello.virtio /home/asteen/devl/solo5/kernel/virtio/solo5.o test_hello.o ld: /home/asteen/devl/solo5/kernel/virtio/solo5.o: relocation R_X86_64_32 against 'a local symbol' can not be used when making a shared object; recompile with -fPIC /home/asteen/devl/solo5/kernel/virtio/solo5.o: could not read symbols: Bad value gmake[2]: *** [../Makefile.tests:64: test_hello.virtio] Error 1 gmake[2]: Leaving directory '/home/asteen/devl/solo5/tests/test_hello' gmake[1]: *** [GNUmakefile:43: _test_virtio_hello] Error 2 gmake[1]: Leaving directory '/home/asteen/devl/solo5/tests' gmake: *** [GNUmakefile:33: virtio] Error 2
gmake -C kernel virtio gmake[1]: Entering directory '/home/asteen/devl/solo5/kernel' clang -fPIC -nostdlibinc -ffreestanding -mno-red-zone -mno-sse -mno-mmx -mno-aes -mno-avx -isystem /home/asteen/devl/solo5/include-host -std=gnu99 -Wall -Wextra -Werror -O2 -g -D__SOLO5_KERNEL__ -DASM_FILE -c virtio/boot.S -o virtio/boot.o virtio/boot.S:38:1: warning: DWARF2 only supports one section per compilation unit .section .data.multiboot ^ virtio/boot.S:51:1: warning: DWARF2 only supports one section per compilation unit .section .bss ^ clang -fPIC -nostdlibinc -ffreestanding -mno-red-zone -mno-sse -mno-mmx -mno-aes -mno-avx -isystem /home/asteen/devl/solo5/include-host -std=gnu99 -Wall -Wextra -Werror -O2 -g -D__SOLO5_KERNEL__ -c virtio/kernel.c -o virtio/kernel.o clang -fPIC -nostdlibinc -ffreestanding -mno-red-zone -mno-sse -mno-mmx -mno-aes -mno-avx -isystem /home/asteen/devl/solo5/include-host -std=gnu99 -Wall -Wextra -Werror -O2 -g -D__SOLO5_KERNEL__ -c virtio/platform.c -o virtio/platform.o clang -fPIC -nostdlibinc -ffreestanding -mno-red-zone -mno-sse -mno-mmx -mno-aes -mno-avx -isystem /home/asteen/devl/solo5/include-host -std=gnu99 -Wall -Wextra -Werror -O2 -g -D__SOLO5_KERNEL__ -c virtio/platform_intr.c -o virtio/platform_intr.o clang -fPIC -nostdlibinc -ffreestanding -mno-red-zone -mno-sse -mno-mmx -mno-aes -mno-avx -isystem /home/asteen/devl/solo5/include-host -std=gnu99 -Wall -Wextra -Werror -O2 -g -D__SOLO5_KERNEL__ -c virtio/pci.c -o virtio/pci.o clang -fPIC -nostdlibinc -ffreestanding -mno-red-zone -mno-sse -mno-mmx -mno-aes -mno-avx -isystem /home/asteen/devl/solo5/include-host -std=gnu99 -Wall -Wextra -Werror -O2 -g -D__SOLO5_KERNEL__ -c virtio/serial.c -o virtio/serial.o clang -fPIC -nostdlibinc -ffreestanding -mno-red-zone -mno-sse -mno-mmx -mno-aes -mno-avx -isystem /home/asteen/devl/solo5/include-host -std=gnu99 -Wall -Wextra -Werror -O2 -g -D__SOLO5_KERNEL__ -c virtio/time.c -o virtio/time.o clang -fPIC -nostdlibinc -ffreestanding -mno-red-zone -mno-sse -mno-mmx -mno-aes -mno-avx -isystem /home/asteen/devl/solo5/include-host -std=gnu99 -Wall -Wextra -Werror -O2 -g -D__SOLO5_KERNEL__ -c virtio/virtio_ring.c -o virtio/virtio_ring.o clang -fPIC -nostdlibinc -ffreestanding -mno-red-zone -mno-sse -mno-mmx -mno-aes -mno-avx -isystem /home/asteen/devl/solo5/include-host -std=gnu99 -Wall -Wextra -Werror -O2 -g -D__SOLO5_KERNEL__ -c virtio/virtio_net.c -o virtio/virtio_net.o clang -fPIC -nostdlibinc -ffreestanding -mno-red-zone -mno-sse -mno-mmx -mno-aes -mno-avx -isystem /home/asteen/devl/solo5/include-host -std=gnu99 -Wall -Wextra -Werror -O2 -g -D__SOLO5_KERNEL__ -c virtio/virtio_blk.c -o virtio/virtio_blk.o clang -fPIC -nostdlibinc -ffreestanding -mno-red-zone -mno-sse -mno-mmx -mno-aes -mno-avx -isystem /home/asteen/devl/solo5/include-host -std=gnu99 -Wall -Wextra -Werror -O2 -g -D__SOLO5_KERNEL__ -c virtio/tscclock.c -o virtio/tscclock.o clang -fPIC -nostdlibinc -ffreestanding -mno-red-zone -mno-sse -mno-mmx -mno-aes -mno-avx -isystem /home/asteen/devl/solo5/include-host -std=gnu99 -Wall -Wextra -Werror -O2 -g -D__SOLO5_KERNEL__ -c virtio/clock_subr.c -o virtio/clock_subr.o clang -fPIC -nostdlibinc -ffreestanding -mno-red-zone -mno-sse -mno-mmx -mno-aes -mno-avx -isystem /home/asteen/devl/solo5/include-host -std=gnu99 -Wall -Wextra -Werror -O2 -g -D__SOLO5_KERNEL__ -c virtio/pvclock.c -o virtio/pvclock.o clang -fPIC -nostdlibinc -ffreestanding -mno-red-zone -mno-sse -mno-mmx -mno-aes -mno-avx -isystem /home/asteen/devl/solo5/include-host -std=gnu99 -Wall -Wextra -Werror -O2 -g -D__SOLO5_KERNEL__ -c abort.c -o abort.o clang -fPIC -nostdlibinc -ffreestanding -mno-red-zone -mno-sse -mno-mmx -mno-aes -mno-avx -isystem /home/asteen/devl/solo5/include-host -std=gnu99 -Wall -Wextra -Werror -O2 -g -D__SOLO5_KERNEL__ -c cpu_x86_64.c -o cpu_x86_64.o clang -fPIC -nostdlibinc -ffreestanding -mno-red-zone -mno-sse -mno-mmx -mno-aes -mno-avx -isystem /home/asteen/devl/solo5/include-host -std=gnu99 -Wall -Wextra -Werror -O2 -g -D__SOLO5_KERNEL__ -DASM_FILE -c cpu_vectors_x86_64.S -o cpu_vectors_x86_64.o clang -fPIC -nostdlibinc -ffreestanding -mno-red-zone -mno-sse -mno-mmx -mno-aes -mno-avx -isystem /home/asteen/devl/solo5/include-host -std=gnu99 -Wall -Wextra -Werror -O2 -g -D__SOLO5_KERNEL__ -c ee_printf.c -o ee_printf.o clang -fPIC -nostdlibinc -ffreestanding -mno-red-zone -mno-sse -mno-mmx -mno-aes -mno-avx -isystem /home/asteen/devl/solo5/include-host -std=gnu99 -Wall -Wextra -Werror -O2 -g -D__SOLO5_KERNEL__ -c intr.c -o intr.o clang -fPIC -nostdlibinc -ffreestanding -mno-red-zone -mno-sse -mno-mmx -mno-aes -mno-avx -isystem /home/asteen/devl/solo5/include-host -std=gnu99 -Wall -Wextra -Werror -O2 -g -D__SOLO5_KERNEL__ -c lib.c -o lib.o clang -fPIC -nostdlibinc -ffreestanding -mno-red-zone -mno-sse -mno-mmx -mno-aes -mno-avx -isystem /home/asteen/devl/solo5/include-host -std=gnu99 -Wall -Wextra -Werror -O2 -g -D__SOLO5_KERNEL__ -c mem.c -o mem.o clang -fPIC -nostdlibinc -ffreestanding -mno-red-zone -mno-sse -mno-mmx -mno-aes -mno-avx -isystem /home/asteen/devl/solo5/include-host -std=gnu99 -Wall -Wextra -Werror -O2 -g -D__SOLO5_KERNEL__ -c malloc.c -o malloc.o clang -fPIC -nostdlibinc -ffreestanding -mno-red-zone -mno-sse -mno-mmx -mno-aes -mno-avx -isystem /home/asteen/devl/solo5/include-host -std=gnu99 -Wall -Wextra -Werror -O2 -g -D__SOLO5_KERNEL__ -c exit.c -o exit.o clang -fPIC -nostdlibinc -ffreestanding -mno-red-zone -mno-sse -mno-mmx -mno-aes -mno-avx -isystem /home/asteen/devl/solo5/include-host -std=gnu99 -Wall -Wextra -Werror -O2 -g -D__SOLO5_KERNEL__ -c log.c -o log.o clang -fPIC -nostdlibinc -ffreestanding -mno-red-zone -mno-sse -mno-mmx -mno-aes -mno-avx -isystem /home/asteen/devl/solo5/include-host -std=gnu99 -Wall -Wextra -Werror -O2 -g -D__SOLO5_KERNEL__ -c cmdline.c -o cmdline.o ld -r -nostdlib -z max-page-size=0x1000 -static -o virtio/solo5.o virtio/boot.o virtio/kernel.o virtio/platform.o virtio/platform_intr.o virtio/pci.o virtio/serial.o virtio/time.o virtio/virtio_ring.o virtio/virtio_net.o virtio/virtio_blk.o virtio/tscclock.o virtio/clock_subr.o virtio/pvclock.o abort.o cpu_x86_64.o cpu_vectors_x86_64.o ee_printf.o intr.o lib.o mem.o malloc.o exit.o log.o cmdline.o objcopy -w -G solo5_\* -G _start\* virtio/solo5.o virtio/solo5.o gmake[1]: Leaving directory '/home/asteen/devl/solo5/kernel' gmake -C tests virtio gmake[1]: Entering directory '/home/asteen/devl/solo5/tests' gmake -C test_hello virtio gmake[2]: Entering directory '/home/asteen/devl/solo5/tests/test_hello' clang -fPIC -nostdlibinc -ffreestanding -mno-red-zone -isystem /home/asteen/devl/solo5/include-host -std=gnu99 -Wall -Wextra -Werror -O2 -g -I/home/asteen/devl/solo5/kernel -c test_hello.c -o test_hello.o ld -T /home/asteen/devl/solo5/kernel/virtio/solo5.lds \ -nostdlib -z max-page-size=0x1000 -static -o test_hello.virtio /home/asteen/devl/solo5/kernel/virtio/solo5.o test_hello.o ld: /home/asteen/devl/solo5/kernel/virtio/solo5.o: relocation R_X86_64_32 against `a local symbol' can not be used when making a shared object; recompile with -fPIC /home/asteen/devl/solo5/kernel/virtio/solo5.o: could not read symbols: Bad value gmake[2]: *** [../Makefile.tests:64: test_hello.virtio] Error 1 gmake[2]: Leaving directory '/home/asteen/devl/solo5/tests/test_hello' gmake[1]: *** [GNUmakefile:43: _test_virtio_hello] Error 2 gmake[1]: Leaving directory '/home/asteen/devl/solo5/tests' gmake: *** [GNUmakefile:33: virtio] Error 2