[2/2] libphobos: don't compile empty switchcontext.S
Commit Message
If it does not contain any files, then there is no point compiling it.
Skipping this saves some milliseconds and ~650 bytes in libgphobos.a.
---
libphobos/configure.ac | 1 +
libphobos/libdruntime/Makefile.am | 2 ++
.../libdruntime/config/x86/switchcontext.S | 25 ++++++-------------
3 files changed, 11 insertions(+), 17 deletions(-)
@@ -78,6 +78,7 @@ AS_IF([test x$enable_cet = xyes], [
])
AC_SUBST(CET_DFLAGS)
AC_SUBST(DCFG_ENABLE_CET)
+AM_CONDITIONAL([ENABLE_CET], [test x$enable_cet = xyes])
# This should be inherited in the recursive make, but ensure it is defined.
test "$AR" || AR=ar
@@ -93,9 +93,11 @@ if DRUNTIME_CPU_X86
if DRUNTIME_OS_MINGW
DRUNTIME_SOURCES_CONFIGURED += config/mingw/switchcontext.S
else
+if !ENABLE_CET
DRUNTIME_SOURCES_CONFIGURED += config/x86/switchcontext.S
endif
endif
+endif
if DRUNTIME_CPU_SYSTEMZ
DRUNTIME_SOURCES_CONFIGURED += config/systemz/get_tls_offset.S
endif
@@ -24,16 +24,9 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#include "../common/threadasm.S"
-/* NB: Generate the CET marker for -fcf-protection. */
-#ifdef __CET__
-# include <cet.h>
-#endif
+#if defined(__ELF__)
-#if !defined(__CET__)
-
-# if defined(__ELF__)
-
-# if defined(__i386__)
+# if defined(__i386__)
.text
.globl CSYM(fiber_switchContext)
@@ -104,13 +97,13 @@ CSYM(fiber_switchContext):
.cfi_endproc
.size CSYM(fiber_switchContext),.-CSYM(fiber_switchContext)
-# endif /* defined(__ELF__) && defined(__x86_64__) && !defined(__ILP32__) */
+# endif /* defined(__ELF__) && defined(__x86_64__) && !defined(__ILP32__) */
-# endif /* defined(__ELF__) */
+#endif /* defined(__ELF__) */
-# if defined(__MACH__)
+#if defined(__MACH__)
-# if defined(__i386__)
+# if defined(__i386__)
.text
.globl CSYM(fiber_switchContext)
@@ -247,8 +240,6 @@ LASFDE1:
.p2align 3,0
LEFDE1:
-# endif /* defined(__MACH__) && defined(__x86_64__) && !defined(__ILP32__) */
+# endif /* defined(__MACH__) && defined(__x86_64__) && !defined(__ILP32__) */
-# endif /* defined (__MACH__) */
-
-#endif /* !defined(__CET__) */
+#endif /* defined (__MACH__) */