Index: Makefile =================================================================== --- Makefile +++ Makefile @@ -165,10 +165,10 @@ # Guess machine architecture from machine type, and vice versa. .if !defined(TARGET_ARCH) && defined(TARGET) -_TARGET_ARCH= ${TARGET:S/pc98/i386/} +_TARGET_ARCH= ${TARGET:S/pc98/i386/:S/arm64/aarch64/} .elif !defined(TARGET) && defined(TARGET_ARCH) && \ ${TARGET_ARCH} != ${MACHINE_ARCH} -_TARGET= ${TARGET_ARCH:C/mips(n32|64)?(el)?/mips/:C/arm(v6)?(eb|hf)?/arm/} +_TARGET= ${TARGET_ARCH:C/mips(n32|64)?(el)?/mips/:C/arm(v6)?(eb|hf)?/arm/:C/aarch64/arm64/} .endif .if defined(TARGET) && !defined(_TARGET) _TARGET=${TARGET} Index: Makefile.inc1 =================================================================== --- Makefile.inc1 +++ Makefile.inc1 @@ -149,7 +149,7 @@ VERSION= FreeBSD ${REVISION}-${BRANCH:C/-p[0-9]+$//} ${TARGET_ARCH} ${SRCRELDATE} .endif -KNOWN_ARCHES?= amd64 arm armeb/arm armv6/arm armv6hf/arm i386 i386/pc98 mips mipsel/mips mips64el/mips mips64/mips mipsn32el/mips mipsn32/mips powerpc powerpc64/powerpc sparc64 +KNOWN_ARCHES?= aarch64/arm64 amd64 arm armeb/arm armv6/arm armv6hf/arm i386 i386/pc98 mips mipsel/mips mips64el/mips mips64/mips mipsn32el/mips mipsn32/mips powerpc powerpc64/powerpc sparc64 .if ${TARGET} == ${TARGET_ARCH} _t= ${TARGET} .else @@ -1476,6 +1476,10 @@ # cross-build on a FreeBSD 10 host: _elftctools+= usr.bin/addr2line .endif +.elif ${TARGET_ARCH} != ${MACHINE_ARCH} && ${MK_ELFTOOLCHAIN_TOOLS} != "no" +# A cross-strip is not passed in WMAKEENV, so build elfcopy/strip. +_elftctools= lib/libelftc \ + usr.bin/elfcopy .endif # If an full path to an external cross compiler is given, don't build Index: contrib/jemalloc/include/jemalloc/jemalloc_FreeBSD.h =================================================================== --- contrib/jemalloc/include/jemalloc/jemalloc_FreeBSD.h +++ contrib/jemalloc/include/jemalloc/jemalloc_FreeBSD.h @@ -40,6 +40,9 @@ #ifdef __arm__ # define LG_SIZEOF_PTR 2 #endif +#ifdef __aarch64__ +# define LG_SIZEOF_PTR 3 +#endif #ifdef __mips__ #ifdef __mips_n64 # define LG_SIZEOF_PTR 3 Index: etc/etc.arm64/ttys =================================================================== --- /dev/null +++ etc/etc.arm64/ttys @@ -0,0 +1,49 @@ +# +# $FreeBSD: projects/arm64/etc/etc.arm/ttys 220154 2011-03-30 08:22:29Z ed $ +# @(#)ttys 5.1 (Berkeley) 4/17/89 +# +# This file specifies various information about terminals on the system. +# It is used by several different programs. Common entries for the +# various columns include: +# +# name The name of the terminal device. +# +# getty The program to start running on the terminal. Typically a +# getty program, as the name implies. Other common entries +# include none, when no getty is needed, and xdm, to start the +# X Window System. +# +# type The initial terminal type for this port. For hardwired +# terminal lines, this will contain the type of terminal used. +# For virtual consoles, the correct type is typically xterm. +# Other common values include dialup for incoming modem ports, and +# unknown when the terminal type cannot be predetermined. +# +# status Must be on or off. If on, init will run the getty program on +# the specified port. If the word "secure" appears, this tty +# allows root login. +# +# name getty type status comments +# +# If console is marked "insecure", then init will ask for the root password +# when going to single-user mode. +console none unknown off secure +# +ttyv0 "/usr/libexec/getty Pc" xterm off secure +# Virtual terminals +ttyv1 "/usr/libexec/getty Pc" xterm off secure +ttyv2 "/usr/libexec/getty Pc" xterm off secure +ttyv3 "/usr/libexec/getty Pc" xterm off secure +ttyv4 "/usr/libexec/getty Pc" xterm off secure +ttyv5 "/usr/libexec/getty Pc" xterm off secure +ttyv6 "/usr/libexec/getty Pc" xterm off secure +ttyv7 "/usr/libexec/getty Pc" xterm off secure +#ttyv8 "/usr/local/bin/xdm -nodaemon" xterm off secure +# Serial terminals +# The 'dialup' keyword identifies dialin lines to login, fingerd etc. +ttyu0 "/usr/libexec/getty std.9600" vt100 on secure +ttyu1 "/usr/libexec/getty std.9600" dialup off secure +ttyu2 "/usr/libexec/getty std.9600" dialup off secure +ttyu3 "/usr/libexec/getty std.9600" dialup off secure +# Dumb console +dcons "/usr/libexec/getty std.9600" vt100 off secure Index: lib/csu/arm64/Makefile =================================================================== --- /dev/null +++ lib/csu/arm64/Makefile @@ -0,0 +1,44 @@ +# $FreeBSD$ + +.PATH: ${.CURDIR}/../common + +SRCS= crt1.c crti.S crtn.S +OBJS= ${SRCS:N*.h:R:S/$/.o/g} +OBJS+= Scrt1.o gcrt1.o +CFLAGS+= -I${.CURDIR}/../common \ + -I${.CURDIR}/../../libc/include + +all: ${OBJS} + +CLEANFILES= ${OBJS} +CLEANFILES+= crt1.s gcrt1.s Scrt1.s + +# See the comment in lib/csu/common/crtbrand.c for the reason crt1.c is not +# directly compiled to .o files. + +crt1.s: crt1.c + ${CC} ${CFLAGS} -S -o ${.TARGET} ${.CURDIR}/crt1.c + sed ${SED_FIX_NOTE} ${.TARGET} + +crt1.o: crt1.s + ${CC} ${ACFLAGS} -c -o ${.TARGET} crt1.s + +gcrt1.s: crt1.c + ${CC} ${CFLAGS} -DGCRT -S -o ${.TARGET} ${.CURDIR}/crt1.c + sed ${SED_FIX_NOTE} ${.TARGET} + +gcrt1.o: gcrt1.s + ${CC} ${ACFLAGS} -c -o ${.TARGET} gcrt1.s + +Scrt1.s: crt1.c + ${CC} ${CFLAGS} -fPIC -DPIC -S -o ${.TARGET} ${.CURDIR}/crt1.c + sed ${SED_FIX_NOTE} ${.TARGET} + +Scrt1.o: Scrt1.s + ${CC} ${ACFLAGS} -c -o ${.TARGET} Scrt1.s + +realinstall: + ${INSTALL} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \ + ${OBJS} ${DESTDIR}${LIBDIR} + +.include Index: lib/csu/arm64/crt1.c =================================================================== --- /dev/null +++ lib/csu/arm64/crt1.c @@ -0,0 +1,136 @@ +/* LINTLIBRARY */ +/*- + * Copyright 2001 David E. O'Brien. + * All rights reserved. + * Copyright 1996-1998 John D. Polstra. + * All rights reserved. + * Copyright (c) 1997 Jason R. Thorpe. + * Copyright (c) 1995 Christopher G. Demetriou + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed for the + * FreeBSD Project. See http://www.freebsd.org/ for + * information about FreeBSD. + * This product includes software developed for the + * NetBSD Project. See http://www.netbsd.org/ for + * information about NetBSD. + * 4. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#ifndef lint +#ifndef __GNUC__ +#error "GCC is needed to compile this file" +#endif +#endif /* lint */ + +#include + +#include "libc_private.h" +#include "crtbrand.c" +#include "ignore_init.c" + +struct Struct_Obj_Entry; +struct ps_strings; + +extern void _start(int, char **, char **, const struct Struct_Obj_Entry *, + void (*)(void), struct ps_strings *); + +#ifdef GCRT +extern void _mcleanup(void); +extern void monstartup(void *, void *); +extern int eprol; +extern int etext; +#endif + +struct ps_strings *__ps_strings; + +void __start(int, char **, char **, struct ps_strings *, + const struct Struct_Obj_Entry *, void (*)(void)); + +/* The entry function. */ +__asm(" .text \n" +" .align 0 \n" +" .globl _start \n" +" _start: \n" +/* TODO: Don't just pass NULL to __start */ +" mov x3, x0 \n" /* ps_strings */ +" mov x4, x1 \n" /* obj */ +" mov x5, x2 \n" /* cleanup */ +" ldr x0, [sp] \n" /* Load argc */ +" add x1, sp, #8 \n" /* load argv */ +" add x2, x1, x0, lsl #3 \n" /* env is after argv */ +" add x2, x2, #8 \n" /* argv is null terminated */ +/* Align the stack to a 16-bit address */ +" mov x10, sp \n" +" mov x11, #15 \n" +" bic x10, x10, x11 \n" +" mov sp, x10 \n" +" b __start "); + +/* ARGSUSED */ +void +__start(int argc, char **argv, char **env, struct ps_strings *ps_strings, + const struct Struct_Obj_Entry *obj __unused, void (*cleanup)(void)) +{ + + handle_argv(argc, argv, env); + + if (ps_strings != (struct ps_strings *)0) + __ps_strings = ps_strings; + + if (&_DYNAMIC != NULL) + atexit(cleanup); + else + _init_tls(); +#ifdef GCRT + atexit(_mcleanup); + monstartup(&eprol, &etext); +#endif + handle_static_init(argc, argv, env); + exit(main(argc, argv, env)); +} + +static const struct { + int32_t namesz; + int32_t descsz; + int32_t type; + char name[sizeof(NOTE_FREEBSD_VENDOR)]; + char desc[sizeof(MACHINE_ARCH)]; +} archtag __attribute__ ((section (NOTE_SECTION), aligned(4))) __used = { + .namesz = sizeof(NOTE_FREEBSD_VENDOR), + .descsz = sizeof(MACHINE_ARCH), + .type = ARCH_NOTETYPE, + .name = NOTE_FREEBSD_VENDOR, + .desc = MACHINE_ARCH +}; + +#ifdef GCRT +__asm__(".text"); +__asm__("eprol:"); +__asm__(".previous"); +#endif Index: lib/csu/arm64/crti.S =================================================================== --- /dev/null +++ lib/csu/arm64/crti.S @@ -0,0 +1,48 @@ +/*- + * Copyright 2001 David E. O'Brien + * Copyright 2014 The FreeBSD Foundation + * All rights reserved. + * + * Portions of this software were developed by Andrew Turner + * under sponsorship from the FreeBSD Foundation. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + + .section .init,"ax",@progbits + .align 4 + .globl _init + .type _init,@function +_init: + sub sp, sp, #16 + str lr, [sp] + + .section .fini,"ax",@progbits + .align 4 + .globl _fini + .type _fini,@function +_fini: + sub sp, sp, #16 + str lr, [sp] + Index: lib/csu/arm64/crtn.S =================================================================== --- /dev/null +++ lib/csu/arm64/crtn.S @@ -0,0 +1,44 @@ +/*- + * Copyright 2001 David E. O'Brien + * Copyright 2014 The FreeBSD Foundation + * All rights reserved. + * + * Portions of this software were developed by Andrew Turner + * under sponsorship from the FreeBSD Foundation. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + + .section .init,"ax",@progbits + ldr lr, [sp] + add sp, sp, #16 + ret + + + .section .fini,"ax",@progbits + ldr lr, [sp] + add sp, sp, #16 + ret + + .section .note.GNU-stack,"",%progbits Index: lib/libc/arm64/Makefile.inc =================================================================== --- /dev/null +++ lib/libc/arm64/Makefile.inc @@ -0,0 +1,5 @@ +# $FreeBSD$ +# +# Machine dependent definitions for the arm 64-bit architecture. +# + Index: lib/libthr/arch/arm64/Makefile.inc =================================================================== --- /dev/null +++ lib/libthr/arch/arm64/Makefile.inc @@ -0,0 +1,2 @@ +# $FreeBSD$ + Index: lib/msun/arm64/Makefile.inc =================================================================== --- /dev/null +++ lib/msun/arm64/Makefile.inc @@ -0,0 +1,4 @@ +# $FreeBSD$ + +LDBL_PREC = 113 + Index: lib/msun/arm64/fenv.h =================================================================== --- /dev/null +++ lib/msun/arm64/fenv.h @@ -0,0 +1,245 @@ +/*- + * Copyright (c) 2004-2005 David Schultz + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _FENV_H_ +#define _FENV_H_ + +#include + +#ifndef __fenv_static +#define __fenv_static static +#endif + +typedef __uint64_t fenv_t; +typedef __uint64_t fexcept_t; + +/* Exception flags */ +#define FE_INVALID 0x00000001 +#define FE_DIVBYZERO 0x00000002 +#define FE_OVERFLOW 0x00000004 +#define FE_UNDERFLOW 0x00000008 +#define FE_INEXACT 0x00000010 +#define FE_ALL_EXCEPT (FE_DIVBYZERO | FE_INEXACT | \ + FE_INVALID | FE_OVERFLOW | FE_UNDERFLOW) + +/* + * Rounding modes + * + * We can't just use the hardware bit values here, because that would + * make FE_UPWARD and FE_DOWNWARD negative, which is not allowed. + */ +#define FE_TONEAREST 0x0 +#define FE_UPWARD 0x1 +#define FE_DOWNWARD 0x2 +#define FE_TOWARDZERO 0x3 +#define _ROUND_MASK (FE_TONEAREST | FE_DOWNWARD | \ + FE_UPWARD | FE_TOWARDZERO) +#define _ROUND_SHIFT 22 + +__BEGIN_DECLS + +/* Default floating-point environment */ +extern const fenv_t __fe_dfl_env; +#define FE_DFL_ENV (&__fe_dfl_env) + +/* We need to be able to map status flag positions to mask flag positions */ +#define _FPUSW_SHIFT 8 +#define _ENABLE_MASK (FE_ALL_EXCEPT << _FPUSW_SHIFT) + +#define __mrs_fpcr(__r) __asm __volatile("mrs %0, fpcr" : : "r" (__r)) +#define __msr_fpcr(__r) __asm __volatile("msr fpcr, %0" : "=r" (*(__r))) + +#define __mrs_fpsr(__r) __asm __volatile("mrs %0, fpsr" : : "r" (__r)) +#define __msr_fpsr(__r) __asm __volatile("msr fpsr, %0" : "=r" (*(__r))) + +__fenv_static __inline int +feclearexcept(int __excepts) +{ + fexcept_t __r; + + __mrs_fpsr(&__r); + __r &= ~__excepts; + __msr_fpsr(__r); + return (0); +} + +__fenv_static inline int +fegetexceptflag(fexcept_t *__flagp, int __excepts) +{ + fexcept_t __r; + + __mrs_fpsr(&__r); + *__flagp = __r & __excepts; + return (0); +} + +__fenv_static inline int +fesetexceptflag(const fexcept_t *__flagp, int __excepts) +{ + fexcept_t __r; + + __mrs_fpsr(&__r); + __r &= ~__excepts; + __r |= *__flagp & __excepts; + __msr_fpsr(__r); + return (0); +} + +__fenv_static inline int +feraiseexcept(int __excepts) +{ + fexcept_t __r; + + __mrs_fpsr(&__r); + __r |= __excepts; + __msr_fpsr(__r); + return (0); +} + +__fenv_static inline int +fetestexcept(int __excepts) +{ + fexcept_t __r; + + __mrs_fpsr(&__r); + return (__r & __excepts); +} + +__fenv_static inline int +fegetround(void) +{ + fenv_t __r; + + __mrs_fpcr(&__r); + return ((__r >> _ROUND_SHIFT) & _ROUND_MASK); +} + +__fenv_static inline int +fesetround(int __round) +{ + fenv_t __r; + + if (__round & ~_ROUND_MASK) + return (-1); + __mrs_fpcr(&__r); + __r &= ~(_ROUND_MASK << _ROUND_SHIFT); + __r |= __round << _ROUND_SHIFT; + __msr_fpcr(__r); + return (0); +} + +__fenv_static inline int +fegetenv(fenv_t *__envp) +{ + + __mrs_fpcr(&__r); + *__envp = __r & _ENABLE_MASK; + + __mrs_fpsr(&__r); + *__envp |= __r & (FE_ALL_EXCEPT | (_ROUND_MASK << _ROUND_SHIFT)); + + return (0); +} + +__fenv_static inline int +feholdexcept(fenv_t *__envp) +{ + fenv_t __r; + + __mrs_fpcr(&__r); + *__envp = __r & _ENABLE_MASK; + __r &= ~(_ENABLE_MASK); + __msr_fpcr(__r); + + __mrs_fpsr(&__r); + *__envp |= __r & (FE_ALL_EXCEPT | (_ROUND_MASK << _ROUND_SHIFT)); + r &= ~(_ENABLE_MASK); + __msr_fpsr(__r); + return (0); +} + +__fenv_static inline int +fesetenv(const fenv_t *__envp) +{ + + __msr_fpcr((*__envp) & _ENABLE_MASK); + __msr_fpsr((*__envp) & (FE_ALL_EXCEPT | (_ROUND_MASK << _ROUND_SHIFT)); + return (0); +} + +__fenv_static inline int +feupdateenv(const fenv_t *__envp) +{ + fexcept_t __r; + + __mrs_fpsr(&__r); + fesetenv(__envp); + feraiseexcept(__r & FE_ALL_EXCEPT); + return (0); +} + +#if __BSD_VISIBLE + +/* We currently provide no external definitions of the functions below. */ + +static inline int +feenableexcept(int __mask) +{ + fenv_t __old_r, __new_r; + + __mrs_fpcr(&__old_r); + __new_r = __old_r | ((__mask & FE_ALL_EXCEPT) << _FPUSW_SHIFT); + __msr_fpcr(__new_r); + return ((__old_r >> _FPUSW_SHIFT) & FE_ALL_EXCEPT); +} + +static inline int +fedisableexcept(int __mask) +{ + fenv_t __old_r, __new_r; + + __mrs_fpcr(&__old_r); + __new_r = __old_r & ~((__mask & FE_ALL_EXCEPT) << _FPUSW_SHIFT); + __msr_fpcr(__new_r); + return ((__old_r >> _FPUSW_SHIFT) & FE_ALL_EXCEPT); +} + +static inline int +fegetexcept(void) +{ + fenv_t __r; + + __mrs_fpcr(&__r); + return ((__r & _ENABLE_MASK) >> _FPUSW_SHIFT); +} + +#endif /* __BSD_VISIBLE */ + +__END_DECLS + +#endif /* !_FENV_H_ */ Index: share/mk/bsd.endian.mk =================================================================== --- share/mk/bsd.endian.mk +++ share/mk/bsd.endian.mk @@ -1,6 +1,7 @@ # $FreeBSD$ -.if ${MACHINE_ARCH} == "amd64" || \ +.if ${MACHINE_ARCH} == "aarch64" || \ + ${MACHINE_ARCH} == "amd64" || \ ${MACHINE_ARCH} == "i386" || \ (${MACHINE} == "arm" && ${MACHINE_ARCH:Marm*eb*} == "") || \ ${MACHINE_ARCH:Mmips*el} != "" Index: share/mk/src.opts.mk =================================================================== --- share/mk/src.opts.mk +++ share/mk/src.opts.mk @@ -215,8 +215,8 @@ # If the compiler is not C++11 capable, disable clang and use gcc instead. __DEFAULT_YES_OPTIONS+=GCC GCC_BOOTSTRAP GNUCXX __DEFAULT_NO_OPTIONS+=CLANG CLANG_BOOTSTRAP CLANG_FULL CLANG_IS_CC -.elif ${__T} == "amd64" || ${__T} == "i386" -# On x86, clang is enabled, and will be installed as the default cc. +.elif ${__T} == "aarch64" || ${__T} == "amd64" || ${__T} == "i386" +# On x86 and arm64, clang is enabled, and will be installed as the default cc. __DEFAULT_YES_OPTIONS+=CLANG CLANG_BOOTSTRAP CLANG_FULL CLANG_IS_CC __DEFAULT_NO_OPTIONS+=GCC GCC_BOOTSTRAP GNUCXX .elif ${__TT} == "arm" && ${__T:Marm*eb*} == "" @@ -233,6 +233,9 @@ __DEFAULT_YES_OPTIONS+=GCC GCC_BOOTSTRAP GNUCXX __DEFAULT_NO_OPTIONS+=CLANG CLANG_BOOTSTRAP CLANG_FULL CLANG_IS_CC .endif +.if ${__T} == "aarch64" +BROKEN_OPTIONS+=BINUTILS BINUTILS_BOOTSTRAP GDB +.endif .include Index: share/mk/sys.mk =================================================================== --- share/mk/sys.mk +++ share/mk/sys.mk @@ -13,7 +13,7 @@ # and/or endian. This is called MACHINE_CPU in NetBSD, but that's used # for something different in FreeBSD. # -MACHINE_CPUARCH=${MACHINE_ARCH:C/mips(n32|64)?(el)?/mips/:C/arm(v6)?(eb|hf)?/arm/:C/powerpc64/powerpc/} +MACHINE_CPUARCH=${MACHINE_ARCH:C/mips(n32|64)?(el)?/mips/:C/arm(v6)?(eb|hf)?/arm/:C/powerpc64/powerpc/:C/aarch64/arm64/} .endif # If the special target .POSIX appears (without prerequisites or Index: usr.bin/xlint/Makefile.inc =================================================================== --- usr.bin/xlint/Makefile.inc +++ usr.bin/xlint/Makefile.inc @@ -8,7 +8,7 @@ # These assignments duplicate much of the functionality of # MACHINE_CPUARCH, but there's no easy way to export make functions... .if defined(TARGET_ARCH) -TARGET_CPUARCH= ${TARGET_ARCH:C/mips(n32|64)?(el)?/mips/:C/arm(v6)?(eb|hf)?/arm/} +TARGET_CPUARCH= ${TARGET_ARCH:C/mips(n32|64)?(el)?/mips/:C/arm(v6)?(eb|hf)?/arm/:C/aarch64/arm64/} .else TARGET_CPUARCH= ${MACHINE_CPUARCH} TARGET_ARCH= ${MACHINE_ARCH} Index: usr.bin/xlint/arch/arm64/targparam.h =================================================================== --- /dev/null +++ usr.bin/xlint/arch/arm64/targparam.h @@ -0,0 +1,53 @@ +/* $NetBSD: targparam.h,v 1.2 2002/01/30 06:55:00 thorpej Exp $ */ + +/* + * Copyright (c) 1994, 1995 Jochen Pohl + * All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Jochen Pohl for + * The NetBSD Project. + * 4. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/* + * Machine-dependent target parameters for lint1. + */ + +#include "lp64.h" + +/* + * Should be set to 1 if the difference of two pointers is of type long + * or the value of sizeof is of type unsigned long. Note this MUST be + * kept in sync with the compiler! + */ + +#define PTRDIFF_IS_LONG 1 +#define SIZEOF_IS_ULONG 1 + +#define FLOAT_SIZE (4 * CHAR_BIT) +#define DOUBLE_SIZE (8 * CHAR_BIT) +#define LDOUBLE_SIZE (16 * CHAR_BIT) + +#define ENUM_SIZE (4 * CHAR_BIT) Index: usr.bin/xlint/lint1/param.h =================================================================== --- usr.bin/xlint/lint1/param.h +++ usr.bin/xlint/lint1/param.h @@ -95,6 +95,9 @@ #elif __mips__ #define PTRDIFF_IS_LONG 0 #define SIZEOF_IS_ULONG 0 +#elif __aarch64__ +#define PTRDIFF_IS_LONG 1 +#define SIZEOF_IS_ULONG 1 #else #error unknown machine type #endif