Use 'gcc' instead of 'ld' to link test modules. (#9710)

This solves several problems in a more elegant way:

* No need to explicitly use `-lc` on x86_64 when building with `-m32`.
* Avoids issues with undefined floating point emulation funcs on ARM.
This commit is contained in:
Yossi Gottlieb 2021-10-31 16:25:57 +02:00 committed by GitHub
parent 033578839b
commit f26e90be0c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -10,11 +10,9 @@ else # Linux, others
SHOBJ_LDFLAGS ?= -shared
endif
# Needed to satisfy __stack_chk_fail_local on Linux with -m32, due to gcc
# -fstack-protector by default. Breaks on FreeBSD and macOS 11 so needs
# to be Linux specific.
ifeq ($(uname_S),Linux)
LIBS = -lc
LD = gcc
CC = gcc
endif
# OS X 11.x doesn't have /usr/lib/libSystem.dylib and needs an explicit setting.
@ -60,7 +58,7 @@ TEST_MODULES = \
all: $(TEST_MODULES)
32bit:
$(MAKE) CFLAGS="-m32" LDFLAGS="-melf_i386"
$(MAKE) CFLAGS="-m32" LDFLAGS="-m32"
%.xo: %.c ../../src/redismodule.h
$(CC) -I../../src $(CFLAGS) $(SHOBJ_CFLAGS) -fPIC -c $< -o $@