xref: /illumos-gate/usr/src/test/elf-tests/tests/tls/i386/ld/half-ldm.s (revision 08f1bbed5edd2a2e9c8be7b7424c32e67c2f3f2c)
1/*
2 * This file and its contents are supplied under the terms of the
3 * Common Development and Distribution License ("CDDL"), version 1.0.
4 * You may only use this file in accordance with the terms of version
5 * 1.0 of the CDDL.
6 *
7 * A full copy of the text of the CDDL should have accompanied this
8 * source.  A copy of the CDDL is also available via the Internet at
9 * http://www.illumos.org/license/CDDL.u
10 */
11
12/*
13 * Copyright 2019, Richard Lowe.
14 */
15
16        .section .rodata.str1.1,"aMS",@progbits,1
17.LC0:
18        .string "foo: %s (%p)\n"
19        .section .tdata,"awT",@progbits
20        .align 4
21	.type foo, @object
22        .size foo,4
23.local foo
24foo:
25	.string	"foo"
26        .text
27.globl main
28        .type main, @function
29main:
30        pushl %ebp
31        movl %esp, %ebp
32	/*
33         * an R_386_TLS_LDM relocation without a following
34         * followed by an R_386_PLT32 relocation, rather than an
35	 * R_386_TLS_LDM_PLT the call should be removed, and _not_
36         * left alone unrelocated as it was prior to:
37         * 10267 ld and GCC disagree about i386 local dynamic TLS
38         */
39        leal foo@TLSLDM(%ebx), %eax
40        call ___tls_get_addr@PLT
41        leal  foo@DTPOFF(%eax), %edx
42        pushl %edx
43        pushl %edx
44        pushl $.LC0
45        call printf@PLT
46        movl $0x0,%eax
47        leave
48        ret
49	.size main, .-main
50