[dpkg] 06/187: build: Fix the __progname check to avoid the optimizer discarding the symbol

Reiner Herrmann reiner at reiner-h.de
Sun Nov 6 12:46:17 UTC 2016


This is an automated email from the git hooks/post-receive script.

deki-guest pushed a commit to branch master
in repository dpkg.

commit 758ecf7fe1cb15abb87c796fb3a7f15933c56f67
Author: Guillem Jover <guillem at debian.org>
Date:   Sat Aug 27 22:32:55 2016 +0200

    build: Fix the __progname check to avoid the optimizer discarding the symbol
    
    Because we were assigning to another unused variable, when building the
    check with optimizations enabled, which is the default when using gcc as
    the compiler, the variable was being discarded. Instead pass it to
    printf() so that it cannot do so.
---
 debian/changelog | 1 +
 m4/dpkg-funcs.m4 | 5 ++---
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 53ea959..4001219 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -4,6 +4,7 @@ dpkg (1.18.11) UNRELEASED; urgency=medium
   * Build system:
     - Add support for profiling perl modules.
     - Clean up compiler and linker automatic flag usage in configure.
+    - Fix the __progname check to avoid the optimizer discarding the symbol.
 
   [ Updated manpages translations ]
   * German (Helge Kreutzmann).
diff --git a/m4/dpkg-funcs.m4 b/m4/dpkg-funcs.m4
index 7e73a12..0d947c6 100644
--- a/m4/dpkg-funcs.m4
+++ b/m4/dpkg-funcs.m4
@@ -111,9 +111,8 @@ AC_DEFUN([DPKG_CHECK_PROGNAME],
                  [AC_MSG_RESULT([no])])
 
   AC_MSG_CHECKING([for __progname])
-  AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],
-                 [[extern char *__progname;
-                   const char *p = __progname;]])],
+  AC_LINK_IFELSE([AC_LANG_PROGRAM([[extern char *__progname;]],
+                 [[printf("%s", __progname);]])],
                  [AC_DEFINE([HAVE___PROGNAME], [1],
                             [Define to 1 if you have __progname])
                   AC_MSG_RESULT([yes])],

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/dpkg.git



More information about the Reproducible-commits mailing list