nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1From 4ee942ccc7cdb06ee51490e9cb44ecb36b25378a Mon Sep 17 00:00:00 2001
2From: =?UTF-8?q?Mustafa=20=C3=87al=C4=B1=C5=9Fkan?= <muscaln@protonmail.com>
3Date: Sat, 30 Apr 2022 16:18:31 +0300
4Subject: [PATCH 2/3] Add clang header path
5
6
7diff --git a/builder/builtins.go b/builder/builtins.go
8index 479b541d..b35283c6 100644
9--- a/builder/builtins.go
10+++ b/builder/builtins.go
11@@ -164,7 +164,7 @@ var aeabiBuiltins = []string{
12 var CompilerRT = Library{
13 name: "compiler-rt",
14 cflags: func(target, headerPath string) []string {
15- return []string{"-Werror", "-Wall", "-std=c11", "-nostdlibinc"}
16+ return []string{"-Werror", "-Wall", "-std=c11", "-isystem", "@clang_include@"}
17 },
18 sourceDir: func() string {
19 llvmDir := filepath.Join(goenv.Get("TINYGOROOT"), "llvm-project/compiler-rt/lib/builtins")
20diff --git a/builder/picolibc.go b/builder/picolibc.go
21index f1b061ae..159f90cf 100644
22--- a/builder/picolibc.go
23+++ b/builder/picolibc.go
24@@ -27,7 +27,7 @@ var Picolibc = Library{
25 "-D_COMPILING_NEWLIB",
26 "-DHAVE_ALIAS_ATTRIBUTE",
27 "-DTINY_STDIO",
28- "-nostdlibinc",
29+ "-isystem", "@clang_include@",
30 "-isystem", picolibcDir + "/include",
31 "-I" + picolibcDir + "/tinystdio",
32 "-I" + headerPath,
33diff --git a/compileopts/config.go b/compileopts/config.go
34index b30e653e..7561b3f2 100644
35--- a/compileopts/config.go
36+++ b/compileopts/config.go
37@@ -288,6 +288,7 @@ func (c *Config) CFlags() []string {
38 path, _ := c.LibcPath("picolibc")
39 cflags = append(cflags,
40 "--sysroot="+path,
41+ "-isystem", "@clang_include@",
42 "-isystem", filepath.Join(path, "include"), // necessary for Xtensa
43 "-isystem", filepath.Join(picolibcDir, "include"),
44 "-isystem", filepath.Join(picolibcDir, "tinystdio"),
45@@ -297,7 +298,6 @@ func (c *Config) CFlags() []string {
46 path, _ := c.LibcPath("musl")
47 arch := MuslArchitecture(c.Triple())
48 cflags = append(cflags,
49- "-nostdlibinc",
50 "-isystem", filepath.Join(path, "include"),
51 "-isystem", filepath.Join(root, "lib", "musl", "arch", arch),
52 "-isystem", filepath.Join(root, "lib", "musl", "include"),
53--
542.36.0
55