1
0
mirror of https://github.com/golang/go synced 2024-11-26 03:07:57 -07:00

all: compiler/bootstrap for dragonfly/amd64

Add dragonfly/amd64 support to the Go compiler, bootstrap and GOOS list.

R=devon.odell, bradfitz
CC=golang-dev
https://golang.org/cl/12796050
This commit is contained in:
Joel Sing 2013-08-24 01:18:04 +10:00
parent 180da80e90
commit 71dc91db0f
15 changed files with 98 additions and 16 deletions

View File

@ -43,6 +43,7 @@ char linuxdynld[] = "/lib64/ld-linux-x86-64.so.2";
char freebsddynld[] = "/libexec/ld-elf.so.1"; char freebsddynld[] = "/libexec/ld-elf.so.1";
char openbsddynld[] = "/usr/libexec/ld.so"; char openbsddynld[] = "/usr/libexec/ld.so";
char netbsddynld[] = "/libexec/ld.elf_so"; char netbsddynld[] = "/libexec/ld.elf_so";
char dragonflydynld[] = "/libexec/ld-elf.so.2";
char zeroes[32]; char zeroes[32];
@ -672,6 +673,7 @@ asmb(void)
case Hfreebsd: case Hfreebsd:
case Hnetbsd: case Hnetbsd:
case Hopenbsd: case Hopenbsd:
case Hdragonfly:
debug['8'] = 1; /* 64-bit addresses */ debug['8'] = 1; /* 64-bit addresses */
break; break;
case Hwindows: case Hwindows:
@ -700,6 +702,7 @@ asmb(void)
case Hfreebsd: case Hfreebsd:
case Hnetbsd: case Hnetbsd:
case Hopenbsd: case Hopenbsd:
case Hdragonfly:
symo = rnd(HEADR+segtext.len, INITRND)+rnd(segrodata.len, INITRND)+segdata.filelen; symo = rnd(HEADR+segtext.len, INITRND)+rnd(segrodata.len, INITRND)+segdata.filelen;
symo = rnd(symo, INITRND); symo = rnd(symo, INITRND);
break; break;
@ -790,6 +793,7 @@ asmb(void)
case Hfreebsd: case Hfreebsd:
case Hnetbsd: case Hnetbsd:
case Hopenbsd: case Hopenbsd:
case Hdragonfly:
asmbelf(symo); asmbelf(symo);
break; break;
case Hwindows: case Hwindows:

View File

@ -48,6 +48,7 @@ Header headers[] = {
"plan9", Hplan9x64, "plan9", Hplan9x64,
"elf", Helf, "elf", Helf,
"darwin", Hdarwin, "darwin", Hdarwin,
"dragonfly", Hdragonfly,
"linux", Hlinux, "linux", Hlinux,
"freebsd", Hfreebsd, "freebsd", Hfreebsd,
"netbsd", Hnetbsd, "netbsd", Hnetbsd,
@ -62,6 +63,7 @@ Header headers[] = {
* -Hplan9 -T0x200028 -R0x200000 is plan9 64-bit format * -Hplan9 -T0x200028 -R0x200000 is plan9 64-bit format
* -Helf -T0x80110000 -R4096 is ELF32 * -Helf -T0x80110000 -R4096 is ELF32
* -Hdarwin -Tx -Rx is apple MH-exec * -Hdarwin -Tx -Rx is apple MH-exec
* -Hdragonfly -Tx -Rx is DragonFly elf-exec
* -Hlinux -Tx -Rx is linux elf-exec * -Hlinux -Tx -Rx is linux elf-exec
* -Hfreebsd -Tx -Rx is FreeBSD elf-exec * -Hfreebsd -Tx -Rx is FreeBSD elf-exec
* -Hnetbsd -Tx -Rx is NetBSD elf-exec * -Hnetbsd -Tx -Rx is NetBSD elf-exec
@ -216,6 +218,7 @@ main(int argc, char *argv[])
case Hfreebsd: /* freebsd */ case Hfreebsd: /* freebsd */
case Hnetbsd: /* netbsd */ case Hnetbsd: /* netbsd */
case Hopenbsd: /* openbsd */ case Hopenbsd: /* openbsd */
case Hdragonfly: /* dragonfly */
/* /*
* ELF uses TLS offset negative from FS. * ELF uses TLS offset negative from FS.
* Translate 0(FS) and 8(FS) into -16(FS) and -8(FS). * Translate 0(FS) and 8(FS) into -16(FS) and -8(FS).

View File

@ -322,7 +322,7 @@ patch(void)
} }
if(HEADTYPE == Hlinux || HEADTYPE == Hfreebsd if(HEADTYPE == Hlinux || HEADTYPE == Hfreebsd
|| HEADTYPE == Hopenbsd || HEADTYPE == Hnetbsd || HEADTYPE == Hopenbsd || HEADTYPE == Hnetbsd
|| HEADTYPE == Hplan9x64) { || HEADTYPE == Hplan9x64 || HEADTYPE == Hdragonfly) {
// ELF uses FS instead of GS. // ELF uses FS instead of GS.
if(p->from.type == D_INDIR+D_GS) if(p->from.type == D_INDIR+D_GS)
p->from.type = D_INDIR+D_FS; p->from.type = D_INDIR+D_FS;
@ -522,7 +522,8 @@ dostkoff(void)
p->as = AMOVQ; p->as = AMOVQ;
if(HEADTYPE == Hlinux || HEADTYPE == Hfreebsd if(HEADTYPE == Hlinux || HEADTYPE == Hfreebsd
|| HEADTYPE == Hopenbsd || HEADTYPE == Hnetbsd || HEADTYPE == Hopenbsd || HEADTYPE == Hnetbsd
|| HEADTYPE == Hplan9x64) // ELF uses FS || HEADTYPE == Hplan9x64 || HEADTYPE == Hdragonfly)
// ELF uses FS
p->from.type = D_INDIR+D_FS; p->from.type = D_INDIR+D_FS;
else else
p->from.type = D_INDIR+D_GS; p->from.type = D_INDIR+D_GS;

View File

@ -48,6 +48,7 @@ static char *okgoarch[] = {
// The known operating systems. // The known operating systems.
static char *okgoos[] = { static char *okgoos[] = {
"darwin", "darwin",
"dragonfly",
"linux", "linux",
"freebsd", "freebsd",
"netbsd", "netbsd",

2
src/cmd/dist/unix.c vendored
View File

@ -674,6 +674,8 @@ main(int argc, char **argv)
gohostarch = "amd64"; gohostarch = "amd64";
#elif defined(__linux__) #elif defined(__linux__)
gohostos = "linux"; gohostos = "linux";
#elif defined(__DragonFly__)
gohostos = "dragonfly";
#elif defined(__FreeBSD__) #elif defined(__FreeBSD__)
gohostos = "freebsd"; gohostos = "freebsd";
#elif defined(__FreeBSD_kernel__) #elif defined(__FreeBSD_kernel__)

View File

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
// +build darwin freebsd linux netbsd openbsd // +build darwin dragonfly freebsd linux netbsd openbsd
package main package main

View File

@ -33,6 +33,8 @@ Options new in this version:
linker. This flag cannot be used when $GOOS is windows. linker. This flag cannot be used when $GOOS is windows.
-H darwin (only in 6l/8l) -H darwin (only in 6l/8l)
Write Apple Mach-O binaries (default when $GOOS is darwin) Write Apple Mach-O binaries (default when $GOOS is darwin)
-H dragonfly (only in 6l)
Write DragonFly ELF binaries (default when $GOOS is dragonfly)
-H linux -H linux
Write Linux ELF binaries (default when $GOOS is linux) Write Linux ELF binaries (default when $GOOS is linux)
-H freebsd -H freebsd

View File

@ -1189,6 +1189,9 @@ asmbelf(vlong symo)
case Hopenbsd: case Hopenbsd:
interpreter = openbsddynld; interpreter = openbsddynld;
break; break;
case Hdragonfly:
interpreter = dragonflydynld;
break;
} }
} }
resoff -= elfinterp(sh, startva, resoff, interpreter); resoff -= elfinterp(sh, startva, resoff, interpreter);
@ -1461,6 +1464,8 @@ elfobj:
eh->ident[EI_OSABI] = ELFOSABI_NETBSD; eh->ident[EI_OSABI] = ELFOSABI_NETBSD;
else if(HEADTYPE == Hopenbsd) else if(HEADTYPE == Hopenbsd)
eh->ident[EI_OSABI] = ELFOSABI_OPENBSD; eh->ident[EI_OSABI] = ELFOSABI_OPENBSD;
else if(HEADTYPE == Hdragonfly)
eh->ident[EI_OSABI] = ELFOSABI_NONE;
if(PtrSize == 8) if(PtrSize == 8)
eh->ident[EI_CLASS] = ELFCLASS64; eh->ident[EI_CLASS] = ELFCLASS64;
else else

View File

@ -1009,6 +1009,7 @@ extern char linuxdynld[];
extern char freebsddynld[]; extern char freebsddynld[];
extern char netbsddynld[]; extern char netbsddynld[];
extern char openbsddynld[]; extern char openbsddynld[];
extern char dragonflydynld[];
int elfreloc1(Reloc*, vlong sectoff); int elfreloc1(Reloc*, vlong sectoff);
void putelfsectionsyms(void); void putelfsectionsyms(void);

View File

@ -344,6 +344,7 @@ enum {
Hfreebsd, // FreeBSD ELF Hfreebsd, // FreeBSD ELF
Hwindows, // MS Windows PE Hwindows, // MS Windows PE
Hopenbsd, // OpenBSD ELF Hopenbsd, // OpenBSD ELF
Hdragonfly, // DragonFly ELF
}; };
typedef struct Header Header; typedef struct Header Header;

View File

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
// +build darwin freebsd linux netbsd openbsd // +build darwin dragonfly freebsd linux netbsd openbsd
#include <u.h> #include <u.h>
#include <errno.h> #include <errno.h>

View File

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
// +build darwin freebsd linux netbsd openbsd // +build darwin dragonfly freebsd linux netbsd openbsd
#include <u.h> #include <u.h>
#include <dirent.h> #include <dirent.h>

62
src/libmach/dragonfly.c Normal file
View File

@ -0,0 +1,62 @@
// This is stubbed out for the moment. Will revisit when the time comes.
#include <u.h>
#include <libc.h>
#include <bio.h>
#include <mach.h>
int
ctlproc(int pid, char *msg)
{
USED(pid);
USED(msg);
sysfatal("ctlproc unimplemented in DragonFly");
return -1;
}
char*
proctextfile(int pid)
{
USED(pid);
sysfatal("proctextfile unimplemented in DragonFly");
return nil;
}
char*
procstatus(int pid)
{
USED(pid);
sysfatal("procstatus unimplemented in DragonFly");
return nil;
}
Map*
attachproc(int pid, Fhdr *fp)
{
USED(pid);
USED(fp);
sysfatal("attachproc unimplemented in DragonFly");
return nil;
}
void
detachproc(Map *m)
{
USED(m);
sysfatal("detachproc unimplemented in DragonFly");
}
int
procthreadpids(int pid, int *p, int np)
{
USED(pid);
USED(p);
USED(np);
sysfatal("procthreadpids unimplemented in DragonFly");
return -1;
}

View File

@ -356,7 +356,7 @@ func allowed(pkg string) map[string]bool {
} }
var bools = []bool{false, true} var bools = []bool{false, true}
var geese = []string{"darwin", "freebsd", "linux", "netbsd", "openbsd", "plan9", "windows"} var geese = []string{"darwin", "dragonfly", "freebsd", "linux", "netbsd", "openbsd", "plan9", "windows"}
var goarches = []string{"386", "amd64", "arm"} var goarches = []string{"386", "amd64", "arm"}
type osPkg struct { type osPkg struct {

View File

@ -4,5 +4,5 @@
package build package build
const goosList = "darwin freebsd linux netbsd openbsd plan9 windows " const goosList = "darwin dragonfly freebsd linux netbsd openbsd plan9 windows "
const goarchList = "386 amd64 arm " const goarchList = "386 amd64 arm "