[PATCH] Add --enable-build-id to ./configure

Nicholas Fraser nfraser at codeweavers.com
Tue Feb 16 14:50:54 CST 2021


Build-ids are required for doing certain kinds of performance tracing. For
example build-ids let Linux perf find the correct objects and transfer them
to other machines via "perf archive".

This keeps it optional because build-ids of PE files are GUIDs which may be
randomly generated. This may interfere with reproducible builds. We could
consider turning this on by default later.
---
 configure.ac | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/configure.ac b/configure.ac
index 3a0bc6e713a..9e5a7b19875 100644
--- a/configure.ac
+++ b/configure.ac
@@ -34,6 +34,7 @@ AC_ARG_ENABLE(tests, AS_HELP_STRING([--disable-tests],[do not build the regressi
 AC_ARG_ENABLE(maintainer-mode, AS_HELP_STRING([--enable-maintainer-mode],[enable maintainer-specific build rules]))
 AC_ARG_ENABLE(silent-rules, AS_HELP_STRING([--enable-silent-rules],[use silent build rules (override: "make V=1")]))
 AC_ARG_ENABLE(werror, AS_HELP_STRING([--enable-werror],[treat compilation warnings as errors]))
+AC_ARG_ENABLE(build-id, AS_HELP_STRING([--enable-build-id],[include .buildid section in output objects]))
 
 AC_ARG_WITH(alsa,      AS_HELP_STRING([--without-alsa],[do not use the Alsa sound support]))
 AC_ARG_WITH(capi,      AS_HELP_STRING([--without-capi],[do not use CAPI (ISDN support)]))
@@ -1084,6 +1085,12 @@ then
             WINE_TRY_CROSSCFLAGS([-Werror])
         fi
 
+        if test "x$enable_build_id" = "xyes"
+        then
+            WINE_TRY_CROSSCFLAGS([-Wl,--build-id], [CROSSCFLAGS="$CROSSCFLAGS -Wl,--build-id"
+                            CROSSLDFLAGS="$CROSSLDFLAGS -Wl,--build-id"])
+        fi
+
         CFLAGS=$saved_CFLAGS
         CC="$ac_save_CC"
     fi
@@ -2093,6 +2100,12 @@ char*f(const char *h,char n) {return strchr(h,n);}]])],[ac_cv_c_logicalop_noisy=
   then
       WINE_TRY_CFLAGS([-Werror])
   fi
+
+  if test "x$enable_build_id" = "xyes"
+  then
+      WINE_TRY_CFLAGS([-Wl,--build-id], [CFLAGS="$CFLAGS -Wl,--build-id"
+                      LDFLAGS="$LDFLAGS -Wl,--build-id"])
+  fi
 fi
 
 dnl **** Disable Fortify, it has too many false positives
-- 
2.30.1




More information about the wine-devel mailing list