I applied this diff, rebooted and successfully built lang/go, but I seem
to be running into some pretty strange issues trying to go programs.  

Perhaps I did something wrong.. but every time I try to compile the
below I get: "/usr/local/bin/go[1]: syntax error: `(' unexpected"

package main

import "fmt"

func main{
  fmt.Println("hello world")
}

gofmt of the file containing above code results in:
"/usr/local/bin/gofmt[1]: syntax error: `^W^Z4' unexpected"

On Thu, Sep 13, 2012 at 04:10:31PM -0700, Matthew Dempsky wrote:
> On Thu, Sep 13, 2012 at 11:26:39PM +0100, Stuart Henderson wrote:
> > Seeing this repeatably fail in my current i386 build, the go port hasn't
> > changed, anyone have an idea what might be doing it?
> 
> As mentioned on icb, the Go linker doesn't set a PT_NOTE segment for
> OpenBSD identification like it does for NetBSD executables.  However,
> it does set EI_OSABI to ELFOSABI_OPENBSD, and it probably wouldn't
> hurt for the kernel to skip the PT_NOTE check in that case.
> 
> Please try this diff to see if it fixes lang/go.  (Sorry, untested.)
> 
> 
> Index: exec_elf.c
> ===================================================================
> RCS file: /cvs/src/sys/kern/exec_elf.c,v
> retrieving revision 1.88
> diff -u -p -r1.88 exec_elf.c
> --- exec_elf.c        11 Sep 2012 15:44:19 -0000      1.88
> +++ exec_elf.c        13 Sep 2012 23:07:36 -0000
> @@ -592,7 +592,8 @@ ELFNAME2(exec,makecmds)(struct proc *p, 
>        * set the ep_emul field in the exec package structure.
>        */
>       error = ENOEXEC;
> -     if (ELFNAME(os_pt_note)(p, epp, epp->ep_hdr, "OpenBSD", 8, 4) != 0) {
> +     if (eh->e_ident[EI_OSABI] != ELFOSABI_OPENBSD &&
> +         ELFNAME(os_pt_note)(p, epp, epp->ep_hdr, "OpenBSD", 8, 4) != 0) {
>               for (i = 0; ELFNAME(probes)[i].func != NULL && error; i++)
>                       error = (*ELFNAME(probes)[i].func)(p, epp, interp, 
> &pos);
>               if (error)
> 

Reply via email to