Skip to content

Instantly share code, notes, and snippets.

@7shi
Created February 12, 2010 10:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 7shi/302455 to your computer and use it in GitHub Desktop.
Save 7shi/302455 to your computer and use it in GitHub Desktop.
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
symnum = ELF_R_SYM(prela[j].r_info);
+#endif
#ifdef DEBUG
printf("sym num o %d n %d\n", symnum,
symmap[symnum]);
#endif
+#ifdef HOSTLE_ELF64LE
+ *psymnum = symmap[symnum];
+#else
prela[j].r_info = ELF_R_INFO(symmap[symnum],
ELF_R_TYPE(prela[j].r_info));
+#endif
}
}
if ((pshdr->sh_type == SHT_REL) &&
--- usr.sbin/crunchgen/Makefile.orig Sat Feb 13 11:44:55 2010
+++ usr.sbin/crunchgen/Makefile Fri Feb 12 19:51:59 2010
@@ -4,7 +4,7 @@
MAN= crunchgen.8
SRCS= crunchgen.c crunched_skel.c \
crunchide.c elf_hide.c ecoff_hide.c mangle.c
-CFLAGS+= -g -Wall
+CFLAGS+= -g -Wall -DHOSTLE_ELF64LE -DELFSIZE=64
CLEANFILES+= crunched_skel.c
crunched_skel.c: crunched_main.c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment