haiku: operating system support

Message ID 20210826173430.2070222-1-kallisti5@unixzen.com
State New
Headers show
Series
  • haiku: operating system support
Related show

Commit Message

Alexander von Gluck IV Aug. 26, 2021, 5:34 p.m.
These are the os support patches we have been grooming and
maintaining for quite a few years over on git.haiku-os.org

All of these architectures are working and most have been
stable for quite some time.
---
 bfd/config.bfd                    | 34 +++++++++++++++++++++++++++
 bfd/configure                     |  2 +-
 binutils/configure                |  2 +-
 configure                         |  2 +-
 configure.ac                      |  2 +-
 gas/config/tc-i386.c              |  1 +
 gas/config/te-haiku.h             | 30 ++++++++++++++++++++++++
 gas/configure                     |  2 +-
 gas/configure.tgt                 |  8 +++++++
 gprof/configure                   |  2 +-
 ld/Makefile.am                    |  6 +++++
 ld/Makefile.in                    | 12 ++++++++++
 ld/configure                      |  4 ++--
 ld/configure.tgt                  | 20 ++++++++++++++++
 ld/emulparams/aarch64haiku.sh     | 39 +++++++++++++++++++++++++++++++
 ld/emulparams/armelf_haiku.sh     | 33 ++++++++++++++++++++++++++
 ld/emulparams/elf32ppchaiku.sh    |  7 ++++++
 ld/emulparams/elf_haiku.sh        |  1 +
 ld/emulparams/elf_i386_haiku.sh   |  7 ++++++
 ld/emulparams/elf_mipsel_haiku.sh |  3 +++
 ld/emulparams/elf_x86_64_haiku.sh |  2 ++
 libtool.m4                        |  2 +-
 opcodes/configure                 |  2 +-
 23 files changed, 213 insertions(+), 10 deletions(-)
 create mode 100644 gas/config/te-haiku.h
 create mode 100644 ld/emulparams/aarch64haiku.sh
 create mode 100644 ld/emulparams/armelf_haiku.sh
 create mode 100644 ld/emulparams/elf32ppchaiku.sh
 create mode 100644 ld/emulparams/elf_haiku.sh
 create mode 100644 ld/emulparams/elf_i386_haiku.sh
 create mode 100644 ld/emulparams/elf_mipsel_haiku.sh
 create mode 100644 ld/emulparams/elf_x86_64_haiku.sh

-- 
2.33.0

Comments

Alan Modra via Binutils Sept. 1, 2021, 3:22 p.m. | #1
Hi Alexander,

> These are the os support patches we have been grooming and

> maintaining for quite a few years over on git.haiku-os.org


The patch itself is fine and I would be happy to apply it - but ...
do you have an FSF copyright assignment for the binutils ?

Even though the idea of the patch is quite straight forward I
think that it is substantial enough that we will need an assignment
before it can be applied.

Cheers
   Nick
Alexander von Gluck IV Sept. 1, 2021, 3:52 p.m. | #2
September 1, 2021 10:22 AM, "Nick Clifton" <nickc@redhat.com> wrote:
> Hi Alexander,
> 
>> These are the os support patches we have been grooming and
>> maintaining for quite a few years over on git.haiku-os.org
> 
> The patch itself is fine and I would be happy to apply it - but ...
> do you have an FSF copyright assignment for the binutils ?
> 
> Even though the idea of the patch is quite straight forward I
> think that it is substantial enough that we will need an assignment
> before it can be applied.

Hi!

I'm a bit confused, everything in the patchset is assigning the
copyright to FSF as usual. Everyone who contributed to it agreed to
the current licensing terms.

What is missing?

Thanks!

 -- Alex
Alan Modra via Binutils Sept. 1, 2021, 4:18 p.m. | #3
Hi Alex,

>> The patch itself is fine and I would be happy to apply it - but ...

>> do you have an FSF copyright assignment for the binutils ?



> I'm a bit confused, everything in the patchset is assigning the

> copyright to FSF as usual. Everyone who contributed to it agreed to

> the current licensing terms.

> 

> What is missing?


Just that.  I need to know that the creators of the patch agree to
assign the copyright to the FSF.  The "copyright assignment" I
referred to is a formal agreement which covers future releases as
well, so that I do not have to ask on every submission.  But if
you and the other authors of the patch are happy with just
assigning the contents of this particular patch (for now) then I
can go ahead and apply it.

Cheers
   Nick
Alexander von Gluck IV Sept. 1, 2021, 5:26 p.m. | #4
September 1, 2021 11:19 AM, "Nick Clifton" <nickc@redhat.com> wrote:
> Hi Alex,
> 
>>> The patch itself is fine and I would be happy to apply it - but ...
>>> do you have an FSF copyright assignment for the binutils ?
>> 
>> I'm a bit confused, everything in the patchset is assigning the
>> copyright to FSF as usual. Everyone who contributed to it agreed to
>> the current licensing terms.
>> What is missing?
> 
> Just that. I need to know that the creators of the patch agree to
> assign the copyright to the FSF. The "copyright assignment" I
> referred to is a formal agreement which covers future releases as
> well, so that I do not have to ask on every submission. But if
> you and the other authors of the patch are happy with just
> assigning the contents of this particular patch (for now) then I
> can go ahead and apply it.

The history here is minor patches applied over roughly 20 years
to files with existing copyrights under FSF and the GPL.

We have a full public vcs log covering that 20 years and everyone
who has contributed from our own git repo.

I understand copyright assignments can't be assumed, however
contributing to binutils source files which are copyrighted to the
FSF under a GPL license without the developers attempting to "adjust"
the copyright headers should be sufficient to indicate continued
implied copyright ownership?

As a step in confirming this, I've CC'ed everyone who authored
patches over the last 20 years to this combined patchset.

To those CC'ed, please indicate any disagreements with continued
implied FSF copyright ownership of source code contributed to binutils.

The overall context is up-streaming our Haiku binutils port.


Data Source: https://git.haiku-os.org/buildtools/log/binutils

Oliver Tappe <zooey@hirschkaefer.de>
Ingo Weinhold <ingo_weinhold@gmx.de>
François Revol <revol@free.fr>
Ithamar R. Adema <ithamar.adema@team-embedded.nl>
Jonas Sundström <jonas@kirilla.com>
Michael Lotz <mmlr@mlotz.ch>
Jérôme Duval <jerome.duval@gmail.com>
Joseph R. Prostko <joe.prostko@gmail.com>
Adrien Destugues <pulkomandy@gmail.com>
Alexander von Gluck IV <kallisti5@unixzen.com>
Simon South <ssouth@simonsouth.com>
Jaroslaw Pelczar <jarek@jpelczar.com>


Nick, let me know if you have any alternative thoughts on this.

Thanks!

 -- Alex
Alexander von Gluck IV Sept. 1, 2021, 5:34 p.m. | #5
September 1, 2021 12:27 PM, "Alexander von Gluck IV" <kallisti5@unixzen.com> wrote:
> September 1, 2021 11:19 AM, "Nick Clifton" <nickc@redhat.com> wrote:
> 
>> Hi Alex,
>> 
>> The patch itself is fine and I would be happy to apply it - but ...
>> do you have an FSF copyright assignment for the binutils ?
>>> I'm a bit confused, everything in the patchset is assigning the
>>> copyright to FSF as usual. Everyone who contributed to it agreed to
>>> the current licensing terms.
>>> What is missing?
>> 
>> Just that. I need to know that the creators of the patch agree to
>> assign the copyright to the FSF. The "copyright assignment" I
>> referred to is a formal agreement which covers future releases as
>> well, so that I do not have to ask on every submission. But if
>> you and the other authors of the patch are happy with just
>> assigning the contents of this particular patch (for now) then I
>> can go ahead and apply it.
>
> As a step in confirming this, I've CC'ed everyone who authored
> patches over the last 20 years to this combined patchset.
> 
> To those CC'ed, please indicate any disagreements with continued
> implied FSF copyright ownership of source code contributed to binutils.

Full disclosure, the following 2 of 11 email addresses bounced:

 * Ithamar R. Adema <ithamar.adema@team-embedded.nl>
   A known alternate email was found and CCed

 * Simon South <ssouth@simonsouth.com>
   Unknown.  However the majority of what was contributed was
   reworked through various binutils updates by myself.
   I feel no relevant changes are left.

-- Alex
Alan Modra via Binutils Sept. 2, 2021, 11:21 a.m. | #6
Hi Alexander,

> These are the os support patches we have been grooming and

> maintaining for quite a few years over on git.haiku-os.org

> 

> All of these architectures are working and most have been

> stable for quite some time.


Right - now that the copyright issue is resolved I have gone ahead and applied your patch.

Cheers
   Nick
Alexander von Gluck IV Sept. 2, 2021, 12:17 p.m. | #7
September 2, 2021 6:21 AM, "Nick Clifton" <nickc@redhat.com> wrote:

> Hi Alexander,
> 
>> These are the os support patches we have been grooming and
>> maintaining for quite a few years over on git.haiku-os.org
>> All of these architectures are working and most have been
>> stable for quite some time.
> 
> Right - now that the copyright issue is resolved I have gone ahead and applied your patch.

Thanks!

There are plans to upstream out gcc patches next,
however that is going to be a *lot* more complex lol.

As a side note, we'll continue to maintain support for this
platform moving forward (though, it should be pretty stable
at this point). I'll make sure anyone who submits binutils
patches is directly involved though to make the copyright
assignment a bit clearer in the future.

 -- Alex
Alan Modra via Binutils Sept. 2, 2021, 2:23 p.m. | #8
Hi,

Le 01/09/2021 à 19:26, Alexander von Gluck IV a écrit :
> September 1, 2021 11:19 AM, "Nick Clifton" <nickc@redhat.com> wrote:

> We have a full public vcs log covering that 20 years and everyone

> who has contributed from our own git repo.

> 

> I understand copyright assignments can't be assumed, however

> contributing to binutils source files which are copyrighted to the

> FSF under a GPL license without the developers attempting to "adjust"

> the copyright headers should be sufficient to indicate continued

> implied copyright ownership?

> 

> As a step in confirming this, I've CC'ed everyone who authored

> patches over the last 20 years to this combined patchset.

> 

> To those CC'ed, please indicate any disagreements with continued

> implied FSF copyright ownership of source code contributed to binutils.


Fine by me!

François.
Alan Modra via Binutils Sept. 3, 2021, 10:01 a.m. | #9
Hi Alex, hi Nick,

I agree to the assignment of copyright ownership to the FSF concerning
my Haiku support contributions to binutils.

Best regards,
Ingo Weinhold


On 01.09.21 19:26, Alexander von Gluck IV wrote:
> September 1, 2021 11:19 AM, "Nick Clifton" <nickc@redhat.com> wrote:

>> Hi Alex,

>>

>>>> The patch itself is fine and I would be happy to apply it - but ...

>>>> do you have an FSF copyright assignment for the binutils ?

>>>

>>> I'm a bit confused, everything in the patchset is assigning the

>>> copyright to FSF as usual. Everyone who contributed to it agreed to

>>> the current licensing terms.

>>> What is missing?

>>

>> Just that. I need to know that the creators of the patch agree to

>> assign the copyright to the FSF. The "copyright assignment" I

>> referred to is a formal agreement which covers future releases as

>> well, so that I do not have to ask on every submission. But if

>> you and the other authors of the patch are happy with just

>> assigning the contents of this particular patch (for now) then I

>> can go ahead and apply it.

>

> The history here is minor patches applied over roughly 20 years

> to files with existing copyrights under FSF and the GPL.

>

> We have a full public vcs log covering that 20 years and everyone

> who has contributed from our own git repo.

>

> I understand copyright assignments can't be assumed, however

> contributing to binutils source files which are copyrighted to the

> FSF under a GPL license without the developers attempting to "adjust"

> the copyright headers should be sufficient to indicate continued

> implied copyright ownership?

>

> As a step in confirming this, I've CC'ed everyone who authored

> patches over the last 20 years to this combined patchset.

>

> To those CC'ed, please indicate any disagreements with continued

> implied FSF copyright ownership of source code contributed to binutils.

>

> The overall context is up-streaming our Haiku binutils port.

>

>

> Data Source: https://git.haiku-os.org/buildtools/log/binutils

>

> Oliver Tappe <zooey@hirschkaefer.de>

> Ingo Weinhold <ingo_weinhold@gmx.de>

> François Revol <revol@free.fr>

> Ithamar R. Adema <ithamar.adema@team-embedded.nl>

> Jonas Sundström <jonas@kirilla.com>

> Michael Lotz <mmlr@mlotz.ch>

> Jérôme Duval <jerome.duval@gmail.com>

> Joseph R. Prostko <joe.prostko@gmail.com>

> Adrien Destugues <pulkomandy@gmail.com>

> Alexander von Gluck IV <kallisti5@unixzen.com>

> Simon South <ssouth@simonsouth.com>

> Jaroslaw Pelczar <jarek@jpelczar.com>

>

>

> Nick, let me know if you have any alternative thoughts on this.

>

> Thanks!

>

>   -- Alex

>
Alexander von Gluck IV Sept. 4, 2021, 3:03 a.m. | #10
September 3, 2021 9:11 PM, "Mike Frysinger" <vapier@gentoo.org> wrote:

> On 26 Aug 2021 12:34, Alexander von Gluck IV wrote:
> 
>> These are the os support patches we have been grooming and
>> maintaining for quite a few years over on git.haiku-os.org
>> 
>> All of these architectures are working and most have been
>> stable for quite some time.
> 
> i think this broke multi build. can you take a look ?
> $ .../configure --host=i686-linux-gnu --enable-targets=all CC='ccache gcc -m32' CXX='ccache g++
> -m32'
> $ make all-ld


Ack.  Investigating now.
I wasn't aware of the --enable-targets=all flag and the scope

 -- Alex
Alexander von Gluck IV Sept. 4, 2021, 4:31 a.m. | #11
September 3, 2021 10:03 PM, "Alexander von Gluck IV" <kallisti5@unixzen.com> wrote:
> September 3, 2021 9:11 PM, "Mike Frysinger" <vapier@gentoo.org> wrote:
> 
>> On 26 Aug 2021 12:34, Alexander von Gluck IV wrote:
> 
> These are the os support patches we have been grooming and
> maintaining for quite a few years over on git.haiku-os.org
> 
> All of these architectures are working and most have been
> stable for quite some time.
>> i think this broke multi build. can you take a look ?
>> $ .../configure --host=i686-linux-gnu --enable-targets=all CC='ccache gcc -m32' CXX='ccache g++
>> -m32'
>> $ make all-ld
> 
> Ack. Investigating now.
> I wasn't aware of the --enable-targets=all flag and the scope

I was able to reproduce this after finding a i686 binutils via:
./configure --host=i686-elf --enable-targets=all CC='gcc -m32' CXX='g++ -m32'

I just realized that that Haiku mips port saw zero traction... I probbably
should have removed it from my "mega Haiku patch"

Sorry for the noise, a patch is inbound within a few minutes to remove it
which will address this issue.

 -- Alex
Alan Modra via Binutils Sept. 4, 2021, 7:11 a.m. | #12
On 26 Aug 2021 12:34, Alexander von Gluck IV wrote:
> These are the os support patches we have been grooming and

> maintaining for quite a few years over on git.haiku-os.org

> 

> All of these architectures are working and most have been

> stable for quite some time.


i think this broke multi build.  can you take a look ?
$ .../configure --host=i686-linux-gnu --enable-targets=all CC='ccache gcc -m32' CXX='ccache g++ -m32'
$ make all-ld
...
make[3]: Entering directory '.../ld'
/bin/bash ./libtool  --tag=CC   --mode=link ccache gcc -m32 -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Wstack-usage=262144 -Werror -DELF_LIST_OPTIONS=true -DELF_SHLIB_LIST_OPTIONS=true -DELF_PLT_UNWIND_LIST_OPTIONS=true -g -O2    -fuse-ld=gold -o ld-new ldgram.o ldlex-wrapper.o lexsup.o ldlang.o mri.o ldctor.o ldmain.o ldwrite.o ldexp.o ldemul.o ldver.o ldmisc.o ldfile.o ldcref.o plugin.o ldbuildid.o eaix5ppc.o eaix5rs6.o eaixppc.o eaixrs6.o ealpha.o ealphavms.o earcv2elf.o earcv2elfx.o earcelf.o earclinux.o earclinux_nps.o earm_wince_pe.o earmelf.o earmelf_fbsd.o earmelf_fuchsia.o earmelf_haiku.o earmelf_linux.o earmelf_linux_eabi.o earmelf_linux_fdpiceabi.o earmelf_nacl.o earmelf_nbsd.o earmelf_phoenix.o earmelf_vxworks.o earmelfb.o earmelfb_fbsd.o earmelfb_fuchsia.o earmelfb_linux.o earmelfb_linux_eabi.o earmelfb_linux_fdpiceabi.o earmelfb_nacl.o earmelfb_nbsd.o earmnto.o earmpe.o eavr1.o eavr2.o eavr25.o eavr3.o eavr31.o eavr35.o eavr4.o eavr5.o eavr51.o eavr6.o eavrxmega1.o eavrxmega2.o eavrxmega3.o eavrxmega4.o eavrxmega5.o eavrxmega6.o eavrxmega7.o eavrtiny.o ecrisaout.o ecriself.o ecrislinux.o ecskyelf.o ecskyelf_linux.o ed10velf.o ed30v_e.o ed30v_o.o ed30velf.o eelf32_dlx.o eelf32_sparc.o eelf32_sparc_sol2.o eelf32_sparc_vxworks.o eelf32_spu.o eelf32_tic6x_be.o eelf32_tic6x_le.o eelf32_tic6x_linux_be.o eelf32_tic6x_linux_le.o eelf32_tic6x_elf_be.o eelf32_tic6x_elf_le.o eelf32am33lin.o eelf32bfin.o eelf32bfinfd.o eelf32cr16.o eelf32crx.o eelf32epiphany.o eelf32epiphany_4x4.o eelf32fr30.o eelf32frv.o eelf32frvfd.o eelf32ft32.o eelf32ip2k.o eelf32iq10.o eelf32iq2000.o eelf32lm32.o eelf32lm32fd.o eelf32lppc.o eelf32lppclinux.o eelf32lppcnto.o eelf32lppcsim.o eelf32m32c.o eelf32mb_linux.o eelf32mbel_linux.o eelf32mcore.o eelf32mep.o eelf32metag.o eelf32microblazeel.o eelf32microblaze.o eelf32moxie.o emoxiebox.o eelf32mt.o eelf32or1k.o eelf32or1k_linux.o eelf32ppc.o eelf32ppc_fbsd.o eelf32ppchaiku.o eelf32ppclinux.o eelf32ppcnto.o eelf32ppcsim.o eelf32ppcvxworks.o eelf32ppcwindiss.o eelf32rl78.o eelf32rx.o eelf32rx_linux.o eelf32tilegx.o eelf32tilegx_be.o eelf32tilepro.o eelf32vax.o eelf32visium.o eelf32xc16x.o eelf32xc16xl.o eelf32xc16xs.o eelf32xstormy16.o eelf32xtensa.o eelf32z80.o eelf_i386.o eelf_i386_be.o eelf_i386_fbsd.o eelf_i386_haiku.o eelf_i386_ldso.o eelf_i386_sol2.o eelf_i386_vxworks.o eelf_iamcu.o eelf_mipsel_haiku.o eelf_s390.o eh8300elf.o eh8300elf_linux.o eh8300helf.o eh8300helf_linux.o eh8300hnelf.o eh8300self.o eh8300self_linux.o eh8300snelf.o eh8300sxelf.o eh8300sxelf_linux.o eh8300sxnelf.o ehppaelf.o ehppalinux.o ehppanbsd.o ehppaobsd.o ei386aout.o ei386beos.o ei386bsd.o ei386go32.o ei386lynx.o ei386moss.o ei386msdos.o ei386nto.o ei386pe.o ei386pe_posix.o em32relf.o em32relf_linux.o em32rlelf.o em32rlelf_linux.o em68hc11elf.o em68hc11elfb.o em68hc12elf.o em68hc12elfb.o em68kelf.o em68kelfnbsd.o em9s12zelf.o emcorepe.o emn10200.o emn10300.o emsp430elf.o emsp430X.o ends32elf.o ends32elf16m.o ends32elf_linux.o ends32belf.o ends32belf16m.o ends32belf_linux.o ens32knbsd.o enios2elf.o enios2linux.o epc532macha.o epdp11.o epjelf.o epjlelf.o eppcmacos.o epruelf.o escore3_elf.o escore7_elf.o esh.o eshelf.o eshelf_fd.o eshelf_linux.o eshelf_nbsd.o eshelf_nto.o eshelf_uclinux.o eshelf_vxworks.o eshl.o eshlelf.o eshlelf_fd.o eshlelf_linux.o eshlelf_nbsd.o eshlelf_nto.o eshlelf_vxworks.o eshpe.o etic30coff.o etic3xcoff.o etic3xcoff_onchip.o etic4xcoff.o etic54xcoff.o ev850.o ev850_rh850.o evanilla.o evaxnbsd.o exgateelf.o ez80.o ez8001.o ez8002.o deffilep.o pe-dll.o ldelf.o ldelfgen.o ../bfd/libbfd.la ../libctf/libctf.la ../libiberty/libiberty.a  -lz -ldl 
libtool: link: ccache gcc -m32 -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Wstack-usage=262144 -Werror -DELF_LIST_OPTIONS=true -DELF_SHLIB_LIST_OPTIONS=true -DELF_PLT_UNWIND_LIST_OPTIONS=true -g -O2 -fuse-ld=gold -o ld-new ldgram.o ldlex-wrapper.o lexsup.o ldlang.o mri.o ldctor.o ldmain.o ldwrite.o ldexp.o ldemul.o ldver.o ldmisc.o ldfile.o ldcref.o plugin.o ldbuildid.o eaix5ppc.o eaix5rs6.o eaixppc.o eaixrs6.o ealpha.o ealphavms.o earcv2elf.o earcv2elfx.o earcelf.o earclinux.o earclinux_nps.o earm_wince_pe.o earmelf.o earmelf_fbsd.o earmelf_fuchsia.o earmelf_haiku.o earmelf_linux.o earmelf_linux_eabi.o earmelf_linux_fdpiceabi.o earmelf_nacl.o earmelf_nbsd.o earmelf_phoenix.o earmelf_vxworks.o earmelfb.o earmelfb_fbsd.o earmelfb_fuchsia.o earmelfb_linux.o earmelfb_linux_eabi.o earmelfb_linux_fdpiceabi.o earmelfb_nacl.o earmelfb_nbsd.o earmnto.o earmpe.o eavr1.o eavr2.o eavr25.o eavr3.o eavr31.o eavr35.o eavr4.o eavr5.o eavr51.o eavr6.o eavrxmega1.o eavrxmega2.o eavrxmega3.o eavrxmega4.o eavrxmega5.o eavrxmega6.o eavrxmega7.o eavrtiny.o ecrisaout.o ecriself.o ecrislinux.o ecskyelf.o ecskyelf_linux.o ed10velf.o ed30v_e.o ed30v_o.o ed30velf.o eelf32_dlx.o eelf32_sparc.o eelf32_sparc_sol2.o eelf32_sparc_vxworks.o eelf32_spu.o eelf32_tic6x_be.o eelf32_tic6x_le.o eelf32_tic6x_linux_be.o eelf32_tic6x_linux_le.o eelf32_tic6x_elf_be.o eelf32_tic6x_elf_le.o eelf32am33lin.o eelf32bfin.o eelf32bfinfd.o eelf32cr16.o eelf32crx.o eelf32epiphany.o eelf32epiphany_4x4.o eelf32fr30.o eelf32frv.o eelf32frvfd.o eelf32ft32.o eelf32ip2k.o eelf32iq10.o eelf32iq2000.o eelf32lm32.o eelf32lm32fd.o eelf32lppc.o eelf32lppclinux.o eelf32lppcnto.o eelf32lppcsim.o eelf32m32c.o eelf32mb_linux.o eelf32mbel_linux.o eelf32mcore.o eelf32mep.o eelf32metag.o eelf32microblazeel.o eelf32microblaze.o eelf32moxie.o emoxiebox.o eelf32mt.o eelf32or1k.o eelf32or1k_linux.o eelf32ppc.o eelf32ppc_fbsd.o eelf32ppchaiku.o eelf32ppclinux.o eelf32ppcnto.o eelf32ppcsim.o eelf32ppcvxworks.o eelf32ppcwindiss.o eelf32rl78.o eelf32rx.o eelf32rx_linux.o eelf32tilegx.o eelf32tilegx_be.o eelf32tilepro.o eelf32vax.o eelf32visium.o eelf32xc16x.o eelf32xc16xl.o eelf32xc16xs.o eelf32xstormy16.o eelf32xtensa.o eelf32z80.o eelf_i386.o eelf_i386_be.o eelf_i386_fbsd.o eelf_i386_haiku.o eelf_i386_ldso.o eelf_i386_sol2.o eelf_i386_vxworks.o eelf_iamcu.o eelf_mipsel_haiku.o eelf_s390.o eh8300elf.o eh8300elf_linux.o eh8300helf.o eh8300helf_linux.o eh8300hnelf.o eh8300self.o eh8300self_linux.o eh8300snelf.o eh8300sxelf.o eh8300sxelf_linux.o eh8300sxnelf.o ehppaelf.o ehppalinux.o ehppanbsd.o ehppaobsd.o ei386aout.o ei386beos.o ei386bsd.o ei386go32.o ei386lynx.o ei386moss.o ei386msdos.o ei386nto.o ei386pe.o ei386pe_posix.o em32relf.o em32relf_linux.o em32rlelf.o em32rlelf_linux.o em68hc11elf.o em68hc11elfb.o em68hc12elf.o em68hc12elfb.o em68kelf.o em68kelfnbsd.o em9s12zelf.o emcorepe.o emn10200.o emn10300.o emsp430elf.o emsp430X.o ends32elf.o ends32elf16m.o ends32elf_linux.o ends32belf.o ends32belf16m.o ends32belf_linux.o ens32knbsd.o enios2elf.o enios2linux.o epc532macha.o epdp11.o epjelf.o epjlelf.o eppcmacos.o epruelf.o escore3_elf.o escore7_elf.o esh.o eshelf.o eshelf_fd.o eshelf_linux.o eshelf_nbsd.o eshelf_nto.o eshelf_uclinux.o eshelf_vxworks.o eshl.o eshlelf.o eshlelf_fd.o eshlelf_linux.o eshlelf_nbsd.o eshlelf_nto.o eshlelf_vxworks.o eshpe.o etic30coff.o etic3xcoff.o etic3xcoff_onchip.o etic4xcoff.o etic54xcoff.o ev850.o ev850_rh850.o evanilla.o evaxnbsd.o exgateelf.o ez80.o ez8001.o ez8002.o deffilep.o pe-dll.o ldelf.o ldelfgen.o  ../bfd/.libs/libbfd.a ../libctf/.libs/libctf.a -L.../libctf/../libiberty .../bfd/.libs/libbfd.a -liberty ../libiberty/libiberty.a -lz -ldl
.../ld/eelf_mipsel_haiku.c:223: error: undefined reference to '_bfd_mips_elf_compact_branches'
.../ld/eelf_mipsel_haiku.c:224: error: undefined reference to '_bfd_mips_elf_init_stubs'
.../ld/eelf_mipsel_haiku.c:218: error: undefined reference to '_bfd_mips_elf_linker_flags'
.../ld/eelf_mipsel_haiku.c:241: error: undefined reference to '_bfd_mips_elf_use_plts_and_copy_relocs'
collect2: error: ld returned 1 exit status
make[3]: *** [Makefile:1234: ld-new] Error 1
make[3]: Leaving directory '.../ld'
make[2]: *** [Makefile:1826: all-recursive] Error 1
make[2]: Leaving directory '.../ld'
make[1]: *** [Makefile:1061: all] Error 2
make[1]: Leaving directory '.../ld'
make: *** [Makefile:7598: all-ld] Error 2
Alan Modra via Binutils Sept. 6, 2021, 1:41 p.m. | #13
For the record, I'm also seeing breakage (for arm32) due to this patch 
with --enable-targets=all.

On 9/4/21 4:11 AM, Mike Frysinger via Binutils wrote:
> On 26 Aug 2021 12:34, Alexander von Gluck IV wrote:

>> These are the os support patches we have been grooming and

>> maintaining for quite a few years over on git.haiku-os.org

>>

>> All of these architectures are working and most have been

>> stable for quite some time.

> 

> i think this broke multi build.  can you take a look ?

> $ .../configure --host=i686-linux-gnu --enable-targets=all CC='ccache gcc -m32' CXX='ccache g++ -m32'

> $ make all-ld

> ...

> make[3]: Entering directory '.../ld'

> /bin/bash ./libtool  --tag=CC   --mode=link ccache gcc -m32 -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Wstack-usage=262144 -Werror -DELF_LIST_OPTIONS=true -DELF_SHLIB_LIST_OPTIONS=true -DELF_PLT_UNWIND_LIST_OPTIONS=true -g -O2    -fuse-ld=gold -o ld-new ldgram.o ldlex-wrapper.o lexsup.o ldlang.o mri.o ldctor.o ldmain.o ldwrite.o ldexp.o ldemul.o ldver.o ldmisc.o ldfile.o ldcref.o plugin.o ldbuildid.o eaix5ppc.o eaix5rs6.o eaixppc.o eaixrs6.o ealpha.o ealphavms.o earcv2elf.o earcv2elfx.o earcelf.o earclinux.o earclinux_nps.o earm_wince_pe.o earmelf.o earmelf_fbsd.o earmelf_fuchsia.o earmelf_haiku.o earmelf_linux.o earmelf_linux_eabi.o earmelf_linux_fdpiceabi.o earmelf_nacl.o earmelf_nbsd.o earmelf_phoenix.o earmelf_vxworks.o earmelfb.o earmelfb_fbsd.o earmelfb_fuchsia.o earmelfb_linux.o earmelfb_linux_eabi.o earmelfb_linux_fdpiceabi.o earmelfb_nacl.o earmelfb_nbsd.o earmnto.o earmpe.o eavr1.o eavr2.o eavr25.o eavr3.o eavr31.o eavr35.o eavr4.o eavr5.o eavr51.o eavr6.o eavrxmega1.o eavrxmega2.o eavrxmega3.o eavrxmega4.o eavrxmega5.o eavrxmega6.o eavrxmega7.o eavrtiny.o ecrisaout.o ecriself.o ecrislinux.o ecskyelf.o ecskyelf_linux.o ed10velf.o ed30v_e.o ed30v_o.o ed30velf.o eelf32_dlx.o eelf32_sparc.o eelf32_sparc_sol2.o eelf32_sparc_vxworks.o eelf32_spu.o eelf32_tic6x_be.o eelf32_tic6x_le.o eelf32_tic6x_linux_be.o eelf32_tic6x_linux_le.o eelf32_tic6x_elf_be.o eelf32_tic6x_elf_le.o eelf32am33lin.o eelf32bfin.o eelf32bfinfd.o eelf32cr16.o eelf32crx.o eelf32epiphany.o eelf32epiphany_4x4.o eelf32fr30.o eelf32frv.o eelf32frvfd.o eelf32ft32.o eelf32ip2k.o eelf32iq10.o eelf32iq2000.o eelf32lm32.o eelf32lm32fd.o eelf32lppc.o eelf32lppclinux.o eelf32lppcnto.o eelf32lppcsim.o eelf32m32c.o eelf32mb_linux.o eelf32mbel_linux.o eelf32mcore.o eelf32mep.o eelf32metag.o eelf32microblazeel.o eelf32microblaze.o eelf32moxie.o emoxiebox.o eelf32mt.o eelf32or1k.o eelf32or1k_linux.o eelf32ppc.o eelf32ppc_fbsd.o eelf32ppchaiku.o eelf32ppclinux.o eelf32ppcnto.o eelf32ppcsim.o eelf32ppcvxworks.o eelf32ppcwindiss.o eelf32rl78.o eelf32rx.o eelf32rx_linux.o eelf32tilegx.o eelf32tilegx_be.o eelf32tilepro.o eelf32vax.o eelf32visium.o eelf32xc16x.o eelf32xc16xl.o eelf32xc16xs.o eelf32xstormy16.o eelf32xtensa.o eelf32z80.o eelf_i386.o eelf_i386_be.o eelf_i386_fbsd.o eelf_i386_haiku.o eelf_i386_ldso.o eelf_i386_sol2.o eelf_i386_vxworks.o eelf_iamcu.o eelf_mipsel_haiku.o eelf_s390.o eh8300elf.o eh8300elf_linux.o eh8300helf.o eh8300helf_linux.o eh8300hnelf.o eh8300self.o eh8300self_linux.o eh8300snelf.o eh8300sxelf.o eh8300sxelf_linux.o eh8300sxnelf.o ehppaelf.o ehppalinux.o ehppanbsd.o ehppaobsd.o ei386aout.o ei386beos.o ei386bsd.o ei386go32.o ei386lynx.o ei386moss.o ei386msdos.o ei386nto.o ei386pe.o ei386pe_posix.o em32relf.o em32relf_linux.o em32rlelf.o em32rlelf_linux.o em68hc11elf.o em68hc11elfb.o em68hc12elf.o em68hc12elfb.o em68kelf.o em68kelfnbsd.o em9s12zelf.o emcorepe.o emn10200.o emn10300.o emsp430elf.o emsp430X.o ends32elf.o ends32elf16m.o ends32elf_linux.o ends32belf.o ends32belf16m.o ends32belf_linux.o ens32knbsd.o enios2elf.o enios2linux.o epc532macha.o epdp11.o epjelf.o epjlelf.o eppcmacos.o epruelf.o escore3_elf.o escore7_elf.o esh.o eshelf.o eshelf_fd.o eshelf_linux.o eshelf_nbsd.o eshelf_nto.o eshelf_uclinux.o eshelf_vxworks.o eshl.o eshlelf.o eshlelf_fd.o eshlelf_linux.o eshlelf_nbsd.o eshlelf_nto.o eshlelf_vxworks.o eshpe.o etic30coff.o etic3xcoff.o etic3xcoff_onchip.o etic4xcoff.o etic54xcoff.o ev850.o ev850_rh850.o evanilla.o evaxnbsd.o exgateelf.o ez80.o ez8001.o ez8002.o deffilep.o pe-dll.o ldelf.o ldelfgen.o ../bfd/libbfd.la ../libctf/libctf.la ../libiberty/libiberty.a  -lz -ldl

> libtool: link: ccache gcc -m32 -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Wstack-usage=262144 -Werror -DELF_LIST_OPTIONS=true -DELF_SHLIB_LIST_OPTIONS=true -DELF_PLT_UNWIND_LIST_OPTIONS=true -g -O2 -fuse-ld=gold -o ld-new ldgram.o ldlex-wrapper.o lexsup.o ldlang.o mri.o ldctor.o ldmain.o ldwrite.o ldexp.o ldemul.o ldver.o ldmisc.o ldfile.o ldcref.o plugin.o ldbuildid.o eaix5ppc.o eaix5rs6.o eaixppc.o eaixrs6.o ealpha.o ealphavms.o earcv2elf.o earcv2elfx.o earcelf.o earclinux.o earclinux_nps.o earm_wince_pe.o earmelf.o earmelf_fbsd.o earmelf_fuchsia.o earmelf_haiku.o earmelf_linux.o earmelf_linux_eabi.o earmelf_linux_fdpiceabi.o earmelf_nacl.o earmelf_nbsd.o earmelf_phoenix.o earmelf_vxworks.o earmelfb.o earmelfb_fbsd.o earmelfb_fuchsia.o earmelfb_linux.o earmelfb_linux_eabi.o earmelfb_linux_fdpiceabi.o earmelfb_nacl.o earmelfb_nbsd.o earmnto.o earmpe.o eavr1.o eavr2.o eavr25.o eavr3.o eavr31.o eavr35.o eavr4.o eavr5.o eavr51.o eavr6.o eavrxmega1.o eavrxmega2.o eavrxmega3.o eavrxmega4.o eavrxmega5.o eavrxmega6.o eavrxmega7.o eavrtiny.o ecrisaout.o ecriself.o ecrislinux.o ecskyelf.o ecskyelf_linux.o ed10velf.o ed30v_e.o ed30v_o.o ed30velf.o eelf32_dlx.o eelf32_sparc.o eelf32_sparc_sol2.o eelf32_sparc_vxworks.o eelf32_spu.o eelf32_tic6x_be.o eelf32_tic6x_le.o eelf32_tic6x_linux_be.o eelf32_tic6x_linux_le.o eelf32_tic6x_elf_be.o eelf32_tic6x_elf_le.o eelf32am33lin.o eelf32bfin.o eelf32bfinfd.o eelf32cr16.o eelf32crx.o eelf32epiphany.o eelf32epiphany_4x4.o eelf32fr30.o eelf32frv.o eelf32frvfd.o eelf32ft32.o eelf32ip2k.o eelf32iq10.o eelf32iq2000.o eelf32lm32.o eelf32lm32fd.o eelf32lppc.o eelf32lppclinux.o eelf32lppcnto.o eelf32lppcsim.o eelf32m32c.o eelf32mb_linux.o eelf32mbel_linux.o eelf32mcore.o eelf32mep.o eelf32metag.o eelf32microblazeel.o eelf32microblaze.o eelf32moxie.o emoxiebox.o eelf32mt.o eelf32or1k.o eelf32or1k_linux.o eelf32ppc.o eelf32ppc_fbsd.o eelf32ppchaiku.o eelf32ppclinux.o eelf32ppcnto.o eelf32ppcsim.o eelf32ppcvxworks.o eelf32ppcwindiss.o eelf32rl78.o eelf32rx.o eelf32rx_linux.o eelf32tilegx.o eelf32tilegx_be.o eelf32tilepro.o eelf32vax.o eelf32visium.o eelf32xc16x.o eelf32xc16xl.o eelf32xc16xs.o eelf32xstormy16.o eelf32xtensa.o eelf32z80.o eelf_i386.o eelf_i386_be.o eelf_i386_fbsd.o eelf_i386_haiku.o eelf_i386_ldso.o eelf_i386_sol2.o eelf_i386_vxworks.o eelf_iamcu.o eelf_mipsel_haiku.o eelf_s390.o eh8300elf.o eh8300elf_linux.o eh8300helf.o eh8300helf_linux.o eh8300hnelf.o eh8300self.o eh8300self_linux.o eh8300snelf.o eh8300sxelf.o eh8300sxelf_linux.o eh8300sxnelf.o ehppaelf.o ehppalinux.o ehppanbsd.o ehppaobsd.o ei386aout.o ei386beos.o ei386bsd.o ei386go32.o ei386lynx.o ei386moss.o ei386msdos.o ei386nto.o ei386pe.o ei386pe_posix.o em32relf.o em32relf_linux.o em32rlelf.o em32rlelf_linux.o em68hc11elf.o em68hc11elfb.o em68hc12elf.o em68hc12elfb.o em68kelf.o em68kelfnbsd.o em9s12zelf.o emcorepe.o emn10200.o emn10300.o emsp430elf.o emsp430X.o ends32elf.o ends32elf16m.o ends32elf_linux.o ends32belf.o ends32belf16m.o ends32belf_linux.o ens32knbsd.o enios2elf.o enios2linux.o epc532macha.o epdp11.o epjelf.o epjlelf.o eppcmacos.o epruelf.o escore3_elf.o escore7_elf.o esh.o eshelf.o eshelf_fd.o eshelf_linux.o eshelf_nbsd.o eshelf_nto.o eshelf_uclinux.o eshelf_vxworks.o eshl.o eshlelf.o eshlelf_fd.o eshlelf_linux.o eshlelf_nbsd.o eshlelf_nto.o eshlelf_vxworks.o eshpe.o etic30coff.o etic3xcoff.o etic3xcoff_onchip.o etic4xcoff.o etic54xcoff.o ev850.o ev850_rh850.o evanilla.o evaxnbsd.o exgateelf.o ez80.o ez8001.o ez8002.o deffilep.o pe-dll.o ldelf.o ldelfgen.o  ../bfd/.libs/libbfd.a ../libctf/.libs/libctf.a -L.../libctf/../libiberty .../bfd/.libs/libbfd.a -liberty ../libiberty/libiberty.a -lz -ldl

> .../ld/eelf_mipsel_haiku.c:223: error: undefined reference to '_bfd_mips_elf_compact_branches'

> .../ld/eelf_mipsel_haiku.c:224: error: undefined reference to '_bfd_mips_elf_init_stubs'

> .../ld/eelf_mipsel_haiku.c:218: error: undefined reference to '_bfd_mips_elf_linker_flags'

> .../ld/eelf_mipsel_haiku.c:241: error: undefined reference to '_bfd_mips_elf_use_plts_and_copy_relocs'

> collect2: error: ld returned 1 exit status

> make[3]: *** [Makefile:1234: ld-new] Error 1

> make[3]: Leaving directory '.../ld'

> make[2]: *** [Makefile:1826: all-recursive] Error 1

> make[2]: Leaving directory '.../ld'

> make[1]: *** [Makefile:1061: all] Error 2

> make[1]: Leaving directory '.../ld'

> make: *** [Makefile:7598: all-ld] Error 2

>
Alexander von Gluck IV Sept. 6, 2021, 2:30 p.m. | #14
>> On 9/4/21 4:11 AM, Mike Frysinger via Binutils wrote:
>>
>> i think this broke multi build. can you take a look ?
>> $ .../configure --host=i686-linux-gnu --enable-targets=all CC='ccache gcc -m32' CXX='ccache g++
>> -m32'
>> $ make all-ld
>> ...
>> make[3]: Entering directory '.../ld'
>> /bin/bash ./libtool --tag=CC --mode=link ccache gcc -m32 -W -Wall -Wstrict-prototypes
>> .
>> .../bfd/.libs/libbfd.a -liberty ../libiberty/libiberty.a -lz -ldl
>> .../ld/eelf_mipsel_haiku.c:223: error: undefined reference to '_bfd_mips_elf_compact_branches'
>> .../ld/eelf_mipsel_haiku.c:224: error: undefined reference to '_bfd_mips_elf_init_stubs'
>> .../ld/eelf_mipsel_haiku.c:218: error: undefined reference to '_bfd_mips_elf_linker_flags'
>> .../ld/eelf_mipsel_haiku.c:241: error: undefined reference to
>> '_bfd_mips_elf_use_plts_and_copy_relocs'
>> collect2: error: ld returned 1 exit status
>> make[3]: *** [Makefile:1234: ld-new] Error 1
>> make[3]: Leaving directory '.../ld'
>> make[2]: *** [Makefile:1826: all-recursive] Error 1
>> make[2]: Leaving directory '.../ld'
>> make[1]: *** [Makefile:1061: all] Error 2
>> make[1]: Leaving directory '.../ld'
>> make: *** [Makefile:7598: all-ld] Error 2
September 6, 2021 8:41 AM, "Luis Machado" <luis.machado@linaro.org> wrote:
> For the record, I'm also seeing breakage (for arm32) due to this patch 
> with --enable-targets=all.

The following patch submitted a few days ago will fix the issue:
"[PATCH] mipsel: drop Haiku mips. Fix multi-build."

Waiting on it to be reviewed. 

 -- Alex

Patch

diff --git a/bfd/config.bfd b/bfd/config.bfd
index 50e356d2e9e..7f7c12d4b2d 100644
--- a/bfd/config.bfd
+++ b/bfd/config.bfd
@@ -269,6 +269,11 @@  case "${targ}" in
     targ_selvecs=aarch64_elf64_be_cloudabi_vec
     want64=true
     ;;
+  aarch64-*-haiku*)
+    targ_defvec=aarch64_elf64_le_vec
+    targ_selvecs="aarch64_elf64_be_vec aarch64_elf32_le_vec aarch64_elf32_be_vec arm_elf32_le_vec arm_elf32_be_vec"
+    want64=true
+    ;;
   aarch64-*-linux* | aarch64-*-netbsd*)
     targ_defvec=aarch64_elf64_le_vec
     targ_selvecs="aarch64_elf64_be_vec aarch64_elf32_le_vec aarch64_elf32_be_vec arm_elf32_le_vec arm_elf32_be_vec"
@@ -353,6 +358,10 @@  case "${targ}" in
     targ_defvec=arm_elf32_le_vec
     targ_selvecs="arm_elf32_be_vec"
     ;;
+  arm*-*-haiku*)
+    targ_defvec=arm_elf32_le_vec
+    targ_selvecs="arm_elf32_fdpic_le_vec arm_elf32_be_vec arm_elf32_fdpic_be_vec arm_pe_le_vec arm_pe_be_vec arm_pei_le_vec arm_pei_be_vec"
+    ;;
   arm-*-nacl*)
     targ_defvec=arm_elf32_nacl_le_vec
     targ_selvecs="arm_elf32_nacl_be_vec"
@@ -679,6 +688,11 @@  case "${targ}" in
     targ_selvecs="i386_elf32_fbsd_vec iamcu_elf32_vec i386_coff_vec i386_pei_vec x86_64_pe_vec x86_64_pei_vec i386_elf32_vec x86_64_elf64_vec l1om_elf64_vec l1om_elf64_fbsd_vec k1om_elf64_vec k1om_elf64_fbsd_vec"
     want64=true
     ;;
+  x86_64-*-haiku*)
+    targ_defvec=x86_64_elf64_vec
+    targ_selvecs="i386_elf32_vec"
+    want64=true
+    ;;
   x86_64-*-netbsd* | x86_64-*-openbsd*)
     targ_defvec=x86_64_elf64_vec
     targ_selvecs="i386_elf32_vec iamcu_elf32_vec i386_coff_vec i386_pei_vec x86_64_pe_vec x86_64_pei_vec l1om_elf64_vec k1om_elf64_vec"
@@ -729,6 +743,9 @@  case "${targ}" in
     targ_defvec=i386_elf32_vec
     targ_selvecs="iamcu_elf32_vec i386_pe_vec i386_pei_vec"
     ;;
+  i[3-7]86-*-haiku*)
+    targ_defvec=i386_elf32_vec
+    ;;
   i[3-7]86-*-interix*)
     targ_defvec=i386_pei_vec
     targ_selvecs="i386_pe_vec"
@@ -794,6 +811,9 @@  case "${targ}" in
     targ_defvec=m32r_elf32_vec
     ;;
 
+  m68*-*-haiku*)
+    targ_defvec=m68k_elf32_vec
+    ;;
   m68hc11-*-* | m6811-*-*)
     targ_defvec=m68hc11_elf32_vec
     targ_selvecs="m68hc11_elf32_vec m68hc12_elf32_vec"
@@ -848,6 +868,10 @@  case "${targ}" in
     targ_defvec=mips_elf32_trad_be_vec
     targ_selvecs="mips_elf32_trad_le_vec mips_elf64_trad_be_vec mips_elf64_trad_le_vec mips_ecoff_be_vec mips_ecoff_le_vec"
     ;;
+  mips*el-*-haiku*)
+    targ_defvec=mips_elf32_le_vec
+    targ_selvecs="mips_elf32_be_vec mips_elf64_be_vec mips_elf64_le_vec mips_ecoff_le_vec mips_ecoff_be_vec"
+    ;;
   mips*-*-irix6*)
     targ_defvec=mips_elf32_n_be_vec
     targ_selvecs="mips_elf32_n_le_vec mips_elf32_be_vec mips_elf32_le_vec mips_elf64_be_vec mips_elf64_le_vec"
@@ -1047,6 +1071,11 @@  case "${targ}" in
     targ_selvecs="rs6000_xcoff64_aix_vec"
     want64=true
     ;;
+  powerpc-*-haiku*)
+    targ_defvec=powerpc_elf32_vec
+    targ_selvecs="rs6000_xcoff_vec powerpc_elf32_le_vec pef_vec pef_xlib_vec powerpc_xcoff_vec powerpc_boot_vec"
+    targ_cflags=-D__HAIKU_TARGET__
+    ;;
 #ifdef BFD64
   powerpc64-*-aix5.[01])
     targ_defvec=rs6000_xcoff64_aix_vec
@@ -1299,6 +1328,11 @@  case "${targ}" in
     targ_selvecs="sparc_elf64_sol2_vec"
     want64=true
     ;;
+  sparc64-*-haiku*)
+    targ_defvec=sparc_elf64_vec
+    targ_selvecs="sparc_elf64_vec sparc_elf32_vec"
+    want64=true
+    ;;
   sparc64-*-freebsd* | sparc64-*-kfreebsd*-gnu)
     targ_defvec=sparc_elf64_fbsd_vec
     targ_selvecs="sparc_elf64_vec sparc_elf32_vec"
diff --git a/bfd/configure b/bfd/configure
index eb45ead43ce..cae69d413d4 100755
--- a/bfd/configure
+++ b/bfd/configure
@@ -10248,7 +10248,7 @@  haiku*)
   soname_spec='${libname}${release}${shared_ext}$major'
   shlibpath_var=LIBRARY_PATH
   shlibpath_overrides_runpath=yes
-  sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/beos/system/lib'
+  sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib'
   hardcode_into_libs=yes
   ;;
 
diff --git a/binutils/configure b/binutils/configure
index 373fb180f74..29201153aeb 100755
--- a/binutils/configure
+++ b/binutils/configure
@@ -10135,7 +10135,7 @@  haiku*)
   soname_spec='${libname}${release}${shared_ext}$major'
   shlibpath_var=LIBRARY_PATH
   shlibpath_overrides_runpath=yes
-  sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/beos/system/lib'
+  sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib'
   hardcode_into_libs=yes
   ;;
 
diff --git a/configure b/configure
index 3dd206525a7..fcec657de7a 100755
--- a/configure
+++ b/configure
@@ -3013,7 +3013,7 @@  case "${ENABLE_GOLD}" in
       *-*-elf* | *-*-sysv4* | *-*-unixware* | *-*-eabi* | hppa*64*-*-hpux* \
       | *-*-linux* | *-*-gnu* | frv-*-uclinux* | *-*-irix5* | *-*-irix6* \
       | *-*-netbsd* | *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* \
-      | *-*-solaris2* | *-*-nto* | *-*-nacl*)
+      | *-*-solaris2* | *-*-nto* | *-*-nacl* | *-*-haiku*)
         case "${target}" in
           *-*-linux*aout* | *-*-linux*oldld*)
             ;;
diff --git a/configure.ac b/configure.ac
index 797a624621e..1b1aa80f7c7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -336,7 +336,7 @@  case "${ENABLE_GOLD}" in
       *-*-elf* | *-*-sysv4* | *-*-unixware* | *-*-eabi* | hppa*64*-*-hpux* \
       | *-*-linux* | *-*-gnu* | frv-*-uclinux* | *-*-irix5* | *-*-irix6* \
       | *-*-netbsd* | *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* \
-      | *-*-solaris2* | *-*-nto* | *-*-nacl*)
+      | *-*-solaris2* | *-*-nto* | *-*-nacl* | *-*-haiku*)
         case "${target}" in
           *-*-linux*aout* | *-*-linux*oldld*)
             ;;
diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c
index 7148c073247..339f9694948 100644
--- a/gas/config/tc-i386.c
+++ b/gas/config/tc-i386.c
@@ -478,6 +478,7 @@  const char extra_symbol_chars[] = "*%-([{}"
 #if ((defined (OBJ_ELF) || defined (OBJ_MAYBE_ELF))	\
      && !defined (TE_GNU)				\
      && !defined (TE_LINUX)				\
+     && !defined (TE_Haiku)				\
      && !defined (TE_FreeBSD)				\
      && !defined (TE_DragonFly)				\
      && !defined (TE_NetBSD))
diff --git a/gas/config/te-haiku.h b/gas/config/te-haiku.h
new file mode 100644
index 00000000000..44557178e2f
--- /dev/null
+++ b/gas/config/te-haiku.h
@@ -0,0 +1,30 @@ 
+/* te-haiku.h -- Haiku target environment declarations.
+   Copyright 2013 Free Software Foundation, Inc.
+
+   This file is part of GAS, the GNU Assembler.
+
+   GAS is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3, or (at your option)
+   any later version.
+
+   GAS is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with GAS; see the file COPYING.  If not, write to
+   the Free Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA
+   02110-1301, USA.  */
+
+/* Target environment for BeOS/Haiku.  It is the same as the generic
+   target, except that it arranges via the TE_BeOS define to
+   suppress the use of "/" as a comment character.  Some code in the
+   haiku kernel uses "/" to mean division.  (What a concept!)  */
+#define TE_Haiku 1
+
+#define LOCAL_LABELS_DOLLAR 1
+#define LOCAL_LABELS_FB 1
+
+#include "obj-format.h"
diff --git a/gas/configure b/gas/configure
index 7a528fd485e..a63c6ff0e39 100755
--- a/gas/configure
+++ b/gas/configure
@@ -9860,7 +9860,7 @@  haiku*)
   soname_spec='${libname}${release}${shared_ext}$major'
   shlibpath_var=LIBRARY_PATH
   shlibpath_overrides_runpath=yes
-  sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/beos/system/lib'
+  sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib'
   hardcode_into_libs=yes
   ;;
 
diff --git a/gas/configure.tgt b/gas/configure.tgt
index 68ee0468e8d..550fa4098f8 100644
--- a/gas/configure.tgt
+++ b/gas/configure.tgt
@@ -125,6 +125,7 @@  generic_target=${cpu_type}-$vendor-$os
 case ${generic_target} in
   aarch64*-*-elf*)			fmt=elf;;
   aarch64*-*-fuchsia*)			fmt=elf;;
+  aarch64*-*-haiku*)			fmt=elf em=haiku ;;
   aarch64*-*-genode*)			fmt=elf;;
   aarch64*-*-linux*)			fmt=elf em=linux
     case ${cpu}-${os} in
@@ -161,6 +162,7 @@  case ${generic_target} in
 					fmt=coff em=wince-pe ;;
   arm-*-pe)				fmt=coff em=pe ;;
   arm-*-fuchsia*)			fmt=elf ;;
+  arm-*-haiku*)				fmt=elf em=haiku ;;
 
   avr-*-*)				fmt=elf bfd_gas=yes ;;
 
@@ -222,6 +224,7 @@  case ${generic_target} in
   i386-*-elfiamcu)			fmt=elf arch=iamcu ;;
   i386-*-elf*)				fmt=elf ;;
   i386-*-fuchsia*)			fmt=elf ;;
+  i386-*-haiku*)			fmt=elf em=haiku ;;
   i386-*-genode*)			fmt=elf ;;
   i386-*-bsd*)				fmt=aout em=386bsd ;;
   i386-*-netbsd*-gnu* | \
@@ -288,6 +291,7 @@  case ${generic_target} in
   m68k-*-uclinux*)			fmt=elf em=uclinux ;;
   m68k-*-gnu*)				fmt=elf ;;
   m68k-*-netbsd*)			fmt=elf em=nbsd ;;
+  m68k-*-haiku*)			fmt=elf em=haiku ;;
 
   s12z-*-*)				fmt=elf ;;
 
@@ -309,6 +313,7 @@  case ${generic_target} in
   mips-*-sysv4* | mips-*-gnu*)		fmt=elf em=tmips ;;
   mips*-sde-elf* | mips*-mti-elf* | mips*-img-elf*)
 					fmt=elf em=tmips ;;
+  mips-*-haiku*)			fmt=elf em=haiku ;;
   mips-*-elf*)				fmt=elf ;;
   mips-*-netbsd*)			fmt=elf em=tmips ;;
   mips-*-openbsd*)			fmt=elf em=tmips ;;
@@ -351,6 +356,7 @@  case ${generic_target} in
   ppc-*-beos*)				fmt=coff ;;
   ppc-*-*n*bsd* | ppc-*-elf*)		fmt=elf ;;
   ppc-*-eabi* | ppc-*-sysv4*)		fmt=elf ;;
+  ppc-*-haiku*)				fmt=elf em=haiku ;;
   ppc-*-linux-*)			fmt=elf em=linux ;;
   ppc-*-solaris*)			fmt=elf em=solaris ;;
   ppc-*-macos*)				fmt=coff em=macos ;;
@@ -359,6 +365,7 @@  case ${generic_target} in
 
   pru-*-*)				fmt=elf ;;
 
+  riscv*-*-haiku*)			fmt=elf endian=little em=haiku ;;
   riscv*-*-*)				fmt=elf ;;
 
   rx-*-linux*)				fmt=elf em=linux ;;
@@ -386,6 +393,7 @@  case ${generic_target} in
   sh-*-kaos*)				fmt=elf ;;
   shle*-*-kaos*)			fmt=elf ;;
 
+  sparc-*-haiku*)			fmt=elf em=haiku ;;
   sparc-*-linux-*)			fmt=elf em=linux ;;
   sparc-*-solaris*)			fmt=elf em=solaris ;;
   sparc-*-freebsd*)			fmt=elf em=freebsd ;;
diff --git a/gprof/configure b/gprof/configure
index 5703bba4462..f88c0ea48c3 100755
--- a/gprof/configure
+++ b/gprof/configure
@@ -9762,7 +9762,7 @@  haiku*)
   soname_spec='${libname}${release}${shared_ext}$major'
   shlibpath_var=LIBRARY_PATH
   shlibpath_overrides_runpath=yes
-  sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/beos/system/lib'
+  sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib'
   hardcode_into_libs=yes
   ;;
 
diff --git a/ld/Makefile.am b/ld/Makefile.am
index f8e99325361..0abbde441df 100644
--- a/ld/Makefile.am
+++ b/ld/Makefile.am
@@ -167,6 +167,7 @@  ALL_EMULATION_SOURCES = \
 	earmelf.c \
 	earmelf_fbsd.c \
 	earmelf_fuchsia.c \
+	earmelf_haiku.c \
 	earmelf_linux.c \
 	earmelf_linux_eabi.c \
 	earmelf_linux_fdpiceabi.c \
@@ -258,6 +259,7 @@  ALL_EMULATION_SOURCES = \
 	eelf32ppc.c \
 	eelf32ppc_fbsd.c \
 	eelf32ppclinux.c \
+	eelf32ppchaiku.c \
 	eelf32ppcnto.c \
 	eelf32ppcsim.c \
 	eelf32ppcvxworks.c \
@@ -279,9 +281,11 @@  ALL_EMULATION_SOURCES = \
 	eelf_i386.c \
 	eelf_i386_be.c \
 	eelf_i386_fbsd.c \
+	eelf_i386_haiku.c \
 	eelf_i386_ldso.c \
 	eelf_i386_sol2.c \
 	eelf_i386_vxworks.c \
+	eelf_mipsel_haiku.c \
 	eelf_iamcu.c \
 	eelf_s390.c \
 	eh8300elf.c \
@@ -383,6 +387,7 @@  ALL_64_EMULATION_SOURCES = \
 	eaarch64cloudabib.c \
 	eaarch64fbsd.c \
 	eaarch64fbsdb.c \
+	eaarch64haiku.c \
 	eaarch64linux.c \
 	eaarch64linuxb.c \
 	eaarch64linux32.c \
@@ -454,6 +459,7 @@  ALL_64_EMULATION_SOURCES = \
 	eelf_k1om_fbsd.c \
 	eelf_x86_64.c \
 	eelf_x86_64_cloudabi.c \
+	eelf_x86_64_haiku.c \
 	eelf_x86_64_fbsd.c \
 	eelf_x86_64_sol2.c \
 	ehppa64linux.c \
diff --git a/ld/Makefile.in b/ld/Makefile.in
index ef2e99e08da..2b83b5e619c 100644
--- a/ld/Makefile.in
+++ b/ld/Makefile.in
@@ -657,6 +657,7 @@  ALL_EMULATION_SOURCES = \
 	earmelf.c \
 	earmelf_fbsd.c \
 	earmelf_fuchsia.c \
+	earmelf_haiku.c \
 	earmelf_linux.c \
 	earmelf_linux_eabi.c \
 	earmelf_linux_fdpiceabi.c \
@@ -747,6 +748,7 @@  ALL_EMULATION_SOURCES = \
 	eelf32or1k_linux.c \
 	eelf32ppc.c \
 	eelf32ppc_fbsd.c \
+	eelf32ppchaiku.c \
 	eelf32ppclinux.c \
 	eelf32ppcnto.c \
 	eelf32ppcsim.c \
@@ -769,10 +771,12 @@  ALL_EMULATION_SOURCES = \
 	eelf_i386.c \
 	eelf_i386_be.c \
 	eelf_i386_fbsd.c \
+	eelf_i386_haiku.c \
 	eelf_i386_ldso.c \
 	eelf_i386_sol2.c \
 	eelf_i386_vxworks.c \
 	eelf_iamcu.c \
+	eelf_mipsel_haiku.c \
 	eelf_s390.c \
 	eh8300elf.c \
 	eh8300elf_linux.c \
@@ -872,6 +876,7 @@  ALL_64_EMULATION_SOURCES = \
 	eaarch64cloudabib.c \
 	eaarch64fbsd.c \
 	eaarch64fbsdb.c \
+	eaarch64haiku.c \
 	eaarch64linux.c \
 	eaarch64linuxb.c \
 	eaarch64linux32.c \
@@ -943,6 +948,7 @@  ALL_64_EMULATION_SOURCES = \
 	eelf_k1om_fbsd.c \
 	eelf_x86_64.c \
 	eelf_x86_64_cloudabi.c \
+	eelf_x86_64_haiku.c \
 	eelf_x86_64_fbsd.c \
 	eelf_x86_64_sol2.c \
 	ehppa64linux.c \
@@ -1242,6 +1248,7 @@  distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eaarch64elfb.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eaarch64fbsd.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eaarch64fbsdb.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eaarch64haiku.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eaarch64linux.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eaarch64linux32.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eaarch64linux32b.Po@am__quote@
@@ -1261,6 +1268,7 @@  distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/earmelf.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/earmelf_fbsd.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/earmelf_fuchsia.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/earmelf_haiku.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/earmelf_linux.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/earmelf_linux_eabi.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/earmelf_linux_fdpiceabi.Po@am__quote@
@@ -1379,6 +1387,7 @@  distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32or1k_linux.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32ppc.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32ppc_fbsd.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32ppchaiku.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32ppclinux.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32ppcnto.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32ppcsim.Po@am__quote@
@@ -1433,6 +1442,7 @@  distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_i386.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_i386_be.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_i386_fbsd.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_i386_haiku.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_i386_ldso.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_i386_sol2.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_i386_vxworks.Po@am__quote@
@@ -2437,6 +2447,7 @@  $(ALL_EMULATION_SOURCES) $(ALL_64_EMULATION_SOURCES): $(GEN_DEPENDS)
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_i386_sol2.Pc@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_i386_vxworks.Pc@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_iamcu.Pc@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_mipsel_haiku.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_s390.Pc@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eh8300elf.Pc@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eh8300elf_linux.Pc@am__quote@
@@ -2598,6 +2609,7 @@  $(ALL_EMULATION_SOURCES) $(ALL_64_EMULATION_SOURCES): $(GEN_DEPENDS)
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_k1om_fbsd.Pc@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_x86_64.Pc@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_x86_64_cloudabi.Pc@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_x86_64_haiku.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_x86_64_fbsd.Pc@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_x86_64_sol2.Pc@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ehppa64linux.Pc@am__quote@
diff --git a/ld/configure b/ld/configure
index 33b7de33d1d..6ea123b2a9e 100755
--- a/ld/configure
+++ b/ld/configure
@@ -10616,7 +10616,7 @@  haiku*)
   soname_spec='${libname}${release}${shared_ext}$major'
   shlibpath_var=LIBRARY_PATH
   shlibpath_overrides_runpath=yes
-  sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/beos/system/lib'
+  sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib'
   hardcode_into_libs=yes
   ;;
 
@@ -14266,7 +14266,7 @@  haiku*)
   soname_spec='${libname}${release}${shared_ext}$major'
   shlibpath_var=LIBRARY_PATH
   shlibpath_overrides_runpath=yes
-  sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/beos/system/lib'
+  sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib'
   hardcode_into_libs=yes
   ;;
 
diff --git a/ld/configure.tgt b/ld/configure.tgt
index d46ed620c17..5411104ec36 100644
--- a/ld/configure.tgt
+++ b/ld/configure.tgt
@@ -77,6 +77,9 @@  aarch64-*-linux*)	targ_emul=aarch64linux
 			targ_extra_libpath="aarch64linuxb aarch64linux32 aarch64linux32b armelfb_linux_eabi armelf_linux_eabi"
 			targ_extra_emuls="aarch64elf aarch64elf32 aarch64elf32b aarch64elfb armelf armelfb $targ_extra_libpath"
 			;;
+aarch64-*-haiku*)	targ_emul=aarch64haiku
+			targ_extra_emuls="aarch64elf aarch64elf32 aarch64elf32b aarch64elfb armelf armelfb armelf_haiku $targ_extra_libpath"
+			;;
 alpha*-*-freebsd* | alpha*-*-kfreebsd*-gnu)
 			targ_emul=elf64alpha_fbsd
 			targ_extra_emuls="elf64alpha alpha"
@@ -199,6 +202,9 @@  arm*-*-conix*)		targ_emul=armelf
 arm*-*-fuchsia*)	targ_emul=armelf_fuchsia
 			targ_extra_emuls="armelfb_fuchsia armelf armelfb"
 			;;
+arm*-*-haiku*)		arg_emul=armelf_haiku
+			targ_extra_emuls=armelf
+			;;
 avr-*-*)		targ_emul=avr2
 			targ_extra_emuls="avr1 avr25 avr3 avr31 avr35 avr4 avr5 avr51 avr6 avrxmega1 avrxmega2 avrxmega3 avrxmega4 avrxmega5 avrxmega6 avrxmega7 avrtiny"
 			;;
@@ -395,6 +401,8 @@  i[3-7]86-*-beospe*)	targ_emul=i386beos
 			;;
 i[3-7]86-*-beos*)	targ_emul=elf_i386_be
 			;;
+i[3-7]86-*-haiku*)	targ_emul=elf_i386_haiku
+			;;
 i[3-7]86-*-vxworks*)	targ_emul=elf_i386_vxworks
 			;;
 i[3-7]86-*-chaos)	targ_emul=elf_i386_chaos
@@ -448,6 +456,8 @@  m68hc12-*-*|m6812-*-*)	targ_emul=m68hc12elf
 			;;
 m68*-*-netbsd*)	targ_emul=m68kelfnbsd
 			;;
+m68*-*-haiku*)		targ_emul=m68kelf
+			;;
 m68*-*-*)		targ_emul=m68kelf
 			;;
 mcore-*-pe)		targ_emul=mcorepe ;
@@ -477,6 +487,9 @@  mips*-sgi-irix6*)	targ_emul=elf32bmipn32
 			targ_extra_emuls="elf32bsmip elf64bmip"
 			targ_extra_libpath=$targ_extra_emuls
 			;;
+mips*el-*-haiku*)	targ_emul=elf_mipsel_haiku
+			targ_extra_emuls="elf32ltsmip elf32btsmip elf32ltsmipn32 elf64ltsmip elf32btsmipn32 elf64btsmip"
+			;;
 mips*el-*-netbsd*)	targ_emul=elf32ltsmip
 			targ_extra_emuls="elf32btsmip elf64ltsmip elf64btsmip"
 			;;
@@ -733,6 +746,8 @@  powerpc-*-aix*)		targ_emul=aixppc
 powerpc-*-beos*)	targ_emul=aixppc
 			targ_extra_ofiles=
 			;;
+powerpc-*-haiku*)	targ_emul=elf32ppchaiku
+			;;
 powerpc-*-windiss*)	targ_emul=elf32ppcwindiss
 			;;
 pru*-*-*)		targ_emul=pruelf
@@ -869,6 +884,8 @@  sparc64-*-solaris2* | sparcv9-*-solaris2*)
 			targ_extra_libpath=$targ_extra_emuls
 			tdir_elf32_sparc=`echo ${targ_alias} | sed -e 's/64//'`
 			;;
+sparc64-*-haiku*)	targ_emul=elf64_sparc
+			;;
 sparc64-*-*)		targ_emul=elf64_sparc
 			;;
 sparc*-*-linux-*)	targ_emul=elf32_sparc
@@ -936,6 +953,9 @@  x86_64-*-rdos*)		targ_emul=elf64rdos
 			;;
 x86_64-*-cloudabi*)	targ_emul=elf_x86_64_cloudabi
 			;;
+x86_64-*-haiku*)	targ_emul=elf_x86_64_haiku
+			targ_extra_emuls="elf_x86_64 elf_i386_haiku"
+			;;
 x86_64-*-linux-gnux32)	targ_emul=elf32_x86_64
 			targ_extra_emuls="elf_x86_64 elf_i386 elf_iamcu elf_l1om elf_k1om"
 			targ_extra_libpath="elf_i386 elf_iamcu elf_x86_64 elf_l1om elf_k1om"
diff --git a/ld/emulparams/aarch64haiku.sh b/ld/emulparams/aarch64haiku.sh
new file mode 100644
index 00000000000..b0298ec4d96
--- /dev/null
+++ b/ld/emulparams/aarch64haiku.sh
@@ -0,0 +1,39 @@ 
+ARCH=aarch64
+MACHINE=
+NOP=0x1f2003d5
+
+SCRIPT_NAME=elf
+ELFSIZE=64
+OUTPUT_FORMAT="elf64-littleaarch64"
+BIG_OUTPUT_FORMAT="elf64-bigaarch64"
+LITTLE_OUTPUT_FORMAT="elf64-littleaarch64"
+NO_REL_RELOCS=yes
+
+TEMPLATE_NAME=elf
+EXTRA_EM_FILE=aarch64elf
+
+GENERATE_SHLIB_SCRIPT=yes
+GENERATE_PIE_SCRIPT=yes
+
+MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
+COMMONPAGESIZE="CONSTANT (COMMONPAGESIZE)"
+SEPARATE_GOTPLT=24
+IREL_IN_PLT=
+
+TEXT_START_ADDR=0x400000
+
+DATA_START_SYMBOLS='PROVIDE (__data_start = .);';
+
+# AArch64 does not support .s* sections.
+NO_SMALL_DATA=yes
+
+OTHER_BSS_SYMBOLS="${CREATE_SHLIB+PROVIDE (}__bss_start__ = .${CREATE_SHLIB+)};"
+OTHER_BSS_END_SYMBOLS="${CREATE_SHLIB+PROVIDE (}_bss_end__ = .${CREATE_SHLIB+)}; ${CREATE_SHLIB+PROVIDE (}__bss_end__ = .${CREATE_SHLIB+)};"
+OTHER_END_SYMBOLS="${CREATE_SHLIB+PROVIDE (}__end__ = .${CREATE_SHLIB+)};"
+
+OTHER_SECTIONS='.note.gnu.arm.ident 0 : { KEEP (*(.note.gnu.arm.ident)) }'
+ATTRS_SECTIONS='.ARM.attributes 0 : { KEEP (*(.ARM.attributes)) KEEP (*(.gnu.attributes)) }'
+# Ensure each PLT entry is aligned to a cache line.
+PLT=".plt          ${RELOCATING-0} : ALIGN(16) { *(.plt)${RELOCATING+${IREL_IN_PLT+ *(.iplt)}} }"
+
+. ${srcdir}/emulparams/elf_haiku.sh
diff --git a/ld/emulparams/armelf_haiku.sh b/ld/emulparams/armelf_haiku.sh
new file mode 100644
index 00000000000..c42060f6b0c
--- /dev/null
+++ b/ld/emulparams/armelf_haiku.sh
@@ -0,0 +1,33 @@ 
+ARCH=arm
+SCRIPT_NAME=elf
+OUTPUT_FORMAT="elf32-littlearm"
+BIG_OUTPUT_FORMAT="elf32-bigarm"
+LITTLE_OUTPUT_FORMAT="elf32-littlearm"
+MAXPAGESIZE=0x8000
+COMMONPAGESIZE=0x1000
+TEMPLATE_NAME=elf
+EXTRA_EM_FILE=armelf
+GENERATE_SHLIB_SCRIPT=yes
+GENERATE_PIE_SCRIPT=yes
+
+DATA_START_SYMBOLS='__data_start = . ;';
+OTHER_TEXT_SECTIONS='*(.glue_7t) *(.glue_7)'
+OTHER_BSS_SYMBOLS='__bss_start__ = .;'
+OTHER_BSS_END_SYMBOLS='_bss_end__ = . ; __bss_end__ = . ;'
+OTHER_END_SYMBOLS='__end__ = . ;'
+OTHER_SECTIONS='.note.gnu.arm.ident 0 : { KEEP (*(.note.gnu.arm.ident)) }'
+
+# Use the ARM ABI-compliant exception-handling sections.
+OTHER_READONLY_SECTIONS="
+  .ARM.extab ${RELOCATING-0} : { *(.ARM.extab${RELOCATING+* .gnu.linkonce.armextab.*}) }
+  ${RELOCATING+ PROVIDE_HIDDEN (__exidx_start = .); }
+  .ARM.exidx ${RELOCATING-0} : { *(.ARM.exidx${RELOCATING+* .gnu.linkonce.armexidx.*}) }
+  ${RELOCATING+ PROVIDE_HIDDEN (__exidx_end = .); }"
+
+TEXT_START_ADDR=0x00008000
+TARGET2_TYPE=got-rel
+
+# ARM does not support .s* sections.
+NO_SMALL_DATA=yes
+
+. ${srcdir}/emulparams/elf_haiku.sh
diff --git a/ld/emulparams/elf32ppchaiku.sh b/ld/emulparams/elf32ppchaiku.sh
new file mode 100644
index 00000000000..547e5c8e669
--- /dev/null
+++ b/ld/emulparams/elf32ppchaiku.sh
@@ -0,0 +1,7 @@ 
+. ${srcdir}/emulparams/elf32ppc.sh
+. ${srcdir}/emulparams/elf_haiku.sh
+TEXT_START_ADDR=0x200000
+MAXPAGESIZE=0x1000
+GENERATE_SHLIB_SCRIPT=yes
+BSS_PLT=
+LIBPATH_SUFFIX=
diff --git a/ld/emulparams/elf_haiku.sh b/ld/emulparams/elf_haiku.sh
new file mode 100644
index 00000000000..401eedce5d4
--- /dev/null
+++ b/ld/emulparams/elf_haiku.sh
@@ -0,0 +1 @@ 
+ELF_INTERPRETER_NAME=\"/system/runtime_loader\"
diff --git a/ld/emulparams/elf_i386_haiku.sh b/ld/emulparams/elf_i386_haiku.sh
new file mode 100644
index 00000000000..6c4001e4e05
--- /dev/null
+++ b/ld/emulparams/elf_i386_haiku.sh
@@ -0,0 +1,7 @@ 
+source_sh ${srcdir}/emulparams/elf_i386.sh
+source_sh ${srcdir}/emulparams/elf_haiku.sh
+TEXT_START_ADDR=0x200000
+NONPAGED_TEXT_START_ADDR=0x200000
+MAXPAGESIZE=0x1000
+NOP=0x90909090
+OUTPUT_FORMAT="elf32-i386"
diff --git a/ld/emulparams/elf_mipsel_haiku.sh b/ld/emulparams/elf_mipsel_haiku.sh
new file mode 100644
index 00000000000..ab38e2323cd
--- /dev/null
+++ b/ld/emulparams/elf_mipsel_haiku.sh
@@ -0,0 +1,3 @@ 
+. ${srcdir}/emulparams/elf32lmip.sh
+. ${srcdir}/emulparams/elf_haiku.sh
+
diff --git a/ld/emulparams/elf_x86_64_haiku.sh b/ld/emulparams/elf_x86_64_haiku.sh
new file mode 100644
index 00000000000..f049559b40f
--- /dev/null
+++ b/ld/emulparams/elf_x86_64_haiku.sh
@@ -0,0 +1,2 @@ 
+. ${srcdir}/emulparams/elf_x86_64.sh
+. ${srcdir}/emulparams/elf_haiku.sh
diff --git a/libtool.m4 b/libtool.m4
index 9a13f3b117a..f69fc99f691 100644
--- a/libtool.m4
+++ b/libtool.m4
@@ -2362,7 +2362,7 @@  haiku*)
   soname_spec='${libname}${release}${shared_ext}$major'
   shlibpath_var=LIBRARY_PATH
   shlibpath_overrides_runpath=yes
-  sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/beos/system/lib'
+  sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib'
   hardcode_into_libs=yes
   ;;
 
diff --git a/opcodes/configure b/opcodes/configure
index 3513e408ce1..9687cef4670 100755
--- a/opcodes/configure
+++ b/opcodes/configure
@@ -10012,7 +10012,7 @@  haiku*)
   soname_spec='${libname}${release}${shared_ext}$major'
   shlibpath_var=LIBRARY_PATH
   shlibpath_overrides_runpath=yes
-  sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/beos/system/lib'
+  sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib'
   hardcode_into_libs=yes
   ;;