aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbloodstalker <thabogre@gmail.com>2017-10-26 13:57:41 +0000
committerbloodstalker <thabogre@gmail.com>2017-10-26 13:57:41 +0000
commitd74c51155427861c4fcc84f823bf436b6c27638f (patch)
treee1e74d07fa09e3fa7507800ba55636fb023fef12
parentfixes #18 (diff)
downloadmutator-d74c51155427861c4fcc84f823bf436b6c27638f.tar.gz
mutator-d74c51155427861c4fcc84f823bf436b6c27638f.zip
playing around with libbfd
-rw-r--r--README.md1
-rw-r--r--bfd/compile_commands.json7
-rw-r--r--bfd/main.c24
-rw-r--r--bfd/makefile30
4 files changed, 61 insertions, 1 deletions
diff --git a/README.md b/README.md
index e224af9..03ac132 100644
--- a/README.md
+++ b/README.md
@@ -35,7 +35,6 @@
- [Support](#support)
- [Contact](#contact)
-/<./bruiser>
## Overview
diff --git a/bfd/compile_commands.json b/bfd/compile_commands.json
new file mode 100644
index 0000000..7f933eb
--- /dev/null
+++ b/bfd/compile_commands.json
@@ -0,0 +1,7 @@
+[
+ {
+ "command": "cc -c -o main.o main.c",
+ "directory": "/home/bloodstalker/devi/hell2/bfd",
+ "file": "/home/bloodstalker/devi/hell2/bfd/main.c"
+ }
+] \ No newline at end of file
diff --git a/bfd/main.c b/bfd/main.c
new file mode 100644
index 0000000..97fbc47
--- /dev/null
+++ b/bfd/main.c
@@ -0,0 +1,24 @@
+
+/*intentionally left blank*/
+#include "bfd.h"
+#include <stdlib.h>
+#include <stdio.h>
+
+bfd* dobfd(const char* __filename, const char* __target) {
+ bfd* abfd;
+ bfd_init();
+
+ abfd = bfd_openr(__filename, __target);
+ if (abfd) return abfd;
+ else return NULL;
+}
+
+int main(int argv, char** argc) {
+ bfd* abfd = dobfd("../mutator-lvl0", "default");
+ if (abfd) {
+ printf("bfd section count is %d.\n", bfd_count_sections(abfd));
+ }
+ return 0;
+}
+/*intentionally left blank*/
+
diff --git a/bfd/makefile b/bfd/makefile
new file mode 100644
index 0000000..7cb4918
--- /dev/null
+++ b/bfd/makefile
@@ -0,0 +1,30 @@
+
+##################################VARS#################################
+CC=clang
+CC_FLAGS=
+LD_FLAGS= -l bfd
+TARGET=main
+##################################RULES################################
+.DEFAULT:all
+
+.PHONY:all clean help $(TARGET)
+
+all:$(TARGET)
+
+.c.o:
+ $(CC) $(CC_FLAGS) -c $< -o $@
+
+$(TARGET): $(TARGET).o
+ $(CC) $^ $(LD_FLAGS) -o $@
+
+clean:
+ rm -f *.o *~ $(TARGET)
+
+help:
+ @echo 'all builds the daemon, the server and the client. all is the default.'
+ @echo 'mutatord builds the daemon with the server'
+ @echo 'mutatorc builds the client'
+ @echo 'mutators builds the standalone server'
+ @echo 'clean runs clean.'
+ @echo 'help runs help.'
+