OSDev.org

The Place to Start for Operating System Developers
It is currently Fri Mar 29, 2024 4:43 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 23 posts ]  Go to page Previous  1, 2
Author Message
 Post subject: Re: ARM Overview Revert
PostPosted: Tue Feb 25, 2014 11:46 am 
Offline
Member
Member
User avatar

Joined: Wed Mar 21, 2012 3:01 pm
Posts: 930
Pancakes: User-space hosted libgcc for linux will depend on stuff from the standard library, in this case you should provide most all these functions anyway (memset, memcpy, memmove and memcmp are all required unconditionally by gcc according to the documentation, even if -ffreestanding) and the rest are trivial to add.

Next, you can't and shouldn't use linux libgcc in your custom OS! (arm-linux-gnueabi is not a suitable target just like x86_64-linux-gnu isn't a suitable target for osdev, besides Linux). You need a cross-libgcc as well. The standard cross-compiler tutorial covers this and it is really simple. See Bare Bones on how to use the cross-libgcc, it's really as simple as just passing -lgcc when you link with your compiler (rather than ld). The cross-libgcc will be static unless you explicitly added shared library support to your cross-toolchain.

Note also that error means you are attempting to link in glibc into your system! That's likely very wrong. I suppose I will have to look at your tutorial carefully to see what is going on.

libgcc isn't fragile as such, you simply need to link in the correct libgcc. The fragile part is that if you clone libgcc, you will not stay in sync with the upstream libgcc and this is the fragile part.

I suppose I should do a libgcc FAQ with a better overview.


Top
 Profile  
 
 Post subject: Re: ARM Overview Revert
PostPosted: Tue Feb 25, 2014 12:14 pm 
Offline
Member
Member
User avatar

Joined: Mon Mar 19, 2012 1:52 pm
Posts: 75
Hmm.. that makes sense. Thanks for the explanation. Yeah, I never followed a specific tutorial. I been messing around with osdev for like 10 years and just never used LIBGCC mainly because I never had a reason to make sure it was linked in until I started messing with ARM.

But, I am very happy at all the information that has come of this that can be put into the wiki!

I am the redneck programmer.. I can make it work. It just might look funny with all that duct tape on it.

Quote:
I suppose I should do a libgcc FAQ with a better overview.

You know also if you can make sure people actually know that LIBGCC is important, and then know they need to read the FAQ. I bet there are a lot of people who do not even know that the library is needed because their linker never complains of any missing symbols, because the compiler just happened to not emit any symbols for it. (Me is one of them) I always targeted X86 and I just never ran into a situation where I needed LIBGCC so I never knew it existed or was needed, and I always pull the cross-compiler binaries (never by hand) so never ran across anything that said I needed it.


Top
 Profile  
 
 Post subject: Re: ARM Overview Revert
PostPosted: Tue Feb 25, 2014 1:37 pm 
Offline
Member
Member
User avatar

Joined: Wed Mar 21, 2012 3:01 pm
Posts: 930
I took the liberty of writing a wiki article about libgcc and how to use it:

http://wiki.osdev.org/Libgcc

Please let me know if you have further questions.


Top
 Profile  
 
 Post subject: Re: ARM Overview Revert
PostPosted: Tue Feb 25, 2014 2:02 pm 
Offline
Member
Member
User avatar

Joined: Mon Mar 19, 2012 1:52 pm
Posts: 75
I linked in the page here:
http://wiki.osdev.org/index.php?title=A ... ldid=15626

So now readers should get pushed toward LIBGCC, and if they for some reason just want to tinker around with the internals then they can read about the discussions on the forums and get a good idea of what is going on.


Top
 Profile  
 
 Post subject: Re: ARM Overview Revert
PostPosted: Tue Feb 25, 2014 2:39 pm 
Offline
Member
Member
User avatar

Joined: Wed Mar 21, 2012 3:01 pm
Posts: 930
I think it's best if you don't say "it's recommended to use libgcc" but just say "you need to use libgcc". Experts can do without libgcc, just like they can do without a real cross-compiler - but it's bad advise to give to newbies. I'm slowly pruning all references to osdev without a cross-compiler from the wiki as it is the right way to do things and causes fewer support requests when things break; I think the same logic applies in regards to libgcc. Experts know to disregard wiki advise regardless.

Thanks for helping me link my new article to existing wiki articles. :)


Top
 Profile  
 
 Post subject: Re: ARM Overview Revert
PostPosted: Tue Feb 25, 2014 5:24 pm 
Offline
Member
Member

Joined: Sun Jan 14, 2007 9:15 pm
Posts: 2566
Location: Sydney, Australia (I come from a land down under!)
As a side note, you almost certainly always want an 'arm-eabi' cross-compiler for ARM (rather than 'arm-elf', and definitely not 'arm-linuxeabi' :) ) - this will help with a variety of things, including libgcc.

_________________
Pedigree | GitHub | Twitter | LinkedIn


Top
 Profile  
 
 Post subject: Re: ARM Overview Revert
PostPosted: Tue Feb 25, 2014 5:33 pm 
Offline
Member
Member
User avatar

Joined: Mon Mar 19, 2012 1:52 pm
Posts: 75
Yep, Lets link it everywhere we can and it is needed. So people know about it.


Top
 Profile  
 
 Post subject: Re: ARM Overview Revert
PostPosted: Tue Feb 25, 2014 5:36 pm 
Offline
Member
Member
User avatar

Joined: Wed Mar 21, 2012 3:01 pm
Posts: 930
No need, I have already searched the wiki for the articles that mention it and added the needed links.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 23 posts ]  Go to page Previous  1, 2

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 22 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