From a10ca5be639e5e6afe997f9af118b3cdf663986f Mon Sep 17 00:00:00 2001 From: Stan Cox Date: Nov 09 2021 15:44:20 +0000 Subject: Do not create relocs for aarch64 static calls --- diff --git a/dyninst-11.0.1-aarch64.patch b/dyninst-11.0.1-aarch64.patch new file mode 100644 index 0000000..7e88331 --- /dev/null +++ b/dyninst-11.0.1-aarch64.patch @@ -0,0 +1,63 @@ +commit 874a73ea4 (HEAD -> master, upstream/master) +Author: Stan Cox +Date: Mon Nov 1 14:24:07 2021 -0400 + + Don't overflow aarch64 float register vector when setting used regs. (#1127) + + Do not include the subtype when setting a float register as a used register if the registerSlot vector would be exceeded, e.g. for a value like 0x400 (Q_REG/register 0). + +--- dyninst-11.0.1/dyninstAPI/src/inst-aarch64.C.orig ++++ dyninst-11.0.1/dyninstAPI/src/inst-aarch64.C +@@ -551,8 +551,13 @@ bool EmitterAARCH64::clobberAllFuncCall(registerSpace *rs, + rs->GPRs()[*itr]->beenUsed = true; + + std::set *fpRegs = callee->ifunc()->usedFPRs(); +- for(std::set::iterator itr = fpRegs->begin(); itr != fpRegs->end(); itr++) +- rs->FPRs()[*itr]->beenUsed = true; ++ for(std::set::iterator itr = fpRegs->begin(); itr != fpRegs->end(); itr++) { ++ if (*itr <= rs->FPRs().size()) ++ rs->FPRs()[*itr]->beenUsed = true; ++ else ++ // parse_func::calcUsedRegs includes the subtype; we only want the regno ++ rs->FPRs()[*itr & 0xff]->beenUsed = true; ++ } + } else { + for(int idx = 0; idx < rs->numGPRs(); idx++) + rs->GPRs()[idx]->beenUsed = true; +commit b2c892f55 +Author: Stan Cox +Date: Tue Oct 26 17:43:14 2021 -0400 + + Load callee's address when the callee and caller are in the same module (#1056) + + If the callee and caller are in the same module and pic is not + required then the callee's address can be loaded directly without + using a relocation. + +--- dyninst-11.0.0/dyninstAPI/src/inst-aarch64.C.orig ++++ dyninst-11.0.0/dyninstAPI/src/inst-aarch64.C +@@ -651,12 +651,14 @@ Register EmitterAARCH64::emitCall(opCode op, + + assert(gen.rs()); + +- //Address of function to call in scratch register ++ // Address of function to call in scratch register + Register scratch = gen.rs()->getScratchRegister(gen); + assert(scratch != REG_NULL && "cannot get a scratch register"); + gen.markRegDefined(scratch); + +- if (gen.addrSpace()->edit() != NULL) { ++ if (gen.addrSpace()->edit() != NULL ++ && (gen.func()->obj() != callee->obj() ++ || gen.addrSpace()->needsPIC())) { + // gen.as.edit() checks if we are in rewriter mode + Address dest = getInterModuleFuncAddr(callee, gen); + +@@ -666,7 +668,6 @@ Register EmitterAARCH64::emitCall(opCode op, + instruction insn; + insn.clear(); + INSN_SET(insn, 31, 31, 0); +- //INSN_SET(insn, 29, 30, disp & 0x3); + INSN_SET(insn, 28, 28, 1); + INSN_SET(insn, 5, 23, disp >> 2); + INSN_SET(insn, 0, 4, scratch); diff --git a/dyninst.spec b/dyninst.spec index 2ef44c4..22a93f4 100644 --- a/dyninst.spec +++ b/dyninst.spec @@ -2,7 +2,7 @@ Summary: An API for Run-time Code Generation License: LGPLv2+ Name: dyninst Group: Development/Libraries -Release: 3%{?dist} +Release: 4%{?dist} URL: http://www.dyninst.org Version: 11.0.1 ExclusiveArch: %{ix86} x86_64 ppc64le aarch64 @@ -12,7 +12,8 @@ Source1: https://github.com/dyninst/testsuite/archive/%{version}/testsuite-%{ver Patch1: dyninst-11.0.1-dwarf.patch Patch2: dyninst-11.0.1-rosebc.patch -Patch3: testsuite-11.0.1-386.patch +Patch3: dyninst-11.0.1-aarch64.patch +Patch4: testsuite-11.0.1-386.patch %global dyninst_base dyninst-%{version} %global testsuite_base testsuite-%{version} @@ -83,10 +84,11 @@ making sure that dyninst works properly. pushd %{dyninst_base} %patch1 -p1 -b .386 %patch2 -p1 -b .rose +%patch3 -p1 -b .aarch64 popd pushd %{testsuite_base} -%patch3 -p1 -b .dwarf +%patch4 -p1 -b .dwarf popd # cotire seems to cause non-deterministic gcc errors @@ -193,6 +195,9 @@ find %{buildroot}%{_libdir}/dyninst/testsuite/ \ %attr(644,root,root) %{_libdir}/dyninst/testsuite/*.a %changelog +* Tue Nov 09 2021 Stan Cox - 11.0.1-4 +- Do not create reloc for aarch64 static calls + * Fri Aug 06 2021 Jonathan Wakely - 11.0.1-3 - Rebuilt for Boost 1.76 diff --git a/testsuite-11.0.0-test12.patch b/testsuite-11.0.0-test12.patch deleted file mode 100644 index f6c999a..0000000 --- a/testsuite-11.0.0-test12.patch +++ /dev/null @@ -1,14 +0,0 @@ ---- dyninst-11.0.0/testsuite-11.0.0/CMakeLists.txt -+++ dyninst-11.0.0/testsuite-11.0.0/CMakeLists.txt -@@ -341,5 +341,10 @@ - add_library(Test12 SHARED src/dyninst/libTest12.c) - add_library(dyninstAPI_RT SHARED IMPORTED) -- set_target_properties(dyninstAPI_RT PROPERTIES IMPORTED_LOCATION "${Dyninst_DIR}/../../libdyninstAPI_RT.so") -+ set(_path_suffixes dyninst) -+ find_library(dyninstAPI_RT_LIBRARY -+ NAMES libdyninstAPI_RT.so -+ PATHS ${Dyninst_DIR}/../.. -+ PATH_SUFFIXES ${_path_suffixes}) -+ set_target_properties(dyninstAPI_RT PROPERTIES IMPORTED_LOCATION ${dyninstAPI_RT_LIBRARY}) - target_link_libraries(Test12 dyninstAPI_RT) - install(TARGETS Test12