]> git.eshelyaron.com Git - emacs.git/commitdiff
; Recommend not to use -O3 in production builds
authorEli Zaretskii <eliz@gnu.org>
Fri, 28 Feb 2025 07:35:05 +0000 (09:35 +0200)
committerEshel Yaron <me@eshelyaron.com>
Fri, 28 Feb 2025 11:20:33 +0000 (12:20 +0100)
* nt/INSTALL:
* INSTALL: Recommend not to use -O3 and -Os in ordinary production
builds.  (Bug#76559)

(cherry picked from commit 75a314dc8a9d82449630631f9c41b26d512bdb87)

INSTALL
nt/INSTALL

diff --git a/INSTALL b/INSTALL
index 14dea1d4a46ef0b0eb5b40ef6ec8b7ab30bd3c77..d38fff7b2e6e3ff31f6a2f1f2f066f137746def9 100644 (file)
--- a/INSTALL
+++ b/INSTALL
@@ -10,7 +10,7 @@ instructions in this file should be sufficient.  For other
 configurations, we have additional specialized files:
 
   . INSTALL.REPO if you build from a Git checkout
-  . nt/INSTALL if you build for MS-Windows
+  . nt/INSTALL if you build a native (non-Cygwin) Emacs for MS-Windows
   . nextstep/INSTALL if you build for GNUstep/macOS
   . java/INSTALL if you build for Android
   . msdos/INSTALL if you build for MS-DOS
@@ -294,12 +294,20 @@ Lisp code even if your system satisfies the build requirements, use the
 
 DETAILED BUILDING AND INSTALLATION:
 
-(This is for a Unix or Unix-like system.  For GNUstep and macOS,
-see nextstep/INSTALL.  For non-ancient versions of MS Windows, see
-the file nt/INSTALL.  For MS-DOS and MS Windows 3.X, see msdos/INSTALL.)
+(This is for a Unix or Unix-like system (including Cygwin on
+MS-Windows).  For GNUstep and macOS, see nextstep/INSTALL.  For building
+a native Windows Emacs for non-ancient versions of MS Windows, see the
+file nt/INSTALL.  For MS-DOS and MS Windows 3.X, see msdos/INSTALL.)
 
 1) See BASIC INSTALLATION above for getting and configuring Emacs.
 
+1a) For ordinary production builds, if you want to specify non-default
+compiler options via CFLAGS variable, we recommend against using
+optimization options -O3 or -Os, and also recommend not to use the
+compiler option -fsanitize=undefined.  These are known to sometimes cause
+problems with the generated code, and we recommend using them only in
+debugging builds or for testing specific problems in Emacs.
+
 2) In the unlikely event that 'configure' does not detect your system
 type correctly, consult './etc/MACHINES' to see what --host, --build
 options you should pass to 'configure'.  That file also offers hints
@@ -534,6 +542,9 @@ to look in '/bar/mylib' for libraries, pass the -Og optimization
 switch to the compiler, and link against libfoo and libbar
 libraries in addition to the standard ones.
 
+For ordinary production builds, we recommend against using -O3 and -Os
+in CFLAGS, and also against using -fsanitize=undefined compiler option.
+
 For some libraries, like Gtk+, fontconfig and ALSA, 'configure' uses
 pkg-config to find where those libraries are installed.
 If you want pkg-config to look in special directories, you have to set
index 39936ce53a14f2d184c7b5654ef888d2f7fd1a70..a99e60839e9c3dd7d02ce8628da99ecd606177d6 100644 (file)
@@ -55,6 +55,10 @@ build should run on Windows 9X and newer systems).
        ./configure --prefix=/d/usr/emacs --enable-checking='yes,glyphs' \
          CFLAGS='-O0 -g3'
 
+     (For ordinary production builds, we recommend not to use -O3 or -Os
+     in CFLAGS, as those could sometimes produce bad or suboptimal code,
+     especially in major new releases of GCC.)
+
   3. After the configure script finishes, it should display the
      resulting configuration.  After that, type