diff options
author | Iain Buclaw <ibuclaw@gdcproject.org> | 2021-04-08 18:31:04 +0200 |
---|---|---|
committer | Iain Buclaw <ibuclaw@gdcproject.org> | 2021-04-10 15:02:07 +0200 |
commit | d118ec221dd5fc829d2170c257e10b8159dce274 (patch) | |
tree | 8ff5b8c0b68632ea682e8765ed30f7b93a5e8581 /libphobos/m4 | |
parent | 32703b80f66f7ca504eb79bee7e745f22cf096a8 (diff) | |
download | gcc-d118ec221dd5fc829d2170c257e10b8159dce274.tar.gz |
libphobos: Build runtime library with -ffunction-sections -fdata-sections
Tests for `-ffunction-sections -fdata-sections' and sets SECTION_FLAGS
accordingly. If there is no warning when using it, take advantage of
the smaller executables that can be had with `--gc-sections'.
libphobos/ChangeLog:
* Makefile.in: Regenerate.
* configure: Regenerate.
* configure.ac: Call DRUNTIME_SECTION_FLAGS.
* libdruntime/Makefile.am: Add SECTION_FLAGS to AM_DFLAGS.
* libdruntime/Makefile.in: Regenerate.
* m4/druntime.m4 (DRUNTIME_SECTION_FLAGS): New macro.
* src/Makefile.am: Add SECTION_FLAGS to AM_DFLAGS.
* src/Makefile.in: Regenerate.
* testsuite/Makefile.in: Regenerate.
Diffstat (limited to 'libphobos/m4')
-rw-r--r-- | libphobos/m4/druntime.m4 | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/libphobos/m4/druntime.m4 b/libphobos/m4/druntime.m4 index 7221712a888..2a7a689dd18 100644 --- a/libphobos/m4/druntime.m4 +++ b/libphobos/m4/druntime.m4 @@ -116,3 +116,22 @@ AC_DEFUN([DRUNTIME_INSTALL_DIRECTORIES], gdc_include_dir='$(libdir)/gcc/${target_alias}/${gcc_version}/include/d' AC_SUBST(gdc_include_dir) ]) + +# DRUNTIME_SECTION_FLAGS +# ---------------------- +# Check for -ffunction-sections nad -fdata-sections. +AC_DEFUN([DRUNTIME_SECTION_FLAGS], +[ + WITH_LOCAL_DRUNTIME([ + AC_LANG_PUSH([D]) + GDCFLAGS="$GDCFLAGS -g -Werror -ffunction-sections -fdata-sections" + AC_TRY_COMPILE([int foo; void bar() { }],[return 0;], + [ac_fdsections=yes], [ac_fdsections=no]) + if test "x$ac_fdsections" = "xyes"; then + SECTION_FLAGS='-ffunction-sections -fdata-sections' + fi + AC_MSG_RESULT($ac_fdsections) + AC_LANG_POP([D]) + ], [-nophoboslib]) + AC_SUBST(SECTION_FLAGS) +]) |