diff --git a/Object-elf.patch b/Object-elf.patch new file mode 100644 index 0000000..1fd9ed6 --- /dev/null +++ b/Object-elf.patch @@ -0,0 +1,30 @@ +# workaround for https://github.com/dyninst/dyninst/issues/396 + +--- ./dyninst-9.3.2/symtabAPI/src/Object-elf.C.sv 2017-09-27 21:43:18.399429243 -0400 ++++ ./dyninst-9.3.2/symtabAPI/src/Object-elf.C 2017-09-27 21:56:14.485125928 -0400 +@@ -1445,6 +1445,24 @@ + if (fbt_iter == -1) { // Create new relocation entry. + relocationEntry re( next_plt_entry_addr, offset, targ_name, + NULL, type ); ++ if (type == R_X86_64_IRELATIVE) { ++ vector funcs; ++ dyn_hash_map >::iterator iter; ++ // find the resolver function and use that as the ++ // caller function symbol. The resolver has not run ++ // so we don't know the ultimate destination. ++ // Since the funcsByOffset map hasn't been setup yet ++ // we cannot call associated_symtab->findFuncByEntryOffset ++ for (iter = symbols_.begin(); iter != symbols_.end(); ++iter) { ++ std::string name = iter->first; ++ Symbol *sym = iter->second[0]; ++ if (sym->getOffset() == (Offset)addend) { ++ // Use dynsym_list.push_back(sym) instead? ++ re.addDynSym(sym); ++ break; ++ } ++ } ++ } + re.setAddend(addend); + re.setRegionType(rtype); + if (dynsym_list.size() > 0) + diff --git a/README.en.md b/README.en.md deleted file mode 100644 index 8cc5fbf..0000000 --- a/README.en.md +++ /dev/null @@ -1,36 +0,0 @@ -# dyninst - -#### Description -Tools for binary instrumentation, analysis, and modification - -#### Software Architecture -Software architecture description - -#### Installation - -1. xxxx -2. xxxx -3. xxxx - -#### Instructions - -1. xxxx -2. xxxx -3. xxxx - -#### Contribution - -1. Fork the repository -2. Create Feat_xxx branch -3. Commit your code -4. Create Pull Request - - -#### Gitee Feature - -1. You can use Readme\_XXX.md to support different languages, such as Readme\_en.md, Readme\_zh.md -2. Gitee blog [blog.gitee.com](https://blog.gitee.com) -3. Explore open source project [https://gitee.com/explore](https://gitee.com/explore) -4. The most valuable open source project [GVP](https://gitee.com/gvp) -5. The manual of Gitee [https://gitee.com/help](https://gitee.com/help) -6. The most popular members [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/) diff --git a/README.md b/README.md index 6113420..7e78376 100644 --- a/README.md +++ b/README.md @@ -1,37 +1 @@ # dyninst - -#### 介绍 -Tools for binary instrumentation, analysis, and modification - -#### 软件架构 -软件架构说明 - - -#### 安装教程 - -1. xxxx -2. xxxx -3. xxxx - -#### 使用说明 - -1. xxxx -2. xxxx -3. xxxx - -#### 参与贡献 - -1. Fork 本仓库 -2. 新建 Feat_xxx 分支 -3. 提交代码 -4. 新建 Pull Request - - -#### 码云特技 - -1. 使用 Readme\_XXX.md 来支持不同的语言,例如 Readme\_en.md, Readme\_zh.md -2. 码云官方博客 [blog.gitee.com](https://blog.gitee.com) -3. 你可以 [https://gitee.com/explore](https://gitee.com/explore) 这个地址来了解码云上的优秀开源项目 -4. [GVP](https://gitee.com/gvp) 全称是码云最有价值开源项目,是码云综合评定出的优秀开源项目 -5. 码云官方提供的使用手册 [https://gitee.com/help](https://gitee.com/help) -6. 码云封面人物是一档用来展示码云会员风采的栏目 [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/) diff --git a/addrtranslate-sysv.patch b/addrtranslate-sysv.patch new file mode 100644 index 0000000..a61d161 --- /dev/null +++ b/addrtranslate-sysv.patch @@ -0,0 +1,13 @@ +# workaround for https://github.com/dyninst/dyninst/issues/406 + +--- dyninst-9.3.2/common/src/addrtranslate-sysv.C.sv 2017-10-03 21:32:23.608614189 -0400 ++++ dyninst-9.3.2/common/src/addrtranslate-sysv.C 2017-10-03 21:33:36.538642148 -0400 +@@ -800,6 +800,7 @@ + continue; + } + if (obj_name == "linux-vdso.so.1" || ++ obj_name == "linux-vdso64.so.1" || + obj_name == "linux-gate.so.1") + { + continue; + diff --git a/dyninst-9.3.2-gcc8.patch b/dyninst-9.3.2-gcc8.patch new file mode 100644 index 0000000..49d3b90 --- /dev/null +++ b/dyninst-9.3.2-gcc8.patch @@ -0,0 +1,15 @@ +diff -up dyninst-9.3.2/dyninst-9.3.2/symtabAPI/src/emitElf.C.me dyninst-9.3.2/dyninst-9.3.2/symtabAPI/src/emitElf.C +--- dyninst-9.3.2/dyninst-9.3.2/symtabAPI/src/emitElf.C.me 2018-02-07 15:50:36.706363500 +0100 ++++ dyninst-9.3.2/dyninst-9.3.2/symtabAPI/src/emitElf.C 2018-02-07 16:30:28.173906877 +0100 +@@ -2512,8 +2512,8 @@ void emitElf::createDynamicSec + + if (!object->hasReldyn() && !object->hasReladyn()) { + if (object->getRelType() == Region::RT_REL) { +- new_dynamic_entries.push_back(make_pair(DT_REL, 0)); +- new_dynamic_entries.push_back(make_pair(DT_RELSZ, 0)); ++ new_dynamic_entries.push_back(std::pair(DT_REL, 0)); ++ new_dynamic_entries.push_back(std::pair(DT_RELSZ, 0)); + + dynamicSecData[DT_REL].push_back(dynsecData + curpos); + dynsecData[curpos].d_tag = DT_NULL; + diff --git a/dyninst-9.3.2-glibc-rpc.patch b/dyninst-9.3.2-glibc-rpc.patch new file mode 100644 index 0000000..4ccd7f9 --- /dev/null +++ b/dyninst-9.3.2-glibc-rpc.patch @@ -0,0 +1,24 @@ +diff -up dyninst-9.3.2/dyninst-9.3.2/CMakeLists.txt.me dyninst-9.3.2/dyninst-9.3.2/CMakeLists.txt +--- dyninst-9.3.2/dyninst-9.3.2/CMakeLists.txt.me 2018-02-07 15:25:38.925763122 +0100 ++++ dyninst-9.3.2/dyninst-9.3.2/CMakeLists.txt 2018-02-07 15:30:42.242099198 +0100 +@@ -19,6 +19,7 @@ include (${DYNINST_ROOT}/cmake/shared.cm + configure_file(cmake/version.h.in common/h/version.h) + include_directories(${PROJECT_BINARY_DIR}) + include_directories(${PROJECT_BINARY_DIR}/common/h) ++include_directories("/usr/include/tirpc/") + set (HEADER_DIRS common + dataflowAPI + dyninstAPI +diff -up dyninst-9.3.2/dyninst-9.3.2/common/src/linuxHeaders.h.me dyninst-9.3.2/dyninst-9.3.2/common/src/linuxHeaders.h +--- dyninst-9.3.2/dyninst-9.3.2/common/src/linuxHeaders.h.me 2018-02-07 15:06:45.961780668 +0100 ++++ dyninst-9.3.2/dyninst-9.3.2/common/src/linuxHeaders.h 2018-02-07 15:38:56.832278338 +0100 +@@ -281,7 +281,7 @@ inline bool_t P_xdr_string(XDR *x, char + inline void P_xdrrec_create(XDR *x, const u_int send_sz, const u_int rec_sz, + const caddr_t handle, + xdr_rd_func read_r, xdr_wr_func write_f) { +- xdrrec_create(x, send_sz, rec_sz, handle, (int(*)(char*, char*, int))read_r, (int(*)(char*, char*, int))write_f);} ++ xdrrec_create(x, send_sz, rec_sz, handle, (int(*)(void*, void*, int))read_r, (int(*)(void*, void*, int))write_f);} + inline bool_t P_xdrrec_endofrecord(XDR *x, int now) { + return (xdrrec_endofrecord(x, now));} + inline bool_t P_xdrrec_skiprecord(XDR *x) { return (xdrrec_skiprecord(x));} + diff --git a/dyninst-9.3.2.tar.gz b/dyninst-9.3.2.tar.gz new file mode 100644 index 0000000..74a30fc Binary files /dev/null and b/dyninst-9.3.2.tar.gz differ diff --git a/dyninst.spec b/dyninst.spec new file mode 100644 index 0000000..d6c8d16 --- /dev/null +++ b/dyninst.spec @@ -0,0 +1,134 @@ +Name: dyninst +License: LGPLv2+ +Release: 13 +Version: 9.3.2 +Summary: An API for Run-time Code Generation +ExclusiveArch: x86_64 + +%global dyninst_base dyninst-%{version} +%global testsuite_base testsuite-9.3.0 + +URL: http://www.dyninst.org +Source0: https://github.com/dyninst/dyninst/archive/v%{version}/dyninst-%{version}.tar.gz +Source1: https://github.com/dyninst/testsuite/archive/v9.3.0/testsuite-9.3.0.tar.gz + +Patch1: testsuite-9.3.0-junit-nullptr.patch +Patch2: addrtranslate-sysv.patch +Patch3: Object-elf.patch +Patch4: dyninst-9.3.2-gcc8.patch +Patch5: dyninst-9.3.2-glibc-rpc.patch + +BuildRequires: cmake gcc-c++ +BuildRequires: binutils-devel boost-devel +BuildRequires: elfutils-libelf-devel +BuildRequires: libdwarf-devel >= 20111030 +BuildRequires: libtirpc-devel + +BuildRequires: gcc-gfortran glibc-static libstdc++-static nasm + +%description +Dyninst is an Application Program Interface (API) to permit +the insertion of code into a computer application that is +either running or on disk. The API for inserting code into +a running application, called dynamic instrumentation, shares +much of the same structure as the API for inserting code into +an executable file or library, known as static instrumentation. + +%package devel +Summary: Header files, libraries and testsuite +Requires: boost-devel glibc-static +Requires: dyninst = %{version}-%{release} + +%description devel +dyninst-devel includes the C header files and libraries. + +%package help +Summary: Manual for using the Dyninst API + +%description help +dyninst-doc contains API documentation for the Dyninst libraries. + +%prep +%setup -q -n %{name}-%{version} -c +%setup -q -T -D -a 1 + +%patch1 -p0 -b.nullptr +%patch2 -p0 -b.addrtrans +%patch3 -p0 -b.objelf +%patch4 -p1 -b.gcc8 +%patch5 -p1 -b.glibc-rpc + +sed -i.cotire -e 's/USE_COTIRE true/USE_COTIRE false/' \ + %{dyninst_base}/cmake/shared.cmake + +%build +cd %{dyninst_base} + +%cmake \ + -DENABLE_STATIC_LIBS=1 \ + -DINSTALL_LIB_DIR:PATH=%{_libdir}/dyninst \ + -DINSTALL_INCLUDE_DIR:PATH=%{_includedir}/dyninst \ + -DINSTALL_CMAKE_DIR:PATH=%{_libdir}/cmake/Dyninst \ + -DCMAKE_BUILD_TYPE=None \ + -DCMAKE_SKIP_RPATH:BOOL=YES +%make_build + +make DESTDIR=../install install +find ../install -name '*.cmake' -execdir \ + sed -i -e 's!%{_prefix}!../install&!' '{}' '+' + +cd ../%{testsuite_base} +%cmake \ + -DDyninst_DIR:PATH=$PWD/../install%{_libdir}/cmake/Dyninst \ + -DINSTALL_DIR:PATH=%{_libdir}/dyninst/testsuite \ + -DCMAKE_BUILD_TYPE:STRING=Debug \ + -DCMAKE_SKIP_RPATH:BOOL=YES +%make_build + +%install +cd %{dyninst_base} +%make_install +rm -v %{buildroot}%{_docdir}/*-%{version}.pdf + +cd ../%{testsuite_base} +%make_install + +mkdir -p %{buildroot}/etc/ld.so.conf.d +echo "%{_libdir}/dyninst" > %{buildroot}/etc/ld.so.conf.d/%{name}-%{_arch}.conf +find %{buildroot}%{_libdir}/dyninst/testsuite/ \ + -type f '!' -name '*.a' -execdir chmod 644 '{}' '+' + +%post -p /sbin/ldconfig +%postun -p /sbin/ldconfig + +%files +%dir %{_libdir}/dyninst +%{_libdir}/dyninst/*.so.* +%config(noreplace) /etc/ld.so.conf.d/* + +%files devel +%{_includedir}/dyninst +%{_libdir}/dyninst/*.so +%{_libdir}/cmake/Dyninst +%{_libdir}/dyninst/*.a +%{_bindir}/parseThat +%dir %{_libdir}/dyninst/testsuite/ +%attr(755,root,root) %{_libdir}/dyninst/testsuite/*[!a] +%attr(644,root,root) %{_libdir}/dyninst/testsuite/*.a + +%files help +%doc %{dyninst_base}/COPYRIGHT +%doc %{dyninst_base}/LGPL +%doc %{dyninst_base}/dataflowAPI/doc/dataflowAPI.pdf +%doc %{dyninst_base}/dynC_API/doc/dynC_API.pdf +%doc %{dyninst_base}/dyninstAPI/doc/dyninstAPI.pdf +%doc %{dyninst_base}/instructionAPI/doc/instructionAPI.pdf +%doc %{dyninst_base}/parseAPI/doc/parseAPI.pdf +%doc %{dyninst_base}/patchAPI/doc/patchAPI.pdf +%doc %{dyninst_base}/proccontrol/doc/proccontrol.pdf +%doc %{dyninst_base}/stackwalk/doc/stackwalk.pdf +%doc %{dyninst_base}/symtabAPI/doc/symtabAPI.pdf + +%changelog +* Mon Feb 24 2020 openEuler Buildteam - 9.3.2-13 +- Package init diff --git a/testsuite-9.3.0-junit-nullptr.patch b/testsuite-9.3.0-junit-nullptr.patch new file mode 100644 index 0000000..472575b --- /dev/null +++ b/testsuite-9.3.0-junit-nullptr.patch @@ -0,0 +1,12 @@ +--- testsuite-9.3.0/src/JUnitOutputDriver.cpp.nullptr 2016-12-19 14:55:38.000000000 -0800 ++++ testsuite-9.3.0/src/JUnitOutputDriver.cpp 2017-02-15 11:19:22.628056889 -0800 +@@ -35,7 +35,7 @@ void JUnitOutputDriver::startNewTest(std + { + std::stringstream suitename; + suitename << last_group->modname; +- if(last_group->mutatee != '\0') suitename << "." << last_group->mutatee; ++ if(last_group->mutatee != nullptr) suitename << "." << last_group->mutatee; + log(HUMAN, "\n", + suitename.str().c_str(), group_errors, group_skips, group_tests, group_failures); + log(HUMAN, group_output.str().c_str()); + diff --git a/testsuite-9.3.0.tar.gz b/testsuite-9.3.0.tar.gz new file mode 100644 index 0000000..a416565 Binary files /dev/null and b/testsuite-9.3.0.tar.gz differ