https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107059

--- Comment #23 from Tobias Burnus <burnus at gcc dot gnu.org> ---
Regarding the $BUILD/gcc/include-fixed and xgcc -B $BUILD/gcc:

In gcc.cc's driver_handle_option:

        add_prefix (&include_prefixes, arg, NULL,
                    PREFIX_PRIORITY_B_OPT, 0, 0);
Adds "$BUILD/gcc/" to the prefix list in include_prefix.plist (priority =
PREFIX_PRIORITY_B_OPT, require_machine_suffix = os_multilib = 0)
the include_prefixes.name is "include".

This is later processed in do_spec_1 as:
              info.option = "-isystem";
              info.append = "include";
...
              for_each_path (&include_prefixes, false, info.append_len,
                             spec_path, &info);
...
              info.append = "include-fixed";
              for_each_path (&include_prefixes, false, info.append_len,
                             spec_path, &info);
which in turn runs with (<prefix> = "$BUILD/gcc/"):

  <prefix>/x86_64-pc-linux-gnu/13.0.0/
  <prefix>/x86_64-linux-gnu/
  <prefix>

It also sets -iprefix $BUILD/gcc/../lib/gcc/x86_64-pc-linux-gnu/13.0.0/
             -isystem $BUILD/gcc/{include,include-fixed}

Without -B, include_prefix.plist is NULL and also no -iprefix is set. Thus, cc1
has to find the paths itself. – The iprefix does not really matter, except that
with the installed compiler, the include-fixed can be found at
  <prefix>/include-fixed
which is $INSTALL/lib/gcc/$target/13.0.0/include-fixed
and is part of the 'cpp_include_defaults' array.

With the in-build compiler,  $BUILD/lib/gcc/$target/13.0.0/include-fixed
is checked for - but does not exist.


The additionally specified -isystem is processed - but not under the multiarch
processing. 

 * * *

Thus, one possibility that should work as well is to create the include-fixed
not under gcc/ but under lib/gcc/$target/$version/include-fixed

Or to change the   for_each_path + spec_path such that it puts "include-fixed'
between
plist->name and the multiarch and then uses "" as suffix (alias info.append)

Reply via email to