Replace own dummy syscall with standard library syscall
This makes it easier to support other standard library packages.
Этот коммит содержится в:
родитель
e01259ba77
коммит
906e061e37
4 изменённых файлов: 17 добавлений и 8 удалений
|
@ -97,10 +97,9 @@ Implemented compiler passes:
|
|||
|
||||
Requirements:
|
||||
|
||||
* Go 1.10+ (Go 1.9 has a
|
||||
[known bug](https://github.com/aykevl/tinygo/issues/2)).
|
||||
* Go 1.11+
|
||||
* LLVM dependencies, see the Software section in the
|
||||
[LLVM build guide](https://llvm.org/docs/GettingStarted.html#software).
|
||||
[LLVM build guide](https://llvm.org/docs/GettingStarted.html#software)
|
||||
|
||||
First download the sources (this takes a while):
|
||||
|
||||
|
|
|
@ -1321,6 +1321,11 @@ func (c *Compiler) parseBuiltin(frame *Frame, args []ssa.Value, callName string)
|
|||
}
|
||||
|
||||
func (c *Compiler) parseFunctionCall(frame *Frame, args []ssa.Value, llvmFn llvm.Value, blocking bool, parentHandle llvm.Value) (llvm.Value, error) {
|
||||
if llvmFn.Name() == "sync.runtime_registerPoolCleanup" || llvmFn.Name() == "sync.runtime_notifyListCheck" {
|
||||
// Ignore these functions calls for now, as a hack.
|
||||
// TODO: implement //go:linkname.
|
||||
return llvm.Value{}, nil
|
||||
}
|
||||
var params []llvm.Value
|
||||
if blocking {
|
||||
if parentHandle.IsNil() {
|
||||
|
|
|
@ -67,6 +67,16 @@ func (p *Program) interpret(instrs []ssa.Instruction, paramKeys []*ssa.Parameter
|
|||
if callee == nil {
|
||||
return i, nil // don't understand dynamic dispatch
|
||||
}
|
||||
if callee.String() == "syscall.runtime_envs" {
|
||||
// TODO: replace this with some //go:linkname magic.
|
||||
// For now, do as if it returned a zero-length slice.
|
||||
var err error
|
||||
locals[instr], err = p.getZeroValue(callee.Signature.Results().At(0).Type())
|
||||
if err != nil {
|
||||
return i, err
|
||||
}
|
||||
continue
|
||||
}
|
||||
if canInterpret(callee) {
|
||||
params := make([]Value, len(common.Args))
|
||||
for i, arg := range common.Args {
|
||||
|
|
|
@ -1,5 +0,0 @@
|
|||
package syscall
|
||||
|
||||
// dummy
|
||||
|
||||
type Errno uintptr
|
Загрузка…
Создание таблицы
Сослаться в новой задаче