Bug 242889 - editors/micro: fix build on aarch64
Summary: editors/micro: fix build on aarch64
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: arm64 Any
: --- Affects Many People
Assignee: Steve Wills
URL:
Keywords:
Depends on:
Blocks: 242312
  Show dependency treegraph
 
Reported: 2019-12-26 09:48 UTC by Mikael Urankar
Modified: 2020-01-06 13:51 UTC (History)
2 users (show)

See Also:
bugzilla: maintainer-feedback? (swills)


Attachments
patch (1.20 KB, patch)
2019-12-26 09:48 UTC, Mikael Urankar
no flags Details | Diff
patch (1.17 KB, patch)
2019-12-26 19:44 UTC, Mikael Urankar
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Mikael Urankar freebsd_committer 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 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 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 2019-12-26 19:44:10 UTC
Created attachment 210238 [details]
patch
Comment 4 commit-hook freebsd_committer 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 2020-01-06 13:51:10 UTC
Committed, thanks!