summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2008-10-17 23:14:53 -0700
committerH. Peter Anvin <hpa@zytor.com>2008-10-17 23:14:53 -0700
commit93c7aa23028c53e6ebf43861d2c778fb01fa895a (patch)
tree34f34f508b86acf1e0f3a424cca1478520743312
parentd5e7498556623df728e1e4cad601f6d9ab2d6740 (diff)
downloadnasm-93c7aa23028c53e6ebf43861d2c778fb01fa895a.tar.gz
test/elf64so.asm: demonstrate a case where we bind to the wrong symbol
Show an artificial case where we bind to the wrong symbol, due to the confusion in the output system between the size of relative symbols and their position. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-rw-r--r--test/elf64so.asm7
1 files changed, 6 insertions, 1 deletions
diff --git a/test/elf64so.asm b/test/elf64so.asm
index a6236951..f1b23464 100644
--- a/test/elf64so.asm
+++ b/test/elf64so.asm
@@ -32,6 +32,7 @@
GLOBAL asmstr:data asmstr.end-asmstr ; [2]
GLOBAL textptr:data 8 ; [2]
GLOBAL selfptr:data 8 ; [2]
+ GLOBAL useless:data 8 ; [3]
GLOBAL integer:data 8 ; [3]
EXTERN printf ; [10]
COMMON commvar 8:8 ; [7]
@@ -59,6 +60,8 @@ lrotate: ; [1]
;; (Large model cannot be linked with other code)
;;
greet_s:
+ ;; This instruction is useless, this is only a test...
+ cmp qword [rel integer wrt ..got],0
mov rax,[rel commvar wrt ..got] ; &commvar
mov rcx,[rax] ; commvar
mov rax,[rel integer wrt ..got] ; &integer
@@ -105,7 +108,9 @@ textptr dq greet_s wrt ..sym ; [15]
selfptr dq selfptr wrt ..sym ; [16]
SECTION .bss
-
+; a useless symbol
+useless resq 1
+
; an integer
integer resq 1 ; [3]