]> Cypherpunks.ru repositories - gostls13.git/commitdiff
[dev.regabi] all: merge master (fca94ab) into dev.regabi
authorRobert Griesemer <gri@golang.org>
Tue, 2 Feb 2021 18:27:02 +0000 (10:27 -0800)
committerRobert Griesemer <gri@golang.org>
Tue, 2 Feb 2021 18:27:02 +0000 (10:27 -0800)
Conflicts:

- src/syscall/mksyscall.pl

Merge List:

+ 2021-02-02 fca94ab3ab spec: improve the example in Type assertions section
+ 2021-02-02 98f8454a73 cmd/link: don't decode type symbol in shared library in deadcode
+ 2021-02-02 1426a571b7 cmd/link: fix off-by-1 error in findShlibSection
+ 2021-02-01 32e789f4fb test: fix incorrectly laid out instructions in issue11656.go
+ 2021-02-01 0b6cfea634 doc/go1.16: document that on OpenBSD syscalls are now made through libc
+ 2021-02-01 26e29aa15a cmd/link: disable TestPIESize if CGO isn't enabled
+ 2021-02-01 6ac91e460c doc/go1.16: minor markup fixes
+ 2021-01-29 44361140c0 embed: update docs for proposal tweaks
+ 2021-01-29 68058edc39 runtime: document pointer write atomicity for memclrNoHeapPointers
+ 2021-01-28 c8bd8010ff syscall: generate readlen/writelen for openbsd libc
+ 2021-01-28 41bb49b878 cmd/go: revert TestScript/build_trimpath to use ioutil.ReadFile
+ 2021-01-28 725a642c2d runtime: correct syscall10/syscall10X on openbsd/amd64
+ 2021-01-28 4b068cafb5 doc/go1.16: document go/build/constraint package
+ 2021-01-28 376518d77f runtime,syscall: convert syscall on openbsd/arm64 to libc
+ 2021-01-27 00f2ff5c94 api/go1.16: add go/build/constraint APIs
+ 2021-01-27 35334caf18 crypto/x509: remove leftover CertificateRequest field
+ 2021-01-27 a5a5e2c968 runtime: make sure to remove open-coded defer entries in all cases after a recover
+ 2021-01-27 8cfa01943a runtime: block console ctrlhandler when the signal is handled
+ 2021-01-27 ff9e8364c6 cmd/go: skip issue33139 when the 'cc' script command is unavailable
+ 2021-01-27 cd176b3615 runtime: switch runtime to libc for openbsd/arm64
+ 2021-01-27 6c8fbfbdcf runtime: convert openbsd/arm64 locking to libc
+ 2021-01-27 5cdf0da1bf syscall: clean up mkasm related changes
+ 2021-01-27 210f70e298 doc/go1.16: fix closing brace in .Export format
+ 2021-01-27 0f797f168d math: fix typo in sqrt.go code comment
+ 2021-01-26 8634a234df runtime,syscall: convert syscall on openbsd/amd64 to libc
+ 2021-01-26 1d5e14632e os: further document limitations around naked file descriptors
+ 2021-01-26 cf263e9f77 os: correct names in CreateTemp and MkdirTemp doc comments
+ 2021-01-26 ce8b318624 net/http/fcgi: remove locking added to prevent a test-only race

Change-Id: I9e89df040dfbbeb50f4ce653a8da437cb72b3ef9

1  2 
src/embed/embed.go
src/syscall/mksyscall.pl

diff --combined src/embed/embed.go
index 26c3f2d60429ae0348c8d8e0ff3da265d6239c6a,f12bf31e767c01c200066211cce9c69daf13f8a6..5f984aaf71d285cecceb00ccd928b85a62a3dad1
@@@ -9,18 -9,28 +9,28 @@@
  // files read from the package directory or subdirectories at compile time.
  //
  // For example, here are three ways to embed a file named hello.txt
- // and then print its contents at run time:
+ // and then print its contents at run time.
  //
- //    import "embed"
+ // Embedding one file into a string:
+ //
+ //    import _ "embed"
  //
  //    //go:embed hello.txt
  //    var s string
  //    print(s)
  //
+ // Embedding one file into a slice of bytes:
+ //
+ //    import _ "embed"
+ //
  //    //go:embed hello.txt
  //    var b []byte
  //    print(string(b))
  //
+ // Embedded one or more files into a file system:
+ //
+ //    import "embed"
+ //
  //    //go:embed hello.txt
  //    var f embed.FS
  //    data, _ := f.ReadFile("hello.txt")
@@@ -34,8 -44,8 +44,8 @@@
  // The directive must immediately precede a line containing the declaration of a single variable.
  // Only blank lines and ‘//’ line comments are permitted between the directive and the declaration.
  //
- // The variable must be of type string, []byte, or FS exactly. Named types or type aliases
- // derived from those types are not allowed.
+ // The type of the variable must be a string type, or a slice of a byte type,
+ // or FS (or an alias of FS).
  //
  // For example:
  //
@@@ -70,8 -80,8 +80,8 @@@
  //
  // The //go:embed directive can be used with both exported and unexported variables,
  // depending on whether the package wants to make the data available to other packages.
- // Similarly, it can be used with both global and function-local variables,
- // depending on what is more convenient in context.
+ // It can only be used with global variables at package scope,
+ // not with local variables.
  //
  // Patterns must not match files outside the package's module, such as ‘.git/*’ or symbolic links.
  // Matches for empty directories are ignored. After that, each pattern in a //go:embed line
@@@ -133,7 -143,7 +143,7 @@@ import 
  // See the package documentation for more details about initializing an FS.
  type FS struct {
        // The compiler knows the layout of this struct.
 -      // See cmd/compile/internal/gc's initEmbed.
 +      // See cmd/compile/internal/staticdata's WriteEmbed.
        //
        // The files list is sorted by name but not by simple string comparison.
        // Instead, each file's name takes the form "dir/elem" or "dir/elem/".
@@@ -203,7 -213,7 +213,7 @@@ var 
  // It implements fs.FileInfo and fs.DirEntry.
  type file struct {
        // The compiler knows the layout of this struct.
 -      // See cmd/compile/internal/gc's initEmbed.
 +      // See cmd/compile/internal/staticdata's WriteEmbed.
        name string
        data string
        hash [16]byte // truncated SHA256 hash
diff --combined src/syscall/mksyscall.pl
index 26c93ffe5b5ab290995651539f39e3dd69fb457e,67e8d1d99efc02c93488dbea947ebd81c2a498a6..c1ed3a35d97705be137057129000cc13aaadf3ae
@@@ -30,6 -30,7 +30,7 @@@ my $openbsd = 0
  my $netbsd = 0;
  my $dragonfly = 0;
  my $arm = 0; # 64-bit value should use (even, odd)-pair
+ my $libc = 0;
  my $tags = "";  # build tags
  
  if($ARGV[0] eq "-b32") {
@@@ -45,6 -46,7 +46,7 @@@ if($ARGV[0] eq "-plan9") 
  }
  if($ARGV[0] eq "-darwin") {
        $darwin = 1;
+       $libc = 1;
        shift;
  }
  if($ARGV[0] eq "-openbsd") {
@@@ -63,6 -65,10 +65,10 @@@ if($ARGV[0] eq "-arm") 
        $arm = 1;
        shift;
  }
+ if($ARGV[0] eq "-libc") {
+       $libc = 1;
+       shift;
+ }
  if($ARGV[0] eq "-tags") {
        shift;
        $tags = $ARGV[0];
@@@ -125,7 -131,7 +131,7 @@@ while(<>) 
        # without reading the header.
        $text .= "// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT\n\n";
  
-       if ($darwin && $func eq "ptrace1") {
+       if (($darwin || ($openbsd && $libc)) && $func eq "ptrace") {
                # The ptrace function is called from forkAndExecInChild where stack
                # growth is forbidden.
                $text .= "//go:nosplit\n"
                        push @args, "uintptr(_p$n)", "uintptr(len($name))";
                        $n++;
                } elsif($type eq "int64" && ($openbsd || $netbsd)) {
-                       push @args, "0";
+                       if (!$libc) {
+                               push @args, "0";
+                       }
                        if($_32bit eq "big-endian") {
                                push @args, "uintptr($name>>32)", "uintptr($name)";
                        } elsif($_32bit eq "little-endian") {
                        $asm = "RawSyscall";
                }
        }
-       if ($darwin) {
+       if ($libc) {
                # Call unexported syscall functions (which take
                # libc functions instead of syscall numbers).
                $asm = lcfirst($asm);
                print STDERR "$ARGV:$.: too many arguments to system call\n";
        }
  
-       if ($darwin) {
+       if ($darwin || ($openbsd && $libc)) {
                # Use extended versions for calls that generate a 64-bit result.
                my ($name, $type) = parseparam($out[0]);
                if ($type eq "int64" || ($type eq "uintptr" && $_32bit eq "")) {
                $sysname = "SYS_$func";
                $sysname =~ s/([a-z])([A-Z])/${1}_$2/g; # turn FooBar into Foo_Bar
                $sysname =~ y/a-z/A-Z/;
-               if($darwin) {
+               if($libc) {
                        $sysname =~ y/A-Z/a-z/;
                        $sysname = substr $sysname, 4;
                        $funcname = "libc_$sysname";
                }
        }
-       if($darwin) {
+       if($libc) {
                if($funcname eq "") {
                        $sysname = substr $sysname, 4;
                        $funcname = "libc_$sysname";
        }
        $text .= "\treturn\n";
        $text .= "}\n\n";
-       if($darwin) {
+       if($libc) {
                if (not exists $trampolines{$funcname}) {
                        $trampolines{$funcname} = 1;
                        # The assembly trampoline that jumps to the libc routine.
                        $text .= "func ${funcname}_trampoline()\n";
 -                      # Map syscall.funcname to just plain funcname.
 -                      # (The jump to this function is in the assembly trampoline, generated by mkasm.go.)
 -                      $text .= "//go:linkname $funcname $funcname\n";
                        # Tell the linker that funcname can be found in libSystem using varname without the libc_ prefix.
                        my $basename = substr $funcname, 5;
-                       $text .= "//go:cgo_import_dynamic $funcname $basename \"/usr/lib/libSystem.B.dylib\"\n\n";
+                       my $libc = "libc.so";
+                       if ($darwin) {
+                               $libc = "/usr/lib/libSystem.B.dylib";
+                       }
+                       $text .= "//go:cgo_import_dynamic $funcname $basename \"$libc\"\n\n";
                }
        }
  }