From 37b9be34024e583212b560a116e5ea9cdba9ddad Mon Sep 17 00:00:00 2001 From: "H. Peter Anvin" Date: Thu, 22 Jun 2017 18:20:44 -0700 Subject: [PATCH] reldef.asm: more comprehensive test More testing of various relative operations. Signed-off-by: H. Peter Anvin --- test/reldef.asm | 45 +++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 41 insertions(+), 4 deletions(-) diff --git a/test/reldef.asm b/test/reldef.asm index 17186c57..46e515e2 100644 --- a/test/reldef.asm +++ b/test/reldef.asm @@ -1,9 +1,46 @@ bits 64 + default rel - extern bar + section .bss +bar: resd 0 + section .rodata +rod1: dd 0x01234567 +rod2: dd 0x89abcdef + + section .text +start: + lea rax, [rod1] + lea rcx, [rod2] + lea rdx, [bar] + lea rbx, [foo] + + lea rax, [rax+rod1-$$] + lea rcx, [rax+rod2-$$] + lea rdx, [rax+bar-$$] + lea rbx, [rax+foo-$$] + + mov rax, [rax+rod1-$$] + mov rcx, [rax+rod2-$$] + mov rdx, [rax+bar-$$] + mov rbx, [rax+foo-$$] + + mov rax, dword rod1-$$ + mov rcx, dword rod2-$$ + mov rdx, dword bar-$$ + mov rbx, dword foo-$$ + section .data -foo: dd bar - dd foo - $ -; dd foo*2 + dq rod1 + dq rod2 + dq bar + dq foo +foo: + dd rod1 - $ + dd rod1 - $$ + dd rod2 - $ + dd rod2 - $$ dd bar - $ + dd bar - $$ + dd foo - $ + dd foo - $$ -- 2.11.4.GIT