summaryrefslogtreecommitdiff
path: root/src/cmd/8l/obj.c
diff options
context:
space:
mode:
authorChristopher Nielsen <m4dh4tt3r@gmail.com>2011-12-12 15:42:11 -0500
committerChristopher Nielsen <m4dh4tt3r@gmail.com>2011-12-12 15:42:11 -0500
commitc5f70ac8617b995d063af7419187e9e85c517b55 (patch)
tree240e12890c9da087c0fd8f56eff2df1d056979fc /src/cmd/8l/obj.c
parent2a753f3da89000ba9c2f301ed4e51d987c564c13 (diff)
downloadgo-c5f70ac8617b995d063af7419187e9e85c517b55.tar.gz
ld/6l/8l: First pass at changes to the linker to support NetBSD binaries.
This will not currently create valid NetBSD binaries because NetBSD requires an ELF note section to run, otherwise the kernel will throw ENOEXEC. I was unable to determine an elegant way to add the section, so I am submitting what I have. References: http://www.netbsd.org/docs/kernel/elf-notes.html http://mail-index.netbsd.org/netbsd-bugs/2001/08/03/0012.html R=rsc CC=golang-dev http://codereview.appspot.com/5472049 Committer: Russ Cox <rsc@golang.org>
Diffstat (limited to 'src/cmd/8l/obj.c')
-rw-r--r--src/cmd/8l/obj.c27
1 files changed, 15 insertions, 12 deletions
diff --git a/src/cmd/8l/obj.c b/src/cmd/8l/obj.c
index c2f409e91..e17b66768 100644
--- a/src/cmd/8l/obj.c
+++ b/src/cmd/8l/obj.c
@@ -47,18 +47,19 @@ char *noname = "<none>";
char *thestring = "386";
Header headers[] = {
- "garbunix", Hgarbunix,
- "unixcoff", Hunixcoff,
- "plan9", Hplan9x32,
- "msdoscom", Hmsdoscom,
- "msdosexe", Hmsdosexe,
- "darwin", Hdarwin,
- "linux", Hlinux,
- "freebsd", Hfreebsd,
- "openbsd", Hopenbsd,
- "windows", Hwindows,
- "windowsgui", Hwindows,
- 0, 0
+ "garbunix", Hgarbunix,
+ "unixcoff", Hunixcoff,
+ "plan9", Hplan9x32,
+ "msdoscom", Hmsdoscom,
+ "msdosexe", Hmsdosexe,
+ "darwin", Hdarwin,
+ "linux", Hlinux,
+ "freebsd", Hfreebsd,
+ "netbsd", Hnetbsd,
+ "openbsd", Hopenbsd,
+ "windows", Hwindows,
+ "windowsgui", Hwindows,
+ 0, 0
};
/*
@@ -70,6 +71,7 @@ Header headers[] = {
* -Hdarwin -Tx -Rx is Apple Mach-O
* -Hlinux -Tx -Rx is Linux ELF32
* -Hfreebsd -Tx -Rx is FreeBSD ELF32
+ * -Hnetbsd -Tx -Rx is NetBSD ELF32
* -Hopenbsd -Tx -Rx is OpenBSD ELF32
* -Hwindows -Tx -Rx is MS Windows PE32
*/
@@ -225,6 +227,7 @@ main(int argc, char *argv[])
break;
case Hlinux: /* elf32 executable */
case Hfreebsd:
+ case Hnetbsd:
case Hopenbsd:
/*
* ELF uses TLS offsets negative from %gs.