diff options
| author | matt <matt@NetBSD.org> | 2014-08-10 05:56:36 +0000 |
|---|---|---|
| committer | matt <matt@NetBSD.org> | 2014-08-10 05:56:36 +0000 |
| commit | aa37019d109cc653e3828a58277d973adfa37ab8 (patch) | |
| tree | 8baa693a360b794f4fedb771c2c034dfb3d52c92 | |
| parent | 67d1b4670c33306186aa6daae835df84d1aca994 (diff) | |
Changes to existing files to enable building AARCH64 userland.
evbarm64-el
This is clang only. While gcc4.8 supports aarch64, no netbsd support has
been written for aarch64 with gcc4.8.
35 files changed, 427 insertions, 99 deletions
@@ -1,5 +1,5 @@ #! /usr/bin/env sh -# $NetBSD: build.sh,v 1.293 2014/08/07 18:10:20 apb Exp $ +# $NetBSD: build.sh,v 1.294 2014/08/10 05:56:36 matt Exp $ # # Copyright (c) 2001-2011 The NetBSD Foundation, Inc. # All rights reserved. @@ -650,6 +650,8 @@ MACHINE=evbarm MACHINE_ARCH=earmv7 ALIAS=evbearmv7-el MACHINE=evbarm MACHINE_ARCH=earmv7eb ALIAS=evbearmv7-eb MACHINE=evbarm MACHINE_ARCH=earmv7hf ALIAS=evbearmv7hf-el MACHINE=evbarm MACHINE_ARCH=earmv7hfeb ALIAS=evbearmv7hf-eb +MACHINE=evbarm64 MACHINE_ARCH=aarch64 ALIAS=evbarm64-el +MACHINE=evbarm64 MACHINE_ARCH=aarch64eb ALIAS=evbarm64-eb MACHINE=evbcf MACHINE_ARCH=coldfire MACHINE=evbmips MACHINE_ARCH= NO_DEFAULT MACHINE=evbmips MACHINE_ARCH=mips64eb ALIAS=evbmips64-eb @@ -1862,7 +1864,7 @@ createmakewrapper() eval cat <<EOF ${makewrapout} #! ${HOST_SH} # Set proper variables to allow easy "make" building of a NetBSD subtree. -# Generated from: \$NetBSD: build.sh,v 1.293 2014/08/07 18:10:20 apb Exp $ +# Generated from: \$NetBSD: build.sh,v 1.294 2014/08/10 05:56:36 matt Exp $ # with these arguments: ${_args} # diff --git a/distrib/common/Makefile.makedev b/distrib/common/Makefile.makedev index 1b549c6542d..c86e319127b 100644 --- a/distrib/common/Makefile.makedev +++ b/distrib/common/Makefile.makedev @@ -1,4 +1,4 @@ -# $NetBSD: Makefile.makedev,v 1.18 2012/08/10 05:22:22 matt Exp $ +# $NetBSD: Makefile.makedev,v 1.19 2014/08/10 05:56:36 matt Exp $ # # Makefile snippet to add ${MAKEDEVTARGETS} devices to the mtree list # (if set), otherwise copy .OBJDIR-of-etc/MAKEDEV to ./dev @@ -41,12 +41,18 @@ CLEANFILES+= ${MAKEDEVSPEC} ${MAKEDEVSPEC}.tmp # MTREECONF+= ${MAKEDEVSPEC} +.if exists(${NETBSDSRCDIR}/etc/etc.${MACHINE_CPU}/MAKEDEV.conf) +MAKEDEV_MACHINE=${MACHINE_CPU} +.else +MAKEDEV_MACHINE=${MACHINE} +.endif + ${MAKEDEVSPEC}: ${MAKEDEVSCRIPT} Makefile \ - ${NETBSDSRCDIR}/etc/etc.${MACHINE}/MAKEDEV.conf + ${NETBSDSRCDIR}/etc/etc.${MAKEDEV_MACHINE}/MAKEDEV.conf ${_MKTARGET_CREATE} rm -f ${.TARGET} ${.TARGET}.tmp - MACHINE=${MACHINE:Q} MACHINE_ARCH=${MACHINE_ARCH:Q} \ + MACHINE=${MAKEDEV_MACHINE:Q} MACHINE_ARCH=${MACHINE_ARCH:Q} \ ${HOST_SH} ${MAKEDEVSCRIPT} -s ${MAKEDEVTARGETS} \ > ${.TARGET}.tmp ${TOOL_SED} -e '/^\. type=dir/d' -e 's,^\.,./dev,' ${.TARGET}.tmp \ diff --git a/etc/Makefile b/etc/Makefile index 0e697a5a4a2..5148e6a320a 100644 --- a/etc/Makefile +++ b/etc/Makefile @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.420 2014/08/06 11:41:18 apb Exp $ +# $NetBSD: Makefile,v 1.421 2014/08/10 05:56:36 matt Exp $ # from: @(#)Makefile 8.7 (Berkeley) 5/25/95 # Environment variables without default values: @@ -179,10 +179,11 @@ motd: ${.CURDIR}/${MOTD_SOURCE} ${_NETBSD_VERSION_DEPENDS} ${HOST_INSTALL_FILE} ${.CURDIR}/${MOTD_SOURCE} ${.TARGET} CLEANFILES+= MAKEDEV +MAKEDEV_MACHINE=${"${MACHINE_CPU}" == "aarch64":?${MACHINE_CPU}:${MACHINE}} MAKEDEV: ${.CURDIR}/MAKEDEV.awk ${.CURDIR}/MAKEDEV.tmpl \ - ${.CURDIR}/etc.${MACHINE}/MAKEDEV.conf + ${.CURDIR}/etc.${MAKEDEV_MACHINE}/MAKEDEV.conf ${_MKTARGET_CREATE} - MACHINE=${MACHINE:Q} MACHINE_ARCH=${MACHINE_ARCH:Q} \ + MACHINE=${MAKEDEV_MACHINE:Q} MACHINE_ARCH=${MACHINE_ARCH:Q} \ NETBSDSRCDIR=${NETBSDSRCDIR:Q} \ ${TOOL_AWK} -f ${.CURDIR}/MAKEDEV.awk ${.CURDIR}/MAKEDEV.tmpl \ > ${.TARGET} @@ -280,8 +281,13 @@ install-etc-files: .PHONY .MAKE check_DESTDIR MAKEDEV ) | ${METALOG.add} .endif # MKUNPRIVED != no ${_MKMSG_INSTALL} ${DESTDIR}/etc/ttys +.if exists(${.CURDIR}/etc.${MACHINE}/ttys) ${ETC_INSTALL_OBJ_FILE} -o ${BINOWN} -g ${BINGRP} -m 644 \ ${.CURDIR}/etc.${MACHINE}/ttys ${DESTDIR}/etc +.else + ${ETC_INSTALL_OBJ_FILE} -o ${BINOWN} -g ${BINGRP} -m 644 \ + ${.CURDIR}/etc.${MACHINE_CPU}/ttys ${DESTDIR}/etc +.endif .if exists(etc.${MACHINE}/boot.cfg) ${_MKMSG_INSTALL} ${DESTDIR}/boot.cfg ${ETC_INSTALL_OBJ_FILE} -o ${BINOWN} -g ${BINGRP} -m 644 \ diff --git a/external/gpl3/binutils/dist/bfd/config.bfd b/external/gpl3/binutils/dist/bfd/config.bfd index 731bad9258e..4485eea6523 100644 --- a/external/gpl3/binutils/dist/bfd/config.bfd +++ b/external/gpl3/binutils/dist/bfd/config.bfd @@ -165,6 +165,16 @@ case "${targ}" in targ_selvecs="bfd_elf64_littleaarch64_vec bfd_elf32_bigarm_vec bfd_elf32_littlearm_vec" want64=true ;; + aarch64-*-netbsd*) + targ_defvec=bfd_elf64_littleaarch64_vec + targ_selvecs="bfd_elf64_bigaarch64_vec bfd_elf32_littlearm_vec bfd_elf32_bigarm_vec" + want64=true + ;; + aarch64_be-*-netbsd*) + targ_defvec=bfd_elf64_bigaarch64_vec + targ_selvecs="bfd_elf64_littleaarch64_vec bfd_elf32_bigarm_vec bfd_elf32_littlearm_vec" + want64=true + ;; alpha*-*-freebsd* | alpha*-*-kfreebsd*-gnu) targ_defvec=bfd_elf64_alpha_freebsd_vec targ_selvecs="bfd_elf64_alpha_vec ecoffalpha_little_vec" diff --git a/external/gpl3/binutils/dist/gas/configure.tgt b/external/gpl3/binutils/dist/gas/configure.tgt index 6bde2b07439..8154916547b 100644 --- a/external/gpl3/binutils/dist/gas/configure.tgt +++ b/external/gpl3/binutils/dist/gas/configure.tgt @@ -100,6 +100,7 @@ generic_target=${cpu_type}-$vendor-$os case ${generic_target} in aarch64*-*-elf) fmt=elf;; aarch64*-*-linux*) fmt=elf em=linux ;; + aarch64*-*-netbsd*) fmt=elf em=nbsd ;; alpha-*-*vms*) fmt=evax ;; alpha-*-osf*) fmt=ecoff ;; diff --git a/external/gpl3/binutils/dist/ld/Makefile.am b/external/gpl3/binutils/dist/ld/Makefile.am index b506d2b516f..ddaf9894b55 100644 --- a/external/gpl3/binutils/dist/ld/Makefile.am +++ b/external/gpl3/binutils/dist/ld/Makefile.am @@ -474,6 +474,8 @@ ALL_64_EMULATION_SOURCES = \ eaarch64elfb.c \ eaarch64linux.c \ eaarch64linuxb.c \ + eaarch64nbsd.c \ + eaarch64nbsdb.c \ eelf32_x86_64.c \ eelf32_x86_64_nacl.c \ eelf64_aix.c \ @@ -1777,6 +1779,14 @@ eaarch64linuxb.c: $(srcdir)/emulparams/aarch64linuxb.sh $(srcdir)/emulparams/aar $(ELF_DEPS) $(srcdir)/emultempl/aarch64elf.em \ $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} ${GENSCRIPTS} aarch64linuxb "$(tdir_aarch64linuxb)" +eaarch64nbsd.c: $(srcdir)/emulparams/aarch64nbsd.sh \ + $(ELF_DEPS) $(srcdir)/emultempl/aarch64elf.em \ + $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} + ${GENSCRIPTS} aarch64nbsd "$(tdir_aarch64nbsd)" +eaarch64nbsdb.c: $(srcdir)/emulparams/aarch64nbsdb.sh $(srcdir)/emulparams/aarch64nbsd.sh \ + $(ELF_DEPS) $(srcdir)/emultempl/aarch64elf.em \ + $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} + ${GENSCRIPTS} aarch64nbsdb "$(tdir_aarch64nbsdb)" eor32.c: $(srcdir)/emulparams/or32.sh \ $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/or32.sc ${GEN_DEPENDS} ${GENSCRIPTS} or32 "$(tdir_or32)" diff --git a/external/gpl3/binutils/dist/ld/Makefile.in b/external/gpl3/binutils/dist/ld/Makefile.in index 781f136fbf0..9e25dbfd00e 100644 --- a/external/gpl3/binutils/dist/ld/Makefile.in +++ b/external/gpl3/binutils/dist/ld/Makefile.in @@ -780,6 +780,8 @@ ALL_64_EMULATION_SOURCES = \ eaarch64elfb.c \ eaarch64linux.c \ eaarch64linuxb.c \ + eaarch64nbsd.c \ + eaarch64nbsdb.c \ eelf32_x86_64.c \ eelf32_x86_64_nacl.c \ eelf64_aix.c \ @@ -1065,6 +1067,8 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eaarch64elfb.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eaarch64linux.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eaarch64linuxb.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eaarch64nbsd.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eaarch64nbsdb.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eaix5ppc.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eaix5rs6.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eaixppc.Po@am__quote@ @@ -3255,6 +3259,14 @@ eaarch64linuxb.c: $(srcdir)/emulparams/aarch64linuxb.sh $(srcdir)/emulparams/aar $(ELF_DEPS) $(srcdir)/emultempl/aarch64elf.em \ $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} ${GENSCRIPTS} aarch64linuxb "$(tdir_aarch64linuxb)" +eaarch64nbsd.c: $(srcdir)/emulparams/aarch64nbsd.sh \ + $(ELF_DEPS) $(srcdir)/emultempl/aarch64elf.em \ + $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} + ${GENSCRIPTS} aarch64nbsd "$(tdir_aarch64nbsd)" +eaarch64nbsdb.c: $(srcdir)/emulparams/aarch64nbsdb.sh $(srcdir)/emulparams/aarch64nbsd.sh \ + $(ELF_DEPS) $(srcdir)/emultempl/aarch64elf.em \ + $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} + ${GENSCRIPTS} aarch64nbsdb "$(tdir_aarch64nbsdb)" eor32.c: $(srcdir)/emulparams/or32.sh \ $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/or32.sc ${GEN_DEPENDS} ${GENSCRIPTS} or32 "$(tdir_or32)" diff --git a/external/gpl3/binutils/dist/ld/configure.tgt b/external/gpl3/binutils/dist/ld/configure.tgt index 3c76d122bf8..8efc94334ab 100644 --- a/external/gpl3/binutils/dist/ld/configure.tgt +++ b/external/gpl3/binutils/dist/ld/configure.tgt @@ -35,6 +35,10 @@ aarch64_be-*-linux*) targ_emul=aarch64linuxb targ_extra_emuls="aarch64linux aarch64elfb aarch64elf armelfb_linux_eabi armelf_linux_eabi armelfb armelf" ;; aarch64-*-linux*) targ_emul=aarch64linux targ_extra_emuls="aarch64linuxb aarch64elf aarch64elfb armelf_linux_eabi armelfb_linux_eabi armelf armelfb" ;; +aarch64_be-*-netbsd*) targ_emul=aarch64nbsdb + targ_extra_emuls="aarch64nbsd aarch64elfb aarch64elf armelfb_nbsd_eabihf armelf_nbsd_eabihf armelfb_nbsd_eabi armelf_nbsd_eabi armelfb_nbsd armelf_nbsd armelf armelfb" ;; +aarch64-*-netbsd*) targ_emul=aarch64nbsd + targ_extra_emuls="aarch64nbsdb aarch64elf aarch64elfb armelf_nbsd_eabihf armelfb_nbsd_eabihf armelf_nbsd_eabi armelfb_nbsd_eabi armelf_nbsd armelfb_nbsd armelf armelfb" ;; alpha*-*-freebsd* | alpha*-*-kfreebsd*-gnu) targ_emul=elf64alpha_fbsd targ_extra_emuls="elf64alpha alpha" diff --git a/external/gpl3/binutils/dist/ld/emulparams/armelf_nbsd.sh b/external/gpl3/binutils/dist/ld/emulparams/armelf_nbsd.sh index 0f437e45779..db3a624ada6 100644 --- a/external/gpl3/binutils/dist/ld/emulparams/armelf_nbsd.sh +++ b/external/gpl3/binutils/dist/ld/emulparams/armelf_nbsd.sh @@ -8,7 +8,7 @@ unset STACK_ADDR unset EMBEDDED case "$target" in - arm*-*-netbsdelf*-*eabi*) + aarch64*-*-netbsd* | arm*-*-netbsdelf*-*eabi*) LIB_PATH='=/usr/lib/oabi' ;; esac diff --git a/external/gpl3/binutils/dist/ld/emulparams/armelf_nbsd_eabi.sh b/external/gpl3/binutils/dist/ld/emulparams/armelf_nbsd_eabi.sh index e8bd724a38d..6c061f7de76 100644 --- a/external/gpl3/binutils/dist/ld/emulparams/armelf_nbsd_eabi.sh +++ b/external/gpl3/binutils/dist/ld/emulparams/armelf_nbsd_eabi.sh @@ -14,7 +14,7 @@ case "$target" in arm*-*-netbsdelf*-*eabi*) LIB_PATH='=/usr/lib' ;; - arm*-*-netbsdelf*) + aarch64*-*-netbsd* | arm*-*-netbsdelf*) LIB_PATH='=/usr/lib/eabi' ;; esac diff --git a/external/gpl3/binutils/dist/ld/emulparams/armelf_nbsd_eabihf.sh b/external/gpl3/binutils/dist/ld/emulparams/armelf_nbsd_eabihf.sh index 9e898f7403f..0a21ed15e15 100644 --- a/external/gpl3/binutils/dist/ld/emulparams/armelf_nbsd_eabihf.sh +++ b/external/gpl3/binutils/dist/ld/emulparams/armelf_nbsd_eabihf.sh @@ -11,7 +11,7 @@ case "$target" in arm*-*-netbsdelf*-*eabihf*) LIB_PATH='=/usr/lib' ;; - arm*-*-netbsdelf*) + aarch64*-*-netbsd* | arm*-*-netbsdelf*) LIB_PATH='=/usr/lib/eabihf' ;; esac diff --git a/external/gpl3/gdb/dist/bfd/config.bfd b/external/gpl3/gdb/dist/bfd/config.bfd index b6db4124b9f..a09e85c7667 100644 --- a/external/gpl3/gdb/dist/bfd/config.bfd +++ b/external/gpl3/gdb/dist/bfd/config.bfd @@ -184,6 +184,16 @@ case "${targ}" in targ_selvecs="bfd_elf64_littleaarch64_vec bfd_elf32_littleaarch64_vec bfd_elf32_bigaarch64_vec bfd_elf32_bigarm_vec bfd_elf32_littlearm_vec" want64=true ;; + aarch64-*-netbsd*) + targ_defvec=bfd_elf64_littleaarch64_vec + targ_selvecs="bfd_elf64_bigaarch64_vec bfd_elf32_littlearm_vec bfd_elf32_bigarm_vec" + want64=true + ;; + aarch64_be-*-netbsd*) + targ_defvec=bfd_elf64_bigaarch64_vec + targ_selvecs="bfd_elf64_littleaarch64_vec bfd_elf32_bigarm_vec bfd_elf32_littlearm_vec" + want64=true + ;; alpha*-*-freebsd* | alpha*-*-kfreebsd*-gnu) targ_defvec=bfd_elf64_alpha_freebsd_vec targ_selvecs="bfd_elf64_alpha_vec ecoffalpha_little_vec" diff --git a/external/gpl3/gdb/dist/gdb/configure.tgt b/external/gpl3/gdb/dist/gdb/configure.tgt index be74192701c..1afe750100b 100644 --- a/external/gpl3/gdb/dist/gdb/configure.tgt +++ b/external/gpl3/gdb/dist/gdb/configure.tgt @@ -45,6 +45,12 @@ aarch64*-*-linux*) build_gdbserver=yes ;; +aarch64*-*-netbsd*) + # Target: AArch64 NetBSD + #gdb_target_obs="aarch64-tdep.o aarch64-netbsd-tdep.o" + gdb_target_obs="aarch64-tdep.o" + ;; + alpha*-*-osf*) # Target: Little-endian Alpha running OSF/1 gdb_target_obs="alpha-tdep.o alpha-osf1-tdep.o alpha-mdebug-tdep.o" diff --git a/include/fenv.h b/include/fenv.h index 7af3847c5a0..ad9420409eb 100644 --- a/include/fenv.h +++ b/include/fenv.h @@ -1,4 +1,4 @@ -/* $NetBSD: fenv.h,v 1.9 2013/04/28 21:07:36 matt Exp $ */ +/* $NetBSD: fenv.h,v 1.10 2014/08/10 05:57:30 matt Exp $ */ /* * Copyright (c) 2010 The NetBSD Foundation, Inc. * All rights reserved. @@ -25,7 +25,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#if !defined(__arm__) && !defined(__i386__) \ +#if !defined(__aarch64__) && !defined(__arm__) && !defined(__i386__) \ && !defined(__sparc__) && !defined(__x86_64__) #error "fenv.h is currently not supported for this architecture" #endif diff --git a/lib/libc/compiler_rt/Makefile.inc b/lib/libc/compiler_rt/Makefile.inc index a0b846e0ff9..d928ea5c715 100644 --- a/lib/libc/compiler_rt/Makefile.inc +++ b/lib/libc/compiler_rt/Makefile.inc @@ -1,4 +1,4 @@ -# $NetBSD: Makefile.inc,v 1.21 2014/07/14 07:55:26 joerg Exp $ +# $NetBSD: Makefile.inc,v 1.22 2014/08/10 05:57:31 matt Exp $ COMPILER_RT_SRCDIR= ${NETBSDSRCDIR}/sys/external/bsd/compiler_rt/dist @@ -63,43 +63,28 @@ GENERIC_SRCS+= \ addvti3.c \ ashlti3.c \ ashrti3.c \ - clzsi2.c \ clzti2.c \ cmpti2.c \ - ctzsi2.c \ ctzti2.c \ - divmodsi4.c \ - divsi3.c \ divti3.c \ ffsti2.c \ fixsfdi.c \ fixdfdi.c \ fixunsdfdi.c \ fixunsdfsi.c \ - fixunsdfti.c \ fixunssfdi.c \ fixunssfsi.c \ - fixunssfti.c \ fixunsxfdi.c \ fixunsxfsi.c \ - fixunsxfti.c \ fixxfdi.c \ - fixxfti.c \ floatdidf.c \ floatdisf.c \ floatdixf.c \ - floattidf.c \ - floattisf.c \ - floattixf.c \ floatundidf.c \ floatundisf.c \ floatundixf.c \ - floatuntidf.c \ - floatuntisf.c \ - floatuntixf.c \ int_util.c \ lshrti3.c \ - modsi3.c \ modti3.c \ muldc3.c \ mulosi4.c \ @@ -123,26 +108,49 @@ GENERIC_SRCS+= \ subvsi3.c \ subvti3.c \ ucmpti2.c \ - udivmodsi4.c \ udivmodti4.c \ udivti3.c \ - umodsi3.c \ umodti3.c -.if ${MACHINE_CPU} != "sh3" +.if ${MACHINE_ARCH} != "aarch64" +GENERIC_SRCS+= \ + fixunsdfti.c \ + fixunssfti.c \ + fixunsxfti.c \ + fixxfti.c \ + floattidf.c \ + floattisf.c \ + floattixf.c \ + floatuntidf.c \ + floatuntisf.c \ + floatuntixf.c +.endif + +# These have h/w instructions which are always used. +.if ${MACHINE_ARCH} != "alpha" && ${MACHINE_CPU} != "powerpc" \ + && ${MACHINE_CPU} != "aarch64" && ${MACHINE_ARCH} != "vax" +GENERIC_SRCS+= \ + clzsi2.c \ + ctzsi2.c \ + divmodsi4.c \ + divsi3.c \ + modsi3.c \ + udivmodsi4.c \ + umodsi3.c + +. if ${MACHINE_CPU} != "sh3" # On sh3 __udivsi3 is gcc "millicode" with special calling convention # (less registers clobbered than usual). Each DSO that needs it gets # its own hidden copy from libgcc.a. GENERIC_SRCS+= \ udivsi3.c +. endif .endif + GENERIC_SRCS+= \ absvdi2.c \ addvdi3.c \ - clzdi2.c \ - ctzdi2.c \ - ffsdi2.c \ mulodi4.c \ mulvdi3.c \ negvdi2.c \ @@ -150,6 +158,16 @@ GENERIC_SRCS+= \ popcountdi2.c \ subvdi3.c +# These have h/w instructions which are always used. +.if ${MACHINE_ARCH} != "alpha" && ${MACHINE_CPU} != "powerpc64" \ + && ${MACHINE_ARCH} != "aarch64" +GENERIC_SRCS+= \ + clzdi2.c \ + ctzdi2.c \ + ffsdi2.c +.endif + +# Don't need these on 64-bit machines. .if empty(LIBC_MACHINE_ARCH:M*64*) && ${LIBC_MACHINE_ARCH} != "alpha" GENERIC_SRCS+= \ cmpdi2.c \ @@ -186,6 +204,11 @@ GENERIC_SRCS+= \ gcc_qsub.c .endif +.if ${MACHINE_CPU} == "aarch64" +GENERIC_SRCS+= \ + clear_cache.c +.endif + .if ${MACHINE_CPU} == "arm" .if !empty(LIBC_MACHINE_ARCH:Mearm*) GENERIC_SRCS+= \ diff --git a/lib/libc/rpc/xdr_float.c b/lib/libc/rpc/xdr_float.c index 96d4a4015a9..8fb843a2ed4 100644 --- a/lib/libc/rpc/xdr_float.c +++ b/lib/libc/rpc/xdr_float.c @@ -1,4 +1,4 @@ -/* $NetBSD: xdr_float.c,v 1.38 2013/03/11 20:19:29 tron Exp $ */ +/* $NetBSD: xdr_float.c,v 1.39 2014/08/10 05:57:31 matt Exp $ */ /* * Copyright (c) 2010, Oracle America, Inc. @@ -37,7 +37,7 @@ static char *sccsid = "@(#)xdr_float.c 1.12 87/08/11 Copyr 1984 Sun Micro"; static char *sccsid = "@(#)xdr_float.c 2.1 88/07/29 4.0 RPCSRC"; #else -__RCSID("$NetBSD: xdr_float.c,v 1.38 2013/03/11 20:19:29 tron Exp $"); +__RCSID("$NetBSD: xdr_float.c,v 1.39 2014/08/10 05:57:31 matt Exp $"); #endif #endif @@ -74,7 +74,8 @@ __weak_alias(xdr_float,_xdr_float) #if defined(__m68k__) || defined(__sparc__) || defined(__i386__) || \ defined(__mips__) || defined(__ns32k__) || defined(__alpha__) || \ defined(__arm__) || defined(__powerpc__) || defined(__sh__) || \ - defined(__x86_64__) || defined(__hppa__) || defined(__ia64__) + defined(__x86_64__) || defined(__hppa__) || defined(__ia64__) || \ + defined(__aarch64__) #include <machine/endian.h> #define IEEEFP #endif diff --git a/lib/libc/softfloat/softfloat-specialize b/lib/libc/softfloat/softfloat-specialize index 3d643dcb9d0..30487198fd8 100644 --- a/lib/libc/softfloat/softfloat-specialize +++ b/lib/libc/softfloat/softfloat-specialize @@ -1,4 +1,4 @@ -/* $NetBSD: softfloat-specialize,v 1.8 2013/01/10 08:16:10 matt Exp $ */ +/* $NetBSD: softfloat-specialize,v 1.9 2014/08/10 05:57:31 matt Exp $ */ /* This is a derivative work. */ @@ -136,8 +136,10 @@ Returns 1 if the single-precision floating-point value `a' is a signaling NaN; otherwise returns 0. ------------------------------------------------------------------------------- */ -#if defined(SOFTFLOAT_FOR_GCC) && !defined(SOFTFLOATSPARC64_FOR_GCC) && \ - !defined(SOFTFLOAT_M68K_FOR_GCC) +#if defined(SOFTFLOAT_FOR_GCC) \ + && !defined(SOFTFLOATAARCH64_FOR_GCC) \ + && !defined(SOFTFLOATSPARC64_FOR_GCC) \ + && !defined(SOFTFLOATM68K_FOR_GCC) static #endif flag float32_is_signaling_nan( float32 a ) @@ -236,8 +238,10 @@ Returns 1 if the double-precision floating-point value `a' is a signaling NaN; otherwise returns 0. ------------------------------------------------------------------------------- */ -#if defined(SOFTFLOAT_FOR_GCC) && !defined(SOFTFLOATSPARC64_FOR_GCC) && \ - !defined(SOFTFLOATM68K_FOR_GCC) +#if defined(SOFTFLOAT_FOR_GCC) \ + && !defined(SOFTFLOATAARCH64_FOR_GCC) \ + && !defined(SOFTFLOATSPARC64_FOR_GCC) \ + && !defined(SOFTFLOATM68K_FOR_GCC) static #endif flag float64_is_signaling_nan( float64 a ) diff --git a/lib/libc/stdlib/jemalloc.c b/lib/libc/stdlib/jemalloc.c index 751191de106..7d1a0196c3c 100644 --- a/lib/libc/stdlib/jemalloc.c +++ b/lib/libc/stdlib/jemalloc.c @@ -1,4 +1,4 @@ -/* $NetBSD: jemalloc.c,v 1.33 2014/07/16 19:09:53 riastradh Exp $ */ +/* $NetBSD: jemalloc.c,v 1.34 2014/08/10 05:57:31 matt Exp $ */ /*- * Copyright (C) 2006,2007 Jason Evans <jasone@FreeBSD.org>. @@ -118,7 +118,7 @@ #include <sys/cdefs.h> /* __FBSDID("$FreeBSD: src/lib/libc/stdlib/malloc.c,v 1.147 2007/06/15 22:00:16 jasone Exp $"); */ -__RCSID("$NetBSD: jemalloc.c,v 1.33 2014/07/16 19:09:53 riastradh Exp $"); +__RCSID("$NetBSD: jemalloc.c,v 1.34 2014/08/10 05:57:31 matt Exp $"); #ifdef __FreeBSD__ #include "libc_private.h" @@ -233,6 +233,11 @@ __strerror_r(int e, char *s, size_t l) # define QUANTUM_2POW_MIN 4 # define SIZEOF_PTR_2POW 3 #endif +#ifdef __aarch64__ +# define QUANTUM_2POW_MIN 4 +# define SIZEOF_PTR_2POW 3 +# define NO_TLS +#endif #ifdef __alpha__ # define QUANTUM_2POW_MIN 4 # define SIZEOF_PTR_2POW 3 diff --git a/lib/libm/Makefile b/lib/libm/Makefile index 6b1129d48ac..7961599b61a 100644 --- a/lib/libm/Makefile +++ b/lib/libm/Makefile @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.160 2014/06/16 12:54:43 joerg Exp $ +# $NetBSD: Makefile,v 1.161 2014/08/10 05:57:31 matt Exp $ # # @(#)Makefile 5.1beta 93/09/24 # @@ -50,7 +50,15 @@ USE_SHLIBDIR= yes # compiler_rt uses typeof() and __extension__ LINTFLAGS += -g -.if (${MACHINE_ARCH} == "alpha") +.if (${MACHINE_CPU} == "aarch64") +.PATH: ${.CURDIR}/arch/aarch64 +ARCH_SRCS = e_sqrt.S e_sqrtf.S s_fabsf.S +ARCH_SRCS+= s_fma.S s_fmaf.S s_fmax.S s_fmaxf.S s_fmin.S s_fminf.S +COPTS.e_sqrtl.c += -DHAVE_FENV_H +COMMON_SRCS+= fenv.c +COMMON_SRCS+= e_sqrtl.c +COMMON_SRCS+= s_fma.c s_fmaf.c s_fmal.c +.elif (${MACHINE_ARCH} == "alpha") .PATH: ${.CURDIR}/arch/alpha ARCH_SRCS = s_copysign.S s_copysignf.S lrint.S COPTS+= -mfloat-ieee -mieee-with-inexact -mfp-trap-mode=sui -mtrap-precision=i diff --git a/libexec/ld.elf_so/Makefile b/libexec/ld.elf_so/Makefile index 0c0ca2a6235..18ceb7e4691 100644 --- a/libexec/ld.elf_so/Makefile +++ b/libexec/ld.elf_so/Makefile @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.126 2014/03/06 09:34:56 matt Exp $ +# $NetBSD: Makefile,v 1.127 2014/08/10 05:57:31 matt Exp $ # # NOTE: when changing ld.so, ensure that ldd still compiles. # @@ -26,7 +26,8 @@ ARCHSUBDIR= ${MACHINE_CPU} .endif M= ${.CURDIR}/arch/${ARCHSUBDIR} -.if ((${LDELFSO_MACHINE_ARCH} == "alpha") || \ +.if ((${MACHINE_CPU} == "aarch64") || \ + (${LDELFSO_MACHINE_ARCH} == "alpha") || \ (${MACHINE_CPU} == "arm") || \ (${LDELFSO_MACHINE_ARCH} == "coldfire") || \ (${LDELFSO_MACHINE_ARCH} == "hppa") || \ diff --git a/sbin/disklabel/main.c b/sbin/disklabel/main.c index 3c2af38862d..c7db3462f91 100644 --- a/sbin/disklabel/main.c +++ b/sbin/disklabel/main.c @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.39 2014/07/15 20:18:30 joerg Exp $ */ +/* $NetBSD: main.c,v 1.40 2014/08/10 05:57:31 matt Exp $ */ /* * Copyright (c) 2006 The NetBSD Foundation, Inc. @@ -76,7 +76,7 @@ __COPYRIGHT("@(#) Copyright (c) 1987, 1993\ static char sccsid[] = "@(#)disklabel.c 8.4 (Berkeley) 5/4/95"; /* from static char sccsid[] = "@(#)disklabel.c 1.2 (Symmetric) 11/28/85"; */ #else -__RCSID("$NetBSD: main.c,v 1.39 2014/07/15 20:18:30 joerg Exp $"); +__RCSID("$NetBSD: main.c,v 1.40 2014/08/10 05:57:31 matt Exp $"); #endif #endif /* not lint */ @@ -259,6 +259,7 @@ static const struct disklabel_params { { "prep", 1, 1, 0, 8, 2, 0, BIG_ENDIAN }, /* powerpc */ { "dreadmcast", 1, 1, 0, 16, 2, 0, LITTLE_ENDIAN }, /* sh3 */ + { "evbarm64", 1, 1, 0, 16, 2, 0, 0 }, /* aarch64 */ { "evbsh3", 1, 1, 0, 16, 2, 0, 0 }, /* sh3 */ { "evbcf", 1, 1, 0, 16, 2, 0, BIG_ENDIAN }, /* coldfire */ { "evbppc-mbr", 1, 1, 0, 16, 2, 0, BIG_ENDIAN }, /* powerpc */ @@ -296,6 +297,7 @@ static const struct arch_endian { int byteorder; const char *arch; } arch_endians[] = { + { LITTLE_ENDIAN, "aarch64" }, { LITTLE_ENDIAN, "alpha" }, { LITTLE_ENDIAN, "arm" }, { LITTLE_ENDIAN, "earm" }, @@ -314,6 +316,7 @@ static const struct arch_endian { { LITTLE_ENDIAN, "vax" }, { LITTLE_ENDIAN, "x86_64" }, + { BIG_ENDIAN, "aarch64eb" }, { BIG_ENDIAN, "armeb" }, { BIG_ENDIAN, "coldfire" }, { BIG_ENDIAN, "earmeb" }, diff --git a/share/mk/bsd.endian.mk b/share/mk/bsd.endian.mk index 846fd5c8d9d..e6b1598cb49 100644 --- a/share/mk/bsd.endian.mk +++ b/share/mk/bsd.endian.mk @@ -1,11 +1,12 @@ -# $NetBSD: bsd.endian.mk,v 1.19 2013/08/05 15:33:07 matt Exp $ +# $NetBSD: bsd.endian.mk,v 1.20 2014/08/10 05:57:31 matt Exp $ .if !defined(_BSD_ENDIAN_MK_) _BSD_ENDIAN_MK_=1 .include <bsd.init.mk> -.if ${MACHINE_ARCH} == "alpha" || \ +.if ${MACHINE_ARCH} == "aarch64" || \ + ${MACHINE_ARCH} == "alpha" || \ ${MACHINE_ARCH} == "arm" || \ (!empty(MACHINE_ARCH:Mearm*) && empty(MACHINE_ARCH:Mearm*eb)) || \ ${MACHINE_ARCH} == "i386" || \ diff --git a/share/mk/bsd.klinks.mk b/share/mk/bsd.klinks.mk index 3b4dbdc5def..2616e4a07fc 100644 --- a/share/mk/bsd.klinks.mk +++ b/share/mk/bsd.klinks.mk @@ -1,4 +1,4 @@ -# $NetBSD: bsd.klinks.mk,v 1.12 2014/01/22 15:19:05 christos Exp $ +# $NetBSD: bsd.klinks.mk,v 1.13 2014/08/10 05:57:31 matt Exp $ # .include <bsd.own.mk> @@ -27,6 +27,8 @@ CLEANFILES+= x86 CLEANFILES+= x86 i386 .elif ${KLINK_MACHINE} == "evbmips" CLEANFILES+= algor sbmips +.elif ${MACHINE_CPU} == "aarch64" +CLEANFILES+= arm .endif .if defined(XEN_BUILD) || ${KLINK_MACHINE} == "xen" @@ -66,6 +68,10 @@ CLEANFILES+= x86 -@rm -f x86 && \ ln -s $S/arch/x86/include x86 .endif +.if ${MACHINE_CPU} == "aarch64" + -@rm -f arm && \ + ln -s $S/arch/arm/include arm +.endif .if defined(XEN_BUILD) || ${KLINK_MACHINE} == "xen" -@rm -f xen && \ ln -s $S/arch/xen/include xen diff --git a/share/mk/bsd.own.mk b/share/mk/bsd.own.mk index 596bcd0f037..9365b6f2308 100644 --- a/share/mk/bsd.own.mk +++ b/share/mk/bsd.own.mk @@ -1,4 +1,4 @@ -# $NetBSD: bsd.own.mk,v 1.826 2014/08/05 15:51:23 apb Exp $ +# $NetBSD: bsd.own.mk,v 1.827 2014/08/10 05:57:31 matt Exp $ # This needs to be before bsd.init.mk .if defined(BSD_MK_COMPAT_FILE) @@ -14,7 +14,7 @@ MAKECONF?= /etc/mk.conf # # CPU model, derived from MACHINE_ARCH # -MACHINE_CPU= ${MACHINE_ARCH:C/mipse[bl]/mips/:C/mips64e[bl]/mips/:C/sh3e[bl]/sh3/:S/coldfire/m68k/:S/m68000/m68k/:C/arm.*/arm/:C/earm.*/arm/:S/earm/arm/:S/powerpc64/powerpc/} +MACHINE_CPU= ${MACHINE_ARCH:C/mipse[bl]/mips/:C/mips64e[bl]/mips/:C/sh3e[bl]/sh3/:S/coldfire/m68k/:S/m68000/m68k/:C/arm.*/arm/:C/earm.*/arm/:S/earm/arm/:S/powerpc64/powerpc/:S/aarch64eb/aarch64/} # # Subdirectory used below ${RELEASEDIR} when building a release @@ -50,6 +50,12 @@ TOOLCHAIN_MISSING?= yes TOOLCHAIN_MISSING?= no +.if ${MACHINE_CPU} == "aarch64" && ${MKLLVM:Uyes} != "no" +MKLLVM?= yes +HAVE_LLVM?= yes +MKGCC?= no +.endif + # # GCC Using platforms. # @@ -62,7 +68,7 @@ TOOLCHAIN_MISSING?= no ${MACHINE_ARCH} == "powerpc64" HAVE_GCC?= 45 -.elif ${MACHINE} == "playstation2" +.elif ${MACHINE} == "playstation2" || ${MACHINE_CPU} == "aarch64" HAVE_GCC?= 0 .else # Otherwise, default to GCC4.8 @@ -87,6 +93,7 @@ EXTERNAL_GCC_SUBDIR= /does/not/exist _LIBC_COMPILER_RT.${MACHINE_ARCH}= yes .endif +_LIBC_COMPILER_RT.aarch64= yes _LIBC_COMPILER_RT.i386= yes _LIBC_COMPILER_RT.x86_64= yes @@ -96,6 +103,7 @@ HAVE_LIBGCC?= no HAVE_LIBGCC?= yes .endif + # ia64 is not support .if ${MKLLVM:Uno} == "yes" || !empty(MACHINE_ARCH:Mearm*) HAVE_LIBGCC_EH?= no @@ -515,6 +523,7 @@ CTFMERGE= ${TOOL_CTFMERGE} .endif # For each ${MACHINE_CPU}, list the ports that use it. +MACHINES.aarch64= evbarm64 MACHINES.alpha= alpha MACHINES.arm= acorn26 acorn32 cats epoc32 evbarm hpcarm \ iyonix netwinder shark zaurus @@ -747,6 +756,7 @@ SHLIB_VERSION_FILE?= ${.CURDIR}/shlib_version # # GNU sources and packages sometimes see architecture names differently. # +GNU_ARCH.aarch64eb=aarch64_be GNU_ARCH.coldfire=m5407 GNU_ARCH.earm=arm GNU_ARCH.earmhf=arm @@ -872,7 +882,7 @@ MK${var}:= yes || ${MACHINE_ARCH} == "mips64eb" || ${MACHINE_ARCH} == "mips64el" \ || ${MACHINE_ARCH} == "powerpc64" MKCOMPAT?= yes -.elif !empty(MACHINE_ARCH:Mearm*) +.elif !empty(MACHINE_ARCH:Mearm*) || ${MACHINE_CPU} == "aarch64" MKCOMPAT?= no .else # Don't let this build where it really isn't supported. @@ -1094,6 +1104,7 @@ _NEEDS_LIBCXX.${MACHINE_ARCH}= yes .endif _NEEDS_LIBCXX.i386= yes _NEEDS_LIBCXX.x86_64= yes +_NEEDS_LIBCXX.aarch64= yes .if ${MKLLVM} == "yes" && ${_NEEDS_LIBCXX.${MACHINE_ARCH}:Uno} == "yes" MKLIBCXX:= yes diff --git a/share/mk/bsd.sys.mk b/share/mk/bsd.sys.mk index 6b7f5dc9142..3755c6bc4f6 100644 --- a/share/mk/bsd.sys.mk +++ b/share/mk/bsd.sys.mk @@ -1,4 +1,4 @@ -# $NetBSD: bsd.sys.mk,v 1.240 2014/06/13 01:17:45 mrg Exp $ +# $NetBSD: bsd.sys.mk,v 1.241 2014/08/10 05:57:31 matt Exp $ # # Build definitions used for NetBSD source tree builds. @@ -259,8 +259,13 @@ YFLAGS+= ${YPREFIX:D-p${YPREFIX}} ${YHEADER:D-d} .endif # Objcopy +.if ${MACHINE_ARCH} == aarch64eb +# AARCH64 big endian needs to preserve $x/$d symbols for the linker. +OBJCOPYLIBFALGS_EXTRA=-K '\$x' -K '\$d' +.elif !empty(MACHINE_ARCH:M*arm*eb) # ARM big endian needs to preserve $a/$d/$t symbols for the linker. -OBJCOPYLIBFLAGS?=${"${.TARGET:M*.po}" != "":?-X:-x} \ - ${"${MACHINE_ARCH:M*arm*eb}" != "":?-K '\$a' -K '\$d' -K '\$t':} +OBJCOPYLIBFLAGS_EXTRA=-K '\$a' -K '\$d' -K '\$t' +.endif +OBJCOPYLIBFLAGS?=${"${.TARGET:M*.po}" != "":?-X:-x} ${OBJCOPYLIBFLAGS_EXTRA} .endif # !defined(_BSD_SYS_MK_) diff --git a/share/mk/sys.mk b/share/mk/sys.mk index 51612c76e8d..f77472100a2 100644 --- a/share/mk/sys.mk +++ b/share/mk/sys.mk @@ -1,4 +1,4 @@ -# $NetBSD: sys.mk,v 1.126 2014/08/06 15:23:48 apb Exp $ +# $NetBSD: sys.mk,v 1.127 2014/08/10 05:57:31 matt Exp $ # @(#)sys.mk 8.2 (Berkeley) 3/21/94 # # This file contains the basic rules for make(1) and is read first @@ -32,6 +32,8 @@ DBG?= -Os -freorder-blocks DBG?= -O2 -fno-reorder-blocks .elif ${MACHINE_ARCH} == "coldfire" DBG?= -O1 +.elif !empty(MACHINE_ARCH:Maarch64*) +DBG?= -O2 ${"${.TARGET:M*.po}" == "":? -fomit-frame-pointer:} .elif ${MACHINE_ARCH} == "vax" DBG?= -O1 -fgcse -fstrength-reduce -fgcse-after-reload .else diff --git a/sys/arch/Makefile b/sys/arch/Makefile index 645e361966b..8f18b9545a3 100644 --- a/sys/arch/Makefile +++ b/sys/arch/Makefile @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.43 2014/03/31 11:25:48 martin Exp $ +# $NetBSD: Makefile,v 1.44 2014/08/10 05:57:31 matt Exp $ # For now, we install the machine and arch includes, and symlink 'machine' # to the location of the machine includes (usually). @@ -16,7 +16,9 @@ ARCHSUBDIR= mips ARCHSUBDIR= powerpc .endif -.if ${MACHINE_CPU} == "arm" +.if ${MACHINE_CPU} == "aarch64" +SUBDIR= evbarm64 +.elif ${MACHINE_CPU} == "arm" SUBDIR= acorn26 acorn32 cats epoc32 evbarm hpcarm iyonix netwinder shark zaurus .else SUBDIR= ${MACHINE} @@ -27,6 +29,9 @@ SUBDIR= ${MACHINE} SUBDIR+= ${ARCHSUBDIR} .endif .endif +.if ${MACHINE_CPU} == "aarch64" +SUBDIR+= arm +.endif .if ${MACHINE} == sparc SUBDIR+= sparc64 .endif @@ -58,7 +63,7 @@ SUBDIR+= xen # x68k x86_64 xen \ # zaurus -.if ${MACHINE_CPU} == arm +.if ${MACHINE_CPU} == aarch64 || ${MACHINE_CPU} == "arm" INCSYMLINKS= ${MACHINE_CPU} /usr/include/machine .else INCSYMLINKS= ${MACHINE} /usr/include/machine diff --git a/sys/lib/libkern/Makefile.compiler-rt b/sys/lib/libkern/Makefile.compiler-rt index 77c862f9143..711cf5242e6 100644 --- a/sys/lib/libkern/Makefile.compiler-rt +++ b/sys/lib/libkern/Makefile.compiler-rt @@ -1,4 +1,4 @@ -# $NetBSD: Makefile.compiler-rt,v 1.4 2014/02/26 22:37:55 joerg Exp $ +# $NetBSD: Makefile.compiler-rt,v 1.5 2014/08/10 05:57:31 matt Exp $ COMPILER_RT_SRCDIR= ${NETBSDSRCDIR}/sys/external/bsd/compiler_rt/dist @@ -21,32 +21,16 @@ GENERIC_SRCS+= \ addvdi3.c \ addvsi3.c \ addvti3.c \ - ashldi3.c \ ashlti3.c \ - ashrdi3.c \ ashrti3.c \ - clzdi2.c \ - clzsi2.c \ clzti2.c \ - cmpdi2.c \ cmpti2.c \ - ctzdi2.c \ - ctzsi2.c \ ctzti2.c \ - divdi3.c \ - divmoddi4.c \ - divmodsi4.c \ - divsi3.c \ divti3.c \ - ffsdi2.c \ ffsti2.c \ int_util.c \ - lshrdi3.c \ lshrti3.c \ - moddi3.c \ - modsi3.c \ modti3.c \ - muldi3.c \ mulodi4.c \ mulosi4.c \ muloti4.c \ @@ -54,7 +38,6 @@ GENERIC_SRCS+= \ mulvdi3.c \ mulvsi3.c \ mulvti3.c \ - negdi2.c \ negti2.c \ negvdi2.c \ negvsi2.c \ @@ -68,18 +51,55 @@ GENERIC_SRCS+= \ subvdi3.c \ subvsi3.c \ subvti3.c \ - ucmpdi2.c \ ucmpti2.c \ - udivdi3.c \ - udivmoddi4.c \ - udivmodsi4.c \ udivmodti4.c \ - udivsi3.c \ udivti3.c \ - umoddi3.c \ - umodsi3.c \ umodti3.c +.if ${MACHINE_CPU} != "aarch64" && ${MACHINE} != "alpha" +GENERIC_SRCS+= \ + clzsi2.c \ + ctzsi2.c +.endif + +.if ${MACHINE_CPU} != "aarch64" && ${MACHINE} != "alpha" +GENERIC_SRCS+= \ + divmodsi4.c \ + divsi3.c \ + modsi3.c \ + udivmodsi4.c \ + udivsi3.c \ + umodsi3.c +.endif + +.if ${MACHINE_CPU} != "aarch64" && ${MACHINE} != "alpha" +GENERIC_SRCS+= \ + clzdi2.c \ + ctzdi2.c \ + ffsdi2.c +.endif + +.if ${MACHINE_CPU} != "aarch64" && ${MACHINE} != "alpha" +GENERIC_SRCS+= \ + ashldi3.c \ + ashrdi3.c \ + lshrdi3.c +.endif + +.if ${MACHINE_CPU} != "aarch64" && ${MACHINE} != "alpha" +GENERIC_SRCS+= \ + cmpdi2.c \ + divdi3.c \ + divmoddi4.c \ + moddi3.c \ + muldi3.c \ + negdi2.c \ + ucmpdi2.c \ + udivdi3.c \ + udivmoddi4.c \ + umoddi3.c +.endif + .if ${MACHINE_CPU} == "arm" . if !empty(MACHINE_ARCH:Mearm*) GENERIC_SRCS+= \ diff --git a/sys/lib/libunwind/Registers.hpp b/sys/lib/libunwind/Registers.hpp index 0467525edcb..13f2b9485e4 100644 --- a/sys/lib/libunwind/Registers.hpp +++ b/sys/lib/libunwind/Registers.hpp @@ -237,6 +237,85 @@ private: }; enum { + DWARF_AARCH64_X0 = 0, + DWARF_AARCH64_X30 = 30, + DWARF_AARCH64_SP = 31, + DWARF_AARCH64_ELR_MODE = 33, + DWARF_AARCH64_V0 = 64, + DWARF_AARCH64_V31 = 95, + + REGNO_AARCH64_X0 = 0, + REGNO_AARCH64_X30 = 30, + REGNO_AARCH64_SP = 31, + REGNO_AARCH64_ELR_MODE = 32, + REGNO_AARCH64_V0 = 33, + REGNO_AARCH64_V31 = 64, +}; + +class Registers_aarch64 { +public: + enum { + LAST_RESTORE_REG = REGNO_AARCH64_V31, + LAST_REGISTER = REGNO_AARCH64_V31, + RETURN_OFFSET = 0, + }; + + __dso_hidden Registers_aarch64(); + + static int dwarf2regno(int num) { + if (num >= DWARF_AARCH64_X0 && num <= DWARF_AARCH64_X30) + return REGNO_AARCH64_X0 + (num - DWARF_AARCH64_X0); + if (num == DWARF_AARCH64_SP) + return REGNO_AARCH64_SP; + if (num == DWARF_AARCH64_ELR_MODE) + return REGNO_AARCH64_ELR_MODE; + if (num >= DWARF_AARCH64_V0 && num <= DWARF_AARCH64_V31) + return REGNO_AARCH64_V0 + (num - DWARF_AARCH64_V0); + return LAST_REGISTER + 1; + } + + bool validRegister(int num) const { + return num >= 0 && num <= LAST_RESTORE_REG; + } + + uint64_t getRegister(int num) const { + assert(validRegister(num)); + return reg[num]; + } + + void setRegister(int num, uint64_t value) { + assert(validRegister(num)); + reg[num] = value; + } + + uint64_t getIP() const { return reg[REGNO_AARCH64_X30]; } + + void setIP(uint64_t value) { reg[REGNO_AARCH64_X30] = value; } + + uint64_t getSP() const { return reg[REGNO_AARCH64_SP]; } + + void setSP(uint64_t value) { reg[REGNO_AARCH64_SP] = value; } + + bool validFloatVectorRegister(int num) const { + return (num >= REGNO_AARCH64_V0 && num <= REGNO_AARCH64_V31); + } + + void copyFloatVectorRegister(int num, uint64_t addr_) { + const void *addr = reinterpret_cast<const void *>(addr_); + memcpy(vecreg + (num - REGNO_AARCH64_V0), addr, sizeof(vecreg[0])); + } + + __dso_hidden void jumpto() const __dead; + +private: + struct vecreg_t { + uint64_t low, high; + }; + uint64_t reg[REGNO_AARCH64_ELR_MODE + 1]; + vecreg_t vecreg[32]; +}; + +enum { DWARF_ARM32_R0 = 0, DWARF_ARM32_R15 = 15, DWARF_ARM32_SPSR = 128, @@ -951,6 +1030,8 @@ typedef Registers_x86 NativeUnwindRegisters; typedef Registers_x86_64 NativeUnwindRegisters; #elif __powerpc__ typedef Registers_ppc32 NativeUnwindRegisters; +#elif __aarch64__ +typedef Registers_aarch64 NativeUnwindRegisters; #elif __arm__ typedef Registers_arm32 NativeUnwindRegisters; #elif __vax__ diff --git a/sys/lib/libunwind/unwind_registers.S b/sys/lib/libunwind/unwind_registers.S index a4dcfadde63..cb55b0b3d95 100644 --- a/sys/lib/libunwind/unwind_registers.S +++ b/sys/lib/libunwind/unwind_registers.S @@ -269,6 +269,75 @@ ENTRY(_ZNK7_Unwind15Registers_ppc326jumptoEv) bctr #endif +#ifdef __aarch64__ + .hidden _ZN7_Unwind17Registers_aarch64C1Ev +ENTRY(_ZN7_Unwind17Registers_aarch64C1Ev) + stp x0, x1, [x0] + add x0, x0, #16 + stp x2, x3, [x0], #16 + stp x4, x5, [x0], #16 + stp x6, x7, [x0], #16 + stp x8, x9, [x0], #16 + stp x10, x11, [x0], #16 + stp x12, x13, [x0], #16 + stp x14, x15, [x0], #16 + stp x16, x17, [x0], #16 + stp x18, x19, [x0], #16 + stp x20, x22, [x0], #16 + stp x22, x24, [x0], #16 + stp x24, x26, [x0], #16 + stp x26, x27, [x0], #16 + stp x28, x29, [x0], #16 + mov x1, sp + stp x30, x1, [x0], #16 + + add x0, x0, #8 + str xzr, [x0], #8 + + stp q0, q1, [x0], #64 + stp q2, q3, [x0], #64 + stp q4, q5, [x0], #64 + stp q6, q7, [x0], #64 + stp q8, q9, [x0], #64 + stp q10, q11, [x0], #64 + stp q12, q13, [x0], #64 + stp q14, q15, [x0], #64 + stp q16, q17, [x0], #64 + stp q18, q19, [x0], #64 + stp q20, q21, [x0], #64 + stp q22, q23, [x0], #64 + stp q24, q25, [x0], #64 + stp q26, q27, [x0], #64 + stp q28, q29, [x0], #64 + stp q30, q31, [x0], #64 + + ret +END(_ZN7_Unwind17Registers_aarch64C1Ev) + + .hidden _ZNK7_Unwind17Registers_aarch646jumptoEv +ENTRY(_ZNK7_Unwind17Registers_aarch646jumptoEv) + ldp x2, x3, [x0, #16] + ldp x4, x6, [x0, #32] + ldp x6, x7, [x0, #48] + ldp x8, x9, [x0, #64] + ldp x10, x11, [x0, #80] + ldp x12, x13, [x0, #96] + ldp x14, x16, [x0, #112] + ldp x16, x17, [x0, #128] + ldp x18, x19, [x0, #144] + ldp x20, x21, [x0, #160] + ldp x22, x23, [x0, #176] + ldp x24, x26, [x0, #192] + ldp x26, x27, [x0, #208] + ldp x28, x29, [x0, #224] + ldp x30, x1, [x0, #240] + mov sp, x1 + + ldp x0, x1, [x0, #0] + ret +END(_ZNK7_Unwind17Registers_aarch646jumptoEv) +#endif /* __aarch64__ */ + #if defined(__arm__) .fpu vfpv3 .hidden _ZN7_Unwind15Registers_arm32C1Ev diff --git a/sys/modules/Makefile b/sys/modules/Makefile index 10a0fa8d875..6d64eab8e99 100644 --- a/sys/modules/Makefile +++ b/sys/modules/Makefile @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.138 2014/08/09 22:10:35 riz Exp $ +# $NetBSD: Makefile,v 1.139 2014/08/10 05:57:31 matt Exp $ .include <bsd.own.mk> @@ -117,11 +117,12 @@ SUBDIR+= xldscripts SUBDIR+= exec_aout .endif -.if ${MACHINE_ARCH} != "alpha" +.if ${MACHINE_ARCH} != "alpha" && ${MACHINE_CPU} != "aarch64" SUBDIR+= exec_elf32 .endif -.if ${MACHINE_ARCH} == "alpha" || \ +.if ${MACHINE_CPU} == "aarch64" || \ + ${MACHINE_ARCH} == "alpha" || \ ${MACHINE_ARCH} == "sparc64" || \ ${MACHINE_ARCH} == "x86_64" SUBDIR+= exec_elf64 diff --git a/sys/sys/aout_mids.h b/sys/sys/aout_mids.h index ef6dacf969a..458cc53cc57 100644 --- a/sys/sys/aout_mids.h +++ b/sys/sys/aout_mids.h @@ -1,4 +1,4 @@ -/* $NetBSD: aout_mids.h,v 1.2 2012/12/27 06:55:49 martin Exp $ */ +/* $NetBSD: aout_mids.h,v 1.3 2014/08/10 05:57:31 matt Exp $ */ /* * Copyright (c) 2009, The NetBSD Foundation, Inc. @@ -61,6 +61,7 @@ #define MID_X86_64 157 /* AMD x86-64 */ #define MID_SH5_32 158 /* ILP32 SH5 */ #define MID_IA64 159 /* Itanium */ +#define MID_AARCH64 183 /* ARM AARCH64 */ #define MID_HP200 200 /* hp200 (68010) BSD binary */ #define MID_HP300 300 /* hp300 (68020+68881) BSD binary */ #define MID_HPUX 0x20C /* hp200/300 HP-UX binary */ diff --git a/tests/lib/libc/gen/Makefile b/tests/lib/libc/gen/Makefile index 17d0eb609a7..4c68bc19725 100644 --- a/tests/lib/libc/gen/Makefile +++ b/tests/lib/libc/gen/Makefile @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.40 2014/04/29 06:29:02 uebayasi Exp $ +# $NetBSD: Makefile,v 1.41 2014/08/10 05:57:31 matt Exp $ .include <bsd.own.mk> @@ -17,8 +17,10 @@ TESTS_C+= t_floatunditf TESTS_C+= t_fmtcheck TESTS_C+= t_fnmatch TESTS_C+= t_fpclassify +.if ${MACHINE_CPU} != "aarch64" TESTS_C+= t_fpsetmask TESTS_C+= t_fpsetround +.endif TESTS_C+= t_ftok TESTS_C+= t_getcwd TESTS_C+= t_getgrent @@ -39,6 +41,14 @@ TESTS_C+= t_time TESTS_C+= t_ttyname TESTS_C+= t_vis +.if ${MACHINE_CPU} == "aarch64" || ${MACHINE_CPU} == "arm" \ + || ${MACHINE_CPU} == "sparc" \ + || ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "x86_64" +CPPFLAGS.t_siginfo.c+= -DHAVE_FENV +LDADD.t_siginfo+= -lm +DPADD.t_siginfo+= ${LIBM} +.endif + LDADD.t_fpclassify+= -lm DPADD.t_fpclassify+= ${LIBM} LDADD.t_fpsetround+= -lm diff --git a/tools/Makefile b/tools/Makefile index 3ad205c60dc..4355500467a 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.176 2014/07/15 13:19:44 christos Exp $ +# $NetBSD: Makefile,v 1.177 2014/08/10 05:57:31 matt Exp $ .include <bsd.own.mk> .include <bsd.endian.mk> @@ -25,7 +25,7 @@ TOOLS_BUILDRUMP?=no .if ${TOOLCHAIN_MISSING} == "no" -. if defined(HAVE_GCC) +. if defined(HAVE_GCC) && ${HAVE_GCC} > 0 TOOLCHAIN_BITS= gmake .WAIT TOOLCHAIN_BITS+= gmp .WAIT TOOLCHAIN_BITS+= mpfr .WAIT @@ -37,7 +37,7 @@ TOOLCHAIN_BITS+= mpc .WAIT TOOLCHAIN_BITS+= binutils .WAIT .endif -.if defined(HAVE_GCC) +.if defined(HAVE_GCC) && ${HAVE_GCC} > 0 . if ${TOOLCHAIN_MISSING} == "no" TOOLCHAIN_BITS+= gcc . if ${MKCROSSGDB:Uno} != "no" || make(obj) diff --git a/tools/headerlist b/tools/headerlist index f32f11b96e5..c93ba4d000e 100644 --- a/tools/headerlist +++ b/tools/headerlist @@ -1,8 +1,10 @@ -# $NetBSD: headerlist,v 1.10 2014/03/31 11:25:49 martin Exp $ +# $NetBSD: headerlist,v 1.11 2014/08/10 05:57:31 matt Exp $ # # do not edit; this file was automatically generated by: # NetBSD: mkheaderlist.sh,v 1.1 2007/08/07 12:38:23 yamt Exp +./aarch64/include/disklabel.h +./aarch64/include/elf_machdep.h ./acorn26/include/disklabel.h ./acorn26/include/elf_machdep.h ./acorn32/include/disklabel.h @@ -40,6 +42,8 @@ ./epoc32/include/elf_machdep.h ./evbarm/include/disklabel.h ./evbarm/include/elf_machdep.h +./evbarm64/include/disklabel.h +./evbarm64/include/elf_machdep.h ./evbcf/include/disklabel.h ./evbcf/include/elf_machdep.h ./evbmips/include/disklabel.h |
