Bug 242889

Summary: editors/micro: fix build on aarch64
Product: Ports & Packages Reporter: Mikael Urankar <mikael>
Component: Individual Port(s)Assignee: Steve Wills <swills>
Status: Closed FIXED    
Severity: Affects Many People CC: dmgk, mikael
Priority: --- Flags: bugzilla: maintainer-feedback? (swills)
Version: Latest   
Hardware: arm64   
OS: Any   
Bug Depends on:    
Bug Blocks: 242312    
Attachments:
Description Flags
patch
none
patch none

Description Mikael Urankar freebsd_committer freebsd_triage 2019-12-26 09:48:11 UTC
Created attachment 210232 [details]
patch

http://thunderx1.nyi.freebsd.org/data/head-arm64-default/p520537_s355573/logs/errors/micro-1.4.1.log

# github.com/zyedidia/micro/vendor/github.com/zyedidia/pty
vendor/github.com/zyedidia/pty/pty_freebsd.go:50:20: undefined: fiodgnameArg
vendor/github.com/zyedidia/pty/pty_freebsd.go:63:12: undefined: _C_SPECNAMELEN
vendor/github.com/zyedidia/pty/pty_freebsd.go:66:9: undefined: fiodgnameArg

see attached patch
Comment 1 Dmitri Goutnik freebsd_committer freebsd_triage 2019-12-26 13:38:49 UTC
(In reply to mikael.urankar from comment #0)
I don't think fiodgnameArg needs additional padding, go implicitly aligns Buf to 8-byte boundary on aarch64:

$ cat fiodgname_arg.c
#include <stdio.h>
#include <stddef.h>
#include <sys/filio.h>

int main(int argc, char *argv[])
{
        printf("len: %zu\n", offsetof(struct fiodgname_arg, len));
        printf("buf: %zu\n", offsetof(struct fiodgname_arg, buf));
}

$ cc -o fiodgname_arg fiodgname_arg.c && ./fiodgname_arg
len: 0
buf: 8

$ cat fiodgname_arg.go
package main

import (
        "fmt"
        "unsafe"
)

type fiodgnameArg struct {
        Len int32
        Buf *byte
}

func main() {
        x := fiodgnameArg{}
        fmt.Printf("x.Len: %d\n", unsafe.Offsetof(x.Len))
        fmt.Printf("x.Buf: %d\n", unsafe.Offsetof(x.Buf))
}

$ go run fiodgname_arg.go
x.Len: 0
x.Buf: 8
Comment 2 Mikael Urankar freebsd_committer freebsd_triage 2019-12-26 17:38:25 UTC
(In reply to Dmitri Goutnik from comment #1)
It was not obvious looking at the amd64 implementation. amd64 needs to be fixed?
Comment 3 Mikael Urankar freebsd_committer freebsd_triage 2019-12-26 19:44:10 UTC
Created attachment 210238 [details]
patch
Comment 4 commit-hook freebsd_committer freebsd_triage 2020-01-06 13:49:47 UTC
A commit references this bug:

Author: swills
Date: Mon Jan  6 13:48:48 UTC 2020
New revision: 522229
URL: https://svnweb.freebsd.org/changeset/ports/522229

Log:
  editors/micro: fix build on aarch64

  PR:		242889
  Submitted by:	mikael.urankar@gmail.com

Changes:
  head/editors/micro/files/
  head/editors/micro/files/patch-vendor_github.com_zyedidia_pty_ztypes__freebsd__arm64.go
Comment 5 Steve Wills freebsd_committer freebsd_triage 2020-01-06 13:51:10 UTC
Committed, thanks!