aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/compile_commands.json7
-rw-r--r--test/makefile35
-rw-r--r--test/test.c32
3 files changed, 74 insertions, 0 deletions
diff --git a/test/compile_commands.json b/test/compile_commands.json
new file mode 100644
index 0000000..ca764a6
--- /dev/null
+++ b/test/compile_commands.json
@@ -0,0 +1,7 @@
+[
+ {
+ "command": "cc -c -fpic -O0 -g -v --debug -o test.o test.c",
+ "directory": "/home/bloodstalker/extra/delf/test",
+ "file": "/home/bloodstalker/extra/delf/test/test.c"
+ }
+] \ No newline at end of file
diff --git a/test/makefile b/test/makefile
new file mode 100644
index 0000000..9414f84
--- /dev/null
+++ b/test/makefile
@@ -0,0 +1,35 @@
+
+##################################VARS#################################
+CC?=gcc
+CC=gcc
+CC_FLAGS=-fpic -O0 -g -v --debug
+#LD_FLAGS= -l bfd
+LD_FLAGS=
+TARGET=test
+##################################RULES################################
+.DEFAULT:all
+
+.PHONY:all clean help
+
+all:$(TARGET) $(TARGET).so $(TARGET).asm
+
+.c.o:
+ $(CC) $(CC_FLAGS) -c $< -o $@
+
+$(TARGET): $(TARGET).o
+ $(CC) $^ $(LD_FLAGS) -o $@
+
+$(TARGET).asm: $(TARGET).o
+ objdump -r -d -M intel -S $(TARGET).o > $(TARGET).asm
+
+$(TARGET).so: $(TARGET).o
+ $(CC) $^ $(LD_FLAGS) -shared -o $@
+
+clean:
+ rm -f *.o *~ $(TARGET) $(TARGET).so $(TARGET).asm
+
+help:
+ @echo 'all builds so and exe. all is the default.'
+ @echo 'clean runs clean.'
+ @echo 'help runs help.'
+
diff --git a/test/test.c b/test/test.c
new file mode 100644
index 0000000..00f92ad
--- /dev/null
+++ b/test/test.c
@@ -0,0 +1,32 @@
+#include "stdio.h"
+
+int myfunc1(void) {return 1;}
+int myfunc2(void) {return 2;}
+int myfunc3(void) {return 3;}
+int myfunc4(void) {return 4;}
+int myfunc5(void) {return 5;}
+int myfunc6(void) {return 6;}
+int add2(int a, int b) {return a + b;}
+int sub2(int a, int b) {return a - b;}
+double adddouble(double a, double b) {return a+b;}
+double subdouble(double a, double b) {return a-b;}
+double triple(double a, double b, double c) {return a+b+c;}
+int quad(int a, int b, int c, int d) {return add2(a,b) + add2(c,d);}
+const char* passthrough(const char* a) {return a;}
+void ext_1(void) {printf("%s", "hey there sleepy-head.\n");}
+
+int myvar1 = 1;
+int myvar2 = 2;
+int myvar3 = 3;
+int myvar4 = 4;
+
+int glob(void) {return myvar1+myvar2+myvar3+myvar4;}
+
+int main(int argc, char** argv) {
+ int sum;
+ sum = add2(10, 20);
+ printf("i live!\n");
+ int res = sub2(20, 10);
+ ext_1();
+ return quad(1,2,3,4);
+}