feat: support libc/compiler-rt for small places#1246
Conversation
There was a problem hiding this comment.
where is this link script come from
There was a problem hiding this comment.
There was a problem hiding this comment.
where is this .ld come from
There was a problem hiding this comment.
d7fe65e to
f860698
Compare
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #1246 +/- ##
==========================================
+ Coverage 87.79% 90.28% +2.49%
==========================================
Files 35 40 +5
Lines 8928 11704 +2776
==========================================
+ Hits 7838 10567 +2729
- Misses 979 1010 +31
- Partials 111 127 +16 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
fix: libc include dir fix: xtensa internal src dir fix: xtensa internal src dir fix: ignore wasm target fix: export libc cflags to global cflags fix: rtlib libc include dir fix: ignore some errors for libc fix: don's search system path for libc fix: adjust compiling options ci: add libc fix: libc cflags fix: test path fix: libc cflags fix: libc cflags
test: add asm test test: add libc.go test test: add DownloadAndExtractLibInternalDir test test: fix checkDownload test test: fix asm test fix: check isCompile fix: remove debug fix: remove debug
| "build-tags": ["xtensa", "baremetal", "linux", "arm"], | ||
| "build-tags": [ | ||
| "xtensa", | ||
| "baremetal", | ||
| "linux", | ||
| "arm" | ||
| ], |
There was a problem hiding this comment.
unexpect unuse style change
| // If targetName is provided, it takes precedence over goos/goarch | ||
| func Use(goos, goarch string, wasiThreads bool, targetName string) (export Export, err error) { | ||
| if targetName != "" { | ||
| if targetName != "" && !strings.HasPrefix(targetName, "wasm") && !strings.HasPrefix(targetName, "wasi") { |
There was a problem hiding this comment.
Is it because wasm currently doesn't support the --target approach? Also, llgo will indeed have another way to support wasm now. I think we should still leave a comment here to indicate this situation
There was a problem hiding this comment.
Crosscompile has been implemented wasm/wasi, those target names are migrated from tinygo, should not useTarget.
| CFlags: []string{ | ||
| "-DNDEBUG", | ||
| "-DVISIBILITY_HIDDEN", | ||
| }, | ||
| CCFlags: []string{ | ||
| "-Oz", | ||
| "-fno-ident", | ||
| "-Wno-unused-parameter", | ||
| "-fno-lto", | ||
| "-Werror=array-bounds", | ||
| "-Werror=uninitialized", | ||
| "-Werror=shadow", | ||
| "-Werror=empty-body", | ||
| "-Werror=sizeof-pointer-memaccess", | ||
| "-Werror=sizeof-array-argument", | ||
| "-Werror=suspicious-memaccess", | ||
| "-Werror=builtin-memcpy-chk-size", | ||
| "-Werror=array-bounds-pointer-arithmetic", | ||
| "-Werror=return-stack-address", | ||
| "-Werror=sizeof-array-decay", | ||
| "-Werror=format-insufficient-args", | ||
| "-Wformat -std=c11", | ||
| "-fno-builtin", | ||
| "-fvisibility=hidden", |
There was a problem hiding this comment.
where is these flags come from?
There was a problem hiding this comment.
| filepath.Join(baseDir, "lib", "builtins", "absvdi2.c"), | ||
| filepath.Join(baseDir, "lib", "builtins", "absvsi2.c"), | ||
| filepath.Join(baseDir, "lib", "builtins", "absvti2.c"), | ||
| filepath.Join(baseDir, "lib", "builtins", "adddf3.c"), | ||
| filepath.Join(baseDir, "lib", "builtins", "addsf3.c"), | ||
| filepath.Join(baseDir, "lib", "builtins", "addvdi3.c"), | ||
| filepath.Join(baseDir, "lib", "builtins", "addvsi3.c"), | ||
| filepath.Join(baseDir, "lib", "builtins", "addvti3.c"), | ||
| filepath.Join(baseDir, "lib", "builtins", "apple_versioning.c"), | ||
| filepath.Join(baseDir, "lib", "builtins", "ashldi3.c"), | ||
| filepath.Join(baseDir, "lib", "builtins", "ashlti3.c"), | ||
| filepath.Join(baseDir, "lib", "builtins", "ashrdi3.c"), | ||
| filepath.Join(baseDir, "lib", "builtins", "ashrti3.c"), | ||
| filepath.Join(baseDir, "lib", "builtins", "bswapdi2.c"), | ||
| filepath.Join(baseDir, "lib", "builtins", "bswapsi2.c"), | ||
| filepath.Join(baseDir, "lib", "builtins", "clzdi2.c"), |
There was a problem hiding this comment.
Where does this C language file list come from?
There was a problem hiding this comment.
| filepath.Join(baseDir, "lib", "builtins", "subtf3.c"), | ||
| filepath.Join(baseDir, "lib", "builtins", "trunctfdf2.c"), | ||
| filepath.Join(baseDir, "lib", "builtins", "trunctfhf2.c"), | ||
| filepath.Join(baseDir, "lib", "builtins", "trunctfsf2.c"), |
There was a problem hiding this comment.
Split multiline string is better for codegen and tests
| package main | ||
|
|
||
| import "github.com/goplus/lib/c" | ||
|
|
||
| func myprint(s *c.Char) { | ||
| for i := 0; i < int(c.Strlen(s)); i++ { | ||
| WriteByte(byte(c.Index(s, i))) | ||
| } | ||
| } | ||
|
|
||
| func main() { | ||
| for { | ||
| myprint(c.Str("hello world")) | ||
| sleep(1) | ||
| } | ||
| } |
Resolves #1248 (Design)
Current support: ESP32