test/elf64so.asm: demonstrate a case where we bind to the wrong symbol
authorH. Peter Anvin <hpa@zytor.com>
Sat, 18 Oct 2008 06:14:53 +0000 (23:14 -0700)
committerH. Peter Anvin <hpa@zytor.com>
Sat, 18 Oct 2008 06:14:53 +0000 (23:14 -0700)
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>
test/elf64so.asm

index a6236951bb0495080624075ede90531e468c0acb..f1b2346429f88d32863c5c2bddb2b312068605f9 100644 (file)
@@ -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]