Error when trying to linking crtbeging.o [SOLVED]

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.
Post Reply
moige
Posts: 4
Joined: Thu Dec 27, 2018 1:45 pm
Libera.chat IRC: moige

Error when trying to linking crtbeging.o [SOLVED]

Post by moige »

Hi,

I'm a beginner in OS development. I just started few days ago and I'm in the firsts steps described in Bare Bones Kernel on osdev wiki.
Right now, I'm trying to link crtbegin.o and crtend.o, with the respective crti.o and crtn.o in my Kernel, but in linking time, with ld, the follow error is just aborting the process:

Code: Select all

/usr/bin/ld: /usr/lib/gcc/x86_64-pc-linux-gnu/8.2.1/32/crtbegin.o: direct GOT relocation R_386_GOT32X against `_ITM_deregisterTMCloneTable' without base register can not be used when making a shared object
/usr/bin/ld: final link failed: nonrepresentable section on output
collect2: error: ld returned 1 exit status
I found a solution that imply pass -no-pie option to ld, but if I link the kernel with that flag, the command "grub-file --is-x86-multiboot" return non-zero result, so I can't boot my kernel with qemu. What can I do to solve this?
I will attach my Makefile so you can see my GCC, ld and GNAS options. If another file is needed, just tell me.

EDIT:
GCC 8.2.1
GNU ld 2.31.1
GNAS 2.31.1
I'm using qemu-system-i386 with -kernel option to boot my system
Linux x86_64 4.19.2 in ArchLinux
Attachments
Makefile.txt
.txt extenseion because I can't submit it without extension.
(1.34 KiB) Downloaded 66 times
Last edited by moige on Thu Dec 27, 2018 8:01 pm, edited 1 time in total.
Octocontrabass
Member
Member
Posts: 5586
Joined: Mon Mar 25, 2013 7:01 pm

Re: Error when trying to linking crtbeging.o

Post by Octocontrabass »

moige wrote:I just started few days ago and I'm in the firsts steps described in Bare Bones Kernel on osdev wiki.
Do you mean this one? If so, you've skipped the section on building a cross-compiler. Go back and do that first.
moige
Posts: 4
Joined: Thu Dec 27, 2018 1:45 pm
Libera.chat IRC: moige

Re: Error when trying to linking crtbeging.o

Post by moige »

Octocontrabass wrote:
moige wrote:I just started few days ago and I'm in the firsts steps described in Bare Bones Kernel on osdev wiki.
Do you mean this one? If so, you've skipped the section on building a cross-compiler. Go back and do that first.
Problem solved. Thanks.
Post Reply