Do not create relocs for aarch64 static calls

This commit is contained in:
Stan Cox 2021-11-09 10:44:20 -05:00
parent ce2957123d
commit a10ca5be63
3 changed files with 71 additions and 17 deletions

View File

@ -0,0 +1,63 @@
commit 874a73ea4 (HEAD -> master, upstream/master)
Author: Stan Cox <scox@redhat.com>
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<Register> *fpRegs = callee->ifunc()->usedFPRs();
- for(std::set<Register>::iterator itr = fpRegs->begin(); itr != fpRegs->end(); itr++)
- rs->FPRs()[*itr]->beenUsed = true;
+ for(std::set<Register>::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 <scox@redhat.com>
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);

View File

@ -2,7 +2,7 @@ Summary: An API for Run-time Code Generation
License: LGPLv2+ License: LGPLv2+
Name: dyninst Name: dyninst
Group: Development/Libraries Group: Development/Libraries
Release: 3%{?dist} Release: 4%{?dist}
URL: http://www.dyninst.org URL: http://www.dyninst.org
Version: 11.0.1 Version: 11.0.1
ExclusiveArch: %{ix86} x86_64 ppc64le aarch64 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 Patch1: dyninst-11.0.1-dwarf.patch
Patch2: dyninst-11.0.1-rosebc.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 dyninst_base dyninst-%{version}
%global testsuite_base testsuite-%{version} %global testsuite_base testsuite-%{version}
@ -83,10 +84,11 @@ making sure that dyninst works properly.
pushd %{dyninst_base} pushd %{dyninst_base}
%patch1 -p1 -b .386 %patch1 -p1 -b .386
%patch2 -p1 -b .rose %patch2 -p1 -b .rose
%patch3 -p1 -b .aarch64
popd popd
pushd %{testsuite_base} pushd %{testsuite_base}
%patch3 -p1 -b .dwarf %patch4 -p1 -b .dwarf
popd popd
# cotire seems to cause non-deterministic gcc errors # 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 %attr(644,root,root) %{_libdir}/dyninst/testsuite/*.a
%changelog %changelog
* Tue Nov 09 2021 Stan Cox <scox@redhat.com> - 11.0.1-4
- Do not create reloc for aarch64 static calls
* Fri Aug 06 2021 Jonathan Wakely <jwakely@redhat.com> - 11.0.1-3 * Fri Aug 06 2021 Jonathan Wakely <jwakely@redhat.com> - 11.0.1-3
- Rebuilt for Boost 1.76 - Rebuilt for Boost 1.76

View File

@ -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