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.
You can't combine two object files that way. If you need a single file that contains both object files, create a static library with i386-elf-ar. Otherwise, delete that line in your makefile and link both object files separately into your final kernel binary.
Your Makefile is very broken. You should really model the actual dependencies, not write pseudo batch files. There is also this linking step in the middle that I don't understand: Why are you linking gdtc.o and gdts.o into a single executable file? It is possible that you actually wanted a relocatable link (-r) here, but again, why? Why not just put gdtc.o and gdts.o on the final linker command line?
I used to have it like this: i386-elf-gcc -ffreestanding -m32 -g -nostdlib -nostartfiles -Ttext 0x1000 -o build/gdt.o src/kernel/gdt/gdt.c src/kernel/gdt/gdt.s
But then I started getting errors about it not being compiled correctly:
Oh, thankyou nullplan, I think I get it now! I've been so confused, and somehow never considered linking the files separately, sorry for wasting your time
Capybara Gymastics is one of the most prestigious Olympic sports
That command line still tries to perform an executable link. And it still does not make sense to me. It is actually very simple:
If the command line contains a -c switch, it compiles to an object file.
If it contains a -r switch, it will perform a relocatable link (i.e. combine object files to another object file).
If it contains a -shared, it will perform a shared lib link (i.e. combine object files to a shared library).
And if it contains none of these, it will perform an executable link.
The reason you are getting those messages is because gdt.s is written for nasm, and you are passing it to GCC, which attempts to compile it with gas, which has a different syntax. But again, you can just add gdts.o and gdtc.o to the linker command line for the main kernel, and get rid of building gdt.o altogether.