diff --git a/src/cmd/godefs/main.c b/src/cmd/godefs/main.c index 02912f20068..f6531ad8ef2 100644 --- a/src/cmd/godefs/main.c +++ b/src/cmd/godefs/main.c @@ -149,6 +149,7 @@ main(int argc, char **argv) { int p[2], pid, i, j, n, off, npad, prefix; char **av, *q, *r, *tofree, *name; + char nambuf[100]; Biobuf *bin, *bout; Type *t; Field *f; @@ -371,6 +372,10 @@ main(int argc, char **argv) name = f->name; if(cutprefix(name)) name += prefix; + if(strcmp(name, "") == 0) { + snprint(nambuf, sizeof nambuf, "Pad%d", npad++); + name = nambuf; + } Bprint(bout, "\t%lT;\n", name, f->type); if(t->kind == Union && lang == &go) break; @@ -531,6 +536,10 @@ cutprefix(char *name) { char *p; + // special case: orig_ in register struct + if(strncmp(name, "orig_", 5) == 0) + return 0; + for(p=name; *p; p++) { if(*p == '_') return p-name > 0; diff --git a/src/pkg/syscall/Makefile b/src/pkg/syscall/Makefile index 2800a8470a7..969cd0def04 100644 --- a/src/pkg/syscall/Makefile +++ b/src/pkg/syscall/Makefile @@ -18,6 +18,5 @@ GOFILES=\ OFILES=\ asm_$(GOOS)_$(GOARCH).$O\ - types_$(GOOS)_$(GOARCH).$O\ include $(GOROOT)/src/Make.pkg diff --git a/src/pkg/syscall/PORT.sh b/src/pkg/syscall/PORT.sh index e7121c45bf2..3e165f87ba2 100755 --- a/src/pkg/syscall/PORT.sh +++ b/src/pkg/syscall/PORT.sh @@ -54,11 +54,6 @@ # there is almost always a #define that can get the real ones. # See types_darwin.c and types_linux.c for examples. # -# * types_${GOOS}_${GOARCH}.c -# -# Same as types_${GOOS}_${GOARCH}.go except that it contains -# definitions specific to ${GOOS} one one particular architecture. -# # * zerror_${GOOS}_${GOARCH}.go # # This machine-generated file defines the system's error numbers, @@ -117,9 +112,4 @@ esac echo "$mkerrors >zerrors_$GOOSARCH.go" echo "$mksyscall syscall_$GOOS.go syscall_$GOOSARCH.go >zsyscall_$GOOSARCH.go" echo "$mksysnum >zsysnum_$GOOSARCH.go" -echo "$mktypes types_$GOOS.c types_$GOOSARCH.c >ztypes_$GOOSARCH.go" - -port=$(ls *.go | grep -v _) -arch=$(ls *_$GOOSARCH.s *_$GOOSARCH.go *_$GOOS.go) -all=$(ls $port $arch) # sort them -echo gobuild $all +echo "$mktypes types_$GOOS.c >ztypes_$GOOSARCH.go" diff --git a/src/pkg/syscall/mkerrors.sh b/src/pkg/syscall/mkerrors.sh index 15835bdd6af..661cd377d1e 100755 --- a/src/pkg/syscall/mkerrors.sh +++ b/src/pkg/syscall/mkerrors.sh @@ -43,7 +43,7 @@ godefs -gsyscall "$@" _errors.c # Run C program to print error strings. ( - echo " + /bin/echo " #include #include #include @@ -57,10 +57,12 @@ int errors[] = { " for i in $errors do - echo ' '$i, + /bin/echo ' '$i, done - echo ' + # Use /bin/echo to avoid builtin echo, + # which interprets \n itself + /bin/echo ' }; int @@ -89,5 +91,4 @@ main(void) ' ) >_errors.c -gcc -o _errors _errors.c && ./_errors -rm -f _errors.c _errors +gcc -o _errors _errors.c && ./_errors && rm -f _errors.c _errors diff --git a/src/pkg/syscall/mksyscall.sh b/src/pkg/syscall/mksyscall.sh index 0a2fb205577..07a28757d45 100755 --- a/src/pkg/syscall/mksyscall.sh +++ b/src/pkg/syscall/mksyscall.sh @@ -171,10 +171,7 @@ print <