dragonfly/patches/lua-v5.4.4.patch
iko1 19d7622280
feat: add s390x architecture support (#1214)
* fix(lua): use native architecture when compiling lua for s390x.

Signed-off-by: iko1 <me@remotecpp.dev>

* feat(server): implement CompareFP for s390x architecture.

Signed-off-by: iko1 <me@remotecpp.dev>

* feat: implement validate_ascii_fast function variant for s390x arch.

Signed-off-by: iko1 <me@remotecpp.dev>

* fix: add comments before s390x vector operations

Signed-off-by: iko1 <me@remotecpp.dev>

* fix validate_ascii_fast function logic after CR comment

Signed-off-by: iko1 <me@remotecpp.dev>

* Revert "fix(lua): use native architecture when compiling lua for s390x."

This reverts commit 6cc5d8a8ed.

* fix(lua): use native architecture when compiling lua for s390x.

Signed-off-by: iko1 <me@remotecpp.dev>

* refactor validate_ascii_fast function after CR comment

Signed-off-by: iko1 <me@remotecpp.dev>

* include vecintrin.h from sse_port.h rather the misleading filename

Signed-off-by: iko1 <me@remotecpp.dev>

---------

Signed-off-by: iko1 <me@remotecpp.dev>
2023-06-18 21:33:22 +03:00

46 lines
1.2 KiB
Diff

diff --git a/luaconf.h b/luaconf.h
index d42d14b7..75647e72 100644
--- a/luaconf.h
+++ b/luaconf.h
@@ -731,7 +731,7 @@
** (It must fit into max(size_t)/32.)
*/
#if LUAI_IS32INT
-#define LUAI_MAXSTACK 1000000
+#define LUAI_MAXSTACK 4096
#else
#define LUAI_MAXSTACK 15000
#endif
diff --git a/makefile b/makefile
index d46e650c..c27e5677 100644
--- a/makefile
+++ b/makefile
@@ -66,13 +66,25 @@ LOCAL = $(TESTS) $(CWARNS)
# enable Linux goodies
-MYCFLAGS= $(LOCAL) -std=c99 -DLUA_USE_LINUX -DLUA_USE_READLINE
+MYCFLAGS= $(LOCAL) -std=c99 -g -O2 -DLUA_USE_LINUX
MYLDFLAGS= $(LOCAL) -Wl,-E
-MYLIBS= -ldl -lreadline
+MYLIBS= -ldl
+uname_m := $(shell uname -m)
+
+# equivalent to: if $(uname_m) == x86_64 || $(uname_m) == amd64
+ifneq (, $(filter $(uname_m),x86_64 amd64))
+OPTFLAGS= -march=sandybridge
+else ifeq ($(uname_m), aarch64)
+OPTFLAGS= -march=armv8.2-a+fp16+rcpc+dotprod+crypto
+else ifeq ($(uname_m), s390x)
+OPTFLAGS= -march=native
+else
+ $(error ERROR: unknown architecture $(uname_m))
+endif
CC= gcc
-CFLAGS= -Wall -O2 $(MYCFLAGS) -fno-stack-protector -fno-common -march=native
+CFLAGS= -Wall -O2 $(MYCFLAGS) -fno-stack-protector -fno-common $(OPTFLAGS)
AR= ar rc
RANLIB= ranlib
RM= rm -f