xref: /illumos-gate/usr/src/test/elf-tests/tests/relocs/amd64/gotpcrelx/gotpcrel.s (revision 0245b61fd282e95735b173b8d95be0d6688163b4)
1	.text
2	.globl	foo
3	.section	.rodata
4foo_addr:
5	.string	"string"
6
7	.section	.data.rel.local,"aw",@progbits
8	.align 8
9	.type	foo, @object
10	.size	foo, 8
11foo:
12	.quad	foo_addr
13
14	.text
15	.globl	main
16	.type	main, @function
17main:
18	pushq	%rbp
19	movq	%rsp, %rbp
20	subq	$16, %rsp
21	movl	%edi, -4(%rbp)
22	movq	%rsi, -16(%rbp)
23	/*
24	 * We do this to explicitly _NOT_ get a REX prefix.
25	 * This relies on our load address to actually _work_, and is otherwise
26	 * disgusting.
27	 */
28	movl	foo@GOTPCREL(%rip), %eax
29	movq	(%rax), %rax
30	movq	%rax, %rdi
31	call	puts@PLT
32	movl	$0, %eax
33	leave
34	ret
35	.size	main, .-main
36