OSDev.org

The Place to Start for Operating System Developers
It is currently Thu Mar 28, 2024 10:41 pm

All times are UTC - 6 hours




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Can't build libgcc for kernel mode
PostPosted: Sun May 26, 2019 7:07 am 
Offline

Joined: Sat May 11, 2019 1:31 pm
Posts: 2
Hi.

I'm trying to build libgcc by following https://wiki.osdev.org/Building_libgcc_for_mcmodel%3Dkernel. The sed command doesn't help at all (it does what it's supposed to, but looks like that's not what has to be done) and the build fails again for the same reason. I have followed the https://wiki.osdev.org/GCC_Cross-Compiler article up to this point.
I have also tried with this multilib setup
Code:
MULTILIB_OPTIONS += mno-red-zone mcmodel=kernel/fpic

but the result is the same.

I'm using gcc 7.4.0 on ubuntu, first tried compiling gcc 8.3, then 9.1, same results both times. Although I didn't try the multilib thing on 8.3.

A web search returns a bunch of posts about not being able to compile the linux kernel, and suggests adding -fno-pie to some flags, but that was supposed to be what the sed command in the libgcc article does.

Has anyone else had issues with this?


Top
 Profile  
 
 Post subject: Re: Can't build libgcc for kernel mode
PostPosted: Sun May 26, 2019 9:53 am 
Offline
Member
Member
User avatar

Joined: Mon Sep 03, 2018 2:25 am
Posts: 66
I dealt with this problem a short while ago and made a small build script for it, maybe it can help you

https://github.com/sigma-os/bootstrap/blob/master/build-crosscompiler.sh


Top
 Profile  
 
 Post subject: Re: Can't build libgcc for kernel mode
PostPosted: Sun May 26, 2019 11:44 am 
Offline

Joined: Sat May 11, 2019 1:31 pm
Posts: 2
Quote:
I dealt with this problem a short while ago and made a small build script for it, maybe it can help you


I took a look at it. While it's essentially the same as the way the article does it, it did work and set me on the path to finding the root of my issue. Looks like the problem was my gcc directory still had the modifications I made from following https://wiki.osdev.org/Libgcc_without_red_zone. I removed those and it worked. Thanks.

Does anyone know if this can be done with multilib configuration? It seems really hackish using sed to modify makefiles, and I would preferably not have to have two gccs to build my kernel and stuff that runs in the lower address space. As far as I understand it that's basically the other way to do it. Unless I'm missing something?


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: Majestic-12 [Bot] and 60 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group