On Tue, 26 Mar 2013 16:39:54 -0700, Philip Guenther wrote:
> On Tue, Mar 26, 2013 at 3:45 PM, Pascal Stumpf <[email protected]> wrote:
> ...
> >> Anyway, can we then just ignore the -pg option if it doesn't work for
> >> shared instead of breaking the link? Or do you have a better solution?
> >
> > I could do that (if I figure out the correct gcc specs), sure.
>
> Change this:
> %l %{pie:-pie} %{p|pg|nopie:-nopie}
>
> to this:
> %{pie:-pie} %{p|pg|nopie:-nopie} %l
>
> in the link_command spec.
That would require changing how LINK_PIE_SPEC is integrated into
LINK_COMMAND_SPEC, and it exploits the -nopie/-shared ordering nits I
mentioned, so I'm not a fan of that. I thought of something like this:
Index: gcc.c
===================================================================
RCS file: /home/pascal/cvs/src/gnu/gcc/gcc/gcc.c,v
retrieving revision 1.2
diff -u -p -r1.2 gcc.c
--- gcc.c 28 Aug 2012 18:59:28 -0000 1.2
+++ gcc.c 26 Mar 2013 23:29:00 -0000
@@ -684,7 +684,7 @@ proper position among the other output f
#ifndef LINK_PIE_SPEC
#ifdef HAVE_LD_PIE
-#define LINK_PIE_SPEC "%{pie:-pie} %{p|pg|nopie:-nopie} "
+#define LINK_PIE_SPEC "%{pie:-pie} %{!shared:%{p|pg:-nopie}} %{nopie:-nopie} "
#else
#define LINK_PIE_SPEC "%{pie:} "
#endif
> ...but I also like Mark's suggestion, to make -nopie not change the
> link mode (shared-object vs executable).
>
>
> Philip Guenther
>
>