Skip to content

Instantly share code, notes, and snippets.

@7shi
7shi / openbsd-crunchgen.diff
Created February 12, 2010 10:21
OpenBSDでクロス用にcrunchgenをやっつけ修正
--- usr.sbin/crunchgen/elf_hide.c.orig Fri Feb 12 04:53:11 2010
+++ usr.sbin/crunchgen/elf_hide.c Fri Feb 12 19:42:55 2010
@@ -416,13 +416,22 @@
prela = (Elf_RelA *) (pexe + pshdr->sh_offset);
num_reloc = pshdr->sh_size / sizeof(Elf_RelA);
for (j = 0; j < num_reloc; j++) {
+#ifdef HOSTLE_ELF64LE
+ uint32_t *psymnum = (uint32_t *)&prela[j].r_info;
+ symnum = *psymnum;
+#else
@7shi
7shi / openbsd-rdsetroot-nlist.diff
Created February 12, 2010 10:22
OpenBSDのrdsetrootを無理やり動かす
--- lib/libc/gen/nlist.c.orig Fri Feb 12 03:32:14 2010
+++ lib/libc/gen/nlist.c Fri Feb 12 20:49:07 2010
@@ -274,6 +274,9 @@
int
__elf_is_okay__(Elf_Ehdr *ehdr)
{
+#ifdef NOARCHCHECK
+ return IS_ELF(*ehdr);
+#else
int retval = 0;
@7shi
7shi / openbsd-gdium.txt
Created February 12, 2010 17:47
GdiumでOpenBSDを起動させようとして失敗
Copyright (c) 1982, 1986, 1989, 1991, 1993
The Regents of the University of California. All rights reserved.
Copyright (c) 1995-2010 OpenBSD. All rights reserved. http://www.OpenBSD.org
OpenBSD 4.7-beta (RAMDISK) #5: Fri Feb 12 20:48:34 JST 2010
root@openbsd-vm.my.domain:/usr/src/sys/arch/loongson/compile/RAMDISK
real mem = 536870912 (512MB)
avail mem = 516784128 (492MB)
mainbus0 at root
cpu0 at mainbus0: STC Loongson2F CPU 891 MHz, STC Loongson2F FPU
@7shi
7shi / patch-filter_texttops_c
Created March 1, 2010 11:49
GdiumでldがGOTエラーになるので小手先の修正
--- filter/texttops.c.orig Tue Mar 2 05:10:03 2010
+++ filter/texttops.c Tue Mar 2 05:30:35 2010
@@ -33,16 +33,16 @@
/*
- * Globals...
+ * Locals...
*/
--- src/devices/dev_mc146818.c.orig
+++ src/devices/dev_mc146818.c
@@ -209,11 +209,13 @@
* emulation. However, for Linux, commenting out this line
* works better. (TODO: Find a way to make both work?)
*/
- d->reg[4 * MC_YEAR] += 80;
+ d->reg[4 * MC_YEAR] -= 20;
break;
+ case MC146818_ARC_JAZZ:
begin-base64 644 hello.exe.xz
/Td6WFoAAATm1rRGAgAhARAAAACocI6G4Av/AYVdACaWjnAAF/fsBbvq9P+UAS9E73zm9QkZRAIp
/1PN1tEU/p5hnIIV9gl6rGu07VQQnibKcc/FRyvI6yJF/kH6s1mPcgQJgG86bF7FVAXcqCcRClyf
j1G5vP7zT6DtkxosDuxPmNiog1ffycSH/56DHTKfNYL3s/u3z6SglVhRnwfOiZzPxp8HlHsksHsu
sIarOm/R3T8oGiwWy0LU09vhJxf4rEhOnsDpHdMCaWI9LBhj9bQKmndNwDl2K39BE0z3lZ4PnoQJ
4txglbouNO+eE+Tv24jzoTSqTYErAuO55hYkLNIgG75CGAzAg5A6I7+CGc/nBtfE8WctsSwIcw7T
zRlxCp7EJJHZNqdmWcVO6mr7iLvPvMT7Z6N7xJ6iiJiD8K6eeBVCC9sL8IjlEqEmdrpEt8lUyTzv
Ec9EyHaRYf8tfqH8TJ7maEvMsB8rti1NzbhkW/dPRVvjNdBY0LUpZTDBdYs1YdovSwKpdAljfSgk
jpW3MAmt10UCJpyOdth8Ta5b6Q8gAAAAALbBU2LxVe2cAAGhA4AYAAC1KNmpscRn+wIAAAAABFla
@7shi
7shi / console.fs
Created March 25, 2010 02:53
F# Interactiveの改造
#light
namespace Microsoft.FSharp.Compiler.Interactive
open System
open System.IO
open System.Text
open System.Collections.Generic
type ReadLineConsole(complete: (string option * string -> seq<string>)) as this =
@7shi
7shi / gist:343277
Created March 25, 2010 07:07
mipsel-peのリンカがおかしい
h-evc.exe: file format pei-mips
Disassembly of section .text:
00401000 <.text>:
401000: 27bdffe8 addiu $sp,$sp,-24
401004: afbf0010 sw $ra,16($sp)
401008: 3c020040 lui $v0,0x40
40100c: 24463020 addiu $a2,$v0,12320
@7shi
7shi / gist:343302
Created March 25, 2010 08:11
mipsel-peのテスト
# cat hello.c
void start()
{
MessageBoxA(0, "Hello, NT4/MIPS!", "mipsel-pe-gcc", 0);
}
# mips-pe-gcc -G0 -EL -S hello.c
# cat hello.s
.file 1 "hello.c"
gcc2_compiled.:
__gnu_compiled_c:
--- bfd/peicode.h.orig 2010-03-26 12:55:32.000000000 +0900
+++ bfd/peicode.h 2010-03-26 12:55:55.000000000 +0900
@@ -977,7 +977,7 @@
{
pe_ILF_make_a_symbol_reloc (& vars, 0, BFD_RELOC_HI16_S,
(struct symbol_cache_entry **) imp_sym, imp_index);
- pe_ILF_make_a_reloc (& vars, 0, BFD_RELOC_LO16, text);
+ /*pe_ILF_make_a_reloc (& vars, 0, BFD_RELOC_LO16, text);*/
pe_ILF_make_a_symbol_reloc (& vars, 4, BFD_RELOC_LO16,
(struct symbol_cache_entry **) imp_sym, imp_index);