From: Eli Zaretskii Date: Fri, 28 Feb 2025 07:35:05 +0000 (+0200) Subject: ; Recommend not to use -O3 in production builds X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=3a7172d768442e1d80a61a39fe24881a6b42983d;p=emacs.git ; Recommend not to use -O3 in production builds * nt/INSTALL: * INSTALL: Recommend not to use -O3 and -Os in ordinary production builds. (Bug#76559) (cherry picked from commit 75a314dc8a9d82449630631f9c41b26d512bdb87) --- diff --git a/INSTALL b/INSTALL index 14dea1d4a46..d38fff7b2e6 100644 --- 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 diff --git a/nt/INSTALL b/nt/INSTALL index 39936ce53a1..a99e60839e9 100644 --- a/nt/INSTALL +++ b/nt/INSTALL @@ -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