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. 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)? Jakub