Skip to content

Commit

Permalink
Update qemu-cheri and llvm-cheri to recent snapshots.
Browse files Browse the repository at this point in the history
In qemu-cheri:
 * Fix build with llvm10 [0]
 * Remove the 256-bit capability version
 * Add CHERI RISC-V

PR:		244768 [0]
Submitted by:	dim [0]
Sponsored by:	DARPA
  • Loading branch information
brooksdavis committed Mar 27, 2020
1 parent ba8a881 commit ceba03b
Show file tree
Hide file tree
Showing 10 changed files with 135 additions and 22 deletions.
5 changes: 2 additions & 3 deletions devel/llvm-cheri/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

PORTNAME= llvm
PORTVERSION= ${LLVM_MAJOR}.0.d${SNAPDATE}
PORTREVISION= 1
PORTREVISION= 0
CATEGORIES= devel lang
PKGNAMESUFFIX= ${LLVM_SUFFIX}

Expand Down Expand Up @@ -117,6 +117,7 @@ COMMANDS= bugpoint \
llvm-exegesis \
llvm-extract \
llvm-ifs \
llvm-install-name-tool \
llvm-jitlink \
llvm-lib \
llvm-link \
Expand Down Expand Up @@ -264,8 +265,6 @@ post-patch:
-e 's|from lit|from lit${LLVM_SUFFIX}|' \
-e 's|lit\.|lit${LLVM_SUFFIX}.|' \
${WRKSRC}/llvm/utils/lit/lit.py ${WRKSRC}/llvm/utils/lit/lit/*.py
${REINPLACE_CMD} -e 's,/usr/local/,${LOCALBASE}/,' \
${WRKSRC}/llvm/CMakeLists.txt

post-install:
${MKDIR} ${STAGEDIR}${PREFIX}/share/toolchains/
Expand Down
6 changes: 3 additions & 3 deletions devel/llvm-cheri/Makefile.snapshot
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
#
# Generated by: files/gen-Makefile.snapshot.sh.
#
LLVM_MAJOR= 10
LLVM_MAJOR= 11
LLVM_RELEASE= ${LLVM_MAJOR}.0.0
SNAPDATE= 20191211
SNAPDATE= 20200309

LLVM_COMMIT= 8cad6d336ad9e91657db9999fcd25adceae3be83
LLVM_COMMIT= b507d88d2aa61cec27adab60324a04b17911f5e4
6 changes: 3 additions & 3 deletions devel/llvm-cheri/distinfo
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
TIMESTAMP = 1576101834
SHA256 (CTSRD-CHERI-llvm-project-10.0.d20191211-8cad6d336ad9e91657db9999fcd25adceae3be83_GH0.tar.gz) = 3401c91b43b768a380b9fc208aad223260541f1d8d1c317cff8de02adefd209a
SIZE (CTSRD-CHERI-llvm-project-10.0.d20191211-8cad6d336ad9e91657db9999fcd25adceae3be83_GH0.tar.gz) = 121667904
TIMESTAMP = 1585007852
SHA256 (CTSRD-CHERI-llvm-project-11.0.d20200309-b507d88d2aa61cec27adab60324a04b17911f5e4_GH0.tar.gz) = 5757ef569e4e3dde25e2a8ea41fd05235c9ed61be1662bab02a848cba09cb124
SIZE (CTSRD-CHERI-llvm-project-11.0.d20200309-b507d88d2aa61cec27adab60324a04b17911f5e4_GH0.tar.gz) = 126759614
2 changes: 1 addition & 1 deletion devel/llvm-cheri/files/gen-Makefile.snapshot.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ cat <<EOF > Makefile.snapshot
#
# Generated by: files/gen-Makefile.snapshot.sh.
#
LLVM_MAJOR= 10
LLVM_MAJOR= 11
LLVM_RELEASE= \${LLVM_MAJOR}.0.0
SNAPDATE= ${MAX_DATE}
Expand Down
60 changes: 57 additions & 3 deletions devel/llvm-cheri/pkg-plist

Large diffs are not rendered by default.

10 changes: 6 additions & 4 deletions emulators/qemu-cheri/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

PORTNAME= qemu
PORTVERSION= 0.d${SNAPDATE}
PORTREVISION= 1
PORTREVISION= 0
CATEGORIES= emulators devel
PKGNAMESUFFIX= -cheri

Expand All @@ -21,6 +21,7 @@ LICENSE= GPLv2

USE_GITHUB= yes
GH_TUPLE= CTSRD-CHERI:qemu:${QEMU_COMMIT} \
CTSRD-CHERI:dtc:${DTC_COMMIT}:dtc/dtc \
CTSRD-CHERI:libslirp:${LIBSLIRP_COMMIT}:libslirp/slirp \
qemu:keycodemapdb:6b3d716:qemu/ui/keycodemapdb \

Expand All @@ -37,13 +38,14 @@ OPTIONS_DEFINE= DOCS
.include "Makefile.snapshot"

CONFIGURE_ARGS+= \
--target-list=cheri128-softmmu,cheri128magic-softmmu,cheri256-softmmu \
--target-list=cheri128-softmmu,cheri128magic-softmmu,riscv64cheri-softmmu \
--disable-curl \
--disable-git-update \
--disable-gtk \
--disable-linux-user \
--disable-linux-aio \
--disable-kvm \
--disable-opengl \
--disable-vnc-png \
--disable-sdl \
--disable-vte \
Expand All @@ -57,12 +59,12 @@ QEMU_SYSTEM_CHERI?= qemu-system${PKGNAMESUFFIX}
PLIST= /dev/null
PLIST_FILES= bin/qemu-system-cheri128 \
bin/qemu-system-cheri128magic \
bin/qemu-system-cheri256
bin/qemu-system-riscv64cheri

do-install:
${INSTALL_PROGRAM} ${WRKSRC}/cheri128-softmmu/qemu-system-cheri128 \
${WRKSRC}/cheri128magic-softmmu/qemu-system-cheri128magic \
${WRKSRC}/cheri256-softmmu/qemu-system-cheri256 \
${WRKSRC}/riscv64cheri-softmmu/qemu-system-riscv64cheri \
${STAGEDIR}${PREFIX}/bin/

.include <bsd.port.mk>
5 changes: 3 additions & 2 deletions emulators/qemu-cheri/Makefile.snapshot
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
#
# Generated by: files/gen-Makefile.snapshot.sh.
#
SNAPDATE= 20191209
SNAPDATE= 20200327

QEMU_COMMIT= 74235a2879944724c88ad8b400170b8e2b0a6147
QEMU_COMMIT= 0a323821042c36e21ea80e58b9545dfc3b0cb8ef
LIBSLIRP_COMMIT= 6651ba26c4e94f64d6448a2db4991269ce553bd9
DTC_COMMIT= 87a656ae5ff96c4903e68eb2f999532a3b98e3a7
8 changes: 5 additions & 3 deletions emulators/qemu-cheri/distinfo
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
TIMESTAMP = 1576015343
SHA256 (CTSRD-CHERI-qemu-0.d20191209-74235a2879944724c88ad8b400170b8e2b0a6147_GH0.tar.gz) = facff8aca23b47d443dad98fa6ece3971636cf0a7d2fb79eaadbff5ddb4bf348
SIZE (CTSRD-CHERI-qemu-0.d20191209-74235a2879944724c88ad8b400170b8e2b0a6147_GH0.tar.gz) = 29444613
TIMESTAMP = 1585324588
SHA256 (CTSRD-CHERI-qemu-0.d20200327-0a323821042c36e21ea80e58b9545dfc3b0cb8ef_GH0.tar.gz) = ba74e4192d02ec6a5c6f72a3ee42ea4113d4719692d98a590ef9968759492fbf
SIZE (CTSRD-CHERI-qemu-0.d20200327-0a323821042c36e21ea80e58b9545dfc3b0cb8ef_GH0.tar.gz) = 29937048
SHA256 (CTSRD-CHERI-dtc-87a656ae5ff96c4903e68eb2f999532a3b98e3a7_GH0.tar.gz) = 9dd7b32701106948f380acdd5d91391031b3d56e9fa84e8a49d469f50bdb2ddf
SIZE (CTSRD-CHERI-dtc-87a656ae5ff96c4903e68eb2f999532a3b98e3a7_GH0.tar.gz) = 200509
SHA256 (CTSRD-CHERI-libslirp-6651ba26c4e94f64d6448a2db4991269ce553bd9_GH0.tar.gz) = aaffa33addd3aec53b5def83c4735275c9f501425bb0d8706494a7724875d8a6
SIZE (CTSRD-CHERI-libslirp-6651ba26c4e94f64d6448a2db4991269ce553bd9_GH0.tar.gz) = 121465
SHA256 (qemu-keycodemapdb-6b3d716_GH0.tar.gz) = c9d3412510aac999865d01aaa14b1fa8dc0385db55c5cf6c4d95d160bd0eaee9
Expand Down
3 changes: 3 additions & 0 deletions emulators/qemu-cheri/files/gen-Makefile.snapshot.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ query_repo qemu qemu-cheri
QEMU_COMMIT=$SHA
query_repo libslirp
LIBSLIRP_COMMIT=$SHA
query_repo dtc
DTC_COMMIT=$SHA

cat <<EOF > Makefile.snapshot
# \$FreeBSD\$
Expand All @@ -45,6 +47,7 @@ SNAPDATE= ${MAX_DATE}
QEMU_COMMIT= ${QEMU_COMMIT}
LIBSLIRP_COMMIT= ${LIBSLIRP_COMMIT}
DTC_COMMIT= ${DTC_COMMIT}
EOF

rm -f $tmpfile
52 changes: 52 additions & 0 deletions emulators/qemu-cheri/files/patch-configure
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
--- configure.orig 2019-12-09 17:14:11 UTC
+++ configure
@@ -6358,27 +6358,30 @@ if ( [ "$linux_user" = yes ] || [ "$bsd_user" = yes ]
cat > $TMPC <<EOF
int main(void) { return 0; }
EOF
- textseg_ldflags="-Wl,-Ttext-segment=$textseg_addr"
+ textseg_ldflags="-Wl,--image-base=$textseg_addr"
if ! compile_prog "" "$textseg_ldflags"; then
- # In case ld does not support -Ttext-segment, edit the default linker
- # script via sed to set the .text start addr. This is needed on FreeBSD
- # at least.
- if ! $ld --verbose >/dev/null 2>&1; then
- error_exit \
- "We need to link the QEMU user mode binaries at a" \
- "specific text address. Unfortunately your linker" \
- "doesn't support either the -Ttext-segment option or" \
- "printing the default linker script with --verbose." \
- "If you don't want the user mode binaries, pass the" \
- "--disable-user option to configure."
- fi
+ textseg_ldflags="-Wl,-Ttext-segment=$textseg_addr"
+ if ! compile_prog "" "$textseg_ldflags"; then
+ # In case ld does not support -Ttext-segment, edit the default linker
+ # script via sed to set the .text start addr. This is needed on FreeBSD
+ # at least.
+ if ! $ld --verbose >/dev/null 2>&1; then
+ error_exit \
+ "We need to link the QEMU user mode binaries at a" \
+ "specific text address. Unfortunately your linker" \
+ "doesn't support either the -Ttext-segment option or" \
+ "printing the default linker script with --verbose." \
+ "If you don't want the user mode binaries, pass the" \
+ "--disable-user option to configure."
+ fi

- $ld --verbose | sed \
- -e '1,/==================================================/d' \
- -e '/==================================================/,$d' \
- -e "s/[.] = [0-9a-fx]* [+] SIZEOF_HEADERS/. = $textseg_addr + SIZEOF_HEADERS/" \
- -e "s/__executable_start = [0-9a-fx]*/__executable_start = $textseg_addr/" > config-host.ld
- textseg_ldflags="-Wl,-T../config-host.ld"
+ $ld --verbose | sed \
+ -e '1,/==================================================/d' \
+ -e '/==================================================/,$d' \
+ -e "s/[.] = [0-9a-fx]* [+] SIZEOF_HEADERS/. = $textseg_addr + SIZEOF_HEADERS/" \
+ -e "s/__executable_start = [0-9a-fx]*/__executable_start = $textseg_addr/" > config-host.ld
+ textseg_ldflags="-Wl,-T../config-host.ld"
+ fi
fi
fi
fi

0 comments on commit ceba03b

Please sign in to comment.