[haiku-development] Re: FatELF Implementation

  • From: Landon J Fuller <landonf@xxxxxxxxxxxxxx>
  • To: haiku-development@xxxxxxxxxxxxx
  • Date: Wed, 28 Nov 2012 11:41:56 -0500

On Nov 28, 2012, at 5:59 AM, Jonathan Schleifer 
<js-haiku-development@xxxxxxxxxxx> wrote:

> Am 27.11.2012 um 01:20 schrieb Landon J Fuller:
> 
>>      - Developer tools, including gcc and gdb. My goal is that one can run 
>> simply run:
>>              gcc -arch x86 -arch x86_64 -arch x86-gcc2 hello.c -o hello
> 
> This won't be easy with GCC. Apple patched a lot to make that happen. Have a 
> look at Clang instead, which works just fine on Haiku. Clang would be a 
> better replacement for GCC2 than GCC4 anyway, IMHO, which is why I'm working 
> in getting Haiku to work when compiled with Clang. The main problems left are 
> in the kernel space - and my limited time.

Agreed on clang being the route forward. For existing GCC support, though, I 
believe the road is passable. Apple patched GCC up the wazoo, but as I 
understand it, all the support for fat binaries was done by implementing a 
wrapping compiler driver-driver that actually called out to standard underlying 
GCC cross-compilers, and then linked the results:
        http://opensource.apple.com/source/gcc/gcc-5664/driverdriver.c

The compilers are actually built for multiple targets and hosts via:
        http://opensource.apple.com/source/gcc/gcc-5664/build_gcc

While I've spent a good amount of time with the Apple GCC forks, I've done 
almost no hacking on clang; any advice you can offer there would be hugely 
useful.


>> The latter goal is a large one, and will also involve implementing 32-bit 
>> syscall compatibility in the x86-64 port, unless someone else beats me to it.
> 
> I think FatELF should be fully working before we try to add a compatibility 
> layer for multiarch, don't you think? ;) And even then, I'm not sure how 
> necessary that will be. And I guess such a compatibility layer will be a huge 
> pain: After all, it also needs to suppor gcc2 and gcc4.

Yep! Really, the runtime support is all functional now, and if you manually 
assembled fat binaries (kernel, userspace, or otherwise), everything would just 
work. At this point, it's a question of being able to build the binaries 
easily, build system integration, OSABI differentiation between gcc2/gcc4, and 
having a target goal that demonstrates FatELF's value.

>> All said, I spent about five days of full-time development on implementing 
>> this (and getting familiar with Haiku at the same time), and it was a lot of 
>> fun. I plan on spending more time on additional work on Haiku in the future, 
>> if you'll have me.
> 
> Nice! I'm looking forward to it, it will really make the GCC2/GCC4 mess 
> easier :).

Thanks, I hope so!

-landonf

Other related posts: