From 5aee2393c1ffe7a67d2e194ee8b733951e1a9573 Mon Sep 17 00:00:00 2001 From: Lukas Larsson Date: Tue, 18 Jun 2024 16:01:12 +0200 Subject: [PATCH 1/2] erts: Only use THP options for beam executable The erlc, dialyzer and other executables should not have the common/max page size options as it makes their executables grow to around 4MB each from just a couple of kbs. closes #8574 --- erts/configure.ac | 6 +++++- erts/emulator/Makefile.in | 3 ++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/erts/configure.ac b/erts/configure.ac index 61f9fe48a5f7..9185e62a1796 100644 --- a/erts/configure.ac +++ b/erts/configure.ac @@ -3071,6 +3071,7 @@ AS_IF([test "x$erts_cv_linux_thp" = "xyes"], ] ) LDFLAGS="$saved_LDFLAGS" + EMU_LDFLAGS="" for flag in "-Wl,-z,common-page-size=2097152" "-Wl,-z,max-page-size=2097152" do AC_MSG_CHECKING([if we can add $flag to LDFLAGS]) @@ -3079,7 +3080,8 @@ AS_IF([test "x$erts_cv_linux_thp" = "xyes"], AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],[[return 0;]])], [ AC_MSG_RESULT([yes]) - LDFLAGS="$saved_LDFLAGS $flag" + EMU_LDFLAGS="$flag" + LDFLAGS="$saved_LDFLAGS" ], [ AC_MSG_RESULT([no]) @@ -3088,6 +3090,8 @@ AS_IF([test "x$erts_cv_linux_thp" = "xyes"], done ]) +AC_SUBST(EMU_LDFLAGS) + dnl ---------------------------------------------------------------------- dnl Tests related to configurable options given on command line dnl (using the --disable, --enable and --with switches). diff --git a/erts/emulator/Makefile.in b/erts/emulator/Makefile.in index e93f052d7520..788784d04b93 100644 --- a/erts/emulator/Makefile.in +++ b/erts/emulator/Makefile.in @@ -95,6 +95,7 @@ M4FLAGS= CREATE_DIRS= LDFLAGS=@LDFLAGS@ +EMU_LDFLAGS=@EMU_LDFLAGS@ ARFLAGS=rc TYPE_LIBS= @@ -1261,7 +1262,7 @@ EMU_LD=$(CC) endif $(BINDIR)/$(FLAVOR_EXECUTABLE): $(INIT_OBJS) $(OBJS) $(DEPLIBS) $(ld_verbose) $(EMU_LD) -o $@ \ - $(PROFILE_LDFLAGS) $(LDFLAGS) $(DEXPORT) $(INIT_OBJS) $(OBJS) \ + $(PROFILE_LDFLAGS) $(LDFLAGS) $(EMU_LDFLAGS) $(DEXPORT) $(INIT_OBJS) $(OBJS) \ $(STATIC_NIF_LIBS) $(STATIC_DRIVER_LIBS) $(LIBS) endif From 7119b244bd4d00385390ee7ea5f31d266d3da2b0 Mon Sep 17 00:00:00 2001 From: Lukas Larsson Date: Tue, 18 Jun 2024 16:06:52 +0200 Subject: [PATCH 2/2] Update configure scripts --- erts/configure | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/erts/configure b/erts/configure index 798868db8631..4a89d597e7d0 100755 --- a/erts/configure +++ b/erts/configure @@ -660,6 +660,7 @@ FLAVORS PRIMARY_FLAVOR JIT_ARCH JIT_ENABLED +EMU_LDFLAGS M4 LIBRT BITS64 @@ -25762,6 +25763,7 @@ fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LDFLAGS="$saved_LDFLAGS" + EMU_LDFLAGS="" for flag in "-Wl,-z,common-page-size=2097152" "-Wl,-z,max-page-size=2097152" do { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add $flag to LDFLAGS" >&5 @@ -25784,7 +25786,8 @@ then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } - LDFLAGS="$saved_LDFLAGS $flag" + EMU_LDFLAGS="$flag" + LDFLAGS="$saved_LDFLAGS" else case e in #( e) @@ -25801,6 +25804,8 @@ rm -f core conftest.err conftest.$ac_objext conftest.beam \ fi + + JIT_ENABLED= FLAVORS="emu jit" # Enable jit