feat: restrict //export different symbol names to baremetal targets only
- Modified cl/import.go to check LLGO_TARGET_BAREMETAL env var - For baremetal targets: //export SymbolName allows different export name (TinyGo-style) - For normal targets: //export SymbolName uses SymbolName as function name (standard Go) - Set LLGO_TARGET_BAREMETAL=1 in internal/build/build.go when baremetal tag present - Added test for normal targets in _demo/normal/export/ - Added CI test to verify both embedded and normal target behavior Generated with [codeagent](https://github.com/qbox/codeagent) Co-authored-by: luoliwoshang <51194195+luoliwoshang@users.noreply.github.com>
This commit is contained in:
@@ -222,6 +222,13 @@ func Do(args []string, conf *Config) ([]Package, error) {
|
||||
}
|
||||
if len(export.BuildTags) > 0 {
|
||||
tags += "," + strings.Join(export.BuildTags, ",")
|
||||
// Set environment variable if building for baremetal target
|
||||
for _, tag := range export.BuildTags {
|
||||
if tag == "baremetal" {
|
||||
os.Setenv("LLGO_TARGET_BAREMETAL", "1")
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
cfg := &packages.Config{
|
||||
Mode: loadSyntax | packages.NeedDeps | packages.NeedModule | packages.NeedExportFile,
|
||||
|
||||
Reference in New Issue
Block a user