Initial project import from IES
This commit is contained in:
parent
754fadeead
commit
58b1168787
1
.gitattributes
vendored
Normal file
1
.gitattributes
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
*.rpm filter=lfs diff=lfs merge=lfs -text
|
3
.gitignore
vendored
Normal file
3
.gitignore
vendored
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
/.idea
|
||||||
|
/output/report
|
||||||
|
/output/*-build
|
2
LICENSE
2
LICENSE
|
@ -1,4 +1,4 @@
|
||||||
Copyright (c) <year> <owner>. All rights reserved.
|
Copyright (c) 2021 WeebDataHoarder. All rights reserved.
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
||||||
|
|
||||||
|
|
14
README.md
14
README.md
|
@ -1,2 +1,14 @@
|
||||||
# IES-binary-diffing
|
# Build instructions for Binary Diffing
|
||||||
|
Use normal build for your own usage. The tools here are used to copy how Intel/Silicom compiles their released versions.
|
||||||
|
|
||||||
|
## Requirements
|
||||||
|
* Docker
|
||||||
|
* patience (specific GCC build will take a while)
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
* `$ ./do-build-as-silicom.sh [commit]`
|
||||||
|
* Creates CentOS 6.10 container with GCC 4.4.2-7 on it, and builds IES from commit (default _master_). Re-run to build new changes.
|
||||||
|
* Alternatively you can build via GCC 4.4.4-10, but it has slight differences. Do this via `$ GCC_VERSION=4.4.4-10.el6 ./do-build-as-silicom.sh`
|
||||||
|
* `$ ./do-binary-diff.sh`
|
||||||
|
* Creates elf_diff container, and diffs produced build on first step. Grabs known Silicom _.so_
|
||||||
|
* Outputs for both steps exist under `./output` folder.
|
13
do-binary-diff.sh
Executable file
13
do-binary-diff.sh
Executable file
|
@ -0,0 +1,13 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
SCRIPT_DIR=$(cd -P -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd -P)
|
||||||
|
|
||||||
|
pushd "${SCRIPT_DIR}"
|
||||||
|
|
||||||
|
docker build --tag=binary-diff docker/binary-diff
|
||||||
|
|
||||||
|
docker run --rm -v "$(pwd)/output":/home/user/output binary-diff \
|
||||||
|
"https://git.gammaspectra.live/Sillycom/rdif/raw/commit/ecabff31a76c6ed966e5ede2f070d81b05324881/driver/64/libFocalpointSDK.so" \
|
||||||
|
"https://git.gammaspectra.live/Sillycom/rdif/raw/commit/ecabff31a76c6ed966e5ede2f070d81b05324881/driver/64/libLTStdPlatform.so"
|
15
do-build-as-silicom.sh
Executable file
15
do-build-as-silicom.sh
Executable file
|
@ -0,0 +1,15 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
SCRIPT_DIR=$(cd -P -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd -P)
|
||||||
|
|
||||||
|
pushd "${SCRIPT_DIR}"
|
||||||
|
|
||||||
|
if [[ "${GCC_VERSION}" == "" ]]; then
|
||||||
|
GCC_VERSION=4.4.2-7.fc12
|
||||||
|
fi
|
||||||
|
|
||||||
|
docker build --build-arg GCC_VERSION="${GCC_VERSION}" --tag=silicom-centos-builder docker/silicom-centos-builder
|
||||||
|
|
||||||
|
docker run --rm -v "$(pwd)/..":/home/mockbuild/src -v "$(pwd)/output":/home/mockbuild/dst silicom-centos-builder "${1}"
|
20
docker/binary-diff/Dockerfile
Normal file
20
docker/binary-diff/Dockerfile
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
FROM python:3.10-buster
|
||||||
|
|
||||||
|
RUN groupadd -g 1000 -r user && useradd -u 1000 -g 1000 -m user && \
|
||||||
|
DEBIAN_FRONTEND=noninteractive apt update && \
|
||||||
|
DEBIAN_FRONTEND=noninteractive apt install -y locales abigail-tools && \
|
||||||
|
sed -i 's/^# *\(en_US.UTF-8\)/\1/' /etc/locale.gen && locale-gen && update-locale LANG="en_US.UTF-8"
|
||||||
|
|
||||||
|
USER user
|
||||||
|
WORKDIR /home/user
|
||||||
|
|
||||||
|
ENV VIRTUAL_ENV=/home/user/venv3
|
||||||
|
|
||||||
|
RUN python3 -m venv $VIRTUAL_ENV
|
||||||
|
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
|
||||||
|
RUN pip install --upgrade pip && \
|
||||||
|
pip install elf_diff
|
||||||
|
|
||||||
|
COPY entrypoint.sh /home/user/entrypoint.sh
|
||||||
|
|
||||||
|
ENTRYPOINT ["/home/user/entrypoint.sh"]
|
44
docker/binary-diff/entrypoint.sh
Executable file
44
docker/binary-diff/entrypoint.sh
Executable file
|
@ -0,0 +1,44 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
export LANGUAGE=en_US.UTF-8
|
||||||
|
export LC_ALL=en_US.UTF-8
|
||||||
|
export LANG=en_US.UTF-8
|
||||||
|
export LC_TYPE=en_US.UTF-8
|
||||||
|
|
||||||
|
if [[ -d "output/target-build" ]]; then
|
||||||
|
rm -R output/target-build
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -d "output/report" ]]; then
|
||||||
|
rm -R output/report
|
||||||
|
fi
|
||||||
|
|
||||||
|
mkdir output/target-build
|
||||||
|
mkdir output/report
|
||||||
|
mkdir output/report/libFocalpointSDK
|
||||||
|
mkdir output/report/libLTStdPlatform
|
||||||
|
|
||||||
|
curl "${1}" --location --output output/target-build/libFocalpointSDK.so
|
||||||
|
curl "${2}" --location --output output/target-build/libLTStdPlatform.so
|
||||||
|
|
||||||
|
do_report () {
|
||||||
|
python3 -m elf_diff \
|
||||||
|
--bin_dir "/usr/bin" \
|
||||||
|
--bin_prefix "x86_64-linux-gnu-" \
|
||||||
|
--symbol_exclusion_regex "^__" \
|
||||||
|
--similarity_threshold 0.985 \
|
||||||
|
--old_binary_filename output/current-build/${1}.so \
|
||||||
|
--new_binary_filename output/target-build/${1}.so \
|
||||||
|
--html_dir output/report/${1}
|
||||||
|
|
||||||
|
abidiff \
|
||||||
|
--deleted-fns --changed-fns --added-fns --deleted-vars --added-vars \
|
||||||
|
--show-bytes --show-hex \
|
||||||
|
output/current-build/${1}.so \
|
||||||
|
output/target-build/${1}.so | tee output/report/${1}/abidiff.txt
|
||||||
|
}
|
||||||
|
|
||||||
|
do_report libLTStdPlatform
|
||||||
|
do_report libFocalpointSDK
|
47
docker/silicom-centos-builder/Dockerfile
Normal file
47
docker/silicom-centos-builder/Dockerfile
Normal file
|
@ -0,0 +1,47 @@
|
||||||
|
FROM centos:6.10
|
||||||
|
|
||||||
|
COPY centos6-eol.repo /etc/yum.repos.d/CentOS-Base.repo
|
||||||
|
|
||||||
|
RUN yum install -y make autogen autoconf automake libtool git rpm-build yum-utils glibc-devel
|
||||||
|
|
||||||
|
RUN groupadd -g 1000 mockbuild && adduser -u 1000 -g 1000 -m mockbuild
|
||||||
|
|
||||||
|
ARG GCC_VERSION=4.4.2-7.fc12
|
||||||
|
#RUN curl "https://vault.centos.org/6.0/os/Source/Packages/gcc-4.4.4-13.el6.src.rpm" --location --output gcc-4.4.4-13.el6.src.rpm
|
||||||
|
COPY "gcc-${GCC_VERSION}.src.rpm" "gcc-${GCC_VERSION}.src.rpm"
|
||||||
|
RUN rpm -ivh "gcc-${GCC_VERSION}.src.rpm" && \
|
||||||
|
sed -i 's/%global include_gappletviewer 1/%global include_gappletviewer 0/g' ~/rpmbuild/SPECS/gcc.spec && \
|
||||||
|
sed -i 's/%global build_ada 1/%global build_ada 0/g' ~/rpmbuild/SPECS/gcc.spec && \
|
||||||
|
sed -i 's/%global build_java 1/%global build_java 0/g' ~/rpmbuild/SPECS/gcc.spec && \
|
||||||
|
sed -i 's/%global build_libstdcxx_docs 1/%global build_libstdcxx_docs 0/g' ~/rpmbuild/SPECS/gcc.spec && \
|
||||||
|
sed -i 's/%enable-languages=c,c++,objc,obj-c++,java,fortran/%enable-languages=c,c++/g' ~/rpmbuild/SPECS/gcc.spec && \
|
||||||
|
sed -i 's/# run the tests./exit 0/g' ~/rpmbuild/SPECS/gcc.spec
|
||||||
|
|
||||||
|
RUN rpmbuild -bs ~/rpmbuild/SPECS/gcc.spec
|
||||||
|
RUN yum-builddep --nogpgcheck -y "/root/rpmbuild/SRPMS/gcc-"*.src.rpm
|
||||||
|
RUN rpmbuild --rebuild "/root/rpmbuild/SRPMS/gcc-"*.src.rpm
|
||||||
|
|
||||||
|
RUN yum remove -y gcc libtool
|
||||||
|
RUN rpm --oldpackage -Uvh /root/rpmbuild/RPMS/x86_64/*.rpm
|
||||||
|
|
||||||
|
|
||||||
|
ARG LIBTOOL_VERSION=2.2.6-15.5.el6
|
||||||
|
COPY "libtool-${LIBTOOL_VERSION}.src.rpm" "libtool-${LIBTOOL_VERSION}.src.rpm"
|
||||||
|
RUN rpm -ivh "libtool-${LIBTOOL_VERSION}.src.rpm" && \
|
||||||
|
sed -i 's/devel, gcc-gfortran, gcc-java/devel/g' ~/rpmbuild/SPECS/libtool.spec && \
|
||||||
|
sed -i 's/gcc_version 4.4.4/gcc_version 4.4.0/g' ~/rpmbuild/SPECS/libtool.spec && \
|
||||||
|
sed -i 's/Requires: gcc = /Requires: gcc >= /g' ~/rpmbuild/SPECS/libtool.spec
|
||||||
|
RUN rpmbuild -bs ~/rpmbuild/SPECS/libtool.spec
|
||||||
|
RUN yum-builddep --nogpgcheck -y "/root/rpmbuild/SRPMS/libtool-"*.src.rpm
|
||||||
|
RUN rpmbuild --rebuild "/root/rpmbuild/SRPMS/libtool-"*.src.rpm
|
||||||
|
RUN rpm --oldpackage -Uvh "/root/rpmbuild/RPMS/x86_64/libtool-"*.rpm
|
||||||
|
|
||||||
|
RUN rm -R "libtool-${LIBTOOL_VERSION}.src.rpm" "gcc-${GCC_VERSION}.src.rpm" ~/rpmbuild
|
||||||
|
|
||||||
|
USER mockbuild
|
||||||
|
|
||||||
|
COPY entrypoint.sh /home/mockbuild/entrypoint.sh
|
||||||
|
|
||||||
|
WORKDIR /home/mockbuild
|
||||||
|
|
||||||
|
ENTRYPOINT ["/home/mockbuild/entrypoint.sh"]
|
39
docker/silicom-centos-builder/centos6-eol.repo
Normal file
39
docker/silicom-centos-builder/centos6-eol.repo
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
[C6.10-base]
|
||||||
|
name=CentOS-6.10 - Base
|
||||||
|
baseurl=http://vault.centos.org/6.10/os/$basearch/
|
||||||
|
gpgcheck=1
|
||||||
|
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
|
||||||
|
enabled=1
|
||||||
|
metadata_expire=never
|
||||||
|
|
||||||
|
[C6.10-updates]
|
||||||
|
name=CentOS-6.10 - Updates
|
||||||
|
baseurl=http://vault.centos.org/6.10/updates/$basearch/
|
||||||
|
gpgcheck=1
|
||||||
|
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
|
||||||
|
enabled=1
|
||||||
|
metadata_expire=never
|
||||||
|
|
||||||
|
[C6.10-extras]
|
||||||
|
name=CentOS-6.10 - Extras
|
||||||
|
baseurl=http://vault.centos.org/6.10/extras/$basearch/
|
||||||
|
gpgcheck=1
|
||||||
|
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
|
||||||
|
enabled=1
|
||||||
|
metadata_expire=never
|
||||||
|
|
||||||
|
[C6.10-contrib]
|
||||||
|
name=CentOS-6.10 - Contrib
|
||||||
|
baseurl=http://vault.centos.org/6.10/contrib/$basearch/
|
||||||
|
gpgcheck=1
|
||||||
|
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
|
||||||
|
enabled=0
|
||||||
|
metadata_expire=never
|
||||||
|
|
||||||
|
[C6.10-centosplus]
|
||||||
|
name=CentOS-6.10 - CentOSPlus
|
||||||
|
baseurl=http://vault.centos.org/6.10/centosplus/$basearch/
|
||||||
|
gpgcheck=1
|
||||||
|
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
|
||||||
|
enabled=0
|
||||||
|
metadata_expire=never
|
23
docker/silicom-centos-builder/entrypoint.sh
Executable file
23
docker/silicom-centos-builder/entrypoint.sh
Executable file
|
@ -0,0 +1,23 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
git clone http://git.gammaspectra.live/Sillycom/IES.git working_src
|
||||||
|
|
||||||
|
pushd working_src
|
||||||
|
git reset --hard "${1}"
|
||||||
|
|
||||||
|
./autogen.sh
|
||||||
|
|
||||||
|
CFLAGS="-march=x86-64 -mtune=generic" CPPFLAGS="-DPLATFORM_NUM_FOCALPOINTS=6" ./configure --enable-shared --disable-static
|
||||||
|
|
||||||
|
make
|
||||||
|
|
||||||
|
if [[ -d "/home/mockbuild/dst/current-build" ]]; then
|
||||||
|
rm -R /home/mockbuild/dst/current-build
|
||||||
|
fi
|
||||||
|
|
||||||
|
mkdir /home/mockbuild/dst/current-build
|
||||||
|
|
||||||
|
cp src/.libs/libFocalpointSDK.so /home/mockbuild/dst/current-build/
|
||||||
|
cp src/.libs/libLTStdPlatform.so /home/mockbuild/dst/current-build/
|
BIN
docker/silicom-centos-builder/gcc-4.4.2-7.fc12.src.rpm
(Stored with Git LFS)
Normal file
BIN
docker/silicom-centos-builder/gcc-4.4.2-7.fc12.src.rpm
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
docker/silicom-centos-builder/gcc-4.4.4-10.el6.src.rpm
(Stored with Git LFS)
Normal file
BIN
docker/silicom-centos-builder/gcc-4.4.4-10.el6.src.rpm
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
docker/silicom-centos-builder/libtool-2.2.6-15.5.el6.src.rpm
(Stored with Git LFS)
Normal file
BIN
docker/silicom-centos-builder/libtool-2.2.6-15.5.el6.src.rpm
(Stored with Git LFS)
Normal file
Binary file not shown.
0
output/.gitkeep
Normal file
0
output/.gitkeep
Normal file
Loading…
Reference in a new issue