Commit 4a5b8060 by Ian Lance Taylor

runtime, testing/internal/testdeps: fixes for cgo

    
    Some fixes that permit misc/cgo/test in the master gc repository to
    pass using the current gccgo.
    
    Install testing/internal/testdeps.gox; it is needed by `go test`.
    
    Export runtime.lockedOSThread to enable calling via go:linkname; it is
    used by misc/cgo/test.
    
    Loop on EAGAIN when creating a new thread; this is what the gc code
    does, and misc/cgo/test tests that it works.
    
    Reviewed-on: https://go-review.googlesource.com/35479

From-SVN: r244733
parent a876231c
907f6e31975443993c47fa45e09cf85d0709b7e6 b573d4756096523d8bd4bf7b11e56383e5a2cca4
The first line of this file holds the git revision number of the last The first line of this file holds the git revision number of the last
merge done from the gofrontend repository. merge done from the gofrontend repository.
...@@ -360,6 +360,11 @@ toolexeclibgotesting_DATA = \ ...@@ -360,6 +360,11 @@ toolexeclibgotesting_DATA = \
testing/iotest.gox \ testing/iotest.gox \
testing/quick.gox testing/quick.gox
toolexeclibgotestinginternaldir = $(toolexeclibgotestingdir)/internal
toolexeclibgotestinginternal_DATA = \
testing/internal/testdeps.gox
toolexeclibgotextdir = $(toolexeclibgodir)/text toolexeclibgotextdir = $(toolexeclibgodir)/text
toolexeclibgotext_DATA = \ toolexeclibgotext_DATA = \
......
...@@ -146,6 +146,7 @@ am__installdirs = "$(DESTDIR)$(toolexeclibdir)" \ ...@@ -146,6 +146,7 @@ am__installdirs = "$(DESTDIR)$(toolexeclibdir)" \
"$(DESTDIR)$(toolexeclibgoruntimedir)" \ "$(DESTDIR)$(toolexeclibgoruntimedir)" \
"$(DESTDIR)$(toolexeclibgosyncdir)" \ "$(DESTDIR)$(toolexeclibgosyncdir)" \
"$(DESTDIR)$(toolexeclibgotestingdir)" \ "$(DESTDIR)$(toolexeclibgotestingdir)" \
"$(DESTDIR)$(toolexeclibgotestinginternaldir)" \
"$(DESTDIR)$(toolexeclibgotextdir)" \ "$(DESTDIR)$(toolexeclibgotextdir)" \
"$(DESTDIR)$(toolexeclibgotexttemplatedir)" \ "$(DESTDIR)$(toolexeclibgotexttemplatedir)" \
"$(DESTDIR)$(toolexeclibgounicodedir)" "$(DESTDIR)$(toolexeclibgounicodedir)"
...@@ -265,7 +266,8 @@ DATA = $(noinst_DATA) $(toolexeclibgo_DATA) \ ...@@ -265,7 +266,8 @@ DATA = $(noinst_DATA) $(toolexeclibgo_DATA) \
$(toolexeclibgonetrpc_DATA) $(toolexeclibgoos_DATA) \ $(toolexeclibgonetrpc_DATA) $(toolexeclibgoos_DATA) \
$(toolexeclibgopath_DATA) $(toolexeclibgoregexp_DATA) \ $(toolexeclibgopath_DATA) $(toolexeclibgoregexp_DATA) \
$(toolexeclibgoruntime_DATA) $(toolexeclibgosync_DATA) \ $(toolexeclibgoruntime_DATA) $(toolexeclibgosync_DATA) \
$(toolexeclibgotesting_DATA) $(toolexeclibgotext_DATA) \ $(toolexeclibgotesting_DATA) \
$(toolexeclibgotestinginternal_DATA) $(toolexeclibgotext_DATA) \
$(toolexeclibgotexttemplate_DATA) $(toolexeclibgounicode_DATA) $(toolexeclibgotexttemplate_DATA) $(toolexeclibgounicode_DATA)
RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
distclean-recursive maintainer-clean-recursive distclean-recursive maintainer-clean-recursive
...@@ -740,6 +742,10 @@ toolexeclibgotesting_DATA = \ ...@@ -740,6 +742,10 @@ toolexeclibgotesting_DATA = \
testing/iotest.gox \ testing/iotest.gox \
testing/quick.gox testing/quick.gox
toolexeclibgotestinginternaldir = $(toolexeclibgotestingdir)/internal
toolexeclibgotestinginternal_DATA = \
testing/internal/testdeps.gox
toolexeclibgotextdir = $(toolexeclibgodir)/text toolexeclibgotextdir = $(toolexeclibgodir)/text
toolexeclibgotext_DATA = \ toolexeclibgotext_DATA = \
text/scanner.gox \ text/scanner.gox \
...@@ -2645,6 +2651,27 @@ uninstall-toolexeclibgotestingDATA: ...@@ -2645,6 +2651,27 @@ uninstall-toolexeclibgotestingDATA:
@list='$(toolexeclibgotesting_DATA)'; test -n "$(toolexeclibgotestingdir)" || list=; \ @list='$(toolexeclibgotesting_DATA)'; test -n "$(toolexeclibgotestingdir)" || list=; \
files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
dir='$(DESTDIR)$(toolexeclibgotestingdir)'; $(am__uninstall_files_from_dir) dir='$(DESTDIR)$(toolexeclibgotestingdir)'; $(am__uninstall_files_from_dir)
install-toolexeclibgotestinginternalDATA: $(toolexeclibgotestinginternal_DATA)
@$(NORMAL_INSTALL)
@list='$(toolexeclibgotestinginternal_DATA)'; test -n "$(toolexeclibgotestinginternaldir)" || list=; \
if test -n "$$list"; then \
echo " $(MKDIR_P) '$(DESTDIR)$(toolexeclibgotestinginternaldir)'"; \
$(MKDIR_P) "$(DESTDIR)$(toolexeclibgotestinginternaldir)" || exit 1; \
fi; \
for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
echo "$$d$$p"; \
done | $(am__base_list) | \
while read files; do \
echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(toolexeclibgotestinginternaldir)'"; \
$(INSTALL_DATA) $$files "$(DESTDIR)$(toolexeclibgotestinginternaldir)" || exit $$?; \
done
uninstall-toolexeclibgotestinginternalDATA:
@$(NORMAL_UNINSTALL)
@list='$(toolexeclibgotestinginternal_DATA)'; test -n "$(toolexeclibgotestinginternaldir)" || list=; \
files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
dir='$(DESTDIR)$(toolexeclibgotestinginternaldir)'; $(am__uninstall_files_from_dir)
install-toolexeclibgotextDATA: $(toolexeclibgotext_DATA) install-toolexeclibgotextDATA: $(toolexeclibgotext_DATA)
@$(NORMAL_INSTALL) @$(NORMAL_INSTALL)
@list='$(toolexeclibgotext_DATA)'; test -n "$(toolexeclibgotextdir)" || list=; \ @list='$(toolexeclibgotext_DATA)'; test -n "$(toolexeclibgotextdir)" || list=; \
...@@ -2849,7 +2876,7 @@ all-am: Makefile $(LIBRARIES) $(LTLIBRARIES) all-multi $(DATA) \ ...@@ -2849,7 +2876,7 @@ all-am: Makefile $(LIBRARIES) $(LTLIBRARIES) all-multi $(DATA) \
config.h config.h
installdirs: installdirs-recursive installdirs: installdirs-recursive
installdirs-am: installdirs-am:
for dir in "$(DESTDIR)$(toolexeclibdir)" "$(DESTDIR)$(toolexeclibdir)" "$(DESTDIR)$(toolexeclibgodir)" "$(DESTDIR)$(toolexeclibgoarchivedir)" "$(DESTDIR)$(toolexeclibgocompressdir)" "$(DESTDIR)$(toolexeclibgocontainerdir)" "$(DESTDIR)$(toolexeclibgocryptodir)" "$(DESTDIR)$(toolexeclibgocryptox509dir)" "$(DESTDIR)$(toolexeclibgodatabasedir)" "$(DESTDIR)$(toolexeclibgodatabasesqldir)" "$(DESTDIR)$(toolexeclibgodebugdir)" "$(DESTDIR)$(toolexeclibgoencodingdir)" "$(DESTDIR)$(toolexeclibgoexpdir)" "$(DESTDIR)$(toolexeclibgogodir)" "$(DESTDIR)$(toolexeclibgohashdir)" "$(DESTDIR)$(toolexeclibgohtmldir)" "$(DESTDIR)$(toolexeclibgoimagedir)" "$(DESTDIR)$(toolexeclibgoimagecolordir)" "$(DESTDIR)$(toolexeclibgoindexdir)" "$(DESTDIR)$(toolexeclibgoiodir)" "$(DESTDIR)$(toolexeclibgologdir)" "$(DESTDIR)$(toolexeclibgomathdir)" "$(DESTDIR)$(toolexeclibgomimedir)" "$(DESTDIR)$(toolexeclibgonetdir)" "$(DESTDIR)$(toolexeclibgonethttpdir)" "$(DESTDIR)$(toolexeclibgonetrpcdir)" "$(DESTDIR)$(toolexeclibgoosdir)" "$(DESTDIR)$(toolexeclibgopathdir)" "$(DESTDIR)$(toolexeclibgoregexpdir)" "$(DESTDIR)$(toolexeclibgoruntimedir)" "$(DESTDIR)$(toolexeclibgosyncdir)" "$(DESTDIR)$(toolexeclibgotestingdir)" "$(DESTDIR)$(toolexeclibgotextdir)" "$(DESTDIR)$(toolexeclibgotexttemplatedir)" "$(DESTDIR)$(toolexeclibgounicodedir)"; do \ for dir in "$(DESTDIR)$(toolexeclibdir)" "$(DESTDIR)$(toolexeclibdir)" "$(DESTDIR)$(toolexeclibgodir)" "$(DESTDIR)$(toolexeclibgoarchivedir)" "$(DESTDIR)$(toolexeclibgocompressdir)" "$(DESTDIR)$(toolexeclibgocontainerdir)" "$(DESTDIR)$(toolexeclibgocryptodir)" "$(DESTDIR)$(toolexeclibgocryptox509dir)" "$(DESTDIR)$(toolexeclibgodatabasedir)" "$(DESTDIR)$(toolexeclibgodatabasesqldir)" "$(DESTDIR)$(toolexeclibgodebugdir)" "$(DESTDIR)$(toolexeclibgoencodingdir)" "$(DESTDIR)$(toolexeclibgoexpdir)" "$(DESTDIR)$(toolexeclibgogodir)" "$(DESTDIR)$(toolexeclibgohashdir)" "$(DESTDIR)$(toolexeclibgohtmldir)" "$(DESTDIR)$(toolexeclibgoimagedir)" "$(DESTDIR)$(toolexeclibgoimagecolordir)" "$(DESTDIR)$(toolexeclibgoindexdir)" "$(DESTDIR)$(toolexeclibgoiodir)" "$(DESTDIR)$(toolexeclibgologdir)" "$(DESTDIR)$(toolexeclibgomathdir)" "$(DESTDIR)$(toolexeclibgomimedir)" "$(DESTDIR)$(toolexeclibgonetdir)" "$(DESTDIR)$(toolexeclibgonethttpdir)" "$(DESTDIR)$(toolexeclibgonetrpcdir)" "$(DESTDIR)$(toolexeclibgoosdir)" "$(DESTDIR)$(toolexeclibgopathdir)" "$(DESTDIR)$(toolexeclibgoregexpdir)" "$(DESTDIR)$(toolexeclibgoruntimedir)" "$(DESTDIR)$(toolexeclibgosyncdir)" "$(DESTDIR)$(toolexeclibgotestingdir)" "$(DESTDIR)$(toolexeclibgotestinginternaldir)" "$(DESTDIR)$(toolexeclibgotextdir)" "$(DESTDIR)$(toolexeclibgotexttemplatedir)" "$(DESTDIR)$(toolexeclibgounicodedir)"; do \
test -z "$$dir" || $(MKDIR_P) "$$dir"; \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
done done
install: install-recursive install: install-recursive
...@@ -2935,7 +2962,9 @@ install-exec-am: install-multi install-toolexeclibLIBRARIES \ ...@@ -2935,7 +2962,9 @@ install-exec-am: install-multi install-toolexeclibLIBRARIES \
install-toolexeclibgonetrpcDATA install-toolexeclibgoosDATA \ install-toolexeclibgonetrpcDATA install-toolexeclibgoosDATA \
install-toolexeclibgopathDATA install-toolexeclibgoregexpDATA \ install-toolexeclibgopathDATA install-toolexeclibgoregexpDATA \
install-toolexeclibgoruntimeDATA install-toolexeclibgosyncDATA \ install-toolexeclibgoruntimeDATA install-toolexeclibgosyncDATA \
install-toolexeclibgotestingDATA install-toolexeclibgotextDATA \ install-toolexeclibgotestingDATA \
install-toolexeclibgotestinginternalDATA \
install-toolexeclibgotextDATA \
install-toolexeclibgotexttemplateDATA \ install-toolexeclibgotexttemplateDATA \
install-toolexeclibgounicodeDATA install-toolexeclibgounicodeDATA
...@@ -3005,6 +3034,7 @@ uninstall-am: uninstall-toolexeclibLIBRARIES \ ...@@ -3005,6 +3034,7 @@ uninstall-am: uninstall-toolexeclibLIBRARIES \
uninstall-toolexeclibgoruntimeDATA \ uninstall-toolexeclibgoruntimeDATA \
uninstall-toolexeclibgosyncDATA \ uninstall-toolexeclibgosyncDATA \
uninstall-toolexeclibgotestingDATA \ uninstall-toolexeclibgotestingDATA \
uninstall-toolexeclibgotestinginternalDATA \
uninstall-toolexeclibgotextDATA \ uninstall-toolexeclibgotextDATA \
uninstall-toolexeclibgotexttemplateDATA \ uninstall-toolexeclibgotexttemplateDATA \
uninstall-toolexeclibgounicodeDATA uninstall-toolexeclibgounicodeDATA
...@@ -3046,7 +3076,9 @@ uninstall-am: uninstall-toolexeclibLIBRARIES \ ...@@ -3046,7 +3076,9 @@ uninstall-am: uninstall-toolexeclibLIBRARIES \
install-toolexeclibgonetrpcDATA install-toolexeclibgoosDATA \ install-toolexeclibgonetrpcDATA install-toolexeclibgoosDATA \
install-toolexeclibgopathDATA install-toolexeclibgoregexpDATA \ install-toolexeclibgopathDATA install-toolexeclibgoregexpDATA \
install-toolexeclibgoruntimeDATA install-toolexeclibgosyncDATA \ install-toolexeclibgoruntimeDATA install-toolexeclibgosyncDATA \
install-toolexeclibgotestingDATA install-toolexeclibgotextDATA \ install-toolexeclibgotestingDATA \
install-toolexeclibgotestinginternalDATA \
install-toolexeclibgotextDATA \
install-toolexeclibgotexttemplateDATA \ install-toolexeclibgotexttemplateDATA \
install-toolexeclibgounicodeDATA installcheck installcheck-am \ install-toolexeclibgounicodeDATA installcheck installcheck-am \
installdirs installdirs-am maintainer-clean \ installdirs installdirs-am maintainer-clean \
...@@ -3080,6 +3112,7 @@ uninstall-am: uninstall-toolexeclibLIBRARIES \ ...@@ -3080,6 +3112,7 @@ uninstall-am: uninstall-toolexeclibLIBRARIES \
uninstall-toolexeclibgoruntimeDATA \ uninstall-toolexeclibgoruntimeDATA \
uninstall-toolexeclibgosyncDATA \ uninstall-toolexeclibgosyncDATA \
uninstall-toolexeclibgotestingDATA \ uninstall-toolexeclibgotestingDATA \
uninstall-toolexeclibgotestinginternalDATA \
uninstall-toolexeclibgotextDATA \ uninstall-toolexeclibgotextDATA \
uninstall-toolexeclibgotexttemplateDATA \ uninstall-toolexeclibgotexttemplateDATA \
uninstall-toolexeclibgounicodeDATA uninstall-toolexeclibgounicodeDATA
......
...@@ -43,6 +43,9 @@ import ( ...@@ -43,6 +43,9 @@ import (
//go:linkname runqempty runtime.runqempty //go:linkname runqempty runtime.runqempty
//go:linkname runqput runtime.runqput //go:linkname runqput runtime.runqput
// Function called by misc/cgo/test.
//go:linkname lockedOSThread runtime.lockedOSThread
// Functions temporarily in C that have not yet been ported. // Functions temporarily in C that have not yet been ported.
func allocm(*p, bool, *unsafe.Pointer, *uintptr) *m func allocm(*p, bool, *unsafe.Pointer, *uintptr) *m
func malg(bool, bool, *unsafe.Pointer, *uintptr) *g func malg(bool, bool, *unsafe.Pointer, *uintptr) *g
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
#include <errno.h>
#include <limits.h> #include <limits.h>
#include <signal.h> #include <signal.h>
#include <stdlib.h> #include <stdlib.h>
...@@ -216,6 +217,7 @@ runtime_newosproc(M *mp) ...@@ -216,6 +217,7 @@ runtime_newosproc(M *mp)
pthread_attr_t attr; pthread_attr_t attr;
sigset_t clear, old; sigset_t clear, old;
pthread_t tid; pthread_t tid;
int tries;
int ret; int ret;
if(pthread_attr_init(&attr) != 0) if(pthread_attr_init(&attr) != 0)
...@@ -234,11 +236,21 @@ runtime_newosproc(M *mp) ...@@ -234,11 +236,21 @@ runtime_newosproc(M *mp)
sigemptyset(&old); sigemptyset(&old);
pthread_sigmask(SIG_BLOCK, &clear, &old); pthread_sigmask(SIG_BLOCK, &clear, &old);
ret = pthread_create(&tid, &attr, runtime_mstart, mp);
for (tries = 0; tries < 20; tries++) {
ret = pthread_create(&tid, &attr, runtime_mstart, mp);
if (ret != EAGAIN) {
break;
}
runtime_usleep((tries + 1) * 1000); // Milliseconds.
}
pthread_sigmask(SIG_SETMASK, &old, nil); pthread_sigmask(SIG_SETMASK, &old, nil);
if (ret != 0) if (ret != 0) {
runtime_printf("pthread_create failed: %d\n", ret);
runtime_throw("pthread_create"); runtime_throw("pthread_create");
}
} }
// First function run by a new goroutine. This replaces gogocall. // First function run by a new goroutine. This replaces gogocall.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment