OSDev.org
https://forum.osdev.org/

Error when trying to linking crtbeging.o [SOLVED]
https://forum.osdev.org/viewtopic.php?f=1&t=33398
Page 1 of 1

Author:  moige [ Thu Dec 27, 2018 2:17 pm ]
Post subject:  Error when trying to linking crtbeging.o [SOLVED]

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:
/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:
File comment: .txt extenseion because I can't submit it without extension.
Makefile.txt [1.34 KiB]
Downloaded 14 times

Author:  Octocontrabass [ Thu Dec 27, 2018 2:48 pm ]
Post subject:  Re: Error when trying to linking crtbeging.o

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.

Author:  moige [ Thu Dec 27, 2018 8:00 pm ]
Post subject:  Re: Error when trying to linking crtbeging.o

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.

Page 1 of 1 All times are UTC - 6 hours
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/