https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126722
Bug ID: 126722
Summary: SYSROOT_CFLAGS_FOR_TARGET is not passed to some target
compiler invocations
Product: gcc
Version: 16.1.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: bootstrap
Assignee: unassigned at gcc dot gnu.org
Reporter: dragon-archer at outlook dot com
Target Milestone: ---
When --with-sysroot or --with-build-sysroot is used, most target compiler
invocations receive SYSROOT_CFLAGS_FOR_TARGET through XGCC_FLAGS_FOR_TARGET.
GCC_FOR_TARGET and the post-stage1 C++ compiler are assembled separately,
however, and therefore miss the configured sysroot. gnattools similarly
constructs its native and rebuild CC and CXX commands directly.
Without these flags, configure tests performed in later bootstrap stages can
fail to find the target headers or startup files, reporting that the C++
compiler cannot create executables. Native gnattools can also invoke xg++
without the build sysroot when linking its programs, causing the target linker
to fail to find crt2.o and default-manifest.o.