build: separate compiler and libs

This commit is contained in:
Li Jie
2025-01-07 21:49:08 +08:00
parent b0123567cd
commit 1172e5bdce
559 changed files with 190 additions and 176 deletions

View File

@@ -0,0 +1,9 @@
// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package runtime
func Caller(skip int) (pc uintptr, file string, line int, ok bool) {
panic("todo: runtime.Caller")
}

View File

@@ -0,0 +1,12 @@
// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Garbage collector: finalizers and block profiling.
package runtime
func SetFinalizer(obj any, finalizer any) {
// TODO(xsw):
// panic("todo: runtime.SetFinalizer")
}

View File

@@ -0,0 +1,36 @@
/*
* Copyright (c) 2024 The GoPlus Authors (goplus.org). All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package runtime
// llgo:skipall
import (
_ "unsafe"
)
// GOROOT returns the root of the Go tree. It uses the
// GOROOT environment variable, if set at process start,
// or else the root used during the Go build.
func GOROOT() string {
/*
s := gogetenv("GOROOT")
if s != "" {
return s
}
return defaultGOROOT
*/
panic("todo: GOROOT")
}

View File

@@ -0,0 +1,13 @@
// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package runtime
// Layout of in-memory per-function information prepared by linker
// See https://golang.org/s/go12symtab.
// Keep in sync with linker (../cmd/link/internal/ld/pcln.go:/pclntab)
// and with package debug/gosym and with symtab.go in package runtime.
type _func struct {
unused [8]byte
}

View File

@@ -0,0 +1,93 @@
// Copyright 2014 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package runtime
// Frames may be used to get function/file/line information for a
// slice of PC values returned by Callers.
type Frames struct {
// callers is a slice of PCs that have not yet been expanded to frames.
callers []uintptr
// frames is a slice of Frames that have yet to be returned.
frames []Frame
frameStore [2]Frame
}
// Frame is the information returned by Frames for each call frame.
type Frame struct {
// PC is the program counter for the location in this frame.
// For a frame that calls another frame, this will be the
// program counter of a call instruction. Because of inlining,
// multiple frames may have the same PC value, but different
// symbolic information.
PC uintptr
// Func is the Func value of this call frame. This may be nil
// for non-Go code or fully inlined functions.
Func *Func
// Function is the package path-qualified function name of
// this call frame. If non-empty, this string uniquely
// identifies a single function in the program.
// This may be the empty string if not known.
// If Func is not nil then Function == Func.Name().
Function string
// File and Line are the file name and line number of the
// location in this frame. For non-leaf frames, this will be
// the location of a call. These may be the empty string and
// zero, respectively, if not known.
File string
Line int
// startLine is the line number of the beginning of the function in
// this frame. Specifically, it is the line number of the func keyword
// for Go functions. Note that //line directives can change the
// filename and/or line number arbitrarily within a function, meaning
// that the Line - startLine offset is not always meaningful.
//
// This may be zero if not known.
startLine int
// Entry point program counter for the function; may be zero
// if not known. If Func is not nil then Entry ==
// Func.Entry().
Entry uintptr
// The runtime's internal view of the function. This field
// is set (funcInfo.valid() returns true) only for Go functions,
// not for C functions.
funcInfo funcInfo
}
func (ci *Frames) Next() (frame Frame, more bool) {
panic("todo: runtime.Frames.Next")
}
// CallersFrames takes a slice of PC values returned by Callers and
// prepares to return function/file/line information.
// Do not change the slice until you are done with the Frames.
func CallersFrames(callers []uintptr) *Frames {
panic("todo: runtime.CallersFrames")
}
// A Func represents a Go function in the running binary.
type Func struct {
opaque struct{} // unexported field to disallow conversions
}
// moduledata records information about the layout of the executable
// image. It is written by the linker. Any changes here must be
// matched changes to the code in cmd/link/internal/ld/symtab.go:symtab.
// moduledata is stored in statically allocated non-pointer memory;
// none of the pointers here are visible to the garbage collector.
type moduledata struct {
unused [8]byte
}
type funcInfo struct {
*_func
datap *moduledata
}

View File

@@ -0,0 +1,30 @@
//go:build 386
package runtime
const GOARCH = `386`
const Is386 = 1
const IsAmd64 = 0
const IsAmd64p32 = 0
const IsArm = 0
const IsArmbe = 0
const IsArm64 = 0
const IsArm64be = 0
const IsLoong64 = 0
const IsMips = 0
const IsMipsle = 0
const IsMips64 = 0
const IsMips64le = 0
const IsMips64p32 = 0
const IsMips64p32le = 0
const IsPpc = 0
const IsPpc64 = 0
const IsPpc64le = 0
const IsRiscv = 0
const IsRiscv64 = 0
const IsS390 = 0
const IsS390x = 0
const IsSparc = 0
const IsSparc64 = 0
const IsWasm = 0

View File

@@ -0,0 +1,30 @@
//go:build amd64
package runtime
const GOARCH = `amd64`
const Is386 = 0
const IsAmd64 = 1
const IsAmd64p32 = 0
const IsArm = 0
const IsArmbe = 0
const IsArm64 = 0
const IsArm64be = 0
const IsLoong64 = 0
const IsMips = 0
const IsMipsle = 0
const IsMips64 = 0
const IsMips64le = 0
const IsMips64p32 = 0
const IsMips64p32le = 0
const IsPpc = 0
const IsPpc64 = 0
const IsPpc64le = 0
const IsRiscv = 0
const IsRiscv64 = 0
const IsS390 = 0
const IsS390x = 0
const IsSparc = 0
const IsSparc64 = 0
const IsWasm = 0

View File

@@ -0,0 +1,30 @@
//go:build arm64
package runtime
const GOARCH = `arm64`
const Is386 = 0
const IsAmd64 = 0
const IsAmd64p32 = 0
const IsArm = 0
const IsArmbe = 0
const IsArm64 = 1
const IsArm64be = 0
const IsLoong64 = 0
const IsMips = 0
const IsMipsle = 0
const IsMips64 = 0
const IsMips64le = 0
const IsMips64p32 = 0
const IsMips64p32le = 0
const IsPpc = 0
const IsPpc64 = 0
const IsPpc64le = 0
const IsRiscv = 0
const IsRiscv64 = 0
const IsS390 = 0
const IsS390x = 0
const IsSparc = 0
const IsSparc64 = 0
const IsWasm = 0

View File

@@ -0,0 +1,30 @@
//go:build wasm
package runtime
const GOARCH = `wasm`
const Is386 = 0
const IsAmd64 = 0
const IsAmd64p32 = 0
const IsArm = 0
const IsArmbe = 0
const IsArm64 = 0
const IsArm64be = 0
const IsLoong64 = 0
const IsMips = 0
const IsMipsle = 0
const IsMips64 = 0
const IsMips64le = 0
const IsMips64p32 = 0
const IsMips64p32le = 0
const IsPpc = 0
const IsPpc64 = 0
const IsPpc64le = 0
const IsRiscv = 0
const IsRiscv64 = 0
const IsS390 = 0
const IsS390x = 0
const IsSparc = 0
const IsSparc64 = 0
const IsWasm = 1

View File

@@ -0,0 +1,24 @@
//go:build android
package runtime
const GOOS = `android`
const IsAix = 0
const IsAndroid = 1
const IsDarwin = 0
const IsDragonfly = 0
const IsFreebsd = 0
const IsHurd = 0
const IsIllumos = 0
const IsIos = 0
const IsJs = 0
const IsLinux = 0
const IsNacl = 0
const IsNetbsd = 0
const IsOpenbsd = 0
const IsPlan9 = 0
const IsSolaris = 0
const IsWasip1 = 0
const IsWindows = 0
const IsZos = 0

View File

@@ -0,0 +1,24 @@
//go:build !ios && darwin
package runtime
const GOOS = `darwin`
const IsAix = 0
const IsAndroid = 0
const IsDarwin = 1
const IsDragonfly = 0
const IsFreebsd = 0
const IsHurd = 0
const IsIllumos = 0
const IsIos = 0
const IsJs = 0
const IsLinux = 0
const IsNacl = 0
const IsNetbsd = 0
const IsOpenbsd = 0
const IsPlan9 = 0
const IsSolaris = 0
const IsWasip1 = 0
const IsWindows = 0
const IsZos = 0

View File

@@ -0,0 +1,24 @@
//go:build ios
package runtime
const GOOS = `ios`
const IsAix = 0
const IsAndroid = 0
const IsDarwin = 0
const IsDragonfly = 0
const IsFreebsd = 0
const IsHurd = 0
const IsIllumos = 0
const IsIos = 1
const IsJs = 0
const IsLinux = 0
const IsNacl = 0
const IsNetbsd = 0
const IsOpenbsd = 0
const IsPlan9 = 0
const IsSolaris = 0
const IsWasip1 = 0
const IsWindows = 0
const IsZos = 0

View File

@@ -0,0 +1,24 @@
//go:build js
package runtime
const GOOS = `js`
const IsAix = 0
const IsAndroid = 0
const IsDarwin = 0
const IsDragonfly = 0
const IsFreebsd = 0
const IsHurd = 0
const IsIllumos = 0
const IsIos = 0
const IsJs = 1
const IsLinux = 0
const IsNacl = 0
const IsNetbsd = 0
const IsOpenbsd = 0
const IsPlan9 = 0
const IsSolaris = 0
const IsWasip1 = 0
const IsWindows = 0
const IsZos = 0

View File

@@ -0,0 +1,24 @@
//go:build !android && linux
package runtime
const GOOS = `linux`
const IsAix = 0
const IsAndroid = 0
const IsDarwin = 0
const IsDragonfly = 0
const IsFreebsd = 0
const IsHurd = 0
const IsIllumos = 0
const IsIos = 0
const IsJs = 0
const IsLinux = 1
const IsNacl = 0
const IsNetbsd = 0
const IsOpenbsd = 0
const IsPlan9 = 0
const IsSolaris = 0
const IsWasip1 = 0
const IsWindows = 0
const IsZos = 0

View File

@@ -0,0 +1,24 @@
//go:build windows
package runtime
const GOOS = `windows`
const IsAix = 0
const IsAndroid = 0
const IsDarwin = 0
const IsDragonfly = 0
const IsFreebsd = 0
const IsHurd = 0
const IsIllumos = 0
const IsIos = 0
const IsJs = 0
const IsLinux = 0
const IsNacl = 0
const IsNetbsd = 0
const IsOpenbsd = 0
const IsPlan9 = 0
const IsSolaris = 0
const IsWasip1 = 0
const IsWindows = 1
const IsZos = 0