This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug driver/77529] -fno-pie disables -fPIC
- From: "hjl.tools at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 08 Sep 2016 17:39:27 +0000
- Subject: [Bug driver/77529] -fno-pie disables -fPIC
- Auto-submitted: auto-generated
- References: <bug-77529-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77529
--- Comment #4 from H.J. Lu <hjl.tools at gmail dot com> ---
(In reply to Matthias Klose from comment #0)
> seen with a GCC 6 configured with --enable-default-pie:
>
> $ gcc -E -dM - < /dev/null 2>&1|grep -i 'pi[ce]'
> #define __pie__ 2
> #define __PIE__ 2
> #define __pic__ 2
> #define __PIC__ 2
>
> $ gcc -E -dM -fPIC - < /dev/null 2>&1|grep -i 'pi[ce]'
> #define __pic__ 2
> #define __PIC__ 2
>
> $ gcc -E -dM -fPIC -fno-pie - < /dev/null 2>&1|grep -i 'pi[ce]'
> $ gcc -E -dM -fno-pie -fPIC - < /dev/null 2>&1|grep -i 'pi[ce]'
> #define __pic__ 2
> #define __PIC__ 2
>
> I would expect the last behavior to be the default one.
--enable-default-pie should only change the default. When -fno-pie -fPIC
are used, the driver behavior should be independent of --enable-default-pie.
GCC 6 without --enable-default-pie, I got
[hjl@gnu-6 gas]$ gcc -E -dM - < /dev/null 2>&1|grep -i 'pi[ce]'
[hjl@gnu-6 gas]$ gcc -E -dM -fPIC - < /dev/null 2>&1|grep -i 'pi[ce]'
#define __pic__ 2
#define __PIC__ 2
[hjl@gnu-6 gas]$ gcc -E -dM -fPIC -fno-pie - < /dev/null 2>&1|grep -i 'pi[ce]'
[hjl@gnu-6 gas]$ gcc -E -dM -fno-pie -fPIC - < /dev/null 2>&1|grep -i 'pi[ce]'
#define __pic__ 2
#define __PIC__ 2
[hjl@gnu-6 gas]$
They match what you got with --enable-default-pie when -fPIC or -fno-pie
are used.