Adding support for the x86_64-elf target to binutils and gcc

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
mkr

Adding support for the x86_64-elf target to binutils and gcc

Post by mkr »

Hi!

Yesterday, I was going to try to build a x86_64-elf cross-compiler. I, of course, had a look inside the wiki, and got a bit disappointed by reading the x86_64-elf stuff in the cross-compiler section.

Sure enough, it didn't work out of the box. There were problems with both binutils and gcc. Luckily, after some light hacking around, I got it to build, by adding various entries to configuration files around the source trees.

This is why I today am sitting with my lovely 'non os-specific' x86_64-elf toolchain. :)

Now, to the patches. Please note that this only was what I needed to build the toolchain. I used cvs snapshots of both gcc and binutils, so your results may vary:

http://omfg.linux.dk/pub/x86_64-elf/
http://omfg.linux.dk/pub/x86_64-elf/README
http://omfg.linux.dk/pub/x86_64-elf/binutils-add-clean-x86_64-elf-bfd-target.patch
http://omfg.linux.dk/pub/x86_64-elf/binutils-add-clean-x86_64-elf-ld-target.patch
http://omfg.linux.dk/pub/x86_64-elf/gcc-add-clean-x86_64-elf-config-target.patch

I have not yet posted these to the -dev mailing lists of either binutils or gcc, because I wanted some feedback first. So, please, post your results!

Thanks,
mkr
User avatar
Candy
Member
Member
Posts: 3882
Joined: Tue Oct 17, 2006 11:33 pm
Location: Eindhoven

Re:Adding support for the x86_64-elf target to binutils and

Post by Candy »

Tried the exact same a few days ago only, but I couldn't get gcc off of including libstdc++ and libiberty, which screwed up my compile. How did you fish them out?
mkr

Re:Adding support for the x86_64-elf target to binutils and

Post by mkr »

I see that libstdc++ fails here too. I only configured my gcc with --enable-languages=c, so I reckon libstdc++ wasn't built. Must be some buggy code in their cvs.

I didn't face any problem with building libiberty, though.

Did you try the patches, did they work?

Thanks,
mkr
User avatar
Candy
Member
Member
Posts: 3882
Joined: Tue Oct 17, 2006 11:33 pm
Location: Eindhoven

Re:Adding support for the x86_64-elf target to binutils and

Post by Candy »

mkr wrote: I see that libstdc++ fails here too. I only configured my gcc with --enable-languages=c, so I reckon libstdc++ wasn't built. Must be some buggy code in their cvs.

I didn't face any problem with building libiberty, though.

Did you try the patches, did they work?
Didn't try the patches because I changed the exact same thing a few weeks ago. Also made a patch to libstdc++ so it at least runs through configure, but then it hangs on compiling. Then I tried to configure gcc to skip the entirety of stdc++ and iberty, but I couldn't find any --disable- or --without- that did that. Still searching though...

Might be libiberty went ok, not sure. At least the compile failed and I couldn't get it fixed within the time I had for it that day.
mkr

Re:Adding support for the x86_64-elf target to binutils and

Post by mkr »

I haven't yet thoroughly looked at getting gcc to build with anything other than --languages=c, but I guess I should.

I must admit that I've already submitted the patches. Noone has responed to the one on the gcc mailing list (probably because I forgot a couple of things in my patch, e.g. adding ChangeLogs, etc.

The other good news is, that the binutils patch have gotten into cvs[1], thanks to Nick Clifton (for applying, and adding ChangeLogs for me ;)).

I'll have to take a better look at the gcc patch, and perhaps add more to it, before resending it. (Unless anyone else steps up, of course ;))

Regards,
mkr

[1] http://sources.redhat.com/ml/binutils-c ... 00174.html
Post Reply