On 01/04/2016 05:46 PM, Bill Williams wrote:
> Will, all:
>
> Patch is attached for testing, if you would be so kind. If it's good I'll send it up to 9.1.x.
>
> --bw
Hi Bill,
The backwards compatibility part wasn't right. There are differences in the glibc headers in rhel-7.2 for aarch64 and fedora23. The attached revised patch is an attemp to make that backward compatibility work when needed. It seems to address the problem on fedora 23, but still allow things to compile on rhel7.2.
-Will
>
> On 12/21/2015 09:31 AM, William Cohen wrote:
>> Hi All,
>>
>> I made a very minor change to the dyninst-9.1.0-1.fc24 source rpm
>> being built on x86 to attempt to build it on aarch64. I submitted the
>> tweaked source rpm to build on aarch64 fedora rawhide as a scratch
>> build:
>>
>> http://arm.koji.fedoraproject.org/koji/taskinfo?taskID=3331297
>>
>> The buildlog shows the build failing because R_AARCH64_* defines are missing:
>>
>>
>> cd /builddir/build/BUILD/dyninst-9.1.0/DyninstAPI-9.1.0/common && /usr/bin/c++ -DCOMMON_LIB -DUSE_PARSE_API -DWITHOUT_SYMLITE -DWITH_SYMTAB_API -Daarch64_unknown_linux -Darch_64bit -Darch_aarch64 -Dbug_force_terminate_failure -Dbug_syscall_changepc_rewind -Dcap_32_64 -Dcap_async_events -Dcap_binary_rewriter -Dcap_dwarf -Dcap_dynamic_heap -Dcap_liveness -Dcap_mutatee_traps -Dcap_ptrace -Dcap_registers -Dcap_thread_db -Dcap_threads -Dcommon_EXPORTS -Dos_linux -I/usr/include/libdwarf -I/builddir/build/BUILD/dyninst-9.1.0/DyninstAPI-9.1.0 -I/builddir/build/BUILD/dyninst-9.1.0/DyninstAPI-9.1.0/common/h -I/builddir/build/BUILD/dyninst-9.1.0/DyninstAPI-9.1.0/dataflowAPI/h -I/builddir/build/BUILD/dyninst-9.1.0/DyninstAPI-9.1.0/dwarf/h -I/builddir/build/BUILD/dyninst-9.1.0/DyninstAPI-9.1.0/dyninstAPI/h -I/builddir/build/BUILD/dyninst-9.1.0/DyninstAPI-9.1.0/dynutil/h -I/builddir/build/BUILD/dyninst-9.1.0/DyninstAPI-9.1.0/elf/h -I/builddir/build/BUILD/dyninst-9.1.0/DyninstAPI-9.1.!
0!
> /i!
>> nstruction
>> API/h -I/builddir/build/BUILD/dyninst-9.1.0/DyninstAPI-9.1.0/parseAPI/h -I/builddir/build/BUILD/dyninst-9.1.0/DyninstAPI-9.1.0/patchAPI/h -I/builddir/build/BUILD/dyninst-9.1.0/DyninstAPI-9.1.0/proccontrol/h -I/builddir/build/BUILD/dyninst-9.1.0/DyninstAPI-9.1.0/stackwalk/h -I/builddir/build/BUILD/dyninst-9.1.0/DyninstAPI-9.1.0/symlite/h -I/builddir/build/BUILD/dyninst-9.1.0/DyninstAPI-9.1.0/symtabAPI/h -I/builddir/build/BUILD/dyninst-9.1.0/DyninstAPI-9.1.0/external -I/builddir/build/BUILD/dyninst-9.1.0/DyninstAPI-9.1.0/common/src -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -std=c++11 -fvisibility=hidden -fvisibility-inlines-hidden -W -Wall -Wpointer-arith -Wcast-qual -Woverloaded-virtual -Wcast-align -Wno-non-template-friend -fPIC -o CMakeFiles/common.dir/src/addrtranslate-auxv.C.o -c /builddir/build/BUILD/dyninst!
-!
> 9.!
>> 1.0/Dynins
>> tAPI-9.1.0/common/src/addrtranslate-auxv.C
>> In file included from /builddir/build/BUILD/dyninst-9.1.0/DyninstAPI-9.1.0/symtabAPI/h/Symtab.h:36:0,
>> from /builddir/build/BUILD/dyninst-9.1.0/DyninstAPI-9.1.0/symtabAPI/src/relocationEntry-elf-aarch64.C:33:
>> /builddir/build/BUILD/dyninst-9.1.0/DyninstAPI-9.1.0/symtabAPI/src/relocationEntry-elf-aarch64.C: In static member function 'static const char* Dyninst::SymtabAPI::relocationEntry::relType2Str(long unsigned int, unsigned int)':
>> /builddir/build/BUILD/dyninst-9.1.0/DyninstAPI-9.1.0/symtabAPI/src/relocationEntry-elf-aarch64.C:163:25: error: 'R_AARCH64_TLS_DTPMOD64' was not declared in this scope
>> CASE_RETURN_STR(R_AARCH64_TLS_DTPMOD64 );
>> ^
>> /builddir/build/BUILD/dyninst-9.1.0/DyninstAPI-9.1.0/symtabAPI/h/Symbol.h:50:33: note: in definition of macro 'CASE_RETURN_STR'
>> #define CASE_RETURN_STR(x) case x: return #x
>> ^
>> /builddir/build/BUILD/dyninst-9.1.0/DyninstAPI-9.1.0/symtabAPI/src/relocationEntry-elf-aarch64.C:164:25: error: 'R_AARCH64_TLS_DTPREL64' was not declared in this scope
>> CASE_RETURN_STR(R_AARCH64_TLS_DTPREL64);
>> ^
>> /builddir/build/BUILD/dyninst-9.1.0/DyninstAPI-9.1.0/symtabAPI/h/Symbol.h:50:33: note: in definition of macro 'CASE_RETURN_STR'
>> #define CASE_RETURN_STR(x) case x: return #x
>> ^
>> /builddir/build/BUILD/dyninst-9.1.0/DyninstAPI-9.1.0/symtabAPI/src/relocationEntry-elf-aarch64.C:165:25: error: 'R_AARCH64_TLS_TPREL64' was not declared in this scope
>> CASE_RETURN_STR(R_AARCH64_TLS_TPREL64);
>> ^
>> /builddir/build/BUILD/dyninst-9.1.0/DyninstAPI-9.1.0/symtabAPI/h/Symbol.h:50:33: note: in definition of macro 'CASE_RETURN_STR'
>> #define CASE_RETURN_STR(x) case x: return #x
>> ^
>> symtabAPI/CMakeFiles/symtabAPI_static.dir/build.make:761: recipe for target 'symtabAPI/CMakeFiles/symtabAPI_static.dir/src/relocationEntry-elf-aarch64.C.o' failed
>> make[2]: *** [symtabAPI/CMakeFiles/symtabAPI_static.dir/src/relocationEntry-elf-aarch64.C.o] Error 1
>>
>>
>> I was able to build the same dyninst sources on aarch64 RHEL 7.2. It
>> looks like there have been some changes in the /usr/include/elf.h
>> between rhel7.2 glibc-headers-2.17-105.el7.aarch64 and fedora 23
>> glibc-headers-2.22-6.fc23.x86_64. The changes specific to aarch64
>> preventing the compile appear to be:
>>
>> #define R_AARCH64_GLOB_DAT 1025 /* Create GOT entry. */
>> #define R_AARCH64_JUMP_SLOT 1026 /* Create PLT entry. */
>> #define R_AARCH64_RELATIVE 1027 /* Adjust by program base. */
>> -#define R_AARCH64_TLS_DTPMOD64 1028 /* Module number, 64 bit. */
>> -#define R_AARCH64_TLS_DTPREL64 1029 /* Module-relative offset, 64 bit. */
>> -#define R_AARCH64_TLS_TPREL64 1030 /* TP-relative offset, 64 bit. */
>> +#define R_AARCH64_TLS_DTPMOD 1028 /* Module number, 64 bit. */
>> +#define R_AARCH64_TLS_DTPREL 1029 /* Module-relative offset, 64 bit. */
>> +#define R_AARCH64_TLS_TPREL 1030 /* TP-relative offset, 64 bit. */
>> #define R_AARCH64_TLSDESC 1031 /* TLS Descriptor. */
>> #define R_AARCH64_IRELATIVE 1032 /* STT_GNU_IFUNC relocation. */
>>
>>
>> The following patch is made the change in glibc
>> (http://patchwork.sourceware.org/patch/3415/) and dyninst will need to
>> be aware of the name changes:
>>
>>
>>
>> Andrew Pinski - Oct. 27, 2014, 7:59 a.m.
>>
>> * sysdeps/aarch64/sysdep.h: Add header guards.
>>
>> [AARCH64] Remove 64 from some relocation names as they have been renamed in later versions of the spec.
>>
>> The AARCH64 elf ABI spec renamed some relocations removing 64 from the TLS
>> relocation names to make them constaint with the ILP32 named ones.
>>
>> * elf/elf.h (R_AARCH64_TLS_DTPMOD64): Rename to ..
>> (R_AARCH64_TLS_DTPMOD): This.
>> (R_AARCH64_TLS_DTPREL64): Rename to ...
>> (R_AARCH64_TLS_DTPREL): This.
>> (R_AARCH64_TLS_TPREL64): Rename to ...
>> (R_AARCH64_TLS_TPREL): This.
>> * sysdeps/aarch64/dl-machine.h (elf_machine_type_class): Update
>> R_AARCH64_TLS_DTPMOD64, R_AARCH64_TLS_DTPREL64, and R_AARCH64_TLS_TPREL64.
>> (elf_machine_rela): Likewise.
>>
>> [AARCH64] Fix pltenter and pltexit for ILP32.
>>
>> * sysdeps/aarch64/bits/link.h (la_aarch64_gnu_pltenter): Use
>> ElfW macro instead of hardcoded Elf64 types.
>> ---
>> elf/elf.h | 6 +++---
>> sysdeps/aarch64/bits/link.h | 6 +++---
>> sysdeps/aarch64/dl-machine.h | 12 ++++++------
>> sysdeps/aarch64/sysdep.h | 5 +++++
>> 4 files changed, 17 insertions(+), 12 deletions(-)
>>
>>
>> -Will
>> _______________________________________________
>> Dyninst-api mailing list
>> Dyninst-api@xxxxxxxxxxx
>> https://lists.cs.wisc.edu/mailman/listinfo/dyninst-api
>
diff -up DyninstAPI-9.1.0/symtabAPI/src/relocationEntry-elf-aarch64.C.elf DyninstAPI-9.1.0/symtabAPI/src/relocationEntry-elf-aarch64.C
--- DyninstAPI-9.1.0/symtabAPI/src/relocationEntry-elf-aarch64.C.elf 2016-01-04 19:16:38.114076209 -0500
+++ DyninstAPI-9.1.0/symtabAPI/src/relocationEntry-elf-aarch64.C 2016-01-04 19:18:53.101069374 -0500
@@ -37,6 +37,18 @@
using namespace Dyninst;
using namespace SymtabAPI;
+// Backwards compatibility definitions
+
+#ifndef R_AARCH64_TLS_DTPMOD
+#define R_AARCH64_TLS_DTPMOD R_AARCH64_TLS_DTPMOD64
+#endif
+#ifndef R_AARCH64_TLS_DTPREL
+#define R_AARCH64_TLS_DTPREL R_AARCH64_TLS_DTPREL64
+#endif
+#ifndef R_AARCH64_TLS_TPREL
+#define R_AARCH64_TLS_TPREL R_AARCH64_TLS_TPREL64
+#endif
+
const char *relocationEntry::relType2Str(unsigned long r, unsigned /*addressWidth*/) {
//#warning "This function is not verified yet!"
//some of the defined symbol should not be included
@@ -160,9 +172,9 @@ const char *relocationEntry::relType2Str
CASE_RETURN_STR(R_AARCH64_GLOB_DAT);
CASE_RETURN_STR(R_AARCH64_JUMP_SLOT);
CASE_RETURN_STR(R_AARCH64_RELATIVE);
- CASE_RETURN_STR(R_AARCH64_TLS_DTPMOD64 );
- CASE_RETURN_STR(R_AARCH64_TLS_DTPREL64);
- CASE_RETURN_STR(R_AARCH64_TLS_TPREL64);
+ CASE_RETURN_STR(R_AARCH64_TLS_DTPMOD );
+ CASE_RETURN_STR(R_AARCH64_TLS_DTPREL);
+ CASE_RETURN_STR(R_AARCH64_TLS_TPREL);
CASE_RETURN_STR(R_AARCH64_TLSDESC );
CASE_RETURN_STR(R_AARCH64_IRELATIVE);
default:
|