Update zig 0.10.1->0.13.0 (#2914)

* Update zig to 0.14.0

* Need to remove previous installation first

* remove echo

* i386 -> x86

* Downgrade to 0.13.0
pull/2920/head
OBarronCS 8 months ago committed by GitHub
parent 34ca4421ce
commit 8ec3de322f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -92,26 +92,38 @@ download_zig_binary() {
# Install zig to current directory # Install zig to current directory
# We use zig to compile some test binaries as it is much easier than with gcc # We use zig to compile some test binaries as it is much easier than with gcc
TARGET_ZIG_VERSION="0.13.0"
ZIG_TAR_URL="https://ziglang.org/download/0.13.0/zig-linux-x86_64-0.13.0.tar.xz"
ZIG_TAR_SHA256="d45312e61ebcc48032b77bc4cf7fd6915c11fa16e4aad116b66c9468211230ea"
if command -v "${ZIGPATH}"/zig &> /dev/null; then if command -v "${ZIGPATH}"/zig &> /dev/null; then
echo "Zig is already installed. Skipping build and install." ZIG_VERSION=$("$ZIGPATH/zig" version)
else
echo "Downloading and installing Zig..."
ZIG_TAR_URL="https://ziglang.org/download/0.10.1/zig-linux-x86_64-0.10.1.tar.xz"
ZIG_TAR_SHA256="6699f0e7293081b42428f32c9d9c983854094bd15fee5489f12c4cf4518cc380"
curl --output /tmp/zig.tar.xz "${ZIG_TAR_URL}"
ACTUAL_SHA256=$(sha256sum /tmp/zig.tar.xz | cut -d' ' -f1)
if [ "${ACTUAL_SHA256}" != "${ZIG_TAR_SHA256}" ]; then
echo "Zig binary checksum mismatch"
echo "Expected: ${ZIG_TAR_SHA256}"
echo "Actual: ${ACTUAL_SHA256}"
exit 1
fi
tar -C /tmp -xJf /tmp/zig.tar.xz if [ "${ZIG_VERSION}" = "${TARGET_ZIG_VERSION}" ]; then
echo "Zig is already installed. Skipping build and install."
return
else
echo "Old version of Zig installed (${ZIG_VERSION}). Installing version ${TARGET_ZIG_VERSION}."
fi
fi
mv /tmp/zig-linux-x86_64-* ${ZIGPATH} &> /dev/null || true echo "Downloading and installing Zig..."
echo "Zig installed to ${ZIGPATH}" curl --output /tmp/zig.tar.xz "${ZIG_TAR_URL}"
ACTUAL_SHA256=$(sha256sum /tmp/zig.tar.xz | cut -d' ' -f1)
if [ "${ACTUAL_SHA256}" != "${ZIG_TAR_SHA256}" ]; then
echo "Zig binary checksum mismatch"
echo "Expected: ${ZIG_TAR_SHA256}"
echo "Actual: ${ACTUAL_SHA256}"
exit 1
fi fi
tar -C /tmp -xJf /tmp/zig.tar.xz
# Delete previous installation
rm -rf "${ZIGPATH}"
mv /tmp/zig-linux-x86_64-* ${ZIGPATH} &> /dev/null || true
echo "Zig installed to ${ZIGPATH}"
} }
install_apt() { install_apt() {

@ -120,7 +120,7 @@ tls.i386.out: tls.i386.c
@echo "[+] Building tls.i386.c" @echo "[+] Building tls.i386.c"
${ZIGCC} \ ${ZIGCC} \
${CFLAGS} \ ${CFLAGS} \
-target i386-linux-gnu \ -target x86-linux-gnu \
-o tls.i386.out tls.i386.c -o tls.i386.out tls.i386.c
issue_1565.out: issue_1565.c issue_1565.out: issue_1565.c
@ -132,7 +132,7 @@ initialized_heap_i386_big.out: initialized_heap.c
@echo "[+] Building initialized_heap_i386_big.out" @echo "[+] Building initialized_heap_i386_big.out"
${ZIGCC} \ ${ZIGCC} \
${CFLAGS} \ ${CFLAGS} \
-target i386-linux-gnu \ -target x86-linux-gnu \
-o initialized_heap_i386_big.out initialized_heap.c -o initialized_heap_i386_big.out initialized_heap.c
# TODO: Link against a specific GLIBC version. # TODO: Link against a specific GLIBC version.
@ -154,7 +154,7 @@ onegadget.i386.out: onegadget.c
@echo "[+] Building onegadget.i386.out" @echo "[+] Building onegadget.i386.out"
${ZIGCC} \ ${ZIGCC} \
${CFLAGS} \ ${CFLAGS} \
-target i386-linux-gnu \ -target x86-linux-gnu \
-o onegadget.i386.out onegadget.c -o onegadget.i386.out onegadget.c
clean : clean :
@ -175,7 +175,7 @@ reference_bin_nopie.out: reference-binary.c
reference_bin_nopie.i386.out: reference-binary.c reference_bin_nopie.i386.out: reference-binary.c
@echo "[+] Building reference_bin_nopie.i386.out" @echo "[+] Building reference_bin_nopie.i386.out"
${ZIGCC} -fpie -target i386-linux-gnu -o reference_bin_nopie.i386.out reference-binary.c ${ZIGCC} -fpie -target x86-linux-gnu -o reference_bin_nopie.i386.out reference-binary.c
symbol_1600_and_752.out: symbol_1600_and_752.cpp symbol_1600_and_752.out: symbol_1600_and_752.cpp
${CXX} -O0 -ggdb -Wno-pmf-conversions symbol_1600_and_752.cpp -o symbol_1600_and_752.out ${CXX} -O0 -ggdb -Wno-pmf-conversions symbol_1600_and_752.cpp -o symbol_1600_and_752.out

Loading…
Cancel
Save