aboutsummaryrefslogtreecommitdiff
path: root/modules/objfmts/elf/tests/curpos.asm
diff options
context:
space:
mode:
Diffstat (limited to 'modules/objfmts/elf/tests/curpos.asm')
-rw-r--r--modules/objfmts/elf/tests/curpos.asm27
1 files changed, 27 insertions, 0 deletions
diff --git a/modules/objfmts/elf/tests/curpos.asm b/modules/objfmts/elf/tests/curpos.asm
new file mode 100644
index 0000000..4599e9c
--- /dev/null
+++ b/modules/objfmts/elf/tests/curpos.asm
@@ -0,0 +1,27 @@
+global bar
+global foo
+
+section .bar
+bar:
+dd foo-$
+dd baz-$
+call foo
+call baz
+foo:
+
+section .data
+baz:
+dd foo-$
+;dd $-foo ; illegal
+dd baz-$
+dd $-baz
+dd foo+4-$ ; with constant
+dd $-baz+foo+4-$ ; both local and cross-segment (legal)
+dd baz+foo+4-$-$ ; ditto, slightly different
+;dd (bar-$)+(foo-$) ; illegal (too many cross-segment)
+dd baz-$+baz-$ ; two from same segment
+
+section .text
+mov dword [foo-$], 5
+mov eax, foo-$
+call foo