This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
PATCH: Fix support for DragonFly BSD on binutils 2.21 and trunk
- From: John Marino <binutils at marino dot st>
- To: binutils at sourceware dot org
- Date: Tue, 08 Mar 2011 19:12:41 +0100
- Subject: PATCH: Fix support for DragonFly BSD on binutils 2.21 and trunk
Hi,
The following patches (one for binutils-2_21-branch and one for master)
will fix support for DragonFly BSD that has long since been broken.
Although I would consider this a trivial patch, I have completed my
binutils copyright assignment to the FSF. My FSF ID is 658681.
I hope I am following proper protocol with this patch submission. If
not, I'm sure somebody will educate me quickly. :)
Thanks in advance,
John Marino
diff --git a/bfd/config.bfd b/bfd/config.bfd
index 2de94a4..fbf77ad 100644
--- a/bfd/config.bfd
+++ b/bfd/config.bfd
@@ -551,13 +551,17 @@ case "${targ}" in
targ_defvec=i386bsd_vec
targ_underscore=yes
;;
+ i[3-7]86-*-dragonfly*)
+ targ_defvec=bfd_elf32_i386_vec
+ targ64_selvecs="bfd_elf64_x86_64_vec bfd_elf64_l1om_vec"
+ ;;
i[3-7]86-*-freebsdaout* | i[3-7]86-*-freebsd[12].* | \
i[3-7]86-*-freebsd[12])
targ_defvec=i386freebsd_vec
targ_selvecs=i386bsd_vec
targ_underscore=yes
;;
- i[3-7]86-*-freebsd* | i[3-7]86-*-kfreebsd*-gnu | i[3-7]86-*-dragonfly*)
+ i[3-7]86-*-freebsd* | i[3-7]86-*-kfreebsd*-gnu)
targ_defvec=bfd_elf32_i386_freebsd_vec
targ_selvecs="bfd_elf32_i386_vec i386pei_vec i386coff_vec"
targ64_selvecs="bfd_elf64_x86_64_freebsd_vec bfd_elf64_x86_64_vec x86_64pei_vec bfd_elf64_l1om_vec bfd_elf64_l1om_freebsd_vec"
@@ -617,6 +621,11 @@ case "${targ}" in
targ_selvecs="bfd_elf32_i386_vec bfd_elf64_l1om_vec i386coff_vec"
want64=true
;;
+ x86_64-*-dragonfly*)
+ targ_defvec=bfd_elf64_x86_64_vec
+ targ_selvecs="bfd_elf32_i386_vec bfd_elf64_l1om_vec"
+ want64=true
+ ;;
x86_64-*-freebsd* | x86_64-*-kfreebsd*-gnu)
targ_defvec=bfd_elf64_x86_64_freebsd_vec
targ_selvecs="bfd_elf32_i386_freebsd_vec i386coff_vec i386pei_vec x86_64pei_vec bfd_elf32_i386_vec bfd_elf64_x86_64_vec bfd_elf64_l1om_vec bfd_elf64_l1om_freebsd_vec"
diff --git a/bfd/configure b/bfd/configure
index c8d48fd..301def9 100755
--- a/bfd/configure
+++ b/bfd/configure
@@ -15068,8 +15068,6 @@ do
bfd_elf32_hppa_nbsd_vec) tb="$tb elf32-hppa.lo elf32.lo $elf" ;;
bfd_elf32_hppa_vec) tb="$tb elf32-hppa.lo elf32.lo $elf" ;;
bfd_elf32_i370_vec) tb="$tb elf32-i370.lo elf32.lo $elf" ;;
- bfd_elf32_i386_dragonfly_vec)
- tb="$tb elf32-i386.lo elf-ifunc.lo elf-vxworks.lo elf32.lo $elf" ;;
bfd_elf32_i386_sol2_vec) tb="$tb elf32-i386.lo elf-ifunc.lo elf-vxworks.lo elf32.lo $elf" ;;
bfd_elf32_i386_freebsd_vec) tb="$tb elf32-i386.lo elf-ifunc.lo elf-vxworks.lo elf32.lo $elf" ;;
bfd_elf32_i386_vxworks_vec) tb="$tb elf32-i386.lo elf-ifunc.lo elf-vxworks.lo elf32.lo $elf" ;;
diff --git a/bfd/configure.in b/bfd/configure.in
index d758a51..4076c6e 100644
--- a/bfd/configure.in
+++ b/bfd/configure.in
@@ -703,8 +703,6 @@ do
bfd_elf32_hppa_nbsd_vec) tb="$tb elf32-hppa.lo elf32.lo $elf" ;;
bfd_elf32_hppa_vec) tb="$tb elf32-hppa.lo elf32.lo $elf" ;;
bfd_elf32_i370_vec) tb="$tb elf32-i370.lo elf32.lo $elf" ;;
- bfd_elf32_i386_dragonfly_vec)
- tb="$tb elf32-i386.lo elf-ifunc.lo elf-vxworks.lo elf32.lo $elf" ;;
bfd_elf32_i386_sol2_vec) tb="$tb elf32-i386.lo elf-ifunc.lo elf-vxworks.lo elf32.lo $elf" ;;
bfd_elf32_i386_freebsd_vec) tb="$tb elf32-i386.lo elf-ifunc.lo elf-vxworks.lo elf32.lo $elf" ;;
bfd_elf32_i386_vxworks_vec) tb="$tb elf32-i386.lo elf-ifunc.lo elf-vxworks.lo elf32.lo $elf" ;;
diff --git a/config.guess b/config.guess
index 115f944..d27d54b 100755
--- a/config.guess
+++ b/config.guess
@@ -798,6 +798,9 @@ EOF
echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
esac
exit ;;
+ *:DragonFly:*:*)
+ echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
+ exit ;;
i*:CYGWIN*:*)
echo ${UNAME_MACHINE}-pc-cygwin
exit ;;
diff --git a/config.rpath b/config.rpath
index 9316b91..00ccde4 100755
--- a/config.rpath
+++ b/config.rpath
@@ -284,6 +284,10 @@ else
dgux*)
hardcode_libdir_flag_spec='-L$libdir'
;;
+ dragonfly*)
+ hardcode_libdir_flag_spec='-R$libdir'
+ hardcode_direct=yes
+ ;;
freebsd1*)
ld_shlibs=no
;;
diff --git a/config/tcl.m4 b/config/tcl.m4
index 900a2ce..ab81991 100644
--- a/config/tcl.m4
+++ b/config/tcl.m4
@@ -1540,6 +1540,17 @@ dnl AC_CHECK_TOOL(AR, ar)
UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.a'
TCL_LIB_VERSIONS_OK=nodots
;;
+ DragonFly-*)
+ SHLIB_CFLAGS="-fPIC"
+ SHLIB_LD="ld -Bshareable -x"
+ SHLIB_LD_LIBS='${LIBS}'
+ SHLIB_SUFFIX=".so"
+ DL_OBJS="tclLoadDl.o"
+ DL_LIBS=""
+ LDFLAGS="$LDFLAGS -export-dynamic"
+ CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
+ LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'
+ ;;
FreeBSD-*)
# FreeBSD 3.* and greater have ELF.
SHLIB_CFLAGS="-fPIC"
diff --git a/configure b/configure
index 7212797..81c167a 100755
--- a/configure
+++ b/configure
@@ -2869,7 +2869,8 @@ case "${ENABLE_GOLD}" in
case "${target}" in
*-*-elf* | *-*-sysv4* | *-*-unixware* | *-*-eabi* | hppa*64*-*-hpux* \
| *-*-linux* | frv-*-uclinux* | *-*-irix5* | *-*-irix6* \
- | *-*-netbsd* | *-*-openbsd* | *-*-freebsd* | *-*-solaris2* | *-*-nto*)
+ | *-*-netbsd* | *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* \
+ | *-*-solaris2* | *-*-nto*)
case "${target}" in
*-*-linux*aout* | *-*-linux*oldld*)
;;
@@ -3035,7 +3036,7 @@ if test x$enable_libgomp = x ; then
case "${target}" in
*-*-linux* | *-*-gnu* | *-*-k*bsd*-gnu | *-*-kopensolaris*-gnu)
;;
- *-*-netbsd* | *-*-freebsd* | *-*-openbsd*)
+ *-*-netbsd* | *-*-freebsd* | *-*-openbsd* | *-*-dragonfly*)
;;
*-*-solaris2* | *-*-sysv4* | *-*-irix6* | *-*-osf* | *-*-hpux11*)
;;
@@ -3071,6 +3072,9 @@ case "${target}" in
noconfigdirs="$noconfigdirs sim target-rda"
noconfigdirs="$noconfigdirs ${libgcj}"
;;
+ *-*-dragonfly*)
+ noconfigdirs="$noconfigdirs target-newlib target-libgloss"
+ ;;
*-*-freebsd[12] | *-*-freebsd[12].* | *-*-freebsd*aout*)
noconfigdirs="$noconfigdirs target-newlib target-libgloss ${libgcj}"
;;
diff --git a/configure.ac b/configure.ac
index 19cf53f..22c0c73 100644
--- a/configure.ac
+++ b/configure.ac
@@ -351,7 +351,8 @@ case "${ENABLE_GOLD}" in
case "${target}" in
*-*-elf* | *-*-sysv4* | *-*-unixware* | *-*-eabi* | hppa*64*-*-hpux* \
| *-*-linux* | frv-*-uclinux* | *-*-irix5* | *-*-irix6* \
- | *-*-netbsd* | *-*-openbsd* | *-*-freebsd* | *-*-solaris2* | *-*-nto*)
+ | *-*-netbsd* | *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* \
+ | *-*-solaris2* | *-*-nto*)
case "${target}" in
*-*-linux*aout* | *-*-linux*oldld*)
;;
@@ -507,7 +508,7 @@ if test x$enable_libgomp = x ; then
case "${target}" in
*-*-linux* | *-*-gnu* | *-*-k*bsd*-gnu | *-*-kopensolaris*-gnu)
;;
- *-*-netbsd* | *-*-freebsd* | *-*-openbsd*)
+ *-*-netbsd* | *-*-freebsd* | *-*-openbsd* | *-*-dragonfly*)
;;
*-*-solaris2* | *-*-sysv4* | *-*-irix6* | *-*-osf* | *-*-hpux11*)
;;
@@ -543,6 +544,9 @@ case "${target}" in
noconfigdirs="$noconfigdirs sim target-rda"
noconfigdirs="$noconfigdirs ${libgcj}"
;;
+ *-*-dragonfly*)
+ noconfigdirs="$noconfigdirs target-newlib target-libgloss"
+ ;;
*-*-freebsd[[12]] | *-*-freebsd[[12]].* | *-*-freebsd*aout*)
noconfigdirs="$noconfigdirs target-newlib target-libgloss ${libgcj}"
;;
diff --git a/gas/configure.tgt b/gas/configure.tgt
index c05a64a..b9363a8 100644
--- a/gas/configure.tgt
+++ b/gas/configure.tgt
@@ -205,8 +205,8 @@ case ${generic_target} in
i386-*-freebsdaout*) fmt=aout em=386bsd ;;
i386-*-freebsd[12].*) fmt=aout em=386bsd ;;
i386-*-freebsd[12]) fmt=aout em=386bsd ;;
- i386-*-freebsd* | i386-*-kfreebsd*-gnu | i386-*-dragonfly*)
- fmt=elf em=freebsd ;;
+ i386-*-freebsd* \
+ | i386-*-kfreebsd*-gnu) fmt=elf em=freebsd ;;
i386-*-sysv*) fmt=coff ;;
i386-*-sco3.2v5*coff) fmt=coff ;;
i386-*-isc*) fmt=coff ;;
@@ -419,6 +419,7 @@ case ${generic_target} in
z8k-*-coff | z8k-*-sim) fmt=coff ;;
*-*-aout | *-*-scout) fmt=aout ;;
+ *-*-dragonfly*) fmt=elf ;;
*-*-freebsd* | *-*-kfreebsd*-gnu) fmt=elf em=freebsd ;;
*-*-bsd*) fmt=aout em=sun3 ;;
*-*-generic) fmt=generic ;;
diff --git a/gold/configure.tgt b/gold/configure.tgt
index 0f3b1c3..523e74e 100644
--- a/gold/configure.tgt
+++ b/gold/configure.tgt
@@ -54,7 +54,7 @@ i?86-*)
targ_size=32
targ_big_endian=false
case "$targ" in
- i?86-*-freebsd*)
+ i?86-*-freebsd* | i?86-*-dragonfly*)
targ_osabi=ELFOSABI_FREEBSD
;;
esac
@@ -67,7 +67,7 @@ x86_64*)
targ_extra_size=32
targ_big_endian=false
case "$targ" in
- x86_64-*-freebsd*)
+ x86_64-*-freebsd* | x86_64-*-dragonfly*)
targ_osabi=ELFOSABI_FREEBSD
;;
esac
diff --git a/ld/configure.host b/ld/configure.host
index f2dffe6..f47b961 100644
--- a/ld/configure.host
+++ b/ld/configure.host
@@ -18,7 +18,12 @@ HOSTING_LIBS='`if [ -f ../gcc/libgcc.a ]; then libgcc=../gcc/libgcc.a; else libg
case "${host}" in
-*-*-freebsd* | *-*-kfreebsd*-gnu | *-*-dragonfly*)
+*-*-dragonfly*)
+ HOSTING_CRT0='-dynamic-linker `[ -f \`${CC} --print-prog-name=ld-elf.so.2\` ] || echo /usr/libexec/``${CC} --print-prog-name=ld-elf.so.2` `${CC} --print-file-name=crt1.o` `${CC} --print-file-name=crti.o` `${CC} --print-file-name=crtbegin.o`'
+ HOSTING_LIBS='-L`dirname \`${CC} --print-file-name=libc.so\`` '"$HOSTING_LIBS"' `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; else ${CC} --print-file-name=crtend.o; fi` `${CC} --print-file-name=crtn.o`'
+ ;;
+
+*-*-freebsd* | *-*-kfreebsd*-gnu)
HOSTING_CRT0='-dynamic-linker `[ -f \`${CC} --print-prog-name=ld-elf.so.1\` ] || echo /usr/libexec/``${CC} --print-prog-name=ld-elf.so.1` `${CC} --print-file-name=crt1.o` `${CC} --print-file-name=crti.o` `${CC} --print-file-name=crtbegin.o`'
HOSTING_LIBS='-L`dirname \`${CC} --print-file-name=libc.so\`` '"$HOSTING_LIBS"' `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; else ${CC} --print-file-name=crtend.o; fi` `${CC} --print-file-name=crtn.o`'
;;
@@ -200,7 +205,10 @@ sparc64-*-solaris2* | sparcv9-*-solaris2*)
HOSTING_LIBS="$HOSTING_LIBS"' `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; else ${CC} -print-file-name=crtend.o; fi` `if [ -f ../gcc/crtn.o ]; then echo ../gcc/crtn.o; else ${CC} -print-file-name=crtn.o; fi`'
;;
-*-*-freebsd* | *-*-kfreebsd*-gnu | *-*-dragonfly*)
+*-*-dragonfly*)
+ ;;
+
+*-*-freebsd* | *-*-kfreebsd*-gnu)
;;
*-*-linux* | *-*-gnu*)
diff --git a/ld/configure.tgt b/ld/configure.tgt
index 4e90739..90d7461 100644
--- a/ld/configure.tgt
+++ b/ld/configure.tgt
@@ -248,7 +248,11 @@ x86_64-*-elf*) targ_emul=elf_x86_64
i[3-7]86-*-kaos*) targ_emul=elf_i386 ;;
i[3-7]86-*-freebsdaout* | i[3-7]86-*-freebsd[12].* | i[3-7]86-*-freebsd[12])
targ_emul=i386bsd ;;
-i[3-7]86-*-freebsd* | i[3-7]86-*-kfreebsd*-gnu | i[3-7]86-*-dragonfly*)
+i[3-7]86-*-dragonfly*) targ_emul=elf_i386
+ targ_extra_emuls="i386bsd" ;;
+x86_64-*-dragonfly*) targ_emul=elf_x86_64
+ targ_extra_emuls="elf_i386 elf_l1om" ;;
+i[3-7]86-*-freebsd* | i[3-7]86-*-kfreebsd*-gnu)
targ_emul=elf_i386_fbsd
targ_extra_emuls="elf_i386 i386bsd" ;;
x86_64-*-freebsd* | x86_64-*-kfreebsd*-gnu)
@@ -666,7 +670,11 @@ esac
NATIVE_LIB_DIRS='/usr/local/lib /lib /usr/lib'
case "${target}" in
-*-*-freebsd* | *-*-dragonfly*)
+*-*-dragonfly*)
+ NATIVE_LIB_DIRS='/usr/lib /usr/pkg/lib /usr/local/lib'
+ ;;
+
+*-*-freebsd*)
NATIVE_LIB_DIRS='/lib /usr/lib /usr/local/lib'
;;
@@ -706,9 +714,6 @@ i[03-9x]86-*-cygwin*)
*-*-linux*)
;;
-*-*-freebsd* | *-*-dragonfly*)
- ;;
-
*-*-netbsd*)
;;
diff --git a/bfd/config.bfd b/bfd/config.bfd
index 01fa09a..5e67d6b 100644
--- a/bfd/config.bfd
+++ b/bfd/config.bfd
@@ -551,13 +551,17 @@ case "${targ}" in
targ_defvec=i386bsd_vec
targ_underscore=yes
;;
+ i[3-7]86-*-dragonfly*)
+ targ_defvec=bfd_elf32_i386_vec
+ targ64_selvecs="bfd_elf64_x86_64_vec bfd_elf64_l1om_vec"
+ ;;
i[3-7]86-*-freebsdaout* | i[3-7]86-*-freebsd[12].* | \
i[3-7]86-*-freebsd[12])
targ_defvec=i386freebsd_vec
targ_selvecs=i386bsd_vec
targ_underscore=yes
;;
- i[3-7]86-*-freebsd* | i[3-7]86-*-kfreebsd*-gnu | i[3-7]86-*-dragonfly*)
+ i[3-7]86-*-freebsd* | i[3-7]86-*-kfreebsd*-gnu)
targ_defvec=bfd_elf32_i386_freebsd_vec
targ_selvecs="bfd_elf32_i386_vec i386pei_vec i386coff_vec"
targ64_selvecs="bfd_elf64_x86_64_freebsd_vec bfd_elf64_x86_64_vec x86_64pei_vec bfd_elf64_l1om_vec bfd_elf64_l1om_freebsd_vec"
@@ -617,6 +621,11 @@ case "${targ}" in
targ_selvecs="bfd_elf32_i386_vec bfd_elf64_l1om_vec i386coff_vec"
want64=true
;;
+ x86_64-*-dragonfly*)
+ targ_defvec=bfd_elf64_x86_64_vec
+ targ_selvecs="bfd_elf32_i386_vec bfd_elf64_l1om_vec"
+ want64=true
+ ;;
x86_64-*-freebsd* | x86_64-*-kfreebsd*-gnu)
targ_defvec=bfd_elf64_x86_64_freebsd_vec
targ_selvecs="bfd_elf32_i386_freebsd_vec i386coff_vec i386pei_vec x86_64pei_vec bfd_elf32_i386_vec bfd_elf64_x86_64_vec bfd_elf64_l1om_vec bfd_elf64_l1om_freebsd_vec"
diff --git a/bfd/configure b/bfd/configure
index 63dd10d..d587593 100755
--- a/bfd/configure
+++ b/bfd/configure
@@ -15060,8 +15060,6 @@ do
bfd_elf32_hppa_nbsd_vec) tb="$tb elf32-hppa.lo elf32.lo $elf" ;;
bfd_elf32_hppa_vec) tb="$tb elf32-hppa.lo elf32.lo $elf" ;;
bfd_elf32_i370_vec) tb="$tb elf32-i370.lo elf32.lo $elf" ;;
- bfd_elf32_i386_dragonfly_vec)
- tb="$tb elf32-i386.lo elf-ifunc.lo elf-vxworks.lo elf32.lo $elf" ;;
bfd_elf32_i386_sol2_vec) tb="$tb elf32-i386.lo elf-ifunc.lo elf-vxworks.lo elf32.lo $elf" ;;
bfd_elf32_i386_freebsd_vec) tb="$tb elf32-i386.lo elf-ifunc.lo elf-vxworks.lo elf32.lo $elf" ;;
bfd_elf32_i386_vxworks_vec) tb="$tb elf32-i386.lo elf-ifunc.lo elf-vxworks.lo elf32.lo $elf" ;;
diff --git a/bfd/configure.in b/bfd/configure.in
index 5908a57..eaba44c 100644
--- a/bfd/configure.in
+++ b/bfd/configure.in
@@ -703,8 +703,6 @@ do
bfd_elf32_hppa_nbsd_vec) tb="$tb elf32-hppa.lo elf32.lo $elf" ;;
bfd_elf32_hppa_vec) tb="$tb elf32-hppa.lo elf32.lo $elf" ;;
bfd_elf32_i370_vec) tb="$tb elf32-i370.lo elf32.lo $elf" ;;
- bfd_elf32_i386_dragonfly_vec)
- tb="$tb elf32-i386.lo elf-ifunc.lo elf-vxworks.lo elf32.lo $elf" ;;
bfd_elf32_i386_sol2_vec) tb="$tb elf32-i386.lo elf-ifunc.lo elf-vxworks.lo elf32.lo $elf" ;;
bfd_elf32_i386_freebsd_vec) tb="$tb elf32-i386.lo elf-ifunc.lo elf-vxworks.lo elf32.lo $elf" ;;
bfd_elf32_i386_vxworks_vec) tb="$tb elf32-i386.lo elf-ifunc.lo elf-vxworks.lo elf32.lo $elf" ;;
diff --git a/config.guess b/config.guess
index 115f944..d27d54b 100755
--- a/config.guess
+++ b/config.guess
@@ -798,6 +798,9 @@ EOF
echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
esac
exit ;;
+ *:DragonFly:*:*)
+ echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
+ exit ;;
i*:CYGWIN*:*)
echo ${UNAME_MACHINE}-pc-cygwin
exit ;;
diff --git a/config.rpath b/config.rpath
index 4dea759..d0cc6d9 100755
--- a/config.rpath
+++ b/config.rpath
@@ -284,6 +284,10 @@ else
dgux*)
hardcode_libdir_flag_spec='-L$libdir'
;;
+ dragonfly*)
+ hardcode_libdir_flag_spec='-R$libdir'
+ hardcode_direct=yes
+ ;;
freebsd2.2*)
hardcode_libdir_flag_spec='-R$libdir'
hardcode_direct=yes
diff --git a/config/tcl.m4 b/config/tcl.m4
index 900a2ce..ab81991 100644
--- a/config/tcl.m4
+++ b/config/tcl.m4
@@ -1540,6 +1540,17 @@ dnl AC_CHECK_TOOL(AR, ar)
UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.a'
TCL_LIB_VERSIONS_OK=nodots
;;
+ DragonFly-*)
+ SHLIB_CFLAGS="-fPIC"
+ SHLIB_LD="ld -Bshareable -x"
+ SHLIB_LD_LIBS='${LIBS}'
+ SHLIB_SUFFIX=".so"
+ DL_OBJS="tclLoadDl.o"
+ DL_LIBS=""
+ LDFLAGS="$LDFLAGS -export-dynamic"
+ CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
+ LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'
+ ;;
FreeBSD-*)
# FreeBSD 3.* and greater have ELF.
SHLIB_CFLAGS="-fPIC"
diff --git a/configure b/configure
index 5e97d0f..aa7356b 100755
--- a/configure
+++ b/configure
@@ -2896,7 +2896,8 @@ case "${ENABLE_GOLD}" in
case "${target}" in
*-*-elf* | *-*-sysv4* | *-*-unixware* | *-*-eabi* | hppa*64*-*-hpux* \
| *-*-linux* | frv-*-uclinux* | *-*-irix5* | *-*-irix6* \
- | *-*-netbsd* | *-*-openbsd* | *-*-freebsd* | *-*-solaris2* | *-*-nto*)
+ | *-*-netbsd* | *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* \
+ | *-*-solaris2* | *-*-nto*)
case "${target}" in
*-*-linux*aout* | *-*-linux*oldld*)
;;
@@ -3091,7 +3092,7 @@ if test x$enable_libgomp = x ; then
case "${target}" in
*-*-linux* | *-*-gnu* | *-*-k*bsd*-gnu | *-*-kopensolaris*-gnu)
;;
- *-*-netbsd* | *-*-freebsd* | *-*-openbsd*)
+ *-*-netbsd* | *-*-freebsd* | *-*-openbsd* | *-*-dragonfly*)
;;
*-*-solaris2* | *-*-sysv4* | *-*-irix6* | *-*-osf* | *-*-hpux11*)
;;
@@ -3127,6 +3128,9 @@ case "${target}" in
noconfigdirs="$noconfigdirs sim target-rda"
noconfigdirs="$noconfigdirs ${libgcj}"
;;
+ *-*-dragonfly*)
+ noconfigdirs="$noconfigdirs target-newlib target-libgloss"
+ ;;
*-*-freebsd[12] | *-*-freebsd[12].* | *-*-freebsd*aout*)
noconfigdirs="$noconfigdirs target-newlib target-libgloss ${libgcj}"
;;
diff --git a/configure.ac b/configure.ac
index 233ce0a..eb7e15f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -355,7 +355,8 @@ case "${ENABLE_GOLD}" in
case "${target}" in
*-*-elf* | *-*-sysv4* | *-*-unixware* | *-*-eabi* | hppa*64*-*-hpux* \
| *-*-linux* | frv-*-uclinux* | *-*-irix5* | *-*-irix6* \
- | *-*-netbsd* | *-*-openbsd* | *-*-freebsd* | *-*-solaris2* | *-*-nto*)
+ | *-*-netbsd* | *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* \
+ | *-*-solaris2* | *-*-nto*)
case "${target}" in
*-*-linux*aout* | *-*-linux*oldld*)
;;
@@ -537,7 +538,7 @@ if test x$enable_libgomp = x ; then
case "${target}" in
*-*-linux* | *-*-gnu* | *-*-k*bsd*-gnu | *-*-kopensolaris*-gnu)
;;
- *-*-netbsd* | *-*-freebsd* | *-*-openbsd*)
+ *-*-netbsd* | *-*-freebsd* | *-*-openbsd* | *-*-dragonfly*)
;;
*-*-solaris2* | *-*-sysv4* | *-*-irix6* | *-*-osf* | *-*-hpux11*)
;;
@@ -573,6 +574,9 @@ case "${target}" in
noconfigdirs="$noconfigdirs sim target-rda"
noconfigdirs="$noconfigdirs ${libgcj}"
;;
+ *-*-dragonfly*)
+ noconfigdirs="$noconfigdirs target-newlib target-libgloss"
+ ;;
*-*-freebsd[[12]] | *-*-freebsd[[12]].* | *-*-freebsd*aout*)
noconfigdirs="$noconfigdirs target-newlib target-libgloss ${libgcj}"
;;
diff --git a/gas/configure.tgt b/gas/configure.tgt
index 8ce9003..be28916 100644
--- a/gas/configure.tgt
+++ b/gas/configure.tgt
@@ -205,8 +205,8 @@ case ${generic_target} in
i386-*-freebsdaout*) fmt=aout em=386bsd ;;
i386-*-freebsd[12].*) fmt=aout em=386bsd ;;
i386-*-freebsd[12]) fmt=aout em=386bsd ;;
- i386-*-freebsd* | i386-*-kfreebsd*-gnu | i386-*-dragonfly*)
- fmt=elf em=freebsd ;;
+ i386-*-freebsd* \
+ | i386-*-kfreebsd*-gnu) fmt=elf em=freebsd ;;
i386-*-sysv*) fmt=coff ;;
i386-*-sco3.2v5*coff) fmt=coff ;;
i386-*-isc*) fmt=coff ;;
@@ -421,6 +421,7 @@ case ${generic_target} in
z8k-*-coff | z8k-*-sim) fmt=coff ;;
*-*-aout | *-*-scout) fmt=aout ;;
+ *-*-dragonfly*) fmt=elf ;;
*-*-freebsd* | *-*-kfreebsd*-gnu) fmt=elf em=freebsd ;;
*-*-bsd*) fmt=aout em=sun3 ;;
*-*-generic) fmt=generic ;;
diff --git a/gold/configure.tgt b/gold/configure.tgt
index 0f3b1c3..523e74e 100644
--- a/gold/configure.tgt
+++ b/gold/configure.tgt
@@ -54,7 +54,7 @@ i?86-*)
targ_size=32
targ_big_endian=false
case "$targ" in
- i?86-*-freebsd*)
+ i?86-*-freebsd* | i?86-*-dragonfly*)
targ_osabi=ELFOSABI_FREEBSD
;;
esac
@@ -67,7 +67,7 @@ x86_64*)
targ_extra_size=32
targ_big_endian=false
case "$targ" in
- x86_64-*-freebsd*)
+ x86_64-*-freebsd* | x86_64-*-dragonfly*)
targ_osabi=ELFOSABI_FREEBSD
;;
esac
diff --git a/ld/configure.host b/ld/configure.host
index f2dffe6..f47b961 100644
--- a/ld/configure.host
+++ b/ld/configure.host
@@ -18,7 +18,12 @@ HOSTING_LIBS='`if [ -f ../gcc/libgcc.a ]; then libgcc=../gcc/libgcc.a; else libg
case "${host}" in
-*-*-freebsd* | *-*-kfreebsd*-gnu | *-*-dragonfly*)
+*-*-dragonfly*)
+ HOSTING_CRT0='-dynamic-linker `[ -f \`${CC} --print-prog-name=ld-elf.so.2\` ] || echo /usr/libexec/``${CC} --print-prog-name=ld-elf.so.2` `${CC} --print-file-name=crt1.o` `${CC} --print-file-name=crti.o` `${CC} --print-file-name=crtbegin.o`'
+ HOSTING_LIBS='-L`dirname \`${CC} --print-file-name=libc.so\`` '"$HOSTING_LIBS"' `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; else ${CC} --print-file-name=crtend.o; fi` `${CC} --print-file-name=crtn.o`'
+ ;;
+
+*-*-freebsd* | *-*-kfreebsd*-gnu)
HOSTING_CRT0='-dynamic-linker `[ -f \`${CC} --print-prog-name=ld-elf.so.1\` ] || echo /usr/libexec/``${CC} --print-prog-name=ld-elf.so.1` `${CC} --print-file-name=crt1.o` `${CC} --print-file-name=crti.o` `${CC} --print-file-name=crtbegin.o`'
HOSTING_LIBS='-L`dirname \`${CC} --print-file-name=libc.so\`` '"$HOSTING_LIBS"' `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; else ${CC} --print-file-name=crtend.o; fi` `${CC} --print-file-name=crtn.o`'
;;
@@ -200,7 +205,10 @@ sparc64-*-solaris2* | sparcv9-*-solaris2*)
HOSTING_LIBS="$HOSTING_LIBS"' `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; else ${CC} -print-file-name=crtend.o; fi` `if [ -f ../gcc/crtn.o ]; then echo ../gcc/crtn.o; else ${CC} -print-file-name=crtn.o; fi`'
;;
-*-*-freebsd* | *-*-kfreebsd*-gnu | *-*-dragonfly*)
+*-*-dragonfly*)
+ ;;
+
+*-*-freebsd* | *-*-kfreebsd*-gnu)
;;
*-*-linux* | *-*-gnu*)
diff --git a/ld/configure.tgt b/ld/configure.tgt
index 4025837..7394f23 100644
--- a/ld/configure.tgt
+++ b/ld/configure.tgt
@@ -249,7 +249,11 @@ x86_64-*-elf*) targ_emul=elf_x86_64
i[3-7]86-*-kaos*) targ_emul=elf_i386 ;;
i[3-7]86-*-freebsdaout* | i[3-7]86-*-freebsd[12].* | i[3-7]86-*-freebsd[12])
targ_emul=i386bsd ;;
-i[3-7]86-*-freebsd* | i[3-7]86-*-kfreebsd*-gnu | i[3-7]86-*-dragonfly*)
+i[3-7]86-*-dragonfly*) targ_emul=elf_i386
+ targ_extra_emuls="i386bsd" ;;
+x86_64-*-dragonfly*) targ_emul=elf_x86_64
+ targ_extra_emuls="elf_i386 elf_l1om" ;;
+i[3-7]86-*-freebsd* | i[3-7]86-*-kfreebsd*-gnu)
targ_emul=elf_i386_fbsd
targ_extra_emuls="elf_i386 i386bsd" ;;
x86_64-*-freebsd* | x86_64-*-kfreebsd*-gnu)
@@ -683,7 +687,11 @@ esac
NATIVE_LIB_DIRS='/usr/local/lib /lib /usr/lib'
case "${target}" in
-*-*-freebsd* | *-*-dragonfly*)
+*-*-dragonfly*)
+ NATIVE_LIB_DIRS='/usr/lib /usr/pkg/lib /usr/local/lib'
+ ;;
+
+*-*-freebsd*)
NATIVE_LIB_DIRS='/lib /usr/lib /usr/local/lib'
;;
@@ -723,9 +731,6 @@ i[03-9x]86-*-cygwin*)
*-*-linux*)
;;
-*-*-freebsd* | *-*-dragonfly*)
- ;;
-
*-*-netbsd*)
;;