Commit 282325bc authored by ed's avatar ed
Browse files

New port: devel/cloudabi-binutils.

This port installs a copy of GNU Binutils that targets CloudABI.
CloudABI is a compact UNIX-like runtime environment built on
capability-based security. More details:

	https://github.com/NuxiNL/cloudlibc

Support for CloudABI has been upstreamed, but will only be part of
the upcoming version of Binutils. This port includes a backported copy
of the patchset. It can safely be removed if devel/binutils is bumped to
a newer version.

PR:		200968
Reviewed by:	bapt
parent f06ee1c0
......@@ -248,6 +248,7 @@
SUBDIR += clig
SUBDIR += clisp-hyperspec
SUBDIR += clojure-cider
SUBDIR += cloudabi-binutils
SUBDIR += cmake
SUBDIR += cmake-fedora
SUBDIR += cmake-gui
......
# Created by: Ed Schouten <ed@FreeBSD.org>
# $FreeBSD$
PKGNAMEPREFIX= cloudabi-
MAINTAINER= ed@FreeBSD.org
COMMENT= GNU Binutils for CloudABI cross-development
MASTERDIR= ${.CURDIR}/../binutils
PATCHDIR= ${.CURDIR}/files
PLIST= ${.CURDIR}/pkg-plist
BUTARGET= x86_64-unknown-cloudabi
.include "${MASTERDIR}/Makefile"
--- bfd/config.bfd
+++ bfd/config.bfd
@@ -645,6 +645,10 @@ case "${targ}" in
targ_archs="$targ_archs bfd_arm_arch"
;;
#ifdef BFD64
+ x86_64-*-cloudabi*)
+ targ_defvec=x86_64_elf64_cloudabi_vec
+ want64=true
+ ;;
x86_64-*-darwin*)
targ_defvec=x86_64_mach_o_vec
targ_selvecs="i386_mach_o_vec mach_o_le_vec mach_o_be_vec mach_o_fat_vec pef_vec pef_xlib_vec sym_vec"
--- bfd/configure
+++ bfd/configure
@@ -15540,6 +15540,7 @@ do
x86_64_elf32_vec) tb="$tb elf64-x86-64.lo elf-ifunc.lo elf-nacl.lo elf64.lo elf32.lo $elf"; target_size=64 ;;
x86_64_elf32_nacl_vec) tb="$tb elf64-x86-64.lo elf-ifunc.lo elf-nacl.lo elf64.lo elf32.lo $elf"; target_size=64 ;;
x86_64_elf64_vec) tb="$tb elf64-x86-64.lo elf-ifunc.lo elf-nacl.lo elf64.lo $elf"; target_size=64 ;;
+ x86_64_elf64_cloudabi_vec) tb="$tb elf64-x86-64.lo elf-ifunc.lo elf-nacl.lo elf64.lo $elf"; target_size=64 ;;
x86_64_elf64_fbsd_vec) tb="$tb elf64-x86-64.lo elf-ifunc.lo elf-nacl.lo elf64.lo $elf"; target_size=64 ;;
x86_64_elf64_nacl_vec) tb="$tb elf64-x86-64.lo elf-ifunc.lo elf-nacl.lo elf64.lo $elf"; target_size=64 ;;
x86_64_elf64_sol2_vec) tb="$tb elf64-x86-64.lo elf-ifunc.lo elf-nacl.lo elf64.lo $elf"; target_size=64 ;;
--- bfd/configure.ac
+++ bfd/configure.ac
@@ -1008,6 +1008,7 @@ do
x86_64_elf32_vec) tb="$tb elf64-x86-64.lo elf-ifunc.lo elf-nacl.lo elf64.lo elf32.lo $elf"; target_size=64 ;;
x86_64_elf32_nacl_vec) tb="$tb elf64-x86-64.lo elf-ifunc.lo elf-nacl.lo elf64.lo elf32.lo $elf"; target_size=64 ;;
x86_64_elf64_vec) tb="$tb elf64-x86-64.lo elf-ifunc.lo elf-nacl.lo elf64.lo $elf"; target_size=64 ;;
+ x86_64_elf64_cloudabi_vec) tb="$tb elf64-x86-64.lo elf-ifunc.lo elf-nacl.lo elf64.lo $elf"; target_size=64 ;;
x86_64_elf64_fbsd_vec) tb="$tb elf64-x86-64.lo elf-ifunc.lo elf-nacl.lo elf64.lo $elf"; target_size=64 ;;
x86_64_elf64_nacl_vec) tb="$tb elf64-x86-64.lo elf-ifunc.lo elf-nacl.lo elf64.lo $elf"; target_size=64 ;;
x86_64_elf64_sol2_vec) tb="$tb elf64-x86-64.lo elf-ifunc.lo elf-nacl.lo elf64.lo $elf"; target_size=64 ;;
--- bfd/elf64-x86-64.c
+++ bfd/elf64-x86-64.c
@@ -5927,6 +5927,21 @@ static const struct bfd_elf_special_section
#include "elf64-target.h"
+/* CloudABI support. */
+
+#undef TARGET_LITTLE_SYM
+#define TARGET_LITTLE_SYM x86_64_elf64_cloudabi_vec
+#undef TARGET_LITTLE_NAME
+#define TARGET_LITTLE_NAME "elf64-x86-64-cloudabi"
+
+#undef ELF_OSABI
+#define ELF_OSABI ELFOSABI_CLOUDABI
+
+#undef elf64_bed
+#define elf64_bed elf64_x86_64_cloudabi_bed
+
+#include "elf64-target.h"
+
/* FreeBSD support. */
#undef TARGET_LITTLE_SYM
--- bfd/targets.c
+++ bfd/targets.c
@@ -885,6 +885,7 @@ extern const bfd_target x86_64_coff_vec;
extern const bfd_target x86_64_elf32_vec;
extern const bfd_target x86_64_elf32_nacl_vec;
extern const bfd_target x86_64_elf64_vec;
+extern const bfd_target x86_64_elf64_cloudabi_vec;
extern const bfd_target x86_64_elf64_fbsd_vec;
extern const bfd_target x86_64_elf64_nacl_vec;
extern const bfd_target x86_64_elf64_sol2_vec;
@@ -1402,6 +1403,7 @@ static const bfd_target * const _bfd_target_vector[] =
&x86_64_elf32_vec,
&x86_64_elf32_nacl_vec,
&x86_64_elf64_vec,
+ &x86_64_elf64_cloudabi_vec,
&x86_64_elf64_fbsd_vec,
&x86_64_elf64_nacl_vec,
&x86_64_elf64_sol2_vec,
--- gas/configure.tgt
+++ gas/configure.tgt
@@ -470,6 +470,7 @@ case ${generic_target} in
z8k-*-coff | z8k-*-sim) fmt=coff ;;
*-*-aout | *-*-scout) fmt=aout ;;
+ *-*-cloudabi*) fmt=elf ;;
*-*-dragonfly*) fmt=elf em=dragonfly ;;
*-*-freebsd* | *-*-kfreebsd*-gnu) fmt=elf em=freebsd ;;
*-*-bsd*) fmt=aout em=sun3 ;;
--- include/elf/common.h
+++ include/elf/common.h
@@ -73,6 +73,7 @@
#define ELFOSABI_NSK 14 /* Hewlett-Packard Non-Stop Kernel */
#define ELFOSABI_AROS 15 /* AROS */
#define ELFOSABI_FENIXOS 16 /* FenixOS */
+#define ELFOSABI_CLOUDABI 17 /* Nuxi CloudABI */
#define ELFOSABI_C6000_ELFABI 64 /* Bare-metal TMS320C6000 */
#define ELFOSABI_C6000_LINUX 65 /* Linux TMS320C6000 */
#define ELFOSABI_ARM 97 /* ARM */
--- ld/Makefile.am
+++ ld/Makefile.am
@@ -483,6 +483,7 @@ ALL_64_EMULATION_SOURCES = \
eelf_k1om.c \
eelf_k1om_fbsd.c \
eelf_x86_64.c \
+ eelf_x86_64_cloudabi.c \
eelf_x86_64_fbsd.c \
eelf_x86_64_nacl.c \
eelf_x86_64_sol2.c \
@@ -1938,6 +1939,10 @@ eelf_k1om_fbsd.c: $(srcdir)/emulparams/elf_k1om_fbsd.sh \
eelf_x86_64.c: $(srcdir)/emulparams/elf_x86_64.sh \
$(ELF_DEPS) $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
+eelf_x86_64_cloudabi.c: $(srcdir)/emulparams/elf_x86_64_cloudabi.sh \
+ $(srcdir)/emulparams/elf_x86_64.sh \
+ $(ELF_DEPS) $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
+
eelf_x86_64_fbsd.c: $(srcdir)/emulparams/elf_x86_64_fbsd.sh \
$(srcdir)/emulparams/elf_x86_64.sh \
$(ELF_DEPS) $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
--- ld/Makefile.in
+++ ld/Makefile.in
@@ -808,6 +808,7 @@ ALL_64_EMULATION_SOURCES = \
eelf_k1om.c \
eelf_k1om_fbsd.c \
eelf_x86_64.c \
+ eelf_x86_64_cloudabi.c \
eelf_x86_64_fbsd.c \
eelf_x86_64_nacl.c \
eelf_x86_64_sol2.c \
@@ -1269,6 +1270,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_l1om_fbsd.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_s390.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_x86_64.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_x86_64_cloudabi.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_x86_64_fbsd.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_x86_64_nacl.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_x86_64_sol2.Po@am__quote@
@@ -3429,6 +3431,10 @@ eelf_k1om_fbsd.c: $(srcdir)/emulparams/elf_k1om_fbsd.sh \
eelf_x86_64.c: $(srcdir)/emulparams/elf_x86_64.sh \
$(ELF_DEPS) $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
+eelf_x86_64_cloudabi.c: $(srcdir)/emulparams/elf_x86_64_cloudabi.sh \
+ $(srcdir)/emulparams/elf_x86_64.sh \
+ $(ELF_DEPS) $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
+
eelf_x86_64_fbsd.c: $(srcdir)/emulparams/elf_x86_64_fbsd.sh \
$(srcdir)/emulparams/elf_x86_64.sh \
$(ELF_DEPS) $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
--- ld/configure.tgt
+++ ld/configure.tgt
@@ -228,6 +228,7 @@ i[3-7]86-*-rtems*) targ_emul=elf_i386 ;;
i[3-7]86-*-aros*) targ_emul=elf_i386 ;;
i[3-7]86-*-rdos*) targ_emul=elf_i386 ;;
x86_64-*-rdos*) targ_emul=elf64rdos ;;
+x86_64-*-cloudabi*) targ_emul=elf_x86_64_cloudabi ;;
i[3-7]86-*-bsd) targ_emul=i386bsd ;;
i[3-7]86-*-bsd386) targ_emul=i386bsd ;;
i[3-7]86-*-bsdi*) targ_emul=i386bsd ;;
--- /dev/null
+++ ld/emulparams/elf_x86_64_cloudabi.sh
@@ -0,0 +1,2 @@
+. ${srcdir}/emulparams/elf_x86_64.sh
+OUTPUT_FORMAT="elf64-x86-64-cloudabi"
bin/x86_64-unknown-cloudabi-addr2line
bin/x86_64-unknown-cloudabi-ar
bin/x86_64-unknown-cloudabi-as
bin/x86_64-unknown-cloudabi-c++filt
bin/x86_64-unknown-cloudabi-elfedit
bin/x86_64-unknown-cloudabi-gprof
bin/x86_64-unknown-cloudabi-ld
bin/x86_64-unknown-cloudabi-ld.bfd
bin/x86_64-unknown-cloudabi-nm
bin/x86_64-unknown-cloudabi-objcopy
bin/x86_64-unknown-cloudabi-objdump
bin/x86_64-unknown-cloudabi-ranlib
bin/x86_64-unknown-cloudabi-readelf
bin/x86_64-unknown-cloudabi-size
bin/x86_64-unknown-cloudabi-strings
bin/x86_64-unknown-cloudabi-strip
man/man1/x86_64-unknown-cloudabi-addr2line.1.gz
man/man1/x86_64-unknown-cloudabi-ar.1.gz
man/man1/x86_64-unknown-cloudabi-as.1.gz
man/man1/x86_64-unknown-cloudabi-c++filt.1.gz
man/man1/x86_64-unknown-cloudabi-dlltool.1.gz
man/man1/x86_64-unknown-cloudabi-elfedit.1.gz
man/man1/x86_64-unknown-cloudabi-gprof.1.gz
man/man1/x86_64-unknown-cloudabi-ld.1.gz
man/man1/x86_64-unknown-cloudabi-nlmconv.1.gz
man/man1/x86_64-unknown-cloudabi-nm.1.gz
man/man1/x86_64-unknown-cloudabi-objcopy.1.gz
man/man1/x86_64-unknown-cloudabi-objdump.1.gz
man/man1/x86_64-unknown-cloudabi-ranlib.1.gz
man/man1/x86_64-unknown-cloudabi-readelf.1.gz
man/man1/x86_64-unknown-cloudabi-size.1.gz
man/man1/x86_64-unknown-cloudabi-strings.1.gz
man/man1/x86_64-unknown-cloudabi-strip.1.gz
man/man1/x86_64-unknown-cloudabi-windmc.1.gz
man/man1/x86_64-unknown-cloudabi-windres.1.gz
x86_64-unknown-cloudabi/lib/ldscripts/elf_x86_64_cloudabi.x
x86_64-unknown-cloudabi/lib/ldscripts/elf_x86_64_cloudabi.xbn
x86_64-unknown-cloudabi/lib/ldscripts/elf_x86_64_cloudabi.xc
x86_64-unknown-cloudabi/lib/ldscripts/elf_x86_64_cloudabi.xd
x86_64-unknown-cloudabi/lib/ldscripts/elf_x86_64_cloudabi.xdc
x86_64-unknown-cloudabi/lib/ldscripts/elf_x86_64_cloudabi.xdw
x86_64-unknown-cloudabi/lib/ldscripts/elf_x86_64_cloudabi.xn
x86_64-unknown-cloudabi/lib/ldscripts/elf_x86_64_cloudabi.xr
x86_64-unknown-cloudabi/lib/ldscripts/elf_x86_64_cloudabi.xs
x86_64-unknown-cloudabi/lib/ldscripts/elf_x86_64_cloudabi.xsc
x86_64-unknown-cloudabi/lib/ldscripts/elf_x86_64_cloudabi.xsw
x86_64-unknown-cloudabi/lib/ldscripts/elf_x86_64_cloudabi.xu
x86_64-unknown-cloudabi/lib/ldscripts/elf_x86_64_cloudabi.xw
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