summaryrefslogtreecommitdiff
path: root/libgo
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@gcc.gnu.org>2013-11-24 02:38:28 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2013-11-24 02:38:28 +0000
commit6b05faddf0bd5e2639b6090b99d2b0186f5e6e31 (patch)
treeb799566fc3e96ceed28ddd0fcb8b09f6d0f4c4de /libgo
parent473f48333b6f0a6fd348bab83a647a5ef4635246 (diff)
syscall: Only call varargs libc functions from C code.
From-SVN: r205321
Diffstat (limited to 'libgo')
-rw-r--r--libgo/Makefile.am1
-rw-r--r--libgo/Makefile.in17
-rw-r--r--libgo/config.h.in3
-rwxr-xr-xlibgo/configure2
-rw-r--r--libgo/configure.ac2
-rw-r--r--libgo/go/syscall/exec_unix.go2
-rw-r--r--libgo/go/syscall/libcall_linux.go2
-rw-r--r--libgo/go/syscall/libcall_posix.go2
-rw-r--r--libgo/go/syscall/libcall_posix_largefile.go2
-rw-r--r--libgo/go/syscall/libcall_posix_regfile.go2
-rw-r--r--libgo/runtime/go-varargs.c47
11 files changed, 71 insertions, 11 deletions
diff --git a/libgo/Makefile.am b/libgo/Makefile.am
index 92fe175cd78..0851b71e02e 100644
--- a/libgo/Makefile.am
+++ b/libgo/Makefile.am
@@ -488,6 +488,7 @@ runtime_files = \
runtime/go-unsafe-newarray.c \
runtime/go-unsafe-pointer.c \
runtime/go-unwind.c \
+ runtime/go-varargs.c \
runtime/chan.c \
runtime/cpuprof.c \
runtime/env_posix.c \
diff --git a/libgo/Makefile.in b/libgo/Makefile.in
index edbc2e1ff8a..ca9df103620 100644
--- a/libgo/Makefile.in
+++ b/libgo/Makefile.in
@@ -212,10 +212,10 @@ am__objects_6 = go-append.lo go-assert.lo go-assert-interface.lo \
go-type-float.lo go-type-identity.lo go-type-interface.lo \
go-type-string.lo go-typedesc-equal.lo go-typestring.lo \
go-unsafe-new.lo go-unsafe-newarray.lo go-unsafe-pointer.lo \
- go-unwind.lo chan.lo cpuprof.lo env_posix.lo lfstack.lo \
- $(am__objects_1) mcache.lo mcentral.lo $(am__objects_2) \
- mfinal.lo mfixalloc.lo mgc0.lo mheap.lo msize.lo \
- $(am__objects_3) panic.lo parfor.lo print.lo proc.lo \
+ go-unwind.lo go-varargs.lo chan.lo cpuprof.lo env_posix.lo \
+ lfstack.lo $(am__objects_1) mcache.lo mcentral.lo \
+ $(am__objects_2) mfinal.lo mfixalloc.lo mgc0.lo mheap.lo \
+ msize.lo $(am__objects_3) panic.lo parfor.lo print.lo proc.lo \
runtime.lo signal_unix.lo thread.lo yield.lo $(am__objects_4) \
iface.lo malloc.lo map.lo mprof.lo netpoll.lo reflect.lo \
runtime1.lo sema.lo sigqueue.lo string.lo time.lo \
@@ -819,6 +819,7 @@ runtime_files = \
runtime/go-unsafe-newarray.c \
runtime/go-unsafe-pointer.c \
runtime/go-unwind.c \
+ runtime/go-varargs.c \
runtime/chan.c \
runtime/cpuprof.c \
runtime/env_posix.c \
@@ -2451,6 +2452,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/go-unsafe-newarray.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/go-unsafe-pointer.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/go-unwind.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/go-varargs.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/iface.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lfstack.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lock_futex.Plo@am__quote@
@@ -2979,6 +2981,13 @@ go-unwind.lo: runtime/go-unwind.c
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o go-unwind.lo `test -f 'runtime/go-unwind.c' || echo '$(srcdir)/'`runtime/go-unwind.c
+go-varargs.lo: runtime/go-varargs.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT go-varargs.lo -MD -MP -MF $(DEPDIR)/go-varargs.Tpo -c -o go-varargs.lo `test -f 'runtime/go-varargs.c' || echo '$(srcdir)/'`runtime/go-varargs.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/go-varargs.Tpo $(DEPDIR)/go-varargs.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='runtime/go-varargs.c' object='go-varargs.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o go-varargs.lo `test -f 'runtime/go-varargs.c' || echo '$(srcdir)/'`runtime/go-varargs.c
+
chan.lo: runtime/chan.c
@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT chan.lo -MD -MP -MF $(DEPDIR)/chan.Tpo -c -o chan.lo `test -f 'runtime/chan.c' || echo '$(srcdir)/'`runtime/chan.c
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/chan.Tpo $(DEPDIR)/chan.Plo
diff --git a/libgo/config.h.in b/libgo/config.h.in
index 8af626d6208..73854351c76 100644
--- a/libgo/config.h.in
+++ b/libgo/config.h.in
@@ -177,6 +177,9 @@
/* Define to 1 if the system has the type `off64_t'. */
#undef HAVE_OFF64_T
+/* Define to 1 if you have the `open64' function. */
+#undef HAVE_OPEN64
+
/* Define to 1 if you have the `openat' function. */
#undef HAVE_OPENAT
diff --git a/libgo/configure b/libgo/configure
index 62082dc6f1f..46bb6066fb3 100755
--- a/libgo/configure
+++ b/libgo/configure
@@ -14718,7 +14718,7 @@ else
fi
-for ac_func in accept4 dup3 epoll_create1 faccessat fallocate fchmodat fchownat futimesat getxattr inotify_add_watch inotify_init inotify_init1 inotify_rm_watch listxattr mkdirat mknodat openat pipe2 removexattr renameat setxattr sync_file_range splice tee unlinkat unshare utimensat
+for ac_func in accept4 dup3 epoll_create1 faccessat fallocate fchmodat fchownat futimesat getxattr inotify_add_watch inotify_init inotify_init1 inotify_rm_watch listxattr mkdirat mknodat open64 openat pipe2 removexattr renameat setxattr sync_file_range splice tee unlinkat unshare utimensat
do :
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
diff --git a/libgo/configure.ac b/libgo/configure.ac
index 0ffcaf9af03..b43a1580749 100644
--- a/libgo/configure.ac
+++ b/libgo/configure.ac
@@ -506,7 +506,7 @@ AC_CHECK_FUNCS(strerror_r strsignal wait4 mincore setenv dl_iterate_phdr)
AM_CONDITIONAL(HAVE_STRERROR_R, test "$ac_cv_func_strerror_r" = yes)
AM_CONDITIONAL(HAVE_WAIT4, test "$ac_cv_func_wait4" = yes)
-AC_CHECK_FUNCS(accept4 dup3 epoll_create1 faccessat fallocate fchmodat fchownat futimesat getxattr inotify_add_watch inotify_init inotify_init1 inotify_rm_watch listxattr mkdirat mknodat openat pipe2 removexattr renameat setxattr sync_file_range splice tee unlinkat unshare utimensat)
+AC_CHECK_FUNCS(accept4 dup3 epoll_create1 faccessat fallocate fchmodat fchownat futimesat getxattr inotify_add_watch inotify_init inotify_init1 inotify_rm_watch listxattr mkdirat mknodat open64 openat pipe2 removexattr renameat setxattr sync_file_range splice tee unlinkat unshare utimensat)
AC_TYPE_OFF_T
AC_CHECK_TYPES([loff_t])
diff --git a/libgo/go/syscall/exec_unix.go b/libgo/go/syscall/exec_unix.go
index c31b8d5c4f6..0cfedb71cf6 100644
--- a/libgo/go/syscall/exec_unix.go
+++ b/libgo/go/syscall/exec_unix.go
@@ -30,7 +30,7 @@ import (
//chdir(path *byte) _C_int
//sysnb raw_fcntl(fd int, cmd int, arg int) (val int, err Errno)
-//fcntl(fd _C_int, cmd _C_int, arg _C_int) _C_int
+//__go_fcntl(fd _C_int, cmd _C_int, arg _C_int) _C_int
//sysnb raw_close(fd int) (err Errno)
//close(fd _C_int) _C_int
diff --git a/libgo/go/syscall/libcall_linux.go b/libgo/go/syscall/libcall_linux.go
index 60eecd9ef89..d5bedd06aac 100644
--- a/libgo/go/syscall/libcall_linux.go
+++ b/libgo/go/syscall/libcall_linux.go
@@ -9,7 +9,7 @@ package syscall
import "unsafe"
//sys Openat(dirfd int, path string, flags int, mode uint32) (fd int, err error)
-//openat(dirfd _C_int, path *byte, flags _C_int, mode Mode_t) _C_int
+//__go_openat(dirfd _C_int, path *byte, flags _C_int, mode Mode_t) _C_int
//sys futimesat(dirfd int, path *byte, times *[2]Timeval) (err error)
//futimesat(dirfd _C_int, path *byte, times *[2]Timeval) _C_int
diff --git a/libgo/go/syscall/libcall_posix.go b/libgo/go/syscall/libcall_posix.go
index 91ff59b6cfa..8f5b0207583 100644
--- a/libgo/go/syscall/libcall_posix.go
+++ b/libgo/go/syscall/libcall_posix.go
@@ -206,7 +206,7 @@ func FDZero(set *FdSet) {
//fchown(fd _C_int, uid Uid_t, gid Gid_t) _C_int
//sys fcntl(fd int, cmd int, arg int) (val int, err error)
-//fcntl(fd _C_int, cmd _C_int, arg _C_int) _C_int
+//__go_fcntl(fd _C_int, cmd _C_int, arg _C_int) _C_int
//sys Fdatasync(fd int) (err error)
//fdatasync(fd _C_int) _C_int
diff --git a/libgo/go/syscall/libcall_posix_largefile.go b/libgo/go/syscall/libcall_posix_largefile.go
index 1ad76920474..fced6e57dde 100644
--- a/libgo/go/syscall/libcall_posix_largefile.go
+++ b/libgo/go/syscall/libcall_posix_largefile.go
@@ -19,7 +19,7 @@ package syscall
//mmap64(addr *byte, length Size_t, prot _C_int, flags _C_int, fd _C_int, offset Offset_t) *byte
//sys Open(path string, mode int, perm uint32) (fd int, err error)
-//open64(path *byte, mode _C_int, perm Mode_t) _C_int
+//__go_open64(path *byte, mode _C_int, perm Mode_t) _C_int
//sys Pread(fd int, p []byte, offset int64) (n int, err error)
//pread64(fd _C_int, buf *byte, count Size_t, offset Offset_t) Ssize_t
diff --git a/libgo/go/syscall/libcall_posix_regfile.go b/libgo/go/syscall/libcall_posix_regfile.go
index 5766e0c15f8..6c98e29873c 100644
--- a/libgo/go/syscall/libcall_posix_regfile.go
+++ b/libgo/go/syscall/libcall_posix_regfile.go
@@ -20,7 +20,7 @@ package syscall
//mmap(addr *byte, length Size_t, prot _C_int, flags _C_int, fd _C_int, offset Offset_t) *byte
//sys Open(path string, mode int, perm uint32) (fd int, err error)
-//open(path *byte, mode _C_int, perm Mode_t) _C_int
+//__go_open(path *byte, mode _C_int, perm Mode_t) _C_int
//sys Pread(fd int, p []byte, offset int64) (n int, err error)
//pread(fd _C_int, buf *byte, count Size_t, offset Offset_t) Ssize_t
diff --git a/libgo/runtime/go-varargs.c b/libgo/runtime/go-varargs.c
new file mode 100644
index 00000000000..682c08d64d4
--- /dev/null
+++ b/libgo/runtime/go-varargs.c
@@ -0,0 +1,47 @@
+/* go-varargs.c -- functions for calling C varargs functions.
+
+ Copyright 2013 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. */
+
+#include "config.h"
+
+#include <sys/types.h>
+#include <fcntl.h>
+
+/* The syscall package calls C functions. The Go compiler can not
+ represent a C varargs functions. On some systems it's important
+ that the declaration of a function match the call. This function
+ holds non-varargs C functions that the Go code can call. */
+
+int
+__go_open (char *path, int mode, mode_t perm)
+{
+ return open (path, mode, perm);
+}
+
+int
+__go_fcntl (int fd, int cmd, int arg)
+{
+ return fcntl (fd, cmd, arg);
+}
+
+#ifdef HAVE_OPEN64
+
+int
+__go_open64 (char *path, int mode, mode_t perm)
+{
+ return open64 (path, mode, perm);
+}
+
+#endif
+
+#ifdef HAVE_OPENAT
+
+int
+__go_openat (int fd, char *path, int flags, mode_t mode)
+{
+ return openat (fd, path, flags, mode);
+}
+
+#endif