Installation and Deployment
Software
- OS: openEuler 23.09
Hardware
- x86_64
- AArch64
Preparing the Environment
- Install the openEuler operating system. For details, see the openEuler 23.09 Installation Guide.
Install the dependency
Installing the Software on Which the PIN GCC Client Depends
yum install -y gcc
yum install -y gcc-c++
yum install -y gcc-plugin-devel
yum install -y make
yum install -y cmake
yum install -y grpc
yum install -y grpc-devel
yum install -y grpc-plugins
yum install -y protobuf-devel
yum install -y jsoncpp
yum install -y jsoncpp-devel
yum install -y mlir
yum install -y mlir-devel
yum install -y llvm-devel
yum install -y llvm-test
Installing the Software on Which the PIN Server Depends
yum install -y gcc # Recommended in case there is no default compiler in the enlivenment.
yum install -y gcc-c++ # Recommended in case there is no default compiler in the enlivenment.
yum install -y make
yum install -y cmake
yum install -y grpc
yum install -y grpc-devel
yum install -y grpc-plugins
yum install -y protobuf-devel
yum install -y jsoncpp
yum install -y jsoncpp-devel
yum install -y mlir
yum install -y mlir-devel
yum install -y llvm-devel
yum install -y llvm-test
Installing PIN
rpmbuild
Building the PIN GCC Client
git clone https://gitee.com/src-openeuler/pin-gcc-client.git
cd pin-gcc-client
mkdir -p ~/rpmbuild/SOURCES
cp *.patch pin-gcc-client-0.4.1.tar.gz ~/rpmbuild/SOURCES
rpmbuild -ba pin-gcc-client.spec
cd ~/rpmbuild/RPMS/aarch64 // aarch64|x86_64
rpm -ivh pin-gcc-client-0.4.1-12.aarch64.rpm // aarch64|x86_64
Building the PIN Server
git clone https://gitee.com/src-openeuler/pin-server.git
cd pin-server
mkdir -p ~/rpmbuild/SOURCES
cp *.patch pin-server-0.4.0.tar.gz ~/rpmbuild/SOURCES
rpmbuild -ba pin-server.spec
cd ~/rpmbuild/RPMS/aarch64 // aarch64|x86_64
rpm -ivh pin-server-demo-0.4.0-14.aarch64.rpm // aarch64|x86_64
rpm -ivh pin-server-0.4.0-14.aarch64.rpm // aarch64|x86_64
Build
Building the PIN GCC Client
git clone https://gitee.com/openeuler/pin-gcc-client.git
cd pin-gcc-client
mkdir build
cd build
cmake ../ -DMLIR_DIR=/usr/lib64/cmake/mlir -DLLVM_DIR=/usr/lib64/cmake/llvm
make
Building the PIN Server
git clone https://gitee.com/openeuler/pin-server.git
cd pin-server
mkdir build
cd build
cmake ../ -DMLIR_DIR=/usr/lib64/cmake/mlir -DLLVM_DIR=/usr/lib64/cmake/llvm
make
Usage
You can use -fplugin
and -fplugin-arg-libpin_xxx
to enable the Plug-IN (PIN) tool.
Command:
gcc -fplugin=${CLIENT_PATH}/build/libpin_gcc_client.so \
-fplugin-arg-libpin_gcc_client-server_path=${SERVER_PATH}/build/pin_server \
-fplugin-arg-libpin_gcc_client-log_level="1" \
-fplugin-arg-libpin_gcc_client-arg1="xxx" \
$(SOURCE)
You can use the /usr/local/bin/pin-gcc-client.json
file to configure PIN. If the file does not exist in /usr/local/bin
, you can copy it from /usr/bin
if PIN is installed using RPM, or the configs
directory of the PIN client source code.
The configuration options are as follows:
path
: path of the executable file of the PIN server.
sha256file
: path of the PIN verification file xxx.sha256
.
timeout
: timeout interval for cross-process communication, in milliseconds.
Compile options:
-fplugin
: path of the .so file of the PIN client.
-fplugin-arg-libpin_gcc_client-server_path
: path of the executable program of the PIN server.
-fplugin-arg-libpin_gcc_client-log_level
: default log level. The value ranges from 0
to 3
. The default value is 1
.
-fplugin-arg-libpin_gcc_client-argN
: other parameters that can be specified as required. argN
indicates the argument required by PIN.
Compatibility
This section describes the compatibility issues in some special scenarios. This project is in continuous iteration and will be fixed as soon as possible. Developers are welcome to join this project.
- PIN has been adapted for LLVM 15. Currently, only basic statistical plugins are supported.