]> Cypherpunks repositories - gostls13.git/commitdiff
8l: add openbsd
authorJoel Sing <jsing@google.com>
Fri, 26 Aug 2011 19:39:23 +0000 (15:39 -0400)
committerRuss Cox <rsc@golang.org>
Fri, 26 Aug 2011 19:39:23 +0000 (15:39 -0400)
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/4972043

src/cmd/8l/asm.c
src/cmd/8l/doc.go
src/cmd/8l/obj.c

index 22abd80491880cc3b2c527d96d317416f687c81c..518951fdee482bf8c9cc3db35b49ba9dd55b0287 100644 (file)
@@ -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;
                }
 
index b708889078e182eaaa3526d3b22a6eef906b2b29..de877bb24368339d1692c6bb2e99dd2b27ebfce7 100644 (file)
@@ -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
index a8e1c34a5380b593397b97a01bc74711120e201a..297b5bed55f4d433bcb8b7b1bb0d22df2fb4be57 100644 (file)
@@ -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).