/* * sdk-diag.c * Probes the exact libc/kernel layers the GCC driver depends on: * access/stat on the compiler backends, and a direct posix_spawn * of cc1plus. Prints one line per probe. */ #include #include #include #include #include #define CC1PLUS "/sdk/libexec/gcc/x86_64-montauk/14.2.0/cc1plus" static void probe(const char *p) { struct stat st; int a = access(p, X_OK); int s = stat(p, &st); printf("%-52s access=%d stat=%d", p, a, s); if (s == 0) { printf(" mode=%o size=%ld", (unsigned)st.st_mode, (long)st.st_size); } printf("\n"); } int main(void) { probe(CC1PLUS); probe("/sdk/libexec/gcc/x86_64-montauk/14.2.0"); probe("/sdk/libexec/gcc"); probe("/sdk/bin/as.elf"); probe("/tmp"); pid_t pid = -1; char *argv[] = { (char *)"cc1plus", (char *)"--version", 0 }; int r = posix_spawn(&pid, CC1PLUS, 0, 0, argv, 0); printf("posix_spawn(cc1plus --version) = %d pid=%d\n", r, (int)pid); if (r == 0) { int st = -1; waitpid(pid, &st, 0); printf("cc1plus wait status = %d (exit %d)\n", st, (st >> 8) & 0xFF); } return 0; }