Commit 48e5b257 authored by emaste's avatar emaste
Browse files

Add 64-bit ARM binutils port

This is a port version of Andrew Turner's AArch64-FreeBSD binutils git
branch, https://github.com/zxombie/aarch64-freebsd-binutils

Reviewed by:	bapt
Approvied by:	bapt
Differential Revision: https://reviews.freebsd.org/D912
parent 92c4d37e
......@@ -33,6 +33,7 @@
SUBDIR += R-cran-reshape2
SUBDIR += SpecTcl
SUBDIR += aap
SUBDIR += aarch64-binutils
SUBDIR += abi-compliance-checker
SUBDIR += ace
SUBDIR += ace+tao-doc
......
# $FreeBSD$
PORTREVISION= 1
COMMENT= GNU binutils for AArch64 cross-development
PKGNAMEPREFIX= aarch64-
PLIST= ${.CURDIR}/pkg-plist
MASTERDIR= ${.CURDIR}/../binutils/
.include "${MASTERDIR}/Makefile"
aarch64-freebsd/bin/ar
aarch64-freebsd/bin/as
aarch64-freebsd/bin/ld
aarch64-freebsd/bin/ld.bfd
aarch64-freebsd/bin/nm
aarch64-freebsd/bin/objcopy
aarch64-freebsd/bin/objdump
aarch64-freebsd/bin/ranlib
aarch64-freebsd/bin/strip
aarch64-freebsd/lib/ldscripts/aarch64elf.x
aarch64-freebsd/lib/ldscripts/aarch64elf.xbn
aarch64-freebsd/lib/ldscripts/aarch64elf.xc
aarch64-freebsd/lib/ldscripts/aarch64elf.xn
aarch64-freebsd/lib/ldscripts/aarch64elf.xr
aarch64-freebsd/lib/ldscripts/aarch64elf.xs
aarch64-freebsd/lib/ldscripts/aarch64elf.xsc
aarch64-freebsd/lib/ldscripts/aarch64elf.xsw
aarch64-freebsd/lib/ldscripts/aarch64elf.xu
aarch64-freebsd/lib/ldscripts/aarch64elf.xw
aarch64-freebsd/lib/ldscripts/aarch64fbsd.x
aarch64-freebsd/lib/ldscripts/aarch64fbsd.xbn
aarch64-freebsd/lib/ldscripts/aarch64fbsd.xc
aarch64-freebsd/lib/ldscripts/aarch64fbsd.xd
aarch64-freebsd/lib/ldscripts/aarch64fbsd.xdc
aarch64-freebsd/lib/ldscripts/aarch64fbsd.xdw
aarch64-freebsd/lib/ldscripts/aarch64fbsd.xn
aarch64-freebsd/lib/ldscripts/aarch64fbsd.xr
aarch64-freebsd/lib/ldscripts/aarch64fbsd.xs
aarch64-freebsd/lib/ldscripts/aarch64fbsd.xsc
aarch64-freebsd/lib/ldscripts/aarch64fbsd.xsw
aarch64-freebsd/lib/ldscripts/aarch64fbsd.xu
aarch64-freebsd/lib/ldscripts/aarch64fbsd.xw
aarch64-freebsd/lib/ldscripts/aarch64fbsdb.x
aarch64-freebsd/lib/ldscripts/aarch64fbsdb.xbn
aarch64-freebsd/lib/ldscripts/aarch64fbsdb.xc
aarch64-freebsd/lib/ldscripts/aarch64fbsdb.xd
aarch64-freebsd/lib/ldscripts/aarch64fbsdb.xdc
aarch64-freebsd/lib/ldscripts/aarch64fbsdb.xdw
aarch64-freebsd/lib/ldscripts/aarch64fbsdb.xn
aarch64-freebsd/lib/ldscripts/aarch64fbsdb.xr
aarch64-freebsd/lib/ldscripts/aarch64fbsdb.xs
aarch64-freebsd/lib/ldscripts/aarch64fbsdb.xsc
aarch64-freebsd/lib/ldscripts/aarch64fbsdb.xsw
aarch64-freebsd/lib/ldscripts/aarch64fbsdb.xu
aarch64-freebsd/lib/ldscripts/aarch64fbsdb.xw
bin/aarch64-freebsd-addr2line
bin/aarch64-freebsd-ar
bin/aarch64-freebsd-as
bin/aarch64-freebsd-c++filt
bin/aarch64-freebsd-elfedit
bin/aarch64-freebsd-gprof
bin/aarch64-freebsd-ld
bin/aarch64-freebsd-ld.bfd
bin/aarch64-freebsd-nm
bin/aarch64-freebsd-objcopy
bin/aarch64-freebsd-objdump
bin/aarch64-freebsd-ranlib
bin/aarch64-freebsd-readelf
bin/aarch64-freebsd-size
bin/aarch64-freebsd-strings
bin/aarch64-freebsd-strip
man/man1/aarch64-freebsd-addr2line.1.gz
man/man1/aarch64-freebsd-ar.1.gz
man/man1/aarch64-freebsd-as.1.gz
man/man1/aarch64-freebsd-c++filt.1.gz
man/man1/aarch64-freebsd-dlltool.1.gz
man/man1/aarch64-freebsd-elfedit.1.gz
man/man1/aarch64-freebsd-gprof.1.gz
man/man1/aarch64-freebsd-ld.1.gz
man/man1/aarch64-freebsd-nlmconv.1.gz
man/man1/aarch64-freebsd-nm.1.gz
man/man1/aarch64-freebsd-objcopy.1.gz
man/man1/aarch64-freebsd-objdump.1.gz
man/man1/aarch64-freebsd-ranlib.1.gz
man/man1/aarch64-freebsd-readelf.1.gz
man/man1/aarch64-freebsd-size.1.gz
man/man1/aarch64-freebsd-strings.1.gz
man/man1/aarch64-freebsd-strip.1.gz
man/man1/aarch64-freebsd-windmc.1.gz
man/man1/aarch64-freebsd-windres.1.gz
diff --git bfd/config.bfd bfd/config.bfd
index 4edcc6a..4c94f69 100644
--- bfd/config.bfd
+++ bfd/config.bfd
@@ -173,6 +173,11 @@ 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-*-freebsd*)
+ targ_defvec=bfd_elf64_littleaarch64_vec
+ targ_selvecs="bfd_elf64_bigaarch64_vec bfd_elf32_littlearm_vec bfd_elf32_bigarm_vec"
+ want64=true
+ ;;
aarch64-*-linux*)
targ_defvec=bfd_elf64_littleaarch64_vec
targ_selvecs="bfd_elf64_bigaarch64_vec bfd_elf32_littleaarch64_vec bfd_elf32_bigaarch64_vec bfd_elf32_littlearm_vec bfd_elf32_bigarm_vec"
diff --git bfd/configure bfd/configure
index bef7295..91156fd 100755
--- bfd/configure
+++ bfd/configure
@@ -12158,7 +12158,7 @@ fi
-GCC_WARN_CFLAGS="-W -Wall -Wstrict-prototypes -Wmissing-prototypes"
+GCC_WARN_CFLAGS="-W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wno-unused-function"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
__GNUC__
diff --git gas/config/tc-aarch64.c gas/config/tc-aarch64.c
index 4b243ce..83e4bb9 100644
--- gas/config/tc-aarch64.c
+++ gas/config/tc-aarch64.c
@@ -54,9 +54,6 @@ static const aarch64_feature_set *march_cpu_opt = NULL;
/* Constants for known architecture features. */
static const aarch64_feature_set cpu_default = CPU_DEFAULT;
-static const aarch64_feature_set aarch64_arch_any = AARCH64_ANY;
-static const aarch64_feature_set aarch64_arch_none = AARCH64_ARCH_NONE;
-
#ifdef OBJ_ELF
/* Pre-defined "_GLOBAL_OFFSET_TABLE_" */
static symbolS *GOT_symbol;
diff --git gas/configure gas/configure
index 8a89e4f..a83138e 100755
--- gas/configure
+++ gas/configure
@@ -11575,7 +11575,7 @@ fi
using_cgen=no
-GCC_WARN_CFLAGS="-W -Wall -Wstrict-prototypes -Wmissing-prototypes"
+GCC_WARN_CFLAGS="-W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wno-unused-function"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
__GNUC__
diff --git ld/Makefile.am ld/Makefile.am
index 5968668..5ffb2a4 100644
--- ld/Makefile.am
+++ ld/Makefile.am
@@ -415,6 +415,8 @@ ALL_64_EMULATION_SOURCES = \
eaarch64elf32.c \
eaarch64elfb.c \
eaarch64elf32b.c \
+ eaarch64fbsd.c \
+ eaarch64fbsdb.c \
eaarch64linux.c \
eaarch64linuxb.c \
eaarch64linux32.c \
@@ -1524,6 +1526,14 @@ eaarch64elf32b.c: $(srcdir)/emulparams/aarch64elf32b.sh $(srcdir)/emulparams/aar
$(ELF_DEPS) $(srcdir)/emultempl/aarch64elf.em \
$(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
${GENSCRIPTS} aarch64elf32b "$(tdir_aarch64elf32b)"
+eaarch64fbsd.c: $(srcdir)/emulparams/aarch64fbsd.sh \
+ $(ELF_DEPS) $(srcdir)/emultempl/aarch64elf.em \
+ $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
+ ${GENSCRIPTS} aarch64fbsd "$(tdir_aarch64fbsd)"
+eaarch64fbsdb.c: $(srcdir)/emulparams/aarch64fbsdb.sh $(srcdir)/emulparams/aarch64fbsd.sh \
+ $(ELF_DEPS) $(srcdir)/emultempl/aarch64elf.em \
+ $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
+ ${GENSCRIPTS} aarch64fbsdb "$(tdir_aarch64fbsdb)"
eaarch64linux.c: $(srcdir)/emulparams/aarch64linux.sh \
$(ELF_DEPS) $(srcdir)/emultempl/aarch64elf.em \
$(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
diff --git ld/Makefile.in ld/Makefile.in
index 59cba73..0ed674f 100644
--- ld/Makefile.in
+++ ld/Makefile.in
@@ -722,6 +722,8 @@ ALL_64_EMULATION_SOURCES = \
eaarch64elf32.c \
eaarch64elfb.c \
eaarch64elf32b.c \
+ eaarch64fbsd.c \
+ eaarch64fbsdb.c \
eaarch64linux.c \
eaarch64linuxb.c \
eaarch64linux32.c \
@@ -1034,6 +1036,8 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eaarch64elf32.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eaarch64elf32b.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eaarch64elfb.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eaarch64fbsd.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eaarch64fbsdb.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eaarch64linux.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eaarch64linux32.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eaarch64linux32b.Po@am__quote@
@@ -2956,6 +2960,14 @@ eaarch64elf32b.c: $(srcdir)/emulparams/aarch64elf32b.sh $(srcdir)/emulparams/aar
$(ELF_DEPS) $(srcdir)/emultempl/aarch64elf.em \
$(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
${GENSCRIPTS} aarch64elf32b "$(tdir_aarch64elf32b)"
+eaarch64fbsd.c: $(srcdir)/emulparams/aarch64fbsd.sh \
+ $(ELF_DEPS) $(srcdir)/emultempl/aarch64elf.em \
+ $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
+ ${GENSCRIPTS} aarch64fbsd "$(tdir_aarch64fbsd)"
+eaarch64fbsdb.c: $(srcdir)/emulparams/aarch64fbsdb.sh $(srcdir)/emulparams/aarch64fbsd.sh \
+ $(ELF_DEPS) $(srcdir)/emultempl/aarch64elf.em \
+ $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
+ ${GENSCRIPTS} aarch64fbsdb "$(tdir_aarch64fbsdb)"
eaarch64linux.c: $(srcdir)/emulparams/aarch64linux.sh \
$(ELF_DEPS) $(srcdir)/emultempl/aarch64elf.em \
$(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
diff --git ld/configure ld/configure
index 8452a13..9ef7a54 100755
--- ld/configure
+++ ld/configure
@@ -4642,7 +4642,7 @@ $as_echo "$ac_cv_path_EGREP" >&6; }
-GCC_WARN_CFLAGS="-W -Wall -Wstrict-prototypes -Wmissing-prototypes"
+GCC_WARN_CFLAGS="-W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wno-uninitialized"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
__GNUC__
diff --git ld/configure.tgt ld/configure.tgt
index c2c3eab..36416e3 100644
--- ld/configure.tgt
+++ ld/configure.tgt
@@ -49,6 +49,8 @@ aarch64_be-*-elf) targ_emul=aarch64elfb
targ_extra_emuls="aarch64elf aarch64elf32 aarch64elf32b armelfb armelf" ;;
aarch64-*-elf) targ_emul=aarch64elf
targ_extra_emuls="aarch64elf32 aarch64elf32b aarch64elfb armelf armelfb" ;;
+aarch64-*-freebsd*) targ_emul=aarch64fbsd
+ targ_extra_emuls="aarch64fbsdb aarch64elf" ;;
aarch64_be-*-linux*) targ_emul=aarch64linuxb
targ_extra_libpath="aarch64linux aarch64linux32 aarch64linux32b armelfb_linux_eabi armelf_linux_eabi"
targ_extra_emuls="aarch64elfb aarch64elf aarch64elf32 aarch64elf32b armelfb armelf $targ_extra_libpath" ;;
diff --git ld/emulparams/aarch64fbsd.sh ld/emulparams/aarch64fbsd.sh
new file mode 100644
index 0000000..b92bde9
--- /dev/null
+++ ld/emulparams/aarch64fbsd.sh
@@ -0,0 +1,37 @@
+ARCH=aarch64
+MACHINE=
+NOP=0
+
+SCRIPT_NAME=elf
+ELFSIZE=64
+OUTPUT_FORMAT="elf64-littleaarch64"
+BIG_OUTPUT_FORMAT="elf64-bigaarch64"
+LITTLE_OUTPUT_FORMAT="elf64-littleaarch64"
+NO_REL_RELOCS=yes
+
+TEMPLATE_NAME=elf32
+EXTRA_EM_FILE=aarch64elf
+
+GENERATE_SHLIB_SCRIPT=yes
+GENERATE_PIE_SCRIPT=yes
+
+MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
+COMMONPAGESIZE="CONSTANT (COMMONPAGESIZE)"
+SEPARATE_GOTPLT=24
+IREL_IN_PLT=
+
+TEXT_START_ADDR=0x400000
+
+DATA_START_SYMBOLS='PROVIDE (__data_start = .);';
+
+# AArch64 does not support .s* sections.
+NO_SMALL_DATA=yes
+
+OTHER_BSS_SYMBOLS='__bss_start__ = .;'
+OTHER_BSS_END_SYMBOLS='_bss_end__ = . ; __bss_end__ = . ;'
+OTHER_END_SYMBOLS='__end__ = . ;'
+
+OTHER_SECTIONS='.note.gnu.arm.ident 0 : { KEEP (*(.note.gnu.arm.ident)) }'
+ATTRS_SECTIONS='.ARM.attributes 0 : { KEEP (*(.ARM.attributes)) KEEP (*(.gnu.attributes)) }'
+# Ensure each PLT entry is aligned to a cache line.
+PLT=".plt ${RELOCATING-0} : ALIGN(16) { *(.plt)${IREL_IN_PLT+ *(.iplt)} }"
diff --git ld/emulparams/aarch64fbsdb.sh ld/emulparams/aarch64fbsdb.sh
new file mode 100644
index 0000000..2c55dde
--- /dev/null
+++ ld/emulparams/aarch64fbsdb.sh
@@ -0,0 +1,2 @@
+. ${srcdir}/emulparams/aarch64fbsd.sh
+OUTPUT_FORMAT="elf64-bigaarch64"
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment