mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-07-26 06:38:42 +00:00
darwin: support Boehm GC (and use by default)
This mostly required some updates to macos-minimal-sdk to add the needed header files and symbols.
This commit is contained in:
committed by
Ron Evans
parent
c1c074f170
commit
95a7d065ca
@@ -3,6 +3,7 @@ package builder
|
||||
import (
|
||||
"bytes"
|
||||
"debug/elf"
|
||||
"debug/macho"
|
||||
"debug/pe"
|
||||
"encoding/binary"
|
||||
"errors"
|
||||
@@ -62,6 +63,20 @@ func makeArchive(arfile *os.File, objs []string) error {
|
||||
fileIndex int
|
||||
}{symbol.Name, i})
|
||||
}
|
||||
} else if dbg, err := macho.NewFile(objfile); err == nil {
|
||||
for _, symbol := range dbg.Symtab.Syms {
|
||||
// See mach-o/nlist.h
|
||||
if symbol.Type&0x0e != 0xe { // (symbol.Type & N_TYPE) != N_SECT
|
||||
continue // undefined symbol
|
||||
}
|
||||
if symbol.Type&0x01 == 0 { // (symbol.Type & N_EXT) == 0
|
||||
continue // internal symbol (static, etc)
|
||||
}
|
||||
symbolTable = append(symbolTable, struct {
|
||||
name string
|
||||
fileIndex int
|
||||
}{symbol.Name, i})
|
||||
}
|
||||
} else if dbg, err := pe.NewFile(objfile); err == nil {
|
||||
for _, symbol := range dbg.Symbols {
|
||||
if symbol.StorageClass != 2 {
|
||||
|
||||
+1
-2
@@ -25,6 +25,7 @@ var BoehmGC = Library{
|
||||
"-DALL_INTERIOR_POINTERS", // scan interior pointers (needed for Go)
|
||||
"-DIGNORE_DYNAMIC_LOADING", // we don't support dynamic loading at the moment
|
||||
"-DNO_GETCONTEXT", // musl doesn't support getcontext()
|
||||
"-DGC_DISABLE_INCREMENTAL", // don't mess with SIGSEGV and such
|
||||
|
||||
// Use a minimal environment.
|
||||
"-DNO_MSGBOX_ON_ERROR", // don't call MessageBoxA on Windows
|
||||
@@ -68,8 +69,6 @@ var BoehmGC = Library{
|
||||
"new_hblk.c",
|
||||
"obj_map.c",
|
||||
"os_dep.c",
|
||||
"pthread_stop_world.c",
|
||||
"pthread_support.c",
|
||||
"reclaim.c",
|
||||
}
|
||||
if strings.Split(target, "-")[2] == "windows" {
|
||||
|
||||
+2
-2
@@ -150,8 +150,8 @@ func Build(pkgName, outpath, tmpdir string, config *compileopts.Config) (BuildRe
|
||||
var libcJob *compileJob
|
||||
switch config.Target.Libc {
|
||||
case "darwin-libSystem":
|
||||
job := makeDarwinLibSystemJob(config, tmpdir)
|
||||
libcDependencies = append(libcDependencies, job)
|
||||
libcJob = makeDarwinLibSystemJob(config, tmpdir)
|
||||
libcDependencies = append(libcDependencies, libcJob)
|
||||
case "musl":
|
||||
var unlock func()
|
||||
libcJob, unlock, err = libMusl.load(config, tmpdir, nil)
|
||||
|
||||
@@ -380,7 +380,7 @@ func defaultTarget(options *Options) (*TargetSpec, error) {
|
||||
llvmvendor := "unknown"
|
||||
switch options.GOOS {
|
||||
case "darwin":
|
||||
spec.GC = "precise"
|
||||
spec.GC = "boehm"
|
||||
platformVersion := "10.12.0"
|
||||
if options.GOARCH == "arm64" {
|
||||
platformVersion = "11.0.0" // first macosx platform with arm64 support
|
||||
|
||||
+1
-1
Submodule lib/macos-minimal-sdk updated: 9b69407cb5...e7c72156ea
Reference in New Issue
Block a user