[haiku] Re: [GSoC] x86_64 application rough draft

  • From: Ingo Weinhold <ingo_weinhold@xxxxxx>
  • To: haiku@xxxxxxxxxxxxx
  • Date: Sat, 10 Apr 2010 09:31:16 +0200

On 2010-04-09 at 23:49:56 [+0200], Nathan Mentley <nathanmentley@xxxxxxxxx> 
wrote:
> Hey, If someone doesn't mind taking a few seconds... minutes... to help me
> out.
>
>  My plan is to submit a few patches to the gcc in buildtools that'll work
> towards gcc outputting haiku elf64 binaries in the next few days, but I'm by
> far not a gcc hacking expert.

Excellent initiative! :-)

I'm certainly not a gcc expert either, but well...

>  So far I've been looking around buildtools/gcc/gcc/config and
> buildtools/gcc/gcc/config/i386
> 
>  In buildtools/gcc/gcc/config/i386 I've found beos-elf.h. <-- I'm assuming
> that's only used for beos and not for haiku...

Exactly. There's no code/configuration shared with the BeOS port (aside from 
stuff that is generally shared, like for ELF).

> So I'll be leaving that
> alone, but in the same folder I found a haiku.h.

That's the equivalent.

> After looking at a
> linux64.h I've made a haiku64.h that I think should work for 64bit haiku elf
> files.

Sounds good.

>  in the buildtools/gcc/gcc/config/i386/haiku.h file it references
> elf_i386_haiku.
> 
>  #undef LINK_SPEC
> 
> #define LINK_SPEC "-m elf_i386_haiku -shared -Bsymbolic %{nostart:-e 0}
> %{shared:-e 0} %{!shared: %{!nostart: -no-undefined}}"
> 
>  I'm under the impression that it's referring to the script
> /buildtools/binutils/ld/emulparams/elf_i386_haiku.sh.

Well, the script is part of it. elf_i386_haiku is actually a linker target 
(not sure, if that's the correct term). Have a look at configure.tgt. More 
generally run a "grep -i -r haiku . | grep -v /.svn/" in both binutils and 
gcc to find the spots where you potentially have to change/add something.

> I've created a
> elf_x86_64_haiku.sh in that folder that's now being used by
> /buildtools/gcc/gcc/config/i386/haiku64.h
> 
>  I'm not exactly sure where to go from here. I'm pretty sure I'll need to
> include haiku64.h somewhere. I'm just at a loss of what file(s) include or
> point to /buildtools/gcc/gcc/config/i386/haiku.h... which would helpful
> information in using elf_x86_64_haiku and haiku64.h with gcc.

You should start with gcc/config.gcc. There all targets are specified. You'll 
have to add an x86_64 Haiku target (best search for haiku and also have a 
look at other 64 bit targets). Your new header will have to be specified 
there -- it will then be automatically included whereever needed.

>  Thanks, for any help. Sorry, I'm more inexperienced with modifying gcc than
> I would like to be.

No worries.

CU, Ingo

Other related posts: