Fix heap test binaries build (#1087)

* Fix heap test binaries build

* Compile some heap test binaries with zig cc
pull/1091/head
Disconnect3d 3 years ago committed by GitHub
parent 546d6ffa19
commit d111c8ddcf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -25,6 +25,8 @@ install_apt() {
gcc \ gcc \
libc6-dev libc6-dev
test -f /usr/bin/go || sudo apt-get install -y golang test -f /usr/bin/go || sudo apt-get install -y golang
# We use zig to compile some test binaries as it is much easier than with gcc
sudo snap install zig --classic --edge
} }
if linux; then if linux; then

@ -1,3 +1,5 @@
ZIGCC = zig cc
CC = gcc CC = gcc
DEBUG = 1 DEBUG = 1
CFLAGS += -Wall CFLAGS += -Wall
@ -29,7 +31,8 @@ CFLAGS += -O1
endif endif
PWD=$(shell pwd) PWD=$(shell pwd)
GLIBC=/glibc_versions/2.29/tcache_x64 # Apparently we don't have this version? :(
#GLIBC=/glibc_versions/2.29/tcache_x64
GLIBC_2_33=$(PWD)/glibcs/2.33 GLIBC_2_33=$(PWD)/glibcs/2.33
.PHONY : all clean .PHONY : all clean
@ -59,27 +62,32 @@ all: $(LINKED) $(LINKED_ASM) $(COMPILED_GO)
@GOARCH=amd64 $(GO) build $? @GOARCH=amd64 $(GO) build $?
@# Not stripped on purpose @# Not stripped on purpose
heap_bugs: heap_bugs.c heap_bugs.out: heap_bugs.c
${CC} \ @echo "[+] Building heap_bugs.out"
-Wl,-rpath=${GLIBC}:\ ${ZIGCC} \
${GLIBC}/math:\ -target native-native-gnu.2.33 \
${GLIBC}/elf:\ -Wl,-rpath=${GLIBC_2_33}:\
${GLIBC}/dlfcn:\ ${GLIBC_2_33}/math:\
${GLIBC}/nss:\ ${GLIBC_2_33}/elf:\
${GLIBC}/nis:\ ${GLIBC_2_33}/dlfcn:\
${GLIBC}/rt:\ ${GLIBC_2_33}/nss:\
${GLIBC}/resolv:\ ${GLIBC_2_33}/nis:\
${GLIBC}/crypt:\ ${GLIBC_2_33}/rt:\
${GLIBC}/nptl_db:\ ${GLIBC_2_33}/resolv:\
${GLIBC}/nptl:\ ${GLIBC_2_33}/crypt:\
-Wl,--dynamic-linker=${GLIBC}/elf/ld.so \ ${GLIBC_2_33}/nptl_db:\
${GLIBC_2_33}/nptl:\
-Wl,--dynamic-linker=${GLIBC_2_33}/ld-linux-x86-64.so.2 \
-g -o heap_bugs.out heap_bugs.c -g -o heap_bugs.out heap_bugs.c
heap_bins: heap_bins.c # TODO/FIXME: We should probably force this to 2.29? a version with tcache?
${CC} \ #heap_bins.out: heap_bins.c
-Wl,-rpath=${GLIBC_2_33} \ # @echo "[+] Building heap_bins.out"
-Wl,--dynamic-linker=${GLIBC_2_33}/ld-linux-x86-64.so.2 \ # ${ZIGCC} \
-g -O0 -o heap_bins.out heap_bins.c # -target native-native-gnu.2.33 \
# -Wl,-rpath=${GLIBC_2_33} \
# -Wl,--dynamic-linker=${GLIBC_2_33}/ld-linux-x86-64.so.2 \
# -g -O0 -o heap_bins.out heap_bins.c
# Note: we use -pthread -lpthread because we hit this bug on CI builds: # Note: we use -pthread -lpthread because we hit this bug on CI builds:
# https://sourceware.org/bugzilla/show_bug.cgi?id=24548 # https://sourceware.org/bugzilla/show_bug.cgi?id=24548

Loading…
Cancel
Save