undefined reference to `_GLOBAL_OFFSET_TABLE_' in gcc 32-bit code for a trivial function, freestanding OS
问题 I have a small c code file(function.c): int function() { return 0x1234abce; } I am using a 64 bit machine. However, I want to write a small 32 bit OS. I want to compile the code into a 'pure' assembly/binary file. I compile my code with: gcc function.c -c -m32 -o file.o -ffreestanding # This gives you the object file I link it with: ld -o function.bin -m elf_i386 -Ttext 0x0 --oformat binary function.o I am getting the following error: function.o: In function `function': function.c:(.text+0x9)