Skip to content

Commit 2e608c7

Browse files
author
Jason Mobarak
committed
Include sysroot with built toolchain package
1 parent ceca503 commit 2e608c7

File tree

9 files changed

+68
-6
lines changed

9 files changed

+68
-6
lines changed

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ before_install:
1616

1717
script:
1818
- ./build.bash
19+
- ./stage_sysroot.bash
1920
- ./build_example.bash
2021

2122
after_success:

Dockerfile.base

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ FROM ubuntu:16.04
33
RUN mkdir /work
44
WORKDIR /work
55

6-
76
RUN apt-get update \
87
&& apt-get install -y build-essential \
98
bison \

bin/arm-linux-gnueabihf-clang

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/bin/bash
2+
3+
R=/opt/llvm-obfuscator/sysroot
4+
5+
/opt/llvm-obfuscator/bin/clang \
6+
-I ${R}/usr/arm-linux-gnueabihf/include \
7+
-L ${R}/usr/arm-linux-gnueabi/libhf \
8+
-ccc-gcc-name arm-linux-gnueabihf-gcc \
9+
--target=arm-linux-gnueabihf \
10+
-mfloat-abi=hard \
11+
-mcpu=cortex-a9 \
12+
$@

bin/arm-linux-gnueabihf-clang++

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/bin/bash
2+
3+
R=/opt/llvm-obfuscator/sysroot
4+
5+
/opt/llvm-obfuscator/bin/clang++ \
6+
-I ${R}/usr/arm-linux-gnueabihf/include \
7+
-L ${R}/usr/arm-linux-gnueabi/libhf \
8+
-I ${R}/usr/arm-linux-gnueabihf/include/c++/4.8.5/ \
9+
-L ${R}/usr/lib/gcc-cross/arm-linux-gnueabihf/4.8/ \
10+
-I ${R}/usr/arm-linux-gnueabihf/include/c++/4.8.5/arm-linux-gnueabihf \
11+
-ccc-gcc-name arm-linux-gnueabihf-gcc \
12+
--target=arm-linux-gnueabihf \
13+
-mfloat-abi=hard \
14+
-mcpu=cortex-a9 \
15+
$@

build_example.bash

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ docker run -i -t --rm \
77
-v $PWD/example:/work/example \
88
-v $PWD/build:/work/build \
99
-v $PWD/output/opt:/opt \
10+
-v $PWD/bin:/wrapper-bin \
1011
arm-llvm-obf:base \
11-
/bin/bash -c "export PATH=/opt/llvm-obfuscator/bin:\$PATH; \
12+
/bin/bash -c "export PATH=/opt/llvm-obfuscator/bin:/wrapper-bin:\$PATH; \
1213
make -C example"

example/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
test-*

example/Makefile

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1+
OBFUSCATE_OPS := -mllvm -sub -mllvm -bcf -mllvm -fla
2+
13
all: normal obfuscated
24

35
normal:
4-
clang++ test.cc -o test-cxx -I /usr/arm-linux-gnueabihf/include -L /usr/arm-linux-gnueabi/libhf -ccc-gcc-name arm-linux-gnueabihf-gcc --target=arm-linux-gnueabihf -mfloat-abi=hard -mcpu=cortex-a9 -I /usr/arm-linux-gnueabihf/include/c++/4.8.5/ -L /usr/lib/gcc-cross/arm-linux-gnueabihf/4.8/ -I /usr/arm-linux-gnueabihf/include/c++/4.8.5/arm-linux-gnueabihf
5-
clang test.c -o test-c -I /usr/arm-linux-gnueabihf/include -L /usr/arm-linux-gnueabi/libhf -ccc-gcc-name arm-linux-gnueabihf-gcc --target=arm-linux-gnueabihf -mfloat-abi=hard -mcpu=cortex-a9
6+
arm-linux-gnueabihf-clang++ test.cc -o test-cxx
7+
arm-linux-gnueabihf-clang test.c -o test-c
68

79
obfuscated:
8-
clang++ test.cc -o test-cxx-obf -I /usr/arm-linux-gnueabihf/include -L /usr/arm-linux-gnueabi/libhf -ccc-gcc-name arm-linux-gnueabihf-gcc --target=arm-linux-gnueabihf -mfloat-abi=hard -mcpu=cortex-a9 -mllvm -sub -mllvm -bcf -mllvm -fla -I /usr/arm-linux-gnueabihf/include/c++/4.8.5/ -L /usr/lib/gcc-cross/arm-linux-gnueabihf/4.8/ -I /usr/arm-linux-gnueabihf/include/c++/4.8.5/arm-linux-gnueabihf
9-
clang test.c -o test-c-obf -I /usr/arm-linux-gnueabihf/include -L /usr/arm-linux-gnueabi/libhf -ccc-gcc-name arm-linux-gnueabihf-gcc --target=arm-linux-gnueabihf -mfloat-abi=hard -mcpu=cortex-a9 -mllvm -sub -mllvm -bcf -mllvm -fla
10+
arm-linux-gnueabihf-clang++ test.cc -o test-cxx $(OBFUSCATE_OPS)
11+
arm-linux-gnueabihf-clang test.c -o test-c $(OBFUSCATE_OPS)

run_build_shell.bash

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/bin/bash
2+
3+
mkdir -p build
4+
mkdir -p output/opt
5+
6+
docker run -i -t --rm \
7+
-v $PWD/example:/work/example \
8+
-v $PWD/build:/work/build \
9+
-v $PWD/output/opt:/opt \
10+
-v $PWD/bin:/wrapper-bin \
11+
arm-llvm-obf:base \
12+
/bin/bash -c "export PATH=/opt/llvm-obfuscator/bin:/wrapper-bin:\$PATH; exec /bin/bash"

stage_sysroot.bash

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/bin/bash
2+
3+
OUT=output/opt/llvm-obfuscator/sysroot
4+
5+
rm -rf "$OUT"
6+
mkdir -p "$OUT"
7+
8+
SYSROOT_DIRS=(
9+
"/usr/arm-linux-gnueabihf/include"
10+
"/usr/arm-linux-gnueabi/libhf"
11+
"/usr/arm-linux-gnueabihf/include/c++/4.8.5"
12+
"/usr/lib/gcc-cross/arm-linux-gnueabihf/4.8"
13+
"/usr/arm-linux-gnueabihf/include/c++/4.8.5/arm-linux-gnueabihf"
14+
)
15+
16+
for SYSROOT_DIR in ${SYSROOT_DIRS[@]}; do
17+
mkdir -p "${OUT}/${SYSROOT_DIR}"
18+
rsync -azv "${SYSROOT_DIR}/" "${OUT}/${SYSROOT_DIR}/"
19+
done

0 commit comments

Comments
 (0)