[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] trunk r117095: * configure.ac (--enable-link-time-optimiza
From: |
Dmitry Antipov |
Subject: |
[Emacs-diffs] trunk r117095: * configure.ac (--enable-link-time-optimization): Add clang support. |
Date: |
Tue, 13 May 2014 11:13:16 +0000 |
User-agent: |
Bazaar (2.6b2) |
------------------------------------------------------------
revno: 117095
revision-id: address@hidden
parent: address@hidden
committer: Dmitry Antipov <address@hidden>
branch nick: trunk
timestamp: Tue 2014-05-13 15:12:05 +0400
message:
* configure.ac (--enable-link-time-optimization): Add clang support.
* INSTALL: Mention it.
* etc/PROBLEMS: Mention potential problems with
--enable-link-time-optimization and clang on Fedora 20.
modified:
ChangeLog changelog-20091113204419-o5vbwnq5f7feedwu-1538
INSTALL install-20091113204419-o5vbwnq5f7feedwu-581
configure.ac
configure.in-20091113204419-o5vbwnq5f7feedwu-783
etc/ChangeLog changelog-20091113204419-o5vbwnq5f7feedwu-1485
etc/PROBLEMS problems-20091113204419-o5vbwnq5f7feedwu-1498
=== modified file 'ChangeLog'
--- a/ChangeLog 2014-05-12 06:09:27 +0000
+++ b/ChangeLog 2014-05-13 11:12:05 +0000
@@ -1,3 +1,8 @@
+2014-05-13 Dmitry Antipov <address@hidden>
+
+ * configure.ac (--enable-link-time-optimization): Add clang support.
+ * INSTALL: Mention it.
+
2014-05-12 Katsumi Yamaoka <address@hidden>
* configure.ac (EMACS_CHECK_MODULES): Fix typo in previous change.
=== modified file 'INSTALL'
--- a/INSTALL 2014-03-27 19:41:57 +0000
+++ b/INSTALL 2014-05-13 11:12:05 +0000
@@ -331,12 +331,17 @@
there should be no warnings; on older and on non-GNU systems the
generated warnings may still be useful.
-Use --enable-link-time-optimization to enable link-time optimizer, which
-is available in GNU compiler since version 4.5.0. If your compiler is not
-GNU or older than version 4.5.0, this option does nothing. If `configure'
-can determine number of online CPUS on your system, final link-time
-optimization and code generation is executed in parallel using one job
-per each available online CPU.
+Use --enable-link-time-optimization to enable link-time optimizer. If
+you're using GNU compiler, this feature is supported since version 4.5.0.
+If `configure' can determine number of online CPUS on your system, final
+link-time optimization and code generation is executed in parallel using
+one job per each available online CPU.
+
+This option is also supported for clang. You should have GNU binutils
+with `gold' linker and plugin support, and clang with LLVMgold.so plugin.
+Read http://llvm.org/docs/GoldPlugin.html for details. Also note that
+this feature is still experimental, so prepare to build binutils and
+clang from the corresponding source code repositories.
The `--prefix=PREFIXDIR' option specifies where the installation process
should put emacs and its data files. This defaults to `/usr/local'.
=== modified file 'configure.ac'
--- a/configure.ac 2014-05-12 06:59:30 +0000
+++ b/configure.ac 2014-05-13 11:12:05 +0000
@@ -762,32 +762,6 @@
[gl_gcc_warnings=no]
)
-AC_ARG_ENABLE(link-time-optimization,
-[AS_HELP_STRING([--enable-link-time-optimization],
- [build emacs with link-time optimization.
- This is supported only for GCC since 4.5.0.])],
-if test "${enableval}" != "no"; then
- AC_MSG_CHECKING([whether link-time optimization is supported])
- ac_lto_supported=no
- if test x$GCC = xyes; then
- CPUS=`getconf _NPROCESSORS_ONLN 2>/dev/null`
- if test x$CPUS != x; then
- LTO="-flto=$CPUS"
- else
- LTO="-flto"
- fi
- old_CFLAGS=$CFLAGS
- CFLAGS="$CFLAGS $LTO"
- AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
- [ac_lto_supported=yes], [ac_lto_supported=no])
- CFLAGS="$old_CFLAGS"
- fi
- AC_MSG_RESULT([$ac_lto_supported])
- if test "$ac_lto_supported" = "yes"; then
- CFLAGS="$CFLAGS $LTO"
- fi
-fi)
-
# clang is unduly picky about some things.
AC_CACHE_CHECK([whether the compiler is clang], [emacs_cv_clang],
[AC_COMPILE_IFELSE(
@@ -913,7 +887,51 @@
s/^ //
"
-
+AC_ARG_ENABLE(link-time-optimization,
+[AS_HELP_STRING([--enable-link-time-optimization],
+ [build emacs with link-time optimization.
+ This is supported for gcc since 4.5.0 and clang.
+ Note that clang support is experimental - see INSTALL])],
+if test "${enableval}" != "no"; then
+ ac_lto_supported=no
+ if test $emacs_cv_clang = yes; then
+ AC_MSG_CHECKING([whether link-time optimization is supported by clang])
+ GOLD_PLUGIN=`$CC -print-file-name=LLVMgold.so 2>/dev/null`
+ if test -x "$GOLD_PLUGIN"; then
+ LTO="-flto"
+ fi
+ elif test x$GCC = xyes; then
+ AC_MSG_CHECKING([whether link-time optimization is supported by gcc])
+ CPUS=`getconf _NPROCESSORS_ONLN 2>/dev/null`
+ if test x$CPUS != x; then
+ LTO="-flto=$CPUS"
+ else
+ LTO="-flto"
+ fi
+ else
+ AC_MSG_ERROR([Link-time optimization is not supported with your
compiler.])
+ fi
+ if test -z "$LTO"; then
+ ac_lto_supported=no
+ else
+ old_CFLAGS=$CFLAGS
+ CFLAGS="$CFLAGS $LTO"
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
+ [ac_lto_supported=yes], [ac_lto_supported=no])
+ CFLAGS="$old_CFLAGS"
+ fi
+ AC_MSG_RESULT([$ac_lto_supported])
+ if test "$ac_lto_supported" = "yes"; then
+ CFLAGS="$CFLAGS $LTO"
+ if test x$emacs_cv_clang = xyes; then
+ AC_MSG_WARN([Please read INSTALL before using link-time optimization
with clang])
+ # WARNING: 'ar --plugin ...' doesn't work without
+ # command, so plugin name is appended to ARFLAGS.
+ ARFLAGS="cru --plugin $GOLD_PLUGIN"
+ RANLIB="$RANLIB --plugin $GOLD_PLUGIN"
+ fi
+ fi
+fi)
dnl Some other nice autoconf tests.
dnl These are commented out, since gl_EARLY and/or Autoconf already does them.
=== modified file 'etc/ChangeLog'
--- a/etc/ChangeLog 2014-05-04 00:16:58 +0000
+++ b/etc/ChangeLog 2014-05-13 11:12:05 +0000
@@ -1,3 +1,8 @@
+2014-05-13 Dmitry Antipov <address@hidden>
+
+ * PROBLEMS: Mention potential problems with
+ --enable-link-time-optimization and clang on Fedora 20.
+
2014-05-04 Leo Liu <address@hidden>
* NEWS: Mention support for Chinese dates in calendar and diary.
=== modified file 'etc/PROBLEMS'
--- a/etc/PROBLEMS 2014-05-03 07:09:16 +0000
+++ b/etc/PROBLEMS 2014-05-13 11:12:05 +0000
@@ -836,6 +836,20 @@
by another key (e.g. C-\) by modifying ~/.fcitx/config, or be
accustomed to use C-@ for `set-mark-command'.
+*** Link-time optimization with clang doesn't work on Fedora 20.
+
+As of May 2014, Fedora 20 has broken LLVMgold.so plugin support in clang
+(tested with clang-3.4-6.fc20) - `clang --print-file-name=LLVMgold.so'
+prints `LLVMgold.so' instead of full path to plugin shared library, and
+`clang -flto' is unable to find the plugin with the following error:
+
+/bin/ld: error: /usr/bin/../lib/LLVMgold.so: could not load plugin library:
+/usr/bin/../lib/LLVMgold.so: cannot open shared object file: No such file
+or directory
+
+The only way to avoid this is to build your own clang from source code
+repositories, as described at http://clang.llvm.org/get_started.html.
+
*** M-SPC seems to be ignored as input.
See if your X server is set up to use this as a command
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] trunk r117095: * configure.ac (--enable-link-time-optimization): Add clang support.,
Dmitry Antipov <=