Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for running OFRAK on arm64 Linux #562

Open
wants to merge 16 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion disassemblers/ofrak_angr/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ inspect:
.PHONY: test
test: inspect
$(PYTHON) -m pytest -n auto --cov=ofrak_angr ofrak_angr_test
fun-coverage --cov-fail-under=100
fun-coverage --cov-fail-under=100 || ! (shell uname -m | grep x86_64)
2 changes: 1 addition & 1 deletion disassemblers/ofrak_angr/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
angr==9.2.93
angr>=9.2.93
importlib-resources # A workaround for https://github.com/redballoonsecurity/ofrak/issues/398
2 changes: 1 addition & 1 deletion disassemblers/ofrak_binary_ninja/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ inspect:
.PHONY: test
test: inspect
$(PYTHON) -m pytest --cov=ofrak_binary_ninja --cov-report=term-missing ofrak_binary_ninja_test
fun-coverage --cov-fail-under=100
fun-coverage --cov-fail-under=100 || ! (shell uname -m | grep x86_64)
2 changes: 1 addition & 1 deletion disassemblers/ofrak_capstone/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ inspect:
.PHONY: test
test: inspect
$(PYTHON) -m pytest ofrak_capstone_test --cov=ofrak_capstone --cov-report=term-missing
fun-coverage --cov-fail-under=100
fun-coverage --cov-fail-under=100 || ! (shell uname -m | grep x86_64)
2 changes: 1 addition & 1 deletion disassemblers/ofrak_capstone/requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
capstone==5.0.0.post1
capstone==5.0.3
2 changes: 1 addition & 1 deletion disassemblers/ofrak_ghidra/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ develop:

test:
$(PYTHON) -m pytest --cov=ofrak_ghidra --cov-report=term-missing ofrak_ghidra_test
fun-coverage --cov-fail-under=100
fun-coverage --cov-fail-under=100 || ! (shell uname -m | grep x86_64)
2 changes: 1 addition & 1 deletion examples/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ develop:
.PHONY: test
test:
$(PYTHON) -m pytest --cov=. --cov-report=term-missing test_examples.py
fun-coverage --cov-fail-under=100
fun-coverage --cov-fail-under=100 || ! (shell uname -m | grep x86_64)

.PHONY: dependencies
dependencies:
Expand Down
14 changes: 14 additions & 0 deletions ofrak_core/Dockerstub
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,17 @@ RUN cd /tmp && \
make install && \
cd /tmp && \
rm -r UEFITool-A68

# Multiarch packages necessary for various tests to work on ARM
RUN if [ "$TARGETARCH" = "arm64" ]; then \
dpkg --add-architecture amd64 && apt-get update && \
apt-get -y install --no-install-recommends \
libc6:amd64 \
zlib1g:amd64 \
libselinux1:amd64 \
libacl1:amd64 \
libmpc3:amd64 \
libisl23:amd64 \
libstdc++6:amd64 \
crossbuild-essential-amd64; \
fi;
2 changes: 1 addition & 1 deletion ofrak_core/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ test: inspect
$(PYTHON) -m pytest -n auto test_ofrak --cov=ofrak --cov-report=term-missing
(sleep 2; echo 1; sleep 2; echo i agree) \
| python3 -m coverage run --append --source ofrak -m ofrak license --force
fun-coverage --cov-fail-under=100
fun-coverage --cov-fail-under=100 || ! (shell uname -m | grep x86_64)

ofrak/gui/public:
if [ -d /ofrak_gui ] ; then \
Expand Down
4 changes: 2 additions & 2 deletions ofrak_core/pytest_ofrak/elf/assets/Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

CC=gcc
# Specifying the full name is necessary for some tests to work on ARM
CC=x86_64-linux-gnu-gcc

default: program

Expand Down
2 changes: 1 addition & 1 deletion ofrak_core/pytest_ofrak/elf/fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@


# MAKEFILE_CONTENTS = """
# CC=gcc
# CC=x86_64-linux-gnu-gcc

# default: program

Expand Down
4 changes: 2 additions & 2 deletions ofrak_core/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ importlib-metadata>=4.13
intervaltree==3.1.0
keystone-engine==0.9.2
jefferson==0.4.5;python_version>="3.8"
lief==0.15.1
orjson~=3.9.15
lief==0.16.1
orjson~=3.10.12
pefile==2023.2.7
pycdlib==1.12.0
python-magic;platform_system!="Windows"
Expand Down
2 changes: 1 addition & 1 deletion ofrak_io/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ inspect:
.PHONY: test
test: inspect
$(PYTHON) -m pytest -n auto --cov=ofrak_io --cov-report=term-missing --cov-fail-under=100 ofrak_io_test
fun-coverage --cov-fail-under=100
fun-coverage --cov-fail-under=100 || ! (shell uname -m | grep x86_64)
26 changes: 20 additions & 6 deletions ofrak_patch_maker/Dockerstub
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
ARG TARGETARCH

COPY ${PACKAGE_PATH}/conf/toolchain_docker_${TARGETARCH}.conf /etc/ofrak/toolchain.conf

# LLVM
RUN mkdir -p /opt/rbs/toolchain && \
cd /tmp && \
Expand All @@ -22,13 +24,11 @@ RUN cd /tmp && \

#X64-64 toolchain for arm64 Docker images
RUN if [ "$TARGETARCH" = "arm64" ]; then \
apt-get update && apt-get install -y gcc-10-x86-64-linux-gnu; \
apt-get update && apt-get install -y gcc-12-x86-64-linux-gnu; \
fi;

#M68k GNU 10 Linux
#Only exists for x86
RUN if [ "$TARGETARCH" = "amd64" ]; then \
cd /tmp && \
RUN cd /tmp && \
apt-get update && apt-get install -y gcc g++ gperf bison flex texinfo help2man make libncurses5-dev python3-dev autoconf automake libtool libtool-bin gawk wget bzip2 xz-utils unzip patch libstdc++6 rsync && \
git clone https://github.com/crosstool-ng/crosstool-ng.git && \
cd crosstool-ng/ && \
Expand Down Expand Up @@ -81,8 +81,7 @@ RUN if [ "$TARGETARCH" = "amd64" ]; then \
'CT_ZSTD_PATCH_GLOBAL=y' \
>> .config && \
./ct-ng build CT_JOBS=`nproc` && \
cd /tmp && rm -rf crosstool-ng; \
fi;
cd /tmp && rm -rf crosstool-ng;

#M68k VBCC
RUN cd /tmp && \
Expand All @@ -108,6 +107,11 @@ RUN if [ "$TARGETARCH" = "amd64" ]; then \
wget https://armkeil.blob.core.windows.net/developer/Files/downloads/gnu-a/10.3-2021.07/binrel/gcc-arm-10.3-2021.07-x86_64-aarch64-none-linux-gnu.tar.xz --show-progress --progress=bar:force:noscroll && \
tar xf gcc-arm-10.3-2021.07-x86_64-aarch64-none-linux-gnu.tar.xz -C /opt/rbs/toolchain && \
rm -rf gcc-arm-10.3-2021.07-x86_64-aarch64-none-linux-gnu.tar.xz; \
elif [ "$TARGETARCH" = "arm64" ]; then \
cd /tmp && \
wget https://developer.arm.com/-/media/Files/downloads/gnu-a/10.3-2021.07/binrel/gcc-arm-10.3-2021.07-aarch64-aarch64-none-elf.tar.xz --show-progress --progress=bar:force:noscroll && \
tar xf gcc-arm-10.3-2021.07-aarch64-aarch64-none-elf.tar.xz -C /opt/rbs/toolchain && \
rm -rf gcc-arm-10.3-2021.07-aarch64-aarch64-none-elf.tar.xz; \
fi;

#AVR GCC
Expand All @@ -116,6 +120,11 @@ RUN if [ "$TARGETARCH" = "amd64" ]; then \
wget https://ww1.microchip.com/downloads/aemDocuments/documents/OTH/ProductDocuments/SoftwareLibraries/Firmware/avr8-gnu-toolchain-3.6.2.1778-linux.any.x86_64.tar.gz --show-progress --progress=bar:force:noscroll && \
tar xzf avr8-gnu-toolchain-3.6.2.1778-linux.any.x86_64.tar.gz -C /opt/rbs/toolchain && \
rm -rf avr8-gnu-toolchain-3.6.2.1778-linux.any.x86_64.tar.gz; \
elif [ "$TARGETARCH" = "arm64" ]; then \
cd /tmp && \
wget http://downloads.arduino.cc/tools/avr-gcc-7.3.0-atmel3.6.1-arduino7-aarch64-pc-linux-gnu.tar.bz2 --show-progress --progress=bar:force:noscroll && \
tar xf avr-gcc-7.3.0-atmel3.6.1-arduino7-aarch64-pc-linux-gnu.tar.bz2 -C /opt/rbs/toolchain && \
rm -rf avr-gcc-7.3.0-atmel3.6.1-arduino7-aarch64-pc-linux-gnu.tar.bz2; \
fi;

#PPC GNU 10 Linux
Expand All @@ -124,6 +133,11 @@ RUN if [ "$TARGETARCH" = "amd64" ]; then \
wget https://download.01.org/0day-ci/cross-package/gcc-10.3.0-nolibc/x86_64-gcc-10.3.0-nolibc_powerpc-linux.tar.xz --show-progress --progress=bar:force:noscroll && \
tar xf x86_64-gcc-10.3.0-nolibc_powerpc-linux.tar.xz -C /opt/rbs/toolchain && \
rm -rf x86_64-gcc-10.3.0-nolibc_powerpc-linux.tar.xz; \
elif [ "$TARGETARCH" = "arm64" ]; then \
cd /tmp && \
wget https://www.kernel.org/pub/tools/crosstool/files/bin/arm64/10.3.0/arm64-gcc-10.3.0-nolibc-powerpc-linux.tar.xz --show-progress --progress=bar:force:noscroll && \
tar xf arm64-gcc-10.3.0-nolibc-powerpc-linux.tar.xz -C /opt/rbs/toolchain && \
rm -rf arm64-gcc-10.3.0-nolibc-powerpc-linux.tar.xz; \
fi;

#BCC (GCC) SPARC v8
Expand Down
2 changes: 1 addition & 1 deletion ofrak_patch_maker/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ inspect:
.PHONY: test
test: inspect
$(PYTHON) -m pytest -n auto --cov=ofrak_patch_maker --cov-report=term-missing ofrak_patch_maker_test
fun-coverage --cov-fail-under=100
fun-coverage --cov-fail-under=100 || ! (shell uname -m | grep x86_64)
79 changes: 79 additions & 0 deletions ofrak_patch_maker/conf/toolchain_docker_amd64.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
[LLVM_12_0_1]
PREPROCESSOR = /opt/rbs/toolchain/llvm_12.0.1/bin/clang
COMPILER = /opt/rbs/toolchain/llvm_12.0.1/bin/clang
LINKER = /opt/rbs/toolchain/llvm_12.0.1/bin/ld.lld
BIN_PARSER = /opt/rbs/toolchain/llvm_12.0.1/bin/llvm-readobj
LIB = /opt/rbs/toolchain/llvm_12.0.1/lib

[GNU_ARM_NONE_EABI_10_2_1]
PREPROCESSOR = /opt/rbs/toolchain/gcc-arm-none-eabi-10-2020-q4-major/bin/arm-none-eabi-gcc
COMPILER = /opt/rbs/toolchain/gcc-arm-none-eabi-10-2020-q4-major/bin/arm-none-eabi-gcc
LINKER = /opt/rbs/toolchain/gcc-arm-none-eabi-10-2020-q4-major/bin/arm-none-eabi-ld
BIN_PARSER = /opt/rbs/toolchain/gcc-arm-none-eabi-10-2020-q4-major/bin/arm-none-eabi-objdump
LIB = /opt/rbs/toolchain/gcc-arm-none-eabi-10-2020-q4-major/lib

[GNU_M68K_LINUX_10]
PREPROCESSOR = /opt/rbs/toolchain/m68k-unknown-linux-gnu/bin/m68k-unknown-linux-gnu-gcc
COMPILER = /opt/rbs/toolchain/m68k-unknown-linux-gnu/bin/m68k-unknown-linux-gnu-gcc
LINKER = /opt/rbs/toolchain/m68k-unknown-linux-gnu/bin/m68k-unknown-linux-gnu-ld
BIN_PARSER = /opt/rbs/toolchain/m68k-unknown-linux-gnu/bin/m68k-unknown-linux-gnu-objdump
LIB=/opt/rbs/toolchain/m68k-unknown-linux-gnu/lib

[VBCC_M68K_0_9]
PREPROCESSOR = /opt/rbs/toolchain/m68k-unknown-linux-gnu/bin/m68k-unknown-linux-gnu-gcc
COMPILER = /opt/rbs/toolchain/vbcc_0_9/bin/vbccm68k
LINKER = /opt/rbs/toolchain/m68k-unknown-linux-gnu/bin/m68k-unknown-linux-gnu-ld
BIN_PARSER = /opt/rbs/toolchain/m68k-unknown-linux-gnu/bin/m68k-unknown-linux-gnu-objdump

[GNU_X86_64_LINUX_EABI_10_3_0]
# Expecting the user host is 64-bit GNU/Linux, we're replacing the system compiler
PREPROCESSOR = /opt/rbs/toolchain/gcc-10.3.0-nolibc/x86_64-linux/bin/x86_64-linux-gcc
COMPILER = /opt/rbs/toolchain/gcc-10.3.0-nolibc/x86_64-linux/bin/x86_64-linux-gcc
LINKER = /opt/rbs/toolchain/gcc-10.3.0-nolibc/x86_64-linux/bin/x86_64-linux-ld
BIN_PARSER = /opt/rbs/toolchain/gcc-10.3.0-nolibc/x86_64-linux/bin/x86_64-linux-objdump
LIB = /opt/rbs/toolchain/gcc-10.3.0-nolibc/x86_64-linux/lib

[GNU_X86_32_LINUX_EABI_10_3_0]
# Expecting the user host is 64-bit GNU/Linux, we're replacing the system compiler
PREPROCESSOR = /opt/rbs/toolchain/gcc-10.3.0-nolibc/x86_64-linux/bin/x86_64-linux-gcc
COMPILER = /opt/rbs/toolchain/gcc-10.3.0-nolibc/x86_64-linux/bin/x86_64-linux-gcc
LINKER = /opt/rbs/toolchain/gcc-10.3.0-nolibc/x86_64-linux/bin/x86_64-linux-ld
BIN_PARSER = /opt/rbs/toolchain/gcc-10.3.0-nolibc/x86_64-linux/bin/x86_64-linux-objdump
LIB = /opt/rbs/toolchain/gcc-10.3.0-nolibc/x86_64-linux/lib

[GNU_AARCH64_LINUX_10]
PREPROCESSOR = /opt/rbs/toolchain/gcc-arm-10.3-2021.07-x86_64-aarch64-none-linux-gnu/bin/aarch64-none-linux-gnu-gcc
COMPILER = /opt/rbs/toolchain/gcc-arm-10.3-2021.07-x86_64-aarch64-none-linux-gnu/bin/aarch64-none-linux-gnu-gcc
LINKER = /opt/rbs/toolchain/gcc-arm-10.3-2021.07-x86_64-aarch64-none-linux-gnu/bin/aarch64-none-linux-gnu-ld
BIN_PARSER = /opt/rbs/toolchain/gcc-arm-10.3-2021.07-x86_64-aarch64-none-linux-gnu/bin/aarch64-none-linux-gnu-objdump
LIB = /opt/rbs/toolchain/gcc-arm-10.3-2021.07-x86_64-aarch64-none-linux-gnu/lib

[GNU_AVR_5]
PREPROCESSOR = /opt/rbs/toolchain/avr8-gnu-toolchain-linux_x86_64/bin/avr-gcc
COMPILER = /opt/rbs/toolchain/avr8-gnu-toolchain-linux_x86_64/bin/avr-gcc
LINKER = /opt/rbs/toolchain/avr8-gnu-toolchain-linux_x86_64/bin/avr-ld
BIN_PARSER = /opt/rbs/toolchain/avr8-gnu-toolchain-linux_x86_64/bin/avr-objdump
LIB = /opt/rbs/toolchain/avr8-gnu-toolchain-linux_x86_64/lib

[GNU_PPC_LINUX_10]
PREPROCESSOR = /opt/rbs/toolchain/gcc-10.3.0-nolibc/powerpc-linux/bin/powerpc-linux-gcc
COMPILER = /opt/rbs/toolchain/gcc-10.3.0-nolibc/powerpc-linux/bin/powerpc-linux-gcc
LINKER = /opt/rbs/toolchain/gcc-10.3.0-nolibc/powerpc-linux/bin/powerpc-linux-ld
BIN_PARSER = /opt/rbs/toolchain/gcc-10.3.0-nolibc/powerpc-linux/bin/powerpc-linux-objdump
LIB = /opt/rbs/toolchain/gcc-10.3.0-nolibc/powerpc-linux/lib

[BCC_SPARC_GAISLER_ELF]
PREPROCESSOR = /opt/rbs/toolchain/bcc-2.0.7-gcc/bin/sparc-gaisler-elf-gcc
COMPILER = /opt/rbs/toolchain/bcc-2.0.7-gcc/bin/sparc-gaisler-elf-gcc
LINKER = /opt/rbs/toolchain/bcc-2.0.7-gcc/bin/sparc-gaisler-elf-ld
BIN_PARSER = /opt/rbs/toolchain/bcc-2.0.7-gcc/bin/sparc-gaisler-elf-objdump
LIB = /opt/rbs/toolchain/bcc-2.0.7-gcc/lib

[ASM]
ARM_ASM_PATH = /opt/rbs/toolchain/gcc-arm-none-eabi-10-2020-q4-major/bin/arm-none-eabi-as
X86_64_ASM_PATH = /opt/rbs/toolchain/gcc-10.3.0-nolibc/x86_64-linux/bin/x86_64-linux-as
M68K_ASM_PATH = /opt/rbs/toolchain/m68k-unknown-linux-gnu/bin/m68k-unknown-linux-gnu-as
AARCH64_ASM_PATH = /opt/rbs/toolchain/gcc-arm-10.3-2021.07-x86_64-aarch64-none-linux-gnu/bin/aarch64-none-linux-gnu-as
AVR_ASM_PATH = /opt/rbs/toolchain/avr8-gnu-toolchain-linux_x86_64/bin/avr-as
PPC_ASM_PATH = /opt/rbs/toolchain/gcc-10.3.0-nolibc/powerpc-linux/bin/powerpc-linux-as
SPARC_ASM_PATH = /opt/rbs/toolchain/bcc-2.0.7-gcc/bin/sparc-gaisler-elf-as
79 changes: 79 additions & 0 deletions ofrak_patch_maker/conf/toolchain_docker_arm64.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
[LLVM_12_0_1]
PREPROCESSOR = /opt/rbs/toolchain/llvm_12.0.1/bin/clang
COMPILER = /opt/rbs/toolchain/llvm_12.0.1/bin/clang
LINKER = /opt/rbs/toolchain/llvm_12.0.1/bin/ld.lld
BIN_PARSER = /opt/rbs/toolchain/llvm_12.0.1/bin/llvm-readobj
LIB = /opt/rbs/toolchain/llvm_12.0.1/lib

[GNU_ARM_NONE_EABI_10_2_1]
PREPROCESSOR = /opt/rbs/toolchain/gcc-arm-none-eabi-10-2020-q4-major/bin/arm-none-eabi-gcc
COMPILER = /opt/rbs/toolchain/gcc-arm-none-eabi-10-2020-q4-major/bin/arm-none-eabi-gcc
LINKER = /opt/rbs/toolchain/gcc-arm-none-eabi-10-2020-q4-major/bin/arm-none-eabi-ld
BIN_PARSER = /opt/rbs/toolchain/gcc-arm-none-eabi-10-2020-q4-major/bin/arm-none-eabi-objdump
LIB = /opt/rbs/toolchain/gcc-arm-none-eabi-10-2020-q4-major/lib

[GNU_M68K_LINUX_10]
PREPROCESSOR = /opt/rbs/toolchain/m68k-unknown-linux-gnu/bin/m68k-unknown-linux-gnu-gcc
COMPILER = /opt/rbs/toolchain/m68k-unknown-linux-gnu/bin/m68k-unknown-linux-gnu-gcc
LINKER = /opt/rbs/toolchain/m68k-unknown-linux-gnu/bin/m68k-unknown-linux-gnu-ld
BIN_PARSER = /opt/rbs/toolchain/m68k-unknown-linux-gnu/bin/m68k-unknown-linux-gnu-objdump
LIB=/opt/rbs/toolchain/m68k-unknown-linux-gnu/lib

[VBCC_M68K_0_9]
PREPROCESSOR = /opt/rbs/toolchain/m68k-unknown-linux-gnu/bin/m68k-unknown-linux-gnu-gcc
COMPILER = /opt/rbs/toolchain/vbcc_0_9/bin/vbccm68k
LINKER = /opt/rbs/toolchain/m68k-unknown-linux-gnu/bin/m68k-unknown-linux-gnu-ld
BIN_PARSER = /opt/rbs/toolchain/m68k-unknown-linux-gnu/bin/m68k-unknown-linux-gnu-objdump

[GNU_X86_64_LINUX_EABI_10_3_0]
# Expecting the user host is 64-bit GNU/Linux, we're replacing the system compiler
PREPROCESSOR = /opt/rbs/toolchain/gcc-10.3.0-nolibc/x86_64-linux/bin/x86_64-linux-gcc
COMPILER = /opt/rbs/toolchain/gcc-10.3.0-nolibc/x86_64-linux/bin/x86_64-linux-gcc
LINKER = /opt/rbs/toolchain/gcc-10.3.0-nolibc/x86_64-linux/bin/x86_64-linux-ld
BIN_PARSER = /opt/rbs/toolchain/gcc-10.3.0-nolibc/x86_64-linux/bin/x86_64-linux-objdump
LIB = /opt/rbs/toolchain/gcc-10.3.0-nolibc/x86_64-linux/lib

[GNU_X86_32_LINUX_EABI_10_3_0]
# Expecting the user host is 64-bit GNU/Linux, we're replacing the system compiler
PREPROCESSOR = /opt/rbs/toolchain/gcc-10.3.0-nolibc/x86_64-linux/bin/x86_64-linux-gcc
COMPILER = /opt/rbs/toolchain/gcc-10.3.0-nolibc/x86_64-linux/bin/x86_64-linux-gcc
LINKER = /opt/rbs/toolchain/gcc-10.3.0-nolibc/x86_64-linux/bin/x86_64-linux-ld
BIN_PARSER = /opt/rbs/toolchain/gcc-10.3.0-nolibc/x86_64-linux/bin/x86_64-linux-objdump
LIB = /opt/rbs/toolchain/gcc-10.3.0-nolibc/x86_64-linux/lib

[GNU_AARCH64_LINUX_10]
PREPROCESSOR = /opt/rbs/toolchain/gcc-arm-10.3-2021.07-aarch64-aarch64-none-elf/bin/aarch64-none-elf-gcc
COMPILER = /opt/rbs/toolchain/gcc-arm-10.3-2021.07-aarch64-aarch64-none-elf/bin/aarch64-none-elf-gcc
LINKER = /opt/rbs/toolchain/gcc-arm-10.3-2021.07-aarch64-aarch64-none-elf/bin/aarch64-none-elf-ld
BIN_PARSER = /opt/rbs/toolchain/gcc-arm-10.3-2021.07-aarch64-aarch64-none-elf/bin/aarch64-none-elf-objdump
LIB = /opt/rbs/toolchain/gcc-arm-10.3-2021.07-aarch64-aarch64-none-elf/lib

[GNU_AVR_5]
PREPROCESSOR = /opt/rbs/toolchain/avr/bin/avr-gcc
COMPILER = /opt/rbs/toolchain/avr/bin/avr-gcc
LINKER = /opt/rbs/toolchain/avr/bin/avr-ld
BIN_PARSER = /opt/rbs/toolchain/avr/bin/avr-objdump
LIB = /opt/rbs/toolchain/avr/lib

[GNU_PPC_LINUX_10]
PREPROCESSOR = /opt/rbs/toolchain/gcc-10.3.0-nolibc/powerpc-linux/bin/powerpc-linux-gcc
COMPILER = /opt/rbs/toolchain/gcc-10.3.0-nolibc/powerpc-linux/bin/powerpc-linux-gcc
LINKER = /opt/rbs/toolchain/gcc-10.3.0-nolibc/powerpc-linux/bin/powerpc-linux-ld
BIN_PARSER = /opt/rbs/toolchain/gcc-10.3.0-nolibc/powerpc-linux/bin/powerpc-linux-objdump
LIB = /opt/rbs/toolchain/gcc-10.3.0-nolibc/powerpc-linux/lib

[BCC_SPARC_GAISLER_ELF]
PREPROCESSOR = /opt/rbs/toolchain/bcc-2.0.7-gcc/bin/sparc-gaisler-elf-gcc
COMPILER = /opt/rbs/toolchain/bcc-2.0.7-gcc/bin/sparc-gaisler-elf-gcc
LINKER = /opt/rbs/toolchain/bcc-2.0.7-gcc/bin/sparc-gaisler-elf-ld
BIN_PARSER = /opt/rbs/toolchain/bcc-2.0.7-gcc/bin/sparc-gaisler-elf-objdump
LIB = /opt/rbs/toolchain/bcc-2.0.7-gcc/lib

[ASM]
ARM_ASM_PATH = /opt/rbs/toolchain/gcc-arm-none-eabi-10-2020-q4-major/bin/arm-none-eabi-as
X86_64_ASM_PATH = /opt/rbs/toolchain/gcc-10.3.0-nolibc/x86_64-linux/bin/x86_64-linux-as
M68K_ASM_PATH = /opt/rbs/toolchain/m68k-unknown-linux-gnu/bin/m68k-unknown-linux-gnu-as
AARCH64_ASM_PATH = /opt/rbs/toolchain/gcc-arm-10.3-2021.07-aarch64-aarch64-none-elf/bin/aarch64-none-elf-as
AVR_ASM_PATH = /opt/rbs/toolchain/avr/bin/avr-as
PPC_ASM_PATH = /opt/rbs/toolchain/gcc-10.3.0-nolibc/powerpc-linux/bin/powerpc-linux-as
SPARC_ASM_PATH = /opt/rbs/toolchain/bcc-2.0.7-gcc/bin/sparc-gaisler-elf-as
12 changes: 6 additions & 6 deletions ofrak_patch_maker/ofrak_patch_maker/toolchain/abstract.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from ofrak_type import ArchInfo
from ofrak_patch_maker.binary_parser.abstract import AbstractBinaryFileParser
from ofrak_patch_maker.toolchain.model import Segment, ToolchainConfig
from ofrak_patch_maker.toolchain.utils import get_repository_config
from ofrak_patch_maker.toolchain.utils import get_exec_from_config, get_repository_config
from ofrak_type.architecture import InstructionSet
from ofrak_type.bit_width import BitWidth
from ofrak_type.memory_permissions import MemoryPermissions
Expand Down Expand Up @@ -157,35 +157,35 @@ def _assembler_path(self) -> str:
assembler_path = "SPARC_ASM_PATH"
else:
assembler_path = f"{self._processor.isa.value.upper()}_ASM_PATH"
return get_repository_config("ASM", assembler_path)
return get_exec_from_config("ASM", assembler_path)

@property
def _preprocessor_path(self) -> str:
"""
:return str: path to the toolchain preprocessor - this is usually the compiler.
"""
return get_repository_config(self.name, "PREPROCESSOR")
return get_exec_from_config(self.name, "PREPROCESSOR")

@property
def _compiler_path(self) -> str:
"""
:return str: path to the toolchain compiler
"""
return get_repository_config(self.name, "COMPILER")
return get_exec_from_config(self.name, "COMPILER")

@property
def _linker_path(self) -> str:
"""
:return str: path to the toolchain linker
"""
return get_repository_config(self.name, "LINKER")
return get_exec_from_config(self.name, "LINKER")

@property
def _readobj_path(self) -> str:
"""
:return str: path to the toolchain binary analysis utility
"""
return get_repository_config(self.name, "BIN_PARSER")
return get_exec_from_config(self.name, "BIN_PARSER")

@property
def _lib_path(self) -> str:
Expand Down
Loading