Building binutils for Linux with PE output format
Building binutils for Linux with PE output format
Hi,
Is it possible/(anyone had luck) to build binutils for i386 plattform outputing PE format on a Linux/BSD/MacOS ELF plattform?
The output format should not have any ties to what plattform it runs on, but i cant find where to enable it in the Makefiles..
LD in mingw and cygwin of course outputs PE, but is that a patched version of LD that adds this or is PE a part of LD ?
The background is;
I moved from a PC to a MAC laptop and want my mac to be able to output PE files as well as ELF.. I installed mac ports and have gcc and binutils working fine, but i miss PE output.
Really need it because my kernel needs kernel+modules in a supported format, and for now only PE loading is complete in my kernel. Elf still have some coding todo before it can load both formats.
Using grub and multiboot loading to load image + modules.. My kernel detects the image formats and load them accordingly into memory and fixes up relocs etc.
best regards
Thomas
Is it possible/(anyone had luck) to build binutils for i386 plattform outputing PE format on a Linux/BSD/MacOS ELF plattform?
The output format should not have any ties to what plattform it runs on, but i cant find where to enable it in the Makefiles..
LD in mingw and cygwin of course outputs PE, but is that a patched version of LD that adds this or is PE a part of LD ?
The background is;
I moved from a PC to a MAC laptop and want my mac to be able to output PE files as well as ELF.. I installed mac ports and have gcc and binutils working fine, but i miss PE output.
Really need it because my kernel needs kernel+modules in a supported format, and for now only PE loading is complete in my kernel. Elf still have some coding todo before it can load both formats.
Using grub and multiboot loading to load image + modules.. My kernel detects the image formats and load them accordingly into memory and fixes up relocs etc.
best regards
Thomas
- Firestryke31
- Member
- Posts: 550
- Joined: Sat Nov 29, 2008 1:07 pm
- Location: Throw a dart at central Texas
- Contact:
Re: Building binutils for Linux with PE output format
IIRC you can configure a build of GCC with a target of MinGW. I've done this (or something very close) before under Linux, and it should work on Mac as well. It's a bit complicated to explain, but basically I just followed the cross-compiler wiki tutorial and substituted i686-pc-mingw instead of i686-pc-elf or whatever.
Owner of Fawkes Software.
Wierd Al wrote: You think your Commodore 64 is really neato,
What kind of chip you got in there, a Dorito?
Re: Building binutils for Linux with PE output format
Hi,
Thanks for you replies. For sure i have searched the wiki for building LD and more specific outputting PE but could not find any specific.
Could not find anything usefull on binutils docs online either.
Im pretty familiar with building a binutils+gcc cross, but building with mingw would need some additional sources (mingw) wouldn´t it?
If it was as easy as setting TARGET before configuring and compiling that would be nice, but are you sure this works?
But hey, i will give it a shot.. Will post back any results
Thanks for you replies. For sure i have searched the wiki for building LD and more specific outputting PE but could not find any specific.
Could not find anything usefull on binutils docs online either.
Im pretty familiar with building a binutils+gcc cross, but building with mingw would need some additional sources (mingw) wouldn´t it?
If it was as easy as setting TARGET before configuring and compiling that would be nice, but are you sure this works?
But hey, i will give it a shot.. Will post back any results
Re: Building binutils for Linux with PE output format
This wiki article http://wiki.osdev.org/OS_Specific_Toolchain has more information than any I have ever found on the 'net. it seems this part of binutils is not well documented. You can create your own target with a bit of experimentation.
However, it would be easier to make an ELF loader (read 60 page doc and write 10 lines of c code) than to create a new binutils target (no documents, horrible scripts, unknown dependancies, difficult verification) etc. I've done both these things. The ELF loader took an evening. My first port of binutils took more than a week.
However, it would be easier to make an ELF loader (read 60 page doc and write 10 lines of c code) than to create a new binutils target (no documents, horrible scripts, unknown dependancies, difficult verification) etc. I've done both these things. The ELF loader took an evening. My first port of binutils took more than a week.
If a trainstation is where trains stop, what is a workstation ?
- Owen
- Member
- Posts: 1700
- Joined: Fri Jun 13, 2008 3:21 pm
- Location: Cambridge, United Kingdom
- Contact:
Re: Building binutils for Linux with PE output format
You are aware that Macs don't use ELF?mutex wrote:I moved from a PC to a MAC laptop and want my mac to be able to output PE files as well as ELF.. I installed mac ports and have gcc and binutils working fine, but i miss PE output.
(Otherwise people have answered your question: Pick an appropriate target)
Re: Building binutils for Linux with PE output format
Does not really matter in this case.
The only thing i want is ld to be able to output PE format..
The only thing i want is ld to be able to output PE format..
Re: Building binutils for Linux with PE output format
I have tried to compile various versions of binutils now, but different errors on compilation. Googling the error codes shows alot of people have same issues on Mac. Problems mostly due to issues with the gcc toolchain on MacOSX.
I found one other thing though;
That solved the whole deal.. They had ALOT of other "ports" for other architectures aswell...
http://www.macports.org/ports.php?by=name&substr=gcc
I found one other thing though;
Code: Select all
port install i386-mingw32-gcc
That solved the whole deal.. They had ALOT of other "ports" for other architectures aswell...
http://www.macports.org/ports.php?by=name&substr=gcc
Re: Building binutils for Linux with PE output format
I never had any problem building binutils on macosx. What problems do you have ?I have tried to compile various versions of binutils now, but different errors on compilation. Googling the error codes shows alot of people have same issues on Mac. Problems mostly due to issues with the gcc toolchain on MacOSX.
If a trainstation is where trains stop, what is a workstation ?
Re: Building binutils for Linux with PE output format
Hi,
The problems was different;
2.20.1 complained about missing stat64_s struct or something and there was serveral warnings treated as errors when using "deprecated features".
2.19 complained that compiler was not able to produce executable files. I checked ld/cc/gcc/cpp but could not find anything. Found a few articles on the web mentioning the same.
2.14 same as 2.14
etc.. probably issues that could be easily resolved, but i was not in the mood for using hours on getting it to work. Not familiar enough with MacOSX yet..
It might be that the xcode i have installed are missing something. Im not sure, but i did a full install.
Ports install of gcc worked well. Could proably use that toolchain to compile binutils, but found that it was in ports already so i used that.
The problems was different;
2.20.1 complained about missing stat64_s struct or something and there was serveral warnings treated as errors when using "deprecated features".
2.19 complained that compiler was not able to produce executable files. I checked ld/cc/gcc/cpp but could not find anything. Found a few articles on the web mentioning the same.
2.14 same as 2.14
etc.. probably issues that could be easily resolved, but i was not in the mood for using hours on getting it to work. Not familiar enough with MacOSX yet..
It might be that the xcode i have installed are missing something. Im not sure, but i did a full install.
Ports install of gcc worked well. Could proably use that toolchain to compile binutils, but found that it was in ports already so i used that.
Re: Building binutils for Linux with PE output format
2.20.1 does build. I think that you'll find that the 'warning: ‘stat64’ is deprecated ' is only a warning, not an error. If you addmutex wrote:Hi,
The problems was different;
2.20.1 complained about missing stat64_s struct or something and there was serveral warnings treated as errors when using "deprecated features".
2.19 complained that compiler was not able to produce executable files. I checked ld/cc/gcc/cpp but could not find anything. Found a few articles on the web mentioning the same.
2.14 same as 2.14
etc.. probably issues that could be easily resolved, but i was not in the mood for using hours on getting it to work. Not familiar enough with MacOSX yet..
It might be that the xcode i have installed are missing something. Im not sure, but i did a full install.
Ports install of gcc worked well. Could proably use that toolchain to compile binutils, but found that it was in ports already so i used that.
Code: Select all
--disable-werror
By the way, the 'config.guess' in old versions of binutils fails on recent versions of MacOSX so configure does not run. I guess that's what's happening with version 2.14
If a trainstation is where trains stop, what is a workstation ?