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 @@
char linuxdynld[] = "/lib/ld-linux.so.2";
char freebsddynld[] = "/usr/libexec/ld-elf.so.1";
char openbsddynld[] = "/usr/libexec/ld.so";
int32
entryvalue(void)
......@@ -956,6 +957,9 @@ asmb(void)
case Hfreebsd:
interpreter = freebsddynld;
break;
case Hopenbsd:
interpreter = openbsddynld;
break;
}
}
elfinterp(sh, startva, interpreter);
......@@ -1122,7 +1126,10 @@ asmb(void)
eh->ident[EI_VERSION] = EV_CURRENT;
switch(HEADTYPE) {
case Hfreebsd:
eh->ident[EI_OSABI] = 9;
eh->ident[EI_OSABI] = ELFOSABI_FREEBSD;
break;
case Hopenbsd:
eh->ident[EI_OSABI] = ELFOSABI_OPENBSD;
break;
}
......
......@@ -33,6 +33,8 @@ Options new in this version:
Write Linux ELF binaries (default when $GOOS is linux)
-Hfreebsd
Write FreeBSD ELF binaries (default when $GOOS is freebsd)
-Hopenbsd
Write OpenBSD ELF binaries (default when $GOOS is openbsd)
-Hwindows
Write Windows PE32 binaries (default when $GOOS is windows)
-I interpreter
......
......@@ -55,6 +55,7 @@ Header headers[] = {
"darwin", Hdarwin,
"linux", Hlinux,
"freebsd", Hfreebsd,
"openbsd", Hopenbsd,
"windows", Hwindows,
"windowsgui", Hwindows,
0, 0
......@@ -69,6 +70,7 @@ Header headers[] = {
* -Hdarwin -Tx -Rx is Apple Mach-O
* -Hlinux -Tx -Rx is Linux ELF32
* -Hfreebsd -Tx -Rx is FreeBSD ELF32
* -Hopenbsd -Tx -Rx is OpenBSD ELF32
* -Hwindows -Tx -Rx is MS Windows PE32
*/
......@@ -223,6 +225,7 @@ main(int argc, char *argv[])
break;
case Hlinux: /* elf32 executable */
case Hfreebsd:
case Hopenbsd:
/*
* ELF uses TLS offsets negative from %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