$NetBSD$

--- tccelf.c.orig	2004-11-08 22:47:16.000000000 +0200
+++ tccelf.c
@@ -1067,6 +1067,8 @@ static void tcc_add_linker_symbols(TCCSt
 /* name of ELF interpreter */
 #ifdef __FreeBSD__
 static char elf_interp[] = "/usr/libexec/ld-elf.so.1";
+#elif defined(__NetBSD__)
+static char elf_interp[] = "/libexec/ld.elf_so";
 #else
 static char elf_interp[] = "/lib/ld-linux.so.2";
 #endif
@@ -1647,6 +1649,9 @@ int tcc_output_file(TCCState *s1, const 
 #ifdef __FreeBSD__
         ehdr.e_ident[EI_OSABI] = ELFOSABI_FREEBSD;
 #endif
+#ifdef __NetBSD__
+	ehdr.e_ident[EI_OSABI] = ELFOSABI_SYSV;
+#endif
 #ifdef TCC_TARGET_ARM
         ehdr.e_ident[EI_OSABI] = ELFOSABI_ARM;
 #endif
