Skip to content

Instantly share code, notes, and snippets.

@pastcompute
Created September 23, 2014 10:56
Show Gist options
  • Save pastcompute/9b5c2855d9caa8e59f9c to your computer and use it in GitHub Desktop.
Save pastcompute/9b5c2855d9caa8e59f9c to your computer and use it in GitHub Desktop.
Toy test for gcc & radare2 for issue #1857
// /scratch/develop/openwrt.bb/staging_dir/toolchain-mips_34kc_gcc-4.8-linaro_uClibc-0.9.33.2/bin/mips-openwrt-linux-gcc -nostdlib example.c
// /scratch/develop/openwrt.bb/staging_dir/toolchain-mips_34kc_gcc-4.8-linaro_uClibc-0.9.33.2/bin/mips-openwrt-linux-strip -s a.out -o a.stripped
// dd if=a.stripped skip=176 of=a.bare bs=1
// dd if=a.bare of=a.short bs=1 count=36
extern int C;
extern const char *A;
extern char B[101];
const char *A = "hello";
char B[101] = "0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789";
int C = 123;
void f1()program
{
int x;
for (x=0; x < 100; x++)
{
const char *y = A;
int n=0;
for (; *y && n < sizeof(B); y++)
{
B[n++] = *y;
}
}
}
int f2() {
f1();
C = B[0] + B[1] + B[2] + B[3];
return C+1;
}
void f3() {
f1();
C = f2() + f2();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment