2010-10-18 10:32:55 -06:00
|
|
|
// Copyright 2010 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.
|
|
|
|
|
2013-08-07 13:20:05 -06:00
|
|
|
#include "../../cmd/ld/textflag.h"
|
|
|
|
|
|
|
|
TEXT _rt0_386_plan9(SB),NOSPLIT, $0
|
2010-10-18 10:32:55 -06:00
|
|
|
MOVL AX, _tos(SB)
|
|
|
|
|
|
|
|
// move arguments down to make room for
|
|
|
|
// m and g at top of stack, right before Tos.
|
|
|
|
MOVL SP, SI
|
|
|
|
SUBL $8, SP
|
|
|
|
MOVL SP, DI
|
|
|
|
|
|
|
|
MOVL AX, CX
|
|
|
|
SUBL SI, CX
|
|
|
|
CLD
|
|
|
|
REP; MOVSB
|
|
|
|
|
|
|
|
// adjust argv
|
|
|
|
SUBL SI, DI
|
|
|
|
MOVL newargc+0(SP), CX
|
|
|
|
LEAL newargv+4(SP), BP
|
|
|
|
argv_fix:
|
|
|
|
ADDL DI, 0(BP)
|
|
|
|
ADDL $4, BP
|
|
|
|
LOOP argv_fix
|
|
|
|
|
2012-04-10 13:14:10 -06:00
|
|
|
CALL runtime·asminit(SB)
|
2013-03-07 20:57:10 -07:00
|
|
|
|
|
|
|
MOVL 0(SP), AX
|
|
|
|
LEAL 4(SP), BX
|
|
|
|
PUSHL BX
|
|
|
|
PUSHL AX
|
|
|
|
PUSHL $-1
|
|
|
|
|
2013-06-11 14:49:24 -06:00
|
|
|
JMP _rt0_go(SB)
|
2010-10-18 10:32:55 -06:00
|
|
|
|
runtime: ,s/[a-zA-Z0-9_]+/runtime·&/g, almost
Prefix all external symbols in runtime by runtime·,
to avoid conflicts with possible symbols of the same
name in linked-in C libraries. The obvious conflicts
are printf, malloc, and free, but hide everything to
avoid future pain.
The symbols left alone are:
** known to cgo **
_cgo_free
_cgo_malloc
libcgo_thread_start
initcgo
ncgocall
** known to linker **
_rt0_$GOARCH
_rt0_$GOARCH_$GOOS
text
etext
data
end
pclntab
epclntab
symtab
esymtab
** known to C compiler **
_divv
_modv
_div64by32
etc (arch specific)
Tested on darwin/386, darwin/amd64, linux/386, linux/amd64.
Built (but not tested) for freebsd/386, freebsd/amd64, linux/arm, windows/386.
R=r, PeterGo
CC=golang-dev
https://golang.org/cl/2899041
2010-11-04 12:00:19 -06:00
|
|
|
DATA runtime·isplan9(SB)/4, $1
|
|
|
|
GLOBL runtime·isplan9(SB), $4
|
2010-10-18 10:32:55 -06:00
|
|
|
GLOBL _tos(SB), $4
|