Commit 26d9c804 authored by Joel Sing's avatar Joel Sing Committed by Russ Cox

8l: add openbsd

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/4972043
parent 582f6d4f
...@@ -41,6 +41,7 @@ ...@@ -41,6 +41,7 @@
char linuxdynld[] = "/lib/ld-linux.so.2"; char linuxdynld[] = "/lib/ld-linux.so.2";
char freebsddynld[] = "/usr/libexec/ld-elf.so.1"; char freebsddynld[] = "/usr/libexec/ld-elf.so.1";
char openbsddynld[] = "/usr/libexec/ld.so";
int32 int32
entryvalue(void) entryvalue(void)
...@@ -956,6 +957,9 @@ asmb(void) ...@@ -956,6 +957,9 @@ asmb(void)
case Hfreebsd: case Hfreebsd:
interpreter = freebsddynld; interpreter = freebsddynld;
break; break;
case Hopenbsd:
interpreter = openbsddynld;
break;
} }
} }
elfinterp(sh, startva, interpreter); elfinterp(sh, startva, interpreter);
...@@ -1122,7 +1126,10 @@ asmb(void) ...@@ -1122,7 +1126,10 @@ asmb(void)
eh->ident[EI_VERSION] = EV_CURRENT; eh->ident[EI_VERSION] = EV_CURRENT;
switch(HEADTYPE) { switch(HEADTYPE) {
case Hfreebsd: case Hfreebsd:
eh->ident[EI_OSABI] = 9; eh->ident[EI_OSABI] = ELFOSABI_FREEBSD;
break;
case Hopenbsd:
eh->ident[EI_OSABI] = ELFOSABI_OPENBSD;
break; break;
} }
......
...@@ -33,6 +33,8 @@ Options new in this version: ...@@ -33,6 +33,8 @@ Options new in this version:
Write Linux ELF binaries (default when $GOOS is linux) Write Linux ELF binaries (default when $GOOS is linux)
-Hfreebsd -Hfreebsd
Write FreeBSD ELF binaries (default when $GOOS is freebsd) Write FreeBSD ELF binaries (default when $GOOS is freebsd)
-Hopenbsd
Write OpenBSD ELF binaries (default when $GOOS is openbsd)
-Hwindows -Hwindows
Write Windows PE32 binaries (default when $GOOS is windows) Write Windows PE32 binaries (default when $GOOS is windows)
-I interpreter -I interpreter
......
...@@ -55,6 +55,7 @@ Header headers[] = { ...@@ -55,6 +55,7 @@ Header headers[] = {
"darwin", Hdarwin, "darwin", Hdarwin,
"linux", Hlinux, "linux", Hlinux,
"freebsd", Hfreebsd, "freebsd", Hfreebsd,
"openbsd", Hopenbsd,
"windows", Hwindows, "windows", Hwindows,
"windowsgui", Hwindows, "windowsgui", Hwindows,
0, 0 0, 0
...@@ -69,6 +70,7 @@ Header headers[] = { ...@@ -69,6 +70,7 @@ Header headers[] = {
* -Hdarwin -Tx -Rx is Apple Mach-O * -Hdarwin -Tx -Rx is Apple Mach-O
* -Hlinux -Tx -Rx is Linux ELF32 * -Hlinux -Tx -Rx is Linux ELF32
* -Hfreebsd -Tx -Rx is FreeBSD ELF32 * -Hfreebsd -Tx -Rx is FreeBSD ELF32
* -Hopenbsd -Tx -Rx is OpenBSD ELF32
* -Hwindows -Tx -Rx is MS Windows PE32 * -Hwindows -Tx -Rx is MS Windows PE32
*/ */
...@@ -223,6 +225,7 @@ main(int argc, char *argv[]) ...@@ -223,6 +225,7 @@ main(int argc, char *argv[])
break; break;
case Hlinux: /* elf32 executable */ case Hlinux: /* elf32 executable */
case Hfreebsd: case Hfreebsd:
case Hopenbsd:
/* /*
* ELF uses TLS offsets negative from %gs. * ELF uses TLS offsets negative from %gs.
* Translate 0(GS) and 4(GS) into -8(GS) and -4(GS). * Translate 0(GS) and 4(GS) into -8(GS) and -4(GS).
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment