--- gcc/config.gcc.orig 2020-03-04 19:30:00.000000000 +1100 +++ gcc/config.gcc 2020-09-11 12:54:20.287819000 +1000 @@ -269,6 +269,7 @@ | sparc-hal-solaris2* \ | thumb-*-* \ | *-*-freebsd[12] | *-*-freebsd[12].* \ + | *-*-bsdsunix*aout* \ | *-*-freebsd*aout* \ | *-*-linux*aout* \ | *-*-linux*coff* \ @@ -696,6 +697,49 @@ default_use_cxa_atexit=yes use_gcc_stdint=wrap ;; +*-*-bsdsunix*) + # This is the generic ELF configuration of BSDSUniX. Later + # machine-specific sections may refine and add to this + # configuration. + # + # Due to tm_file entry ordering issues that vary between cpu + # architectures, we only define bsdsux_tm_file to allow the + # machine-specific section to dictate the final order of all + # entries of tm_file with the minor exception that components + # of the tm_file set here will always be of the form: + # + # bsdsunix.h [bsdsunix-.h ...] bsdsunix-spec.h bsdsunix.h + # + # The machine-specific section should not tamper with this + # ordering but may order all other entries of tm_file as it + # pleases around the provided core setting. + gas=yes + gnu_ld=yes + bsdsux_major=`echo ${target} | sed -e 's/.*bsdsunix//g' | sed -e 's/\..*//g'` + if test "$bsdsux_major" = ""; then + echo "Specify the major version number of the targeted BSDSUniX release" + echo "like this: --target=amd64-unknown-bsdsunix2.0" + exit 1 + fi + tm_defines="${tm_defines} BSDSUX_MAJOR=${bsdsux_major}" + tmake_file="t-slibgcc" + case ${enable_threads} in + no) + bsdsux_tm_file="${bsdsux_tm_file} bsdsunix-nthr.h" + ;; + "" | yes | posix) + thread_file='posix' + ;; + *) + echo 'Unknown thread configuration for BSDSUniX' + exit 1 + ;; + esac + bsdsux_tm_file="${bsdsux_tm_file} bsdsunix-spec.h bsdsunix.h bsdsunix-stdint.h" + extra_options="$extra_options rpath.opt bsdsunix.opt" + default_use_cxa_atexit=yes + use_gcc_stdint=wrap + ;; *-*-freebsd*) # This is the generic ELF configuration of FreeBSD. Later # machine-specific sections may refine and add to this @@ -975,6 +1019,11 @@ done TM_MULTILIB_CONFIG=`echo $TM_MULTILIB_CONFIG | sed 's/^,//'` ;; +aarch64*-*-bsdsunix*) + tm_file="${tm_file} dbxelf.h elfos.h ${bsdsux_tm_file}" + tm_file="${tm_file} aarch64/aarch64-elf.h aarch64/aarch64-bsdsunix.h" + tmake_file="${tmake_file} aarch64/t-aarch64 aarch64/t-aarch64-bsdsunix" + ;; aarch64*-*-freebsd*) tm_file="${tm_file} dbxelf.h elfos.h ${fbsd_tm_file}" tm_file="${tm_file} aarch64/aarch64-elf.h aarch64/aarch64-freebsd.h" @@ -1014,6 +1063,11 @@ tmake_file="${tmake_file} alpha/t-linux alpha/t-alpha" extra_options="${extra_options} alpha/elf.opt" ;; +alpha*-*-bsdsunix*) + tm_file="elfos.h ${tm_file} ${bsdsux_tm_file} alpha/elf.h alpha/bsdsunix.h" + tmake_file="${tmake_file} alpha/t-alpha" + extra_options="${extra_options} alpha/elf.opt" + ;; alpha*-*-freebsd*) tm_file="elfos.h ${tm_file} ${fbsd_tm_file} alpha/elf.h alpha/freebsd.h" tmake_file="${tmake_file} alpha/t-alpha" @@ -1099,6 +1153,38 @@ tm_file="elfos.h arm/elf.h arm/aout.h ${tm_file} vx-common.h vxworks.h arm/vxworks.h" target_cpu_cname="arm8" ;; +arm*-*-bsdsunix*) # ARM BSDSUniX EABI + tm_file="dbxelf.h elfos.h ${bsdsux_tm_file} arm/elf.h" + case $target in + arm*b-*-bsdsunix*) + tm_defines="${tm_defines} TARGET_BIG_ENDIAN_DEFAULT=1" + ;; + esac + tmake_file="${tmake_file} arm/t-arm arm/t-bpabi" + tm_file="${tm_file} arm/bpabi.h arm/bsdsunix.h arm/aout.h arm/arm.h" + case $target in + armv6*-*-bsdsunix*) + target_cpu_cname="arm1176jzf-s" + if test $bsdsux_major -ge 2; then + tm_defines="${tm_defines} TARGET_BSDSUNIX_ARM_HARD_FLOAT=1" + fi + ;; + armv7*-*-bsdsunix*) + target_cpu_cname="generic-armv7-a" + tm_defines="${tm_defines} TARGET_BSDSUNIX_ARM_HARD_FLOAT=1" + ;; + *) + target_cpu_cname="arm9" + ;; + esac + with_tls=${with_tls:-gnu} + ;; +arm*-*-netbsdelf*) + tm_file="dbxelf.h elfos.h ${nbsd_tm_file} arm/elf.h arm/aout.h ${tm_file} arm/netbsd-elf.h" + extra_options="${extra_options} netbsd.opt netbsd-elf.opt" + tmake_file="${tmake_file} arm/t-arm" + target_cpu_cname="arm6" + ;; arm*-*-freebsd*) # ARM FreeBSD EABI tm_file="dbxelf.h elfos.h ${fbsd_tm_file} arm/elf.h" case $target in @@ -1526,6 +1612,12 @@ tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h dragonfly.h dragonfly-stdint.h i386/x86-64.h i386/dragonfly.h" tmake_file="${tmake_file} i386/t-crtstuff" ;; +i[34567]86-*-bsdsunix*) + tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h ${bsdsux_tm_file} i386/bsdsunix.h" + ;; +x86_64-*-bsdsunix*) + tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h ${bsdsux_tm_file} i386/x86-64.h i386/bsdsunix.h i386/bsdsunix64.h" + ;; i[34567]86-*-freebsd*) tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h ${fbsd_tm_file} i386/freebsd.h" ;; @@ -1860,6 +1952,11 @@ target_cpu_default="${target_cpu_default}|MASK_GNU_LD" fi ;; +ia64*-*-bsdsunix*) + tm_file="${tm_file} dbxelf.h elfos.h ${bsdsux_tm_file} ia64/sysv4.h ia64/bsdsunix.h" + target_cpu_default="MASK_GNU_AS|MASK_GNU_LD" + tmake_file="${tmake_file} ia64/t-ia64" + ;; ia64*-*-freebsd*) tm_file="${tm_file} dbxelf.h elfos.h ${fbsd_tm_file} ia64/sysv4.h ia64/freebsd.h" target_cpu_default="MASK_GNU_AS|MASK_GNU_LD" @@ -2104,6 +2201,15 @@ # automatically detect that GAS supports it, yet we require it. gcc_cv_initfini_array=yes ;; +riscv*-*-bsdsunix*) + tm_file="${tm_file} elfos.h ${bsdsux_tm_file} riscv/bsdsunix.h" + tmake_file="${tmake_file} riscv/t-riscv" + gnu_ld=yes + gas=yes + # Force .init_array support. The configure script cannot always + # automatically detect that GAS supports it, yet we require it. + gcc_cv_initfini_array=yes + ;; riscv*-*-freebsd*) tm_file="${tm_file} elfos.h ${fbsd_tm_file} riscv/freebsd.h" tmake_file="${tmake_file} riscv/t-riscv" @@ -2423,6 +2529,24 @@ tm_file="${tm_file} ${cpu_type}/darwin64-biarch.h" extra_headers=altivec.h ;; +powerpc*-*-bsdsunix*) + tm_file="${tm_file} dbxelf.h elfos.h ${bsdsux_tm_file} rs6000/sysv4.h" + extra_options="${extra_options} rs6000/sysv4.opt" + tmake_file="rs6000/t-fprules rs6000/t-ppcos ${tmake_file} rs6000/t-ppccomm" + case ${target} in + powerpc64*) + tm_file="${tm_file} rs6000/default64.h rs6000/bsdsunix64.h" + tmake_file="${tmake_file} rs6000/t-bsdsunix64" + extra_options="${extra_options} rs6000/linux64.opt" + ;; + powerpcspe-*) + tm_file="${tm_file} powerpcspe/bsdsunix.h powerpcspe/linuxspe.h powerpcspe/e500.h" + ;; + *) + tm_file="${tm_file} rs6000/bsdsunix.h" + ;; + esac + ;; powerpc*-*-freebsd*) tm_file="${tm_file} dbxelf.h elfos.h ${fbsd_tm_file} rs6000/sysv4.h" extra_options="${extra_options} rs6000/sysv4.opt" @@ -2976,6 +3103,16 @@ extra_options="${extra_options} sparc/long-double-switch.opt" tmake_file="${tmake_file} sparc/t-sparc sparc/t-linux64" ;; +sparc64-*-bsdsunix*|ultrasparc-*-bsdsunix*) + tm_file="${tm_file} ${bsdsux_tm_file} dbxelf.h elfos.h sparc/sysv4.h sparc/bsdsunix.h" + extra_options="${extra_options} sparc/long-double-switch.opt" + case "x$with_cpu" in + xultrasparc) ;; + x) with_cpu=ultrasparc ;; + *) echo "$with_cpu not supported for bsdsunix target"; exit 1 ;; + esac + tmake_file="${tmake_file} sparc/t-sparc" + ;; sparc64-*-freebsd*|ultrasparc-*-freebsd*) tm_file="${tm_file} ${fbsd_tm_file} dbxelf.h elfos.h sparc/sysv4.h sparc/freebsd.h" extra_options="${extra_options} sparc/long-double-switch.opt" @@ -3220,6 +3357,12 @@ arch_without_sse2=no arch_without_64bit=no case ${target} in + i386-*-bsdsunix*) + arch=i486 + cpu=generic + arch_without_sse2=yes + arch_without_64bit=yes + ;; i386-*-freebsd*) if test $fbsd_major -ge 6; then arch=i486 @@ -4693,6 +4836,11 @@ ;; i[34567]86-*-dragonfly* | x86_64-*-dragonfly*) ;; + i[34567]86-*-bsdsunix*) + ;; + x86_64-*-bsdsunix*) + tmake_file="${tmake_file} i386/t-bsdsunix64" + ;; i[34567]86-*-freebsd*) ;; x86_64-*-freebsd*)