cl,build: support //export with different names on embedded targets
Add support for using different C symbol names in //export directives
when compiling for embedded targets (enabled via -target flag).
This is for TinyGo compatibility on embedded platforms where hardware
interrupt handlers often require specific naming conventions.
Implementation:
- Add EnableExportRename() to control export rename behavior
- Add isExport parameter to initLink callback for context awareness
- Update initLinknameByDoc() to handle export rename logic:
* When isExport && enableExportRename: allow different names
* Otherwise: require name match
- Clean error handling in initLink():
* export + enableExportRename: silent return (already processed)
* export + !enableExportRename: panic with clear error message
* other cases: warning for missing linkname
Example:
//export LPSPI2_IRQHandler
func interruptLPSPI2() { ... }
The Go function is named interruptLPSPI2 but exported as
LPSPI2_IRQHandler for the hardware vector table.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -214,6 +214,11 @@ func Do(args []string, conf *Config) ([]Package, error) {
|
||||
conf.Goarch = export.GOARCH
|
||||
}
|
||||
|
||||
// Enable different export names for TinyGo compatibility when using -target
|
||||
if conf.Target != "" {
|
||||
cl.EnableExportRename(true)
|
||||
}
|
||||
|
||||
verbose := conf.Verbose
|
||||
patterns := args
|
||||
tags := "llgo,math_big_pure_go"
|
||||
|
||||
Reference in New Issue
Block a user