unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#20338: configure test for nopie with gcc 4.4.3 on Trisquel 4.1
@ 2015-04-15 19:13 Glenn Morris
  2015-04-15 19:42 ` Glenn Morris
  2015-04-16  7:18 ` Paul Eggert
  0 siblings, 2 replies; 3+ messages in thread
From: Glenn Morris @ 2015-04-15 19:13 UTC (permalink / raw)
  To: 20338

Package: emacs
Version: 25.0.50

On fencepost.gnu.org, I noticed the following oddity in config.log:

    configure:30326: checking whether gcc -std=gnu99 accepts -nopie
    configure:30346: gcc -std=gnu99 -o conftest -g3 -O2 -Werror -nopie conftest.c   >&5 
    gcc: unrecognized option '-nopie'
    configure:30346: $? = 0
    configure:30356: result: yes

cat /etc/issue
Trisquel GNU/Linux 4.1 \n \l

gcc --version
gcc (Ubuntu 4.4.3-4ubuntu5.1) 4.4.3

cat test.c
int main ()
 {
   return 0;
 }

gcc -std=gnu99 -o conftest -g3 -O2 -Werror -nopie test.c
gcc: unrecognized option '-nopie'

echo $?
0


Seems odd. Whereas:

gcc -std=gnu99 -o conftest -g3 -O2 -Werror  -foobar test.c
cc1: error: unrecognized command line option "-foobar"

echo $?
1





^ permalink raw reply	[flat|nested] 3+ messages in thread

* bug#20338: configure test for nopie with gcc 4.4.3 on Trisquel 4.1
  2015-04-15 19:13 bug#20338: configure test for nopie with gcc 4.4.3 on Trisquel 4.1 Glenn Morris
@ 2015-04-15 19:42 ` Glenn Morris
  2015-04-16  7:18 ` Paul Eggert
  1 sibling, 0 replies; 3+ messages in thread
From: Glenn Morris @ 2015-04-15 19:42 UTC (permalink / raw)
  To: 20338


IIUC, https://gcc.gnu.org/bugzilla/show_bug.cgi?id=15303 says that you
can't reliably use the exit status of gcc to check whether it supports
a command-line option prior to gcc 4.6. Whee.





^ permalink raw reply	[flat|nested] 3+ messages in thread

* bug#20338: configure test for nopie with gcc 4.4.3 on Trisquel 4.1
  2015-04-15 19:13 bug#20338: configure test for nopie with gcc 4.4.3 on Trisquel 4.1 Glenn Morris
  2015-04-15 19:42 ` Glenn Morris
@ 2015-04-16  7:18 ` Paul Eggert
  1 sibling, 0 replies; 3+ messages in thread
From: Paul Eggert @ 2015-04-16  7:18 UTC (permalink / raw)
  To: 20338-done

[-- Attachment #1: Type: text/plain, Size: 148 bytes --]

Thanks for reporting that.  In master commit 
c6e93df20266fe9f8517f14f3b7c367281f988a5 I installed the attached patch, which 
fixed the bug for me.

[-- Attachment #2: 0001-Pre-4.6-GCC-succeeds-with-unknown-option.patch --]
[-- Type: text/x-patch, Size: 1636 bytes --]

From aefb6f4a4b4bc59386d817728760a15e1225aa6f Mon Sep 17 00:00:00 2001
From: Paul Eggert <eggert@cs.ucla.edu>
Date: Thu, 16 Apr 2015 00:14:11 -0700
Subject: [PATCH] Pre-4.6 GCC succeeds with unknown option

* configure.ac (emacs_cv_prog_cc_nopie): Port to pre-4.6 GCC.
Fixes: bug#20338
---
 configure.ac | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/configure.ac b/configure.ac
index c35e962..39f3f9f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -5021,18 +5021,19 @@ esac
 # -nopie fixes a temacs segfault on Gentoo, OpenBSD, and other systems
 # with "hardened" GCC configurations for some reason (Bug#18784).
 # We don't know why -nopie works, but not segfaulting is better than
-# segfaulting.  Use -Werror when trying -nopie, otherwise clang keeps
-# warning that it does not understand -nopie.
+# segfaulting.  Use ac_c_werror_flag=yes when trying -nopie, otherwise
+# clang keeps warning that it does not understand -nopie, and pre-4.6
+# GCC has a similar problem (Bug#20338).
 AC_CACHE_CHECK([whether $CC accepts -nopie],
   [emacs_cv_prog_cc_nopie],
-  [emacs_save_CFLAGS=$CFLAGS
+  [emacs_save_c_werror_flag=$ac_c_werror_flag
    emacs_save_LDFLAGS=$LDFLAGS
-   CFLAGS="$CFLAGS -Werror"
+   ac_c_werror_flag=yes
    LDFLAGS="$LDFLAGS -nopie"
    AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])],
      [emacs_cv_prog_cc_nopie=yes],
      [emacs_cv_prog_cc_nopie=no])
-   CFLAGS=$emacs_save_CFLAGS
+   ac_c_werror_flag=$emacs_save_c_werror_flag
    LDFLAGS=$emacs_save_LDFLAGS])
 if test "$emacs_cv_prog_cc_nopie" = yes; then
   LD_SWITCH_SYSTEM_TEMACS="$LD_SWITCH_SYSTEM_TEMACS -nopie"
-- 
2.1.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-04-16  7:18 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-15 19:13 bug#20338: configure test for nopie with gcc 4.4.3 on Trisquel 4.1 Glenn Morris
2015-04-15 19:42 ` Glenn Morris
2015-04-16  7:18 ` Paul Eggert

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).