Skip to content
This repository was archived by the owner on Jun 29, 2020. It is now read-only.

Commit 4772469

Browse files
committed
Modify directory structure to be more akin
1 parent cfde694 commit 4772469

File tree

12 files changed

+68
-68
lines changed

12 files changed

+68
-68
lines changed

Diff for: Makefile.common.in

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Set the name of the project here
2-
PROJECT_NAME := sample
3-
PROJ_VERSION := 0.9
2+
PROJECT_NAME := LLVMObfuscator
3+
PROJ_VERSION := 1.0.0
44

55
# Set this variable to the top of the LLVM source tree.
66
LLVM_SRC_ROOT = @LLVM_SRC@

Diff for: autoconf/configure.ac

+2-2
Original file line numberDiff line numberDiff line change
@@ -1492,9 +1492,9 @@ dnl Configure project makefiles
14921492
dnl List every Makefile that exists within your source tree
14931493
AC_CONFIG_MAKEFILE(Makefile)
14941494
AC_CONFIG_MAKEFILE(lib/Makefile)
1495-
AC_CONFIG_MAKEFILE(lib/sample/Makefile)
1495+
AC_CONFIG_MAKEFILE(lib/Transform/Makefile)
14961496
AC_CONFIG_MAKEFILE(tools/Makefile)
1497-
AC_CONFIG_MAKEFILE(tools/sample/Makefile)
1497+
AC_CONFIG_MAKEFILE(tools/obfuscator/Makefile)
14981498

14991499
dnl This must be last
15001500
AC_OUTPUT

Diff for: configure

+8-8
Original file line numberDiff line numberDiff line change
@@ -12890,13 +12890,13 @@ ac_config_commands="$ac_config_commands Makefile"
1289012890
ac_config_commands="$ac_config_commands lib/Makefile"
1289112891

1289212892

12893-
ac_config_commands="$ac_config_commands lib/sample/Makefile"
12893+
ac_config_commands="$ac_config_commands lib/Transform/Makefile"
1289412894

1289512895

1289612896
ac_config_commands="$ac_config_commands tools/Makefile"
1289712897

1289812898

12899-
ac_config_commands="$ac_config_commands tools/sample/Makefile"
12899+
ac_config_commands="$ac_config_commands tools/obfuscator/Makefile"
1290012900

1290112901

1290212902

@@ -13629,9 +13629,9 @@ do
1362913629
"Makefile.llvm.config") CONFIG_FILES="$CONFIG_FILES Makefile.llvm.config" ;;
1363013630
"Makefile") CONFIG_COMMANDS="$CONFIG_COMMANDS Makefile" ;;
1363113631
"lib/Makefile") CONFIG_COMMANDS="$CONFIG_COMMANDS lib/Makefile" ;;
13632-
"lib/sample/Makefile") CONFIG_COMMANDS="$CONFIG_COMMANDS lib/sample/Makefile" ;;
13632+
"lib/Transform/Makefile") CONFIG_COMMANDS="$CONFIG_COMMANDS lib/Transform/Makefile" ;;
1363313633
"tools/Makefile") CONFIG_COMMANDS="$CONFIG_COMMANDS tools/Makefile" ;;
13634-
"tools/sample/Makefile") CONFIG_COMMANDS="$CONFIG_COMMANDS tools/sample/Makefile" ;;
13634+
"tools/obfuscator/Makefile") CONFIG_COMMANDS="$CONFIG_COMMANDS tools/obfuscator/Makefile" ;;
1363513635
1363613636
*) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
1363713637
esac
@@ -14059,12 +14059,12 @@ $as_echo "$as_me: executing $ac_file commands" >&6;}
1405914059
${SHELL} ${llvm_src}/autoconf/install-sh -m 0644 -c ${srcdir}/Makefile Makefile ;;
1406014060
"lib/Makefile":C) ${llvm_src}/autoconf/mkinstalldirs `dirname lib/Makefile`
1406114061
${SHELL} ${llvm_src}/autoconf/install-sh -m 0644 -c ${srcdir}/lib/Makefile lib/Makefile ;;
14062-
"lib/sample/Makefile":C) ${llvm_src}/autoconf/mkinstalldirs `dirname lib/sample/Makefile`
14063-
${SHELL} ${llvm_src}/autoconf/install-sh -m 0644 -c ${srcdir}/lib/sample/Makefile lib/sample/Makefile ;;
14062+
"lib/Transform/Makefile":C) ${llvm_src}/autoconf/mkinstalldirs `dirname lib/Transform/Makefile`
14063+
${SHELL} ${llvm_src}/autoconf/install-sh -m 0644 -c ${srcdir}/lib/Transform/Makefile lib/Transform/Makefile ;;
1406414064
"tools/Makefile":C) ${llvm_src}/autoconf/mkinstalldirs `dirname tools/Makefile`
1406514065
${SHELL} ${llvm_src}/autoconf/install-sh -m 0644 -c ${srcdir}/tools/Makefile tools/Makefile ;;
14066-
"tools/sample/Makefile":C) ${llvm_src}/autoconf/mkinstalldirs `dirname tools/sample/Makefile`
14067-
${SHELL} ${llvm_src}/autoconf/install-sh -m 0644 -c ${srcdir}/tools/sample/Makefile tools/sample/Makefile ;;
14066+
"tools/obfuscator/Makefile":C) ${llvm_src}/autoconf/mkinstalldirs `dirname tools/obfuscator/Makefile`
14067+
${SHELL} ${llvm_src}/autoconf/install-sh -m 0644 -c ${srcdir}/tools/obfuscator/Makefile tools/obfuscator/Makefile ;;
1406814068
1406914069
esac
1407014070
done # for ac_tag

Diff for: lib/Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@ LEVEL=..
88
#
99
# List all of the subdirectories that we will compile.
1010
#
11-
DIRS=sample
11+
DIRS=Transform
1212

1313
include $(LEVEL)/Makefile.common

Diff for: lib/Transform/Makefile

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Makefile for hello pass
2+
3+
# Path to top level of LLVM hierarchy
4+
LEVEL = ../..
5+
6+
# Name of the library to build
7+
LIBRARYNAME = LLVMObfuscatorTransforms
8+
9+
# Make the shared library become a loadable module so the tools can
10+
# dlopen/dlsym on the resulting library.
11+
LOADABLE_MODULE = 1
12+
13+
# Include the makefile implementation stuff
14+
include $(LEVEL)/Makefile.common

Diff for: lib/Transform/hello.cpp

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#include "llvm/Pass.h"
2+
#include "llvm/IR/Function.h"
3+
#include "llvm/IR/Instructions.h"
4+
#include "llvm/Support/raw_ostream.h"
5+
6+
using namespace llvm;
7+
8+
namespace {
9+
struct Hello : public FunctionPass {
10+
static char ID;
11+
Hello() : FunctionPass(ID) {}
12+
13+
virtual bool runOnFunction(Function &F) {
14+
int count = 0;
15+
errs().write_escaped(F.getName()) << '\n';
16+
17+
for (Function::iterator B = F.begin(), Bend = F.end(); B !=Bend; ++B) {
18+
for (BasicBlock::iterator I = B -> begin(), Iend = B -> end(); I != Iend; ++I) {
19+
// check for instance of CallInst
20+
if (CallInst *call = dyn_cast<CallInst>(I)) {
21+
Function *calledFunction = call -> getCalledFunction();
22+
if (calledFunction -> getName() == "printf") ++count;
23+
}
24+
}
25+
}
26+
27+
errs() << "\t printf called " << count << " times\n";
28+
return false;
29+
}
30+
};
31+
}
32+
33+
char Hello::ID = 0;
34+
static RegisterPass<Hello> X("hello", "Hello World Pass - counts the number of printf(s)", false, false);

Diff for: lib/sample/Makefile

-16
This file was deleted.

Diff for: lib/sample/sample.c

-25
This file was deleted.

Diff for: tools/Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@ LEVEL=..
88
#
99
# List all of the subdirectories that we will compile.
1010
#
11-
DIRS=sample
11+
DIRS=obfuscator
1212

1313
include $(LEVEL)/Makefile.common

Diff for: tools/sample/Makefile renamed to tools/obfuscator/Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ TOOLNAME=Sample
1414
# List libraries that we'll need
1515
# We use LIBS because sample is a dynamic library.
1616
#
17-
USEDLIBS = sample.a
17+
# USEDLIBS = sample.a
1818

1919
#
2020
# Include Makefile.common so we know what to do.

Diff for: tools/obfuscator/hello.cpp

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#include <stdio.h>
2+
3+
int main() {
4+
printf("Hello world!");
5+
}

Diff for: tools/sample/main.c

-12
This file was deleted.

0 commit comments

Comments
 (0)