On Wed, 26 Oct 2011, Richard Guenther wrote:
This completely rewrites LTO option merging. At compile (uselessly
now at WPA?) time we now stream a COLLECT_GCC_OPTIONS like string
as it comes from argv of the compiler binary. Those options are
read in by the LTO driver (lto-wrapper), merged into a single
set (very simple merge function right now ;)) and given a place to
complain about incompatible arguments. The merged set is then
prepended to the arguments from the linker driver line
(what we get in COLLECT_GCC_OPTIONS for lto-wrapper), thus the
linker command-line may override what the compiler command-line(s)
provided.
One visible change is that no optimization option on the link line
no longer means -O0, unless you explicitly specify -O0 at link time.
There are probably more obscure differences, especially due to the
very simple merge and complain function ;)) But this is a RFC ...
If WPA partitioning at any point wants to do something clever with
a set of incompatible functions it can re-parse the options and
do that (we then have to arrange for lto-wrapper to let the options
slip through).
I'm LTO bootstrapping and testing this simple variant right now
(I believe we do not excercise funny option combinations right now).
I'll still implement a very simple merge/complain function.
Suggestions for that welcome (I'll probably simply compute the
intersection of options ... in the long run we'd want to annotate
our options as to whether they should be unioned/intersected).
! if (i != 1)
! obstack_grow (&temporary_obstack, " ", 1);
! obstack_grow (&temporary_obstack, "'", 1);
! q = option->canonical_option[0];
! while ((p = strchr (q, '\'')))
! {
! obstack_grow (&temporary_obstack, q, p - q);
! obstack_grow (&temporary_obstack, "'\\''", 4);
! q = ++p;
! }
! obstack_grow (&temporary_obstack, q, strlen (q));
! obstack_grow (&temporary_obstack, "'", 1);
! for (j = 1; j< option->canonical_option_num_elements; ++j)
{
! obstack_grow (&temporary_obstack, " '", 2);
! q = option->canonical_option[j];
! while ((p = strchr (q, '\'')))
! {
! obstack_grow (&temporary_obstack, q, p - q);
! obstack_grow (&temporary_obstack, "'\\''", 4);
! q = ++p;
! }
! obstack_grow (&temporary_obstack, q, strlen (q));
! obstack_grow (&temporary_obstack, "'", 1);