summaryrefslogtreecommitdiff
path: root/modules/objfmts/elf/tests
diff options
context:
space:
mode:
Diffstat (limited to 'modules/objfmts/elf/tests')
-rw-r--r--modules/objfmts/elf/tests/Makefile.inc4
-rw-r--r--modules/objfmts/elf/tests/gasx32/Makefile.inc11
-rw-r--r--modules/objfmts/elf/tests/gasx32/crosssect.asm18
-rw-r--r--modules/objfmts/elf/tests/gasx32/crosssect.hex568
-rw-r--r--modules/objfmts/elf/tests/gasx32/elf_gasx32_curpos.asm27
-rw-r--r--modules/objfmts/elf/tests/gasx32/elf_gasx32_curpos.hex848
-rw-r--r--modules/objfmts/elf/tests/gasx32/elf_gasx32_reloc.asm37
-rw-r--r--modules/objfmts/elf/tests/gasx32/elf_gasx32_reloc.hex1016
-rw-r--r--modules/objfmts/elf/tests/gasx32/elf_gasx32_ssym.asm10
-rw-r--r--modules/objfmts/elf/tests/gasx32/elf_gasx32_ssym.hex592
-rwxr-xr-xmodules/objfmts/elf/tests/gasx32/elf_gasx32_test.sh3
-rw-r--r--modules/objfmts/elf/tests/x32/Makefile.inc11
-rw-r--r--modules/objfmts/elf/tests/x32/elf-rip.asm7
-rw-r--r--modules/objfmts/elf/tests/x32/elf-rip.hex496
-rwxr-xr-xmodules/objfmts/elf/tests/x32/elf_x32_test.sh3
-rw-r--r--modules/objfmts/elf/tests/x32/elfsox32.asm90
-rw-r--r--modules/objfmts/elf/tests/x32/elfsox32.hex1176
-rw-r--r--modules/objfmts/elf/tests/x32/gotpcrel.asm6
-rw-r--r--modules/objfmts/elf/tests/x32/gotpcrel.hex496
-rw-r--r--modules/objfmts/elf/tests/x32/multiplefixup.asm8
-rw-r--r--modules/objfmts/elf/tests/x32/multiplefixup.hex680
21 files changed, 6107 insertions, 0 deletions
diff --git a/modules/objfmts/elf/tests/Makefile.inc b/modules/objfmts/elf/tests/Makefile.inc
index e6d421c0..0980329c 100644
--- a/modules/objfmts/elf/tests/Makefile.inc
+++ b/modules/objfmts/elf/tests/Makefile.inc
@@ -47,9 +47,13 @@ EXTRA_DIST += modules/objfmts/elf/tests/nasm-forceident.asm
EXTRA_DIST += modules/objfmts/elf/tests/nasm-forceident.hex
EXTRA_DIST += modules/objfmts/elf/tests/amd64/Makefile.inc
+EXTRA_DIST += modules/objfmts/elf/tests/x32/Makefile.inc
EXTRA_DIST += modules/objfmts/elf/tests/gas32/Makefile.inc
EXTRA_DIST += modules/objfmts/elf/tests/gas64/Makefile.inc
+EXTRA_DIST += modules/objfmts/elf/tests/gasx32/Makefile.inc
include modules/objfmts/elf/tests/amd64/Makefile.inc
+include modules/objfmts/elf/tests/x32/Makefile.inc
include modules/objfmts/elf/tests/gas32/Makefile.inc
include modules/objfmts/elf/tests/gas64/Makefile.inc
+include modules/objfmts/elf/tests/gasx32/Makefile.inc
diff --git a/modules/objfmts/elf/tests/gasx32/Makefile.inc b/modules/objfmts/elf/tests/gasx32/Makefile.inc
new file mode 100644
index 00000000..6bba8bd6
--- /dev/null
+++ b/modules/objfmts/elf/tests/gasx32/Makefile.inc
@@ -0,0 +1,11 @@
+TESTS += modules/objfmts/elf/tests/gasx32/elf_gasx32_test.sh
+
+EXTRA_DIST += modules/objfmts/elf/tests/gasx32/elf_gasx32_test.sh
+EXTRA_DIST += modules/objfmts/elf/tests/gasx32/crosssect.asm
+EXTRA_DIST += modules/objfmts/elf/tests/gasx32/crosssect.hex
+EXTRA_DIST += modules/objfmts/elf/tests/gasx32/elf_gasx32_curpos.asm
+EXTRA_DIST += modules/objfmts/elf/tests/gasx32/elf_gasx32_curpos.hex
+EXTRA_DIST += modules/objfmts/elf/tests/gasx32/elf_gasx32_reloc.asm
+EXTRA_DIST += modules/objfmts/elf/tests/gasx32/elf_gasx32_reloc.hex
+EXTRA_DIST += modules/objfmts/elf/tests/gasx32/elf_gasx32_ssym.asm
+EXTRA_DIST += modules/objfmts/elf/tests/gasx32/elf_gasx32_ssym.hex
diff --git a/modules/objfmts/elf/tests/gasx32/crosssect.asm b/modules/objfmts/elf/tests/gasx32/crosssect.asm
new file mode 100644
index 00000000..41999791
--- /dev/null
+++ b/modules/objfmts/elf/tests/gasx32/crosssect.asm
@@ -0,0 +1,18 @@
+.section .rodata
+ .align 4
+_sys_srt:
+ .long 0
+
+.text
+ .align 4,0x90
+ .long _sys_srt-.
+ .long _sys_srt-_sys_info
+ #.long _sys_info-_sys_srt
+ #.long -(_sys_srt-_sys_info)
+ .long _sys_info-.
+ .long .-_sys_info
+ .long (_sys_srt-.)+(.-_sys_info) # GAS cannot handle this but we can
+ .long 0
+ .long 65558
+_sys_info:
+ .long 0
diff --git a/modules/objfmts/elf/tests/gasx32/crosssect.hex b/modules/objfmts/elf/tests/gasx32/crosssect.hex
new file mode 100644
index 00000000..35893c4e
--- /dev/null
+++ b/modules/objfmts/elf/tests/gasx32/crosssect.hex
@@ -0,0 +1,568 @@
+7f
+45
+4c
+46
+01
+01
+01
+00
+00
+00
+00
+00
+00
+00
+00
+00
+01
+00
+3e
+00
+01
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+20
+01
+00
+00
+00
+00
+00
+00
+34
+00
+00
+00
+00
+00
+28
+00
+07
+00
+01
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+14
+00
+00
+00
+f0
+ff
+ff
+ff
+00
+00
+00
+00
+00
+00
+00
+00
+16
+00
+01
+00
+00
+00
+00
+00
+00
+00
+00
+00
+02
+04
+00
+00
+00
+00
+00
+00
+04
+00
+00
+00
+02
+04
+00
+00
+e8
+ff
+ff
+ff
+10
+00
+00
+00
+02
+04
+00
+00
+f4
+ff
+ff
+ff
+00
+00
+00
+00
+00
+2e
+74
+65
+78
+74
+00
+2e
+72
+6f
+64
+61
+74
+61
+00
+2e
+72
+65
+6c
+61
+2e
+74
+65
+78
+74
+00
+2e
+73
+74
+72
+74
+61
+62
+00
+2e
+73
+79
+6d
+74
+61
+62
+00
+2e
+73
+68
+73
+74
+72
+74
+61
+62
+00
+00
+2d
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+01
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+04
+00
+f1
+ff
+00
+00
+00
+00
+1c
+00
+00
+00
+00
+00
+00
+00
+00
+00
+04
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+06
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+03
+00
+06
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+03
+00
+04
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+2a
+00
+00
+00
+03
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+88
+00
+00
+00
+34
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+1a
+00
+00
+00
+03
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+bc
+00
+00
+00
+03
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+22
+00
+00
+00
+02
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+c0
+00
+00
+00
+60
+00
+00
+00
+02
+00
+00
+00
+06
+00
+00
+00
+04
+00
+00
+00
+10
+00
+00
+00
+01
+00
+00
+00
+01
+00
+00
+00
+06
+00
+00
+00
+00
+00
+00
+00
+40
+00
+00
+00
+20
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+10
+00
+00
+00
+00
+00
+00
+00
+0f
+00
+00
+00
+04
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+60
+00
+00
+00
+24
+00
+00
+00
+03
+00
+00
+00
+04
+00
+00
+00
+04
+00
+00
+00
+0c
+00
+00
+00
+07
+00
+00
+00
+01
+00
+00
+00
+02
+00
+00
+00
+00
+00
+00
+00
+84
+00
+00
+00
+04
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+04
+00
+00
+00
+00
+00
+00
+00
diff --git a/modules/objfmts/elf/tests/gasx32/elf_gasx32_curpos.asm b/modules/objfmts/elf/tests/gasx32/elf_gasx32_curpos.asm
new file mode 100644
index 00000000..60a893b3
--- /dev/null
+++ b/modules/objfmts/elf/tests/gasx32/elf_gasx32_curpos.asm
@@ -0,0 +1,27 @@
+.globl bar
+.globl foo
+
+.section .bar
+bar:
+.4byte foo-.
+.4byte baz-.
+call foo
+call baz
+foo:
+
+.section .data
+baz:
+.4byte foo-.
+#.4byte .-foo # illegal
+.4byte baz-.
+.4byte .-baz
+.4byte foo+4-. # with constant
+.4byte .-baz+foo+4-. # both local and cross-segment (legal)
+#.4byte baz+foo+4-.-. # ditto, slightly different - GAS gets confused on this
+#.4byte (bar-.)+(foo-.) # illegal (too many cross-segment)
+.4byte baz-.+baz-. # two from same segment
+
+.section .text
+movl $5, foo-.
+movl $(foo-.), %eax
+call foo
diff --git a/modules/objfmts/elf/tests/gasx32/elf_gasx32_curpos.hex b/modules/objfmts/elf/tests/gasx32/elf_gasx32_curpos.hex
new file mode 100644
index 00000000..45cb217f
--- /dev/null
+++ b/modules/objfmts/elf/tests/gasx32/elf_gasx32_curpos.hex
@@ -0,0 +1,848 @@
+7f
+45
+4c
+46
+01
+01
+01
+00
+00
+00
+00
+00
+00
+00
+00
+00
+01
+00
+3e
+00
+01
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+c0
+01
+00
+00
+00
+00
+00
+00
+34
+00
+00
+00
+00
+00
+28
+00
+0a
+00
+01
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+c7
+04
+25
+00
+00
+00
+00
+05
+00
+00
+00
+b8
+00
+00
+00
+00
+e8
+00
+00
+00
+00
+00
+00
+00
+03
+00
+00
+00
+02
+07
+00
+00
+03
+00
+00
+00
+0c
+00
+00
+00
+02
+07
+00
+00
+01
+00
+00
+00
+11
+00
+00
+00
+02
+07
+00
+00
+fc
+ff
+ff
+ff
+12
+00
+00
+00
+00
+00
+00
+00
+e8
+05
+00
+00
+00
+e8
+00
+00
+00
+00
+00
+00
+04
+00
+00
+00
+02
+02
+00
+00
+00
+00
+00
+00
+0e
+00
+00
+00
+02
+02
+00
+00
+fc
+ff
+ff
+ff
+00
+00
+00
+00
+fc
+ff
+ff
+ff
+08
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+d8
+ff
+ff
+ff
+00
+00
+00
+00
+02
+07
+00
+00
+00
+00
+00
+00
+0c
+00
+00
+00
+02
+07
+00
+00
+04
+00
+00
+00
+10
+00
+00
+00
+02
+07
+00
+00
+14
+00
+00
+00
+00
+2e
+74
+65
+78
+74
+00
+2e
+62
+61
+72
+00
+2e
+64
+61
+74
+61
+00
+2e
+72
+65
+6c
+61
+2e
+74
+65
+78
+74
+00
+2e
+72
+65
+6c
+61
+2e
+62
+61
+72
+00
+2e
+72
+65
+6c
+61
+2e
+64
+61
+74
+61
+00
+2e
+73
+74
+72
+74
+61
+62
+00
+2e
+73
+79
+6d
+74
+61
+62
+00
+2e
+73
+68
+73
+74
+72
+74
+61
+62
+00
+00
+2d
+00
+62
+61
+72
+00
+66
+6f
+6f
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+01
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+04
+00
+f1
+ff
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+03
+00
+08
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+08
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+03
+00
+06
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+03
+00
+04
+00
+03
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+10
+00
+06
+00
+07
+00
+00
+00
+12
+00
+00
+00
+00
+00
+00
+00
+10
+00
+06
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+42
+00
+00
+00
+03
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+e4
+00
+00
+00
+4c
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+32
+00
+00
+00
+03
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+30
+01
+00
+00
+0b
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+3a
+00
+00
+00
+02
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+3c
+01
+00
+00
+80
+00
+00
+00
+02
+00
+00
+00
+06
+00
+00
+00
+04
+00
+00
+00
+10
+00
+00
+00
+01
+00
+00
+00
+01
+00
+00
+00
+06
+00
+00
+00
+00
+00
+00
+00
+40
+00
+00
+00
+15
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+10
+00
+00
+00
+00
+00
+00
+00
+12
+00
+00
+00
+04
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+58
+00
+00
+00
+24
+00
+00
+00
+03
+00
+00
+00
+04
+00
+00
+00
+04
+00
+00
+00
+0c
+00
+00
+00
+07
+00
+00
+00
+01
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+7c
+00
+00
+00
+12
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+01
+00
+00
+00
+00
+00
+00
+00
+1d
+00
+00
+00
+04
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+90
+00
+00
+00
+18
+00
+00
+00
+03
+00
+00
+00
+06
+00
+00
+00
+04
+00
+00
+00
+0c
+00
+00
+00
+0c
+00
+00
+00
+01
+00
+00
+00
+03
+00
+00
+00
+00
+00
+00
+00
+a8
+00
+00
+00
+18
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+04
+00
+00
+00
+00
+00
+00
+00
+27
+00
+00
+00
+04
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+c0
+00
+00
+00
+24
+00
+00
+00
+03
+00
+00
+00
+08
+00
+00
+00
+04
+00
+00
+00
+0c
+00
+00
+00
diff --git a/modules/objfmts/elf/tests/gasx32/elf_gasx32_reloc.asm b/modules/objfmts/elf/tests/gasx32/elf_gasx32_reloc.asm
new file mode 100644
index 00000000..e015ce4b
--- /dev/null
+++ b/modules/objfmts/elf/tests/gasx32/elf_gasx32_reloc.asm
@@ -0,0 +1,37 @@
+.comm _ZEROVAR, 32, 16
+.comm _VAR, 16, 16
+.data
+.org 0
+_ZEROVAR:
+.org 0xa0
+.globl _VAR
+.type _VAR, @object
+.size _VAR, 16
+_VAR:
+.4byte 0
+.4byte 0
+.4byte 0
+.4byte 0
+.org 0xc0
+_VAR2:
+.org 0xe0
+.globl _VAR3
+_VAR3:
+
+.text
+movq $0, %rax
+movq _VAR, %rax
+movq %rax, _VAR(%rip)
+movq _VAR+8(%rip), %rcx
+movlpd _VAR(%rip), %xmm1
+
+movq _VAR2, %rax
+movq %rax, _VAR2(%rip)
+movq _VAR2+8(%rip), %rcx
+movlpd _VAR2(%rip), %xmm1
+
+movq _VAR3, %rax
+movq %rax, _VAR3(%rip)
+movq _VAR3+8(%rip), %rcx
+movlpd _VAR3(%rip), %xmm1
+
diff --git a/modules/objfmts/elf/tests/gasx32/elf_gasx32_reloc.hex b/modules/objfmts/elf/tests/gasx32/elf_gasx32_reloc.hex
new file mode 100644
index 00000000..1b46fa18
--- /dev/null
+++ b/modules/objfmts/elf/tests/gasx32/elf_gasx32_reloc.hex
@@ -0,0 +1,1016 @@
+7f
+45
+4c
+46
+01
+01
+01
+00
+00
+00
+00
+00
+00
+00
+00
+00
+01
+00
+3e
+00
+01
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+e0
+02
+00
+00
+00
+00
+00
+00
+34
+00
+00
+00
+00
+00
+28
+00
+07
+00
+01
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+48
+c7
+c0
+00
+00
+00
+00
+48
+8b
+04
+25
+00
+00
+00
+00
+48
+89
+05
+00
+00
+00
+00
+48
+8b
+0d
+00
+00
+00
+00
+66
+0f
+12
+0d
+00
+00
+00
+00
+48
+8b
+04
+25
+00
+00
+00
+00
+48
+89
+05
+00
+00
+00
+00
+48
+8b
+0d
+00
+00
+00
+00
+66
+0f
+12
+0d
+00
+00
+00
+00
+48
+8b
+04
+25
+00
+00
+00
+00
+48
+89
+05
+00
+00
+00
+00
+48
+8b
+0d
+00
+00
+00
+00
+66
+0f
+12
+0d
+00
+00
+00
+00
+00
+00
+00
+0b
+00
+00
+00
+0a
+06
+00
+00
+00
+00
+00
+00
+12
+00
+00
+00
+02
+06
+00
+00
+fc
+ff
+ff
+ff
+19
+00
+00
+00
+02
+06
+00
+00
+04
+00
+00
+00
+21
+00
+00
+00
+02
+06
+00
+00
+fc
+ff
+ff
+ff
+29
+00
+00
+00
+0a
+03
+00
+00
+c0
+00
+00
+00
+30
+00
+00
+00
+02
+03
+00
+00
+bc
+00
+00
+00
+37
+00
+00
+00
+02
+03
+00
+00
+c4
+00
+00
+00
+3f
+00
+00
+00
+02
+03
+00
+00
+bc
+00
+00
+00
+47
+00
+00
+00
+0a
+07
+00
+00
+00
+00
+00
+00
+4e
+00
+00
+00
+02
+07
+00
+00
+fc
+ff
+ff
+ff
+55
+00
+00
+00
+02
+07
+00
+00
+04
+00
+00
+00
+5d
+00
+00
+00
+02
+07
+00
+00
+fc
+ff
+ff
+ff
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+2e
+74
+65
+78
+74
+00
+2e
+64
+61
+74
+61
+00
+2e
+72
+65
+6c
+61
+2e
+74
+65
+78
+74
+00
+2e
+73
+74
+72
+74
+61
+62
+00
+2e
+73
+79
+6d
+74
+61
+62
+00
+2e
+73
+68
+73
+74
+72
+74
+61
+62
+00
+00
+00
+00
+2d
+00
+5f
+56
+41
+52
+00
+5f
+5a
+45
+52
+4f
+56
+41
+52
+00
+5f
+56
+41
+52
+33
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+01
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+04
+00
+f1
+ff
+00
+00
+00
+00
+c0
+00
+00
+00
+00
+00
+00
+00
+00
+00
+06
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+03
+00
+06
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+03
+00
+04
+00
+08
+00
+00
+00
+00
+00
+00
+00
+20
+00
+00
+00
+10
+00
+06
+00
+03
+00
+00
+00
+a0
+00
+00
+00
+10
+00
+00
+00
+11
+00
+06
+00
+11
+00
+00
+00
+e0
+00
+00
+00
+00
+00
+00
+00
+10
+00
+06
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+28
+00
+00
+00
+03
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+14
+02
+00
+00
+32
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+18
+00
+00
+00
+03
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+48
+02
+00
+00
+17
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+20
+00
+00
+00
+02
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+60
+02
+00
+00
+80
+00
+00
+00
+02
+00
+00
+00
+05
+00
+00
+00
+04
+00
+00
+00
+10
+00
+00
+00
+01
+00
+00
+00
+01
+00
+00
+00
+06
+00
+00
+00
+00
+00
+00
+00
+40
+00
+00
+00
+61
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+10
+00
+00
+00
+00
+00
+00
+00
+0d
+00
+00
+00
+04
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+a4
+00
+00
+00
+90
+00
+00
+00
+03
+00
+00
+00
+04
+00
+00
+00
+04
+00
+00
+00
+0c
+00
+00
+00
+07
+00
+00
+00
+01
+00
+00
+00
+03
+00
+00
+00
+00
+00
+00
+00
+34
+01
+00
+00
+e0
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+04
+00
+00
+00
+00
+00
+00
+00
diff --git a/modules/objfmts/elf/tests/gasx32/elf_gasx32_ssym.asm b/modules/objfmts/elf/tests/gasx32/elf_gasx32_ssym.asm
new file mode 100644
index 00000000..b7203f62
--- /dev/null
+++ b/modules/objfmts/elf/tests/gasx32/elf_gasx32_ssym.asm
@@ -0,0 +1,10 @@
+.text
+foo:
+movl %eax, foo@PLT
+movl %eax, foo@GOTPCREL
+movl %eax, bar@TLSGD
+movl %eax, bar@TLSLD
+movl %eax, bar@GOTTPOFF
+movl %eax, bar@TPOFF
+movl %eax, bar@DTPOFF
+movl %eax, foo@GOT
diff --git a/modules/objfmts/elf/tests/gasx32/elf_gasx32_ssym.hex b/modules/objfmts/elf/tests/gasx32/elf_gasx32_ssym.hex
new file mode 100644
index 00000000..cac39900
--- /dev/null
+++ b/modules/objfmts/elf/tests/gasx32/elf_gasx32_ssym.hex
@@ -0,0 +1,592 @@
+7f
+45
+4c
+46
+01
+01
+01
+00
+00
+00
+00
+00
+00
+00
+00
+00
+01
+00
+3e
+00
+01
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+60
+01
+00
+00
+00
+00
+00
+00
+34
+00
+00
+00
+00
+00
+28
+00
+06
+00
+01
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+89
+04
+25
+00
+00
+00
+00
+89
+04
+25
+00
+00
+00
+00
+89
+04
+25
+00
+00
+00
+00
+89
+04
+25
+00
+00
+00
+00
+89
+04
+25
+00
+00
+00
+00
+89
+04
+25
+00
+00
+00
+00
+89
+04
+25
+00
+00
+00
+00
+89
+04
+25
+00
+00
+00
+00
+03
+00
+00
+00
+04
+02
+00
+00
+00
+00
+00
+00
+0a
+00
+00
+00
+09
+02
+00
+00
+00
+00
+00
+00
+11
+00
+00
+00
+13
+04
+00
+00
+00
+00
+00
+00
+18
+00
+00
+00
+14
+04
+00
+00
+00
+00
+00
+00
+1f
+00
+00
+00
+16
+04
+00
+00
+00
+00
+00
+00
+26
+00
+00
+00
+17
+04
+00
+00
+00
+00
+00
+00
+2d
+00
+00
+00
+15
+04
+00
+00
+00
+00
+00
+00
+34
+00
+00
+00
+03
+02
+00
+00
+00
+00
+00
+00
+00
+2e
+74
+65
+78
+74
+00
+2e
+72
+65
+6c
+61
+2e
+74
+65
+78
+74
+00
+2e
+73
+74
+72
+74
+61
+62
+00
+2e
+73
+79
+6d
+74
+61
+62
+00
+2e
+73
+68
+73
+74
+72
+74
+61
+62
+00
+00
+2d
+00
+62
+61
+72
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+01
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+04
+00
+f1
+ff
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+04
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+03
+00
+04
+00
+03
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+16
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+22
+00
+00
+00
+03
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+d8
+00
+00
+00
+2c
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+12
+00
+00
+00
+03
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+04
+01
+00
+00
+07
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+1a
+00
+00
+00
+02
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+0c
+01
+00
+00
+50
+00
+00
+00
+02
+00
+00
+00
+04
+00
+00
+00
+04
+00
+00
+00
+10
+00
+00
+00
+01
+00
+00
+00
+01
+00
+00
+00
+06
+00
+00
+00
+00
+00
+00
+00
+40
+00
+00
+00
+38
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+10
+00
+00
+00
+00
+00
+00
+00
+07
+00
+00
+00
+04
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+78
+00
+00
+00
+60
+00
+00
+00
+03
+00
+00
+00
+04
+00
+00
+00
+04
+00
+00
+00
+0c
+00
+00
+00
diff --git a/modules/objfmts/elf/tests/gasx32/elf_gasx32_test.sh b/modules/objfmts/elf/tests/gasx32/elf_gasx32_test.sh
new file mode 100755
index 00000000..f5372cb5
--- /dev/null
+++ b/modules/objfmts/elf/tests/gasx32/elf_gasx32_test.sh
@@ -0,0 +1,3 @@
+#! /bin/sh
+${srcdir}/out_test.sh elf_gasx32_test modules/objfmts/elf/tests/gasx32 "GAS elf-x32 objfmt" "-f elfx32 -p gas" ".o"
+exit $?
diff --git a/modules/objfmts/elf/tests/x32/Makefile.inc b/modules/objfmts/elf/tests/x32/Makefile.inc
new file mode 100644
index 00000000..d62ba3ea
--- /dev/null
+++ b/modules/objfmts/elf/tests/x32/Makefile.inc
@@ -0,0 +1,11 @@
+TESTS += modules/objfmts/elf/tests/x32/elf_x32_test.sh
+
+EXTRA_DIST += modules/objfmts/elf/tests/x32/elf_x32_test.sh
+EXTRA_DIST += modules/objfmts/elf/tests/x32/elf-rip.asm
+EXTRA_DIST += modules/objfmts/elf/tests/x32/elf-rip.hex
+EXTRA_DIST += modules/objfmts/elf/tests/x32/elfso32.asm
+EXTRA_DIST += modules/objfmts/elf/tests/x32/elfso32.hex
+EXTRA_DIST += modules/objfmts/elf/tests/x32/gotpcrel.asm
+EXTRA_DIST += modules/objfmts/elf/tests/x32/gotpcrel.hex
+EXTRA_DIST += modules/objfmts/elf/tests/x32/multiplefixup.asm
+EXTRA_DIST += modules/objfmts/elf/tests/x32/multiplefixup.hex
diff --git a/modules/objfmts/elf/tests/x32/elf-rip.asm b/modules/objfmts/elf/tests/x32/elf-rip.asm
new file mode 100644
index 00000000..5f10f096
--- /dev/null
+++ b/modules/objfmts/elf/tests/x32/elf-rip.asm
@@ -0,0 +1,7 @@
+[bits 64]
+[extern sym]
+mov eax, [rip]
+mov eax, [rip+2]
+mov eax, [rip+sym]
+mov eax, [sym wrt rip]
+call sym
diff --git a/modules/objfmts/elf/tests/x32/elf-rip.hex b/modules/objfmts/elf/tests/x32/elf-rip.hex
new file mode 100644
index 00000000..be5da687
--- /dev/null
+++ b/modules/objfmts/elf/tests/x32/elf-rip.hex
@@ -0,0 +1,496 @@
+7f
+45
+4c
+46
+01
+01
+01
+00
+00
+00
+00
+00
+00
+00
+00
+00
+01
+00
+3e
+00
+01
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+01
+00
+00
+00
+00
+00
+00
+34
+00
+00
+00
+00
+00
+28
+00
+06
+00
+01
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+8b
+05
+00
+00
+00
+00
+8b
+05
+02
+00
+00
+00
+8b
+05
+00
+00
+00
+00
+8b
+05
+00
+00
+00
+00
+e8
+00
+00
+00
+00
+00
+00
+00
+0e
+00
+00
+00
+0a
+03
+00
+00
+00
+00
+00
+00
+14
+00
+00
+00
+02
+03
+00
+00
+fc
+ff
+ff
+ff
+19
+00
+00
+00
+02
+03
+00
+00
+fc
+ff
+ff
+ff
+00
+2e
+74
+65
+78
+74
+00
+2e
+72
+65
+6c
+61
+2e
+74
+65
+78
+74
+00
+2e
+73
+74
+72
+74
+61
+62
+00
+2e
+73
+79
+6d
+74
+61
+62
+00
+2e
+73
+68
+73
+74
+72
+74
+61
+62
+00
+00
+2d
+00
+73
+79
+6d
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+01
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+04
+00
+f1
+ff
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+03
+00
+04
+00
+03
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+10
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+22
+00
+00
+00
+03
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+84
+00
+00
+00
+2c
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+12
+00
+00
+00
+03
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+b0
+00
+00
+00
+07
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+1a
+00
+00
+00
+02
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+b8
+00
+00
+00
+40
+00
+00
+00
+02
+00
+00
+00
+03
+00
+00
+00
+04
+00
+00
+00
+10
+00
+00
+00
+01
+00
+00
+00
+01
+00
+00
+00
+06
+00
+00
+00
+00
+00
+00
+00
+40
+00
+00
+00
+1d
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+10
+00
+00
+00
+00
+00
+00
+00
+07
+00
+00
+00
+04
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+60
+00
+00
+00
+24
+00
+00
+00
+03
+00
+00
+00
+04
+00
+00
+00
+04
+00
+00
+00
+0c
+00
+00
+00
diff --git a/modules/objfmts/elf/tests/x32/elf_x32_test.sh b/modules/objfmts/elf/tests/x32/elf_x32_test.sh
new file mode 100755
index 00000000..39618166
--- /dev/null
+++ b/modules/objfmts/elf/tests/x32/elf_x32_test.sh
@@ -0,0 +1,3 @@
+#! /bin/sh
+${srcdir}/out_test.sh elf_x32_test modules/objfmts/elf/tests/x32 "elf-x32 objfmt" "-f elf -m x32" ".o"
+exit $?
diff --git a/modules/objfmts/elf/tests/x32/elfsox32.asm b/modules/objfmts/elf/tests/x32/elfsox32.asm
new file mode 100644
index 00000000..931c7ffe
--- /dev/null
+++ b/modules/objfmts/elf/tests/x32/elfsox32.asm
@@ -0,0 +1,90 @@
+; This code is UNTESTED, and almost certainly DOES NOT WORK!
+; Do NOT use this as an example of how to write AMD64 shared libraries!
+; This code is simply to test the AMD64 ELF WRT relocations.
+
+; This file should test the following:
+; [1] Define and export a global text-section symbol
+; [2] Define and export a global data-section symbol
+; [3] Define and export a global BSS-section symbol
+; [4] Define a non-global text-section symbol
+; [5] Define a non-global data-section symbol
+; [6] Define a non-global BSS-section symbol
+; [7] Define a COMMON symbol
+; [8] Define a NASM local label
+; [9] Reference a NASM local label
+; [10] Import an external symbol
+; [11] Make a PC-relative call to an external symbol
+; [12] Reference a text-section symbol in the text section
+; [13] Reference a data-section symbol in the text section
+; [14] Reference a BSS-section symbol in the text section
+; [15] Reference a text-section symbol in the data section
+; [16] Reference a data-section symbol in the data section
+; [17] Reference a BSS-section symbol in the data section
+
+ [BITS 64]
+ [GLOBAL lrotate:function] ; [1]
+ [GLOBAL greet:function] ; [1]
+ [GLOBAL asmstr:data asmstr.end-asmstr] ; [2]
+ [GLOBAL textptr:data 4] ; [2]
+ [GLOBAL selfptr:data 4] ; [2]
+ [GLOBAL integer:data 4] ; [3]
+ [EXTERN printf] ; [10]
+ [COMMON commvar 4:4] ; [7]
+ [EXTERN _GLOBAL_OFFSET_TABLE_]
+
+ [SECTION .text]
+
+; prototype: long lrotate(long x, int num);
+lrotate: ; [1]
+ push rbp
+ mov rbp,rsp
+ mov rax,[rbp+8]
+ mov rcx,[rbp+12]
+.label rol rax,1 ; [4] [8]
+ loop .label ; [9] [12]
+ mov rsp,rbp
+ pop rbp
+ ret
+
+; prototype: void greet(void);
+greet push rbx ; we'll use RBX for GOT, so save it
+ mov rbx,[integer wrt ..gotpcrel wrt rip]
+ mov rax,[rbx] ; [14]
+ inc rax
+ mov rbx,[_GLOBAL_OFFSET_TABLE_ wrt ..gotpcrel wrt rip]
+ mov [rbx+localint wrt ..got],eax ; [14]
+ mov rax,[rbx+commvar wrt ..got]
+ push qword [rax]
+ mov rax,[rbx+localptr wrt ..got] ; [13]
+ push qword [rax]
+ mov rax,[rbx+integer wrt ..got] ; [1] [14]
+ push qword [rax]
+ lea rax,[rbx+printfstr wrt ..got]
+ push rax ; [13]
+ call printf wrt ..plt ; [11]
+ add rsp,16
+ pop rbx
+ ret
+
+ [SECTION .data]
+
+; a string
+asmstr db 'hello, world', 0 ; [2]
+.end
+
+; a string for Printf
+printfstr db "integer==%d, localint==%d, commvar=%d"
+ db 10, 0
+
+; some pointers
+localptr dd localint ; [5] [17]
+textptr dd greet wrt ..sym ; [15]
+selfptr dd selfptr wrt ..sym ; [16]
+
+ [SECTION .bss]
+
+; an integer
+integer resd 1 ; [3]
+
+; a local integer
+localint resd 1 ; [6]
diff --git a/modules/objfmts/elf/tests/x32/elfsox32.hex b/modules/objfmts/elf/tests/x32/elfsox32.hex
new file mode 100644
index 00000000..d423b2de
--- /dev/null
+++ b/modules/objfmts/elf/tests/x32/elfsox32.hex
@@ -0,0 +1,1176 @@
+7f
+45
+4c
+46
+01
+01
+01
+00
+00
+00
+00
+00
+00
+00
+00
+00
+01
+00
+3e
+00
+01
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+30
+03
+00
+00
+00
+00
+00
+00
+34
+00
+00
+00
+00
+00
+28
+00
+09
+00
+01
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+55
+48
+89
+e5
+48
+8b
+45
+08
+48
+8b
+4d
+0c
+48
+d1
+c0
+e2
+fb
+48
+89
+ec
+5d
+c3
+53
+48
+8b
+1d
+00
+00
+00
+00
+48
+8b
+03
+48
+ff
+c0
+48
+8b
+1d
+00
+00
+00
+00
+89
+83
+00
+00
+00
+00
+48
+8b
+83
+00
+00
+00
+00
+ff
+30
+48
+8b
+83
+00
+00
+00
+00
+ff
+30
+48
+8b
+83
+00
+00
+00
+00
+ff
+30
+48
+8d
+83
+00
+00
+00
+00
+50
+e8
+00
+00
+00
+00
+48
+83
+c4
+10
+5b
+c3
+00
+1a
+00
+00
+00
+09
+0f
+00
+00
+fc
+ff
+ff
+ff
+27
+00
+00
+00
+09
+12
+00
+00
+fc
+ff
+ff
+ff
+2d
+00
+00
+00
+03
+06
+00
+00
+00
+00
+00
+00
+34
+00
+00
+00
+03
+11
+00
+00
+00
+00
+00
+00
+3d
+00
+00
+00
+03
+05
+00
+00
+00
+00
+00
+00
+46
+00
+00
+00
+03
+0f
+00
+00
+00
+00
+00
+00
+4f
+00
+00
+00
+03
+04
+00
+00
+00
+00
+00
+00
+55
+00
+00
+00
+04
+10
+00
+00
+fc
+ff
+ff
+ff
+68
+65
+6c
+6c
+6f
+2c
+20
+77
+6f
+72
+6c
+64
+00
+69
+6e
+74
+65
+67
+65
+72
+3d
+3d
+25
+64
+2c
+20
+6c
+6f
+63
+61
+6c
+69
+6e
+74
+3d
+3d
+25
+64
+2c
+20
+63
+6f
+6d
+6d
+76
+61
+72
+3d
+25
+64
+0a
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+34
+00
+00
+00
+0a
+02
+00
+00
+04
+00
+00
+00
+38
+00
+00
+00
+0a
+0b
+00
+00
+00
+00
+00
+00
+3c
+00
+00
+00
+0a
+0e
+00
+00
+00
+00
+00
+00
+00
+2e
+74
+65
+78
+74
+00
+2e
+64
+61
+74
+61
+00
+2e
+62
+73
+73
+00
+2e
+72
+65
+6c
+61
+2e
+74
+65
+78
+74
+00
+2e
+72
+65
+6c
+61
+2e
+64
+61
+74
+61
+00
+2e
+73
+74
+72
+74
+61
+62
+00
+2e
+73
+79
+6d
+74
+61
+62
+00
+2e
+73
+68
+73
+74
+72
+74
+61
+62
+00
+00
+00
+00
+2d
+00
+6c
+72
+6f
+74
+61
+74
+65
+00
+67
+72
+65
+65
+74
+00
+61
+73
+6d
+73
+74
+72
+00
+74
+65
+78
+74
+70
+74
+72
+00
+73
+65
+6c
+66
+70
+74
+72
+00
+69
+6e
+74
+65
+67
+65
+72
+00
+70
+72
+69
+6e
+74
+66
+00
+63
+6f
+6d
+6d
+76
+61
+72
+00
+5f
+47
+4c
+4f
+42
+41
+4c
+5f
+4f
+46
+46
+53
+45
+54
+5f
+54
+41
+42
+4c
+45
+5f
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+01
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+04
+00
+f1
+ff
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+03
+00
+08
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+03
+00
+06
+00
+00
+00
+00
+00
+0d
+00
+00
+00
+00
+00
+00
+00
+00
+00
+06
+00
+00
+00
+00
+00
+34
+00
+00
+00
+00
+00
+00
+00
+00
+00
+06
+00
+00
+00
+00
+00
+04
+00
+00
+00
+00
+00
+00
+00
+00
+00
+08
+00
+00
+00
+00
+00
+0c
+00
+00
+00
+00
+00
+00
+00
+00
+00
+04
+00
+00
+00
+00
+00
+0d
+00
+00
+00
+00
+00
+00
+00
+00
+00
+06
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+03
+00
+04
+00
+03
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+12
+00
+04
+00
+0b
+00
+00
+00
+16
+00
+00
+00
+00
+00
+00
+00
+12
+00
+04
+00
+11
+00
+00
+00
+00
+00
+00
+00
+0d
+00
+00
+00
+11
+00
+06
+00
+18
+00
+00
+00
+38
+00
+00
+00
+04
+00
+00
+00
+11
+00
+06
+00
+20
+00
+00
+00
+3c
+00
+00
+00
+04
+00
+00
+00
+11
+00
+06
+00
+28
+00
+00
+00
+00
+00
+00
+00
+04
+00
+00
+00
+11
+00
+08
+00
+30
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+10
+00
+00
+00
+37
+00
+00
+00
+04
+00
+00
+00
+04
+00
+00
+00
+10
+00
+f2
+ff
+3f
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+10
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+38
+00
+00
+00
+03
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+64
+01
+00
+00
+42
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+28
+00
+00
+00
+03
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+a8
+01
+00
+00
+55
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+30
+00
+00
+00
+02
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+02
+00
+00
+30
+01
+00
+00
+02
+00
+00
+00
+0a
+00
+00
+00
+04
+00
+00
+00
+10
+00
+00
+00
+01
+00
+00
+00
+01
+00
+00
+00
+06
+00
+00
+00
+00
+00
+00
+00
+40
+00
+00
+00
+5f
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+10
+00
+00
+00
+00
+00
+00
+00
+12
+00
+00
+00
+04
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+a0
+00
+00
+00
+60
+00
+00
+00
+03
+00
+00
+00
+04
+00
+00
+00
+04
+00
+00
+00
+0c
+00
+00
+00
+07
+00
+00
+00
+01
+00
+00
+00
+03
+00
+00
+00
+00
+00
+00
+00
+00
+01
+00
+00
+40
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+04
+00
+00
+00
+00
+00
+00
+00
+1d
+00
+00
+00
+04
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+40
+01
+00
+00
+24
+00
+00
+00
+03
+00
+00
+00
+06
+00
+00
+00
+04
+00
+00
+00
+0c
+00
+00
+00
+0d
+00
+00
+00
+08
+00
+00
+00
+03
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+08
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+04
+00
+00
+00
+00
+00
+00
+00
diff --git a/modules/objfmts/elf/tests/x32/gotpcrel.asm b/modules/objfmts/elf/tests/x32/gotpcrel.asm
new file mode 100644
index 00000000..c3d12383
--- /dev/null
+++ b/modules/objfmts/elf/tests/x32/gotpcrel.asm
@@ -0,0 +1,6 @@
+var:
+mov rax, [var wrt ..got]
+mov rax, [var wrt ..gotpcrel] ; should be error/warning?
+mov rax, [rel var wrt ..got] ; automatic promotion to GOTPCREL
+mov rax, [rel var wrt ..gotpcrel]
+
diff --git a/modules/objfmts/elf/tests/x32/gotpcrel.hex b/modules/objfmts/elf/tests/x32/gotpcrel.hex
new file mode 100644
index 00000000..695cf7d6
--- /dev/null
+++ b/modules/objfmts/elf/tests/x32/gotpcrel.hex
@@ -0,0 +1,496 @@
+7f
+45
+4c
+46
+01
+01
+01
+00
+00
+00
+00
+00
+00
+00
+00
+00
+01
+00
+3e
+00
+01
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+01
+00
+00
+00
+00
+00
+00
+34
+00
+00
+00
+00
+00
+28
+00
+06
+00
+01
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+48
+8b
+04
+25
+00
+00
+00
+00
+48
+8b
+04
+25
+00
+00
+00
+00
+48
+8b
+05
+00
+00
+00
+00
+48
+8b
+05
+00
+00
+00
+00
+00
+00
+04
+00
+00
+00
+03
+02
+00
+00
+00
+00
+00
+00
+0c
+00
+00
+00
+09
+02
+00
+00
+00
+00
+00
+00
+13
+00
+00
+00
+09
+02
+00
+00
+fc
+ff
+ff
+ff
+1a
+00
+00
+00
+09
+02
+00
+00
+fc
+ff
+ff
+ff
+00
+2e
+74
+65
+78
+74
+00
+2e
+72
+65
+6c
+61
+2e
+74
+65
+78
+74
+00
+2e
+73
+74
+72
+74
+61
+62
+00
+2e
+73
+79
+6d
+74
+61
+62
+00
+2e
+73
+68
+73
+74
+72
+74
+61
+62
+00
+00
+2d
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+01
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+04
+00
+f1
+ff
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+04
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+03
+00
+04
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+22
+00
+00
+00
+03
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+90
+00
+00
+00
+2c
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+12
+00
+00
+00
+03
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+bc
+00
+00
+00
+03
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+1a
+00
+00
+00
+02
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+c0
+00
+00
+00
+40
+00
+00
+00
+02
+00
+00
+00
+04
+00
+00
+00
+04
+00
+00
+00
+10
+00
+00
+00
+01
+00
+00
+00
+01
+00
+00
+00
+06
+00
+00
+00
+00
+00
+00
+00
+40
+00
+00
+00
+1e
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+10
+00
+00
+00
+00
+00
+00
+00
+07
+00
+00
+00
+04
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+60
+00
+00
+00
+30
+00
+00
+00
+03
+00
+00
+00
+04
+00
+00
+00
+04
+00
+00
+00
+0c
+00
+00
+00
diff --git a/modules/objfmts/elf/tests/x32/multiplefixup.asm b/modules/objfmts/elf/tests/x32/multiplefixup.asm
new file mode 100644
index 00000000..ec253cbb
--- /dev/null
+++ b/modules/objfmts/elf/tests/x32/multiplefixup.asm
@@ -0,0 +1,8 @@
+[section .data]
+foobar:
+ dq 42
+[section .text]
+foo:
+ times 4 mov rax, [rel foobar]
+ times 4 mov rax, [foobar]
+ times 4 jmp foo
diff --git a/modules/objfmts/elf/tests/x32/multiplefixup.hex b/modules/objfmts/elf/tests/x32/multiplefixup.hex
new file mode 100644
index 00000000..a1874282
--- /dev/null
+++ b/modules/objfmts/elf/tests/x32/multiplefixup.hex
@@ -0,0 +1,680 @@
+7f
+45
+4c
+46
+01
+01
+01
+00
+00
+00
+00
+00
+00
+00
+00
+00
+01
+00
+3e
+00
+01
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+90
+01
+00
+00
+00
+00
+00
+00
+34
+00
+00
+00
+00
+00
+28
+00
+07
+00
+01
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+48
+8b
+05
+00
+00
+00
+00
+48
+8b
+05
+00
+00
+00
+00
+48
+8b
+05
+00
+00
+00
+00
+48
+8b
+05
+00
+00
+00
+00
+48
+8b
+04
+25
+00
+00
+00
+00
+48
+8b
+04
+25
+00
+00
+00
+00
+48
+8b
+04
+25
+00
+00
+00
+00
+48
+8b
+04
+25
+00
+00
+00
+00
+eb
+c2
+eb
+c0
+eb
+be
+eb
+bc
+03
+00
+00
+00
+02
+04
+00
+00
+fc
+ff
+ff
+ff
+0a
+00
+00
+00
+02
+04
+00
+00
+fc
+ff
+ff
+ff
+11
+00
+00
+00
+02
+04
+00
+00
+fc
+ff
+ff
+ff
+18
+00
+00
+00
+02
+04
+00
+00
+fc
+ff
+ff
+ff
+20
+00
+00
+00
+0a
+04
+00
+00
+00
+00
+00
+00
+28
+00
+00
+00
+0a
+04
+00
+00
+00
+00
+00
+00
+30
+00
+00
+00
+0a
+04
+00
+00
+00
+00
+00
+00
+38
+00
+00
+00
+0a
+04
+00
+00
+00
+00
+00
+00
+2a
+00
+00
+00
+00
+00
+00
+00
+00
+2e
+74
+65
+78
+74
+00
+2e
+64
+61
+74
+61
+00
+2e
+72
+65
+6c
+61
+2e
+74
+65
+78
+74
+00
+2e
+73
+74
+72
+74
+61
+62
+00
+2e
+73
+79
+6d
+74
+61
+62
+00
+2e
+73
+68
+73
+74
+72
+74
+61
+62
+00
+00
+00
+00
+2d
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+01
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+04
+00
+f1
+ff
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+04
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+06
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+03
+00
+06
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+03
+00
+04
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+28
+00
+00
+00
+03
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+ec
+00
+00
+00
+32
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+18
+00
+00
+00
+03
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+20
+01
+00
+00
+03
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+20
+00
+00
+00
+02
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+24
+01
+00
+00
+60
+00
+00
+00
+02
+00
+00
+00
+06
+00
+00
+00
+04
+00
+00
+00
+10
+00
+00
+00
+01
+00
+00
+00
+01
+00
+00
+00
+06
+00
+00
+00
+00
+00
+00
+00
+40
+00
+00
+00
+44
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+10
+00
+00
+00
+00
+00
+00
+00
+0d
+00
+00
+00
+04
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+84
+00
+00
+00
+60
+00
+00
+00
+03
+00
+00
+00
+04
+00
+00
+00
+04
+00
+00
+00
+0c
+00
+00
+00
+07
+00
+00
+00
+01
+00
+00
+00
+03
+00
+00
+00
+00
+00
+00
+00
+e4
+00
+00
+00
+08
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+04
+00
+00
+00
+00
+00
+00
+00