Skip to content

Commit

Permalink
erts: Only use THP options for beam executable
Browse files Browse the repository at this point in the history
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
  • Loading branch information
garazdawi committed Jun 18, 2024
1 parent 601a012 commit 5aee239
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
6 changes: 5 additions & 1 deletion erts/configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -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])
Expand All @@ -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])
Expand All @@ -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).
Expand Down
3 changes: 2 additions & 1 deletion erts/emulator/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ M4FLAGS=
CREATE_DIRS=

LDFLAGS=@LDFLAGS@
EMU_LDFLAGS=@EMU_LDFLAGS@
ARFLAGS=rc
TYPE_LIBS=

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 5aee239

Please sign in to comment.