+ .dynamic_loop:
+ mov rsi, [rdx+8]
+
+ cmp [rdx], dword 4 ; DT_HASH == 4
+ jne .no_hash ; Why the heck does it segfault when
+ mov ecx, [rsi+4] ; I use cmove ecx, [rsi+4] instead
+ .no_hash: ; of this jne construction ????
+
+ cmp [rdx], dword 5 ; DT_STRTAB == 5
+ cmove r10, rsi ; r10 : pointer to strtab
+
+ cmp [rdx], dword 6 ; DT_SYMTAB == 6
+ cmove r11, rsi ; r11 : pointer to symtab
+
+ cmp [rdx], dword 0x6ffffef5 ; DT_GNU_HASH
+ jne .not_gnu_hash
+ mov ecx, [rsi] ; ecx is nbuckets
+ mov r9d, [rsi + 8] ; maskwords (64 bits entries)
+ lea r9, [rsi + 16 + r9 * 8] ; rdx points to the first bucket
+
+ xor eax, eax
+ .walk_buckets: ; Find the last chain
+ cmp eax, [r9]
+ cmovl eax, [r9]
+ add r9, 4 ; next bucket
+ loop .walk_buckets ; eax is offset to the last chain
+ ; Now, rdx points to the beginning of the first chain
+
+ mov ecx, [rsi+4] ; symndx
+ xchg eax, ecx
+ shl rax, 2 ; symndx * 4
+ sub r9, rax ; hash values - symndx * 4
+ .walk_chain:
+ bt dword [r9 + rcx*4], 0 ;
+ inc ecx ; Increment ecx for each entry found
+ jc .walk_chain ; in the chain.
+ dec ecx ; fixup.
+ .not_gnu_hash: