-; Bold - Import by hash for linux/amd64 (elf64-x86-64)
-; © 2009 Amand "alrj" Tihon
; kate: syntax Intel x86 (NASM);
+; Copyright (C) 2009 Amand "alrj" Tihon <amand.tihon@alrj.org>
+
+; Import by hash for linux/amd64 (elf64-x86-64)
+; This file is part of bold, the Byte Optimized Linker.
+
+; You can redistribute this file and/or modify it under the terms of the
+; GNU General Public License as published by the Free Software Foundation,
+; either version 3 of the License or (at your option) any later version.
+
+;------------------------------------------------------------------------------
; alrj's x86_64 version of the import by hash method by parapete, las, leblane.
; See the wonderful thread at http://www.pouet.net/topic.php?which=5392 to
; learn everything about import by hash on Linux.
extern _bold__functions_count ; immediate 32 bits
extern main ; must be declared when using this
-
%define SYS_exit 60
%define DT_HASH 4
mov al, DT_HASH ; DT_HASH == 4
cmp [rdx], rax
- cmove r9, [rdx+8]
+ cmove r9, [rdx+8] ; r9 : pointer to the hash table
inc al ; DT_STRTAB == 5
cmp [rdx], rax
- cmove r10, [rdx+8]
+ cmove r10, [rdx+8] ; r10 : pointer to strtab
inc al ; DT_SYMTAB == 6
cmp [rdx], rax
- cmove r11, [rdx+8]
+ cmove r11, [rdx+8] ; r11 : pointer to symtab
; Next dynamic entry
add rdx, 16