Bug 6428 - --noexecstack is not used with CFLAGS="-g1"
Summary: --noexecstack is not used with CFLAGS="-g1"
Status: RESOLVED FIXED
Alias: None
Product: glibc
Classification: Unclassified
Component: libc (show other bugs)
Version: 2.4
: P2 normal
Target Milestone: ---
Assignee: Ulrich Drepper
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-04-17 20:02 UTC by Mark Seaborn
Modified: 2014-07-03 11:36 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:
fweimer: security-


Attachments
configure script patch (275 bytes, patch)
2008-04-17 20:04 UTC, Mark Seaborn
Details | Diff
slightly different patch to the configure script (281 bytes, patch)
2008-04-17 20:05 UTC, Mark Seaborn
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Mark Seaborn 2008-04-17 20:02:33 UTC
Configuring glibc with CFLAGS="-g1" causes glibc to be built without the
--noexecstack option:

$ ../libc/configure | grep noexecstack
checking whether --noexecstack is desirable for .S files... yes

$ ../libc/configure CFLAGS="-g1" | grep noexecstack
checking whether --noexecstack is desirable for .S files... no

Other variants of the -g option (-g, -g0, -g2) give the correct behaviour.

This happens because the configure script is doing an invocation of gcc like the
following:

$ gcc -g1 -S conftest.c
$ gcc -g1 -c conftest.s -Wa,--noexecstack
test.s: Assembler messages:
test.s:79: Error: file number 1 already allocated

This fails for a reason other than the -Wa,--noexecstack argument, but it causes
configure to conclude that --noexecstack is not available.  I filed a bug on gcc
(http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35925) because it was not clear
whether passing -g1 to both invocations should be expected to work.

One way to fix this is not to pass CFLAGS to the second invocation; using
ASFLAGS brings this into line with other compilations of .s files.  Suggested
patches attached.
Comment 1 Mark Seaborn 2008-04-17 20:04:00 UTC
Created attachment 2704 [details]
configure script patch
Comment 2 Mark Seaborn 2008-04-17 20:05:40 UTC
Created attachment 2705 [details]
slightly different patch to the configure script
Comment 3 Ulrich Drepper 2008-05-15 02:58:25 UTC
I applied the second patch to cvs.