This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [Patch] Fix the testcases that use bind_pic_locally

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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]