This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [Patch] Fix the testcases that use bind_pic_locally
- From: Vidya Praveen <vidyapraveen at arm dot com>
- To: Jakub Jelinek <jakub at redhat dot com>
- Cc: "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>, Marcus Shawcroft <Marcus dot Shawcroft at arm dot com>, "janisjo at codesourcery dot com" <janisjo at codesourcery dot com>, "mikestump at comcast dot net" <mikestump at comcast dot net>
- Date: Tue, 8 Oct 2013 15:03:55 +0100
- Subject: Re: [Patch] Fix the testcases that use bind_pic_locally
- Authentication-results: sourceware.org; auth=none
- References: <20131008091458 dot GA2667 at e103625-lin dot cambridge dot arm dot com> <20131008093022 dot GR30970 at tucnak dot zalov dot cz>
On Tue, Oct 08, 2013 at 10:30:22AM +0100, Jakub Jelinek wrote:
> On Tue, Oct 08, 2013 at 10:14:59AM +0100, Vidya Praveen wrote:
> > There are several tests that use "dg-add-options bind_pic_locally" in order to
> > add -fPIE or -fpie when -fPIC or -fpic are used respectively with the expecta-
> > tion that -fPIE/-fpie will override -fPIC/-fpic. But this doesn't happen since
> > since -fPIE/-fpie will be added before the -fPIC/-fpic (whether -fPIC/-fpic is
> > added as a multilib option or through cflags). This is essentially due to the
> > fact that cflags and multilib flags are added after the options are added
> > through dg-options, dg-add-options, et al. in default_target_compile function.
> >
> > Assuming dg-options or dg-add-options should always win, we can fix this by
> > modifying the order in which they are concatenated at default_target_compile in
> > target.exp. But this is not recommended since it depends on everyone who tests
> > upgrading their dejagnu (refer [1]).
>
> This looks like a big step backwards and I'm afraid it can break targets
> where -fpic/-fPIC is the default.
I agree. I didn't think of this. Since the -fPIC/-fpic comes before the -fPIE/-fpie
this will work here. In other words, bind_pic_locally is not broken in this case.
(This is assuming the -fPIC/-fpic as default option is passed through
DRIVER_SELF_SPECS or similar).
> If dg-add-options bind_pic_locally must
> add options to the end of command line, then can't you just push the options
> that must go last to some variable other than dg-extra-tool-flags and as we
> override dejagnu's dg-test, put it in our override last (or in whatever
> other method that already added the multilib options)?
Well, multilib options are added at default_target_compile which is in target.exp.
If I store the flags in some variable at add_options_for_bind_pic_locally and add
it later, it still going to be before default_target_compile is called.
Hope I understood your suggestion right.
Cheers
VP