diff test/MC/Sparc/sparc-tls-relocations.s @ 147:c2174574ed3a

LLVM 10
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Wed, 14 Aug 2019 16:55:33 +0900
parents 803732b1fca8
children
line wrap: on
line diff
--- a/test/MC/Sparc/sparc-tls-relocations.s	Sat Feb 17 09:57:20 2018 +0900
+++ b/test/MC/Sparc/sparc-tls-relocations.s	Wed Aug 14 16:55:33 2019 +0900
@@ -10,74 +10,147 @@
 
 ! REL: Arch: sparc
 ! REL: Relocations [
-! REL: 0x{{[0-9,A-F]+}} R_SPARC_TLS_LE_HIX22 Head 0x0
-! REL: 0x{{[0-9,A-F]+}} R_SPARC_TLS_LE_LOX10 Head 0x0
-! REL: 0x{{[0-9,A-F]+}} R_SPARC_TLS_LDO_HIX22 Head 0x0
-! REL: 0x{{[0-9,A-F]+}} R_SPARC_TLS_LDM_HI22  Head 0x0
-! REL: 0x{{[0-9,A-F]+}} R_SPARC_TLS_LDM_LO10  Head 0x0
-! REL: 0x{{[0-9,A-F]+}} R_SPARC_TLS_LDO_LOX10 Head 0x0
+! REL: 0x{{[0-9,A-F]+}} R_SPARC_TLS_LE_HIX22 Local 0x0
+! REL: 0x{{[0-9,A-F]+}} R_SPARC_TLS_LE_LOX10 Local 0x0
+! REL: 0x{{[0-9,A-F]+}} R_SPARC_TLS_LDO_HIX22 Local 0x0
+! REL: 0x{{[0-9,A-F]+}} R_SPARC_TLS_LDM_HI22  Local 0x0
+! REL: 0x{{[0-9,A-F]+}} R_SPARC_TLS_LDM_LO10  Local 0x0
+! REL: 0x{{[0-9,A-F]+}} R_SPARC_TLS_LDO_LOX10 Local 0x0
 ! REL: ]
 
 
 ! OBJDUMP: foo:
 foo:
-! Here we use two different sequences to get the address of a static TLS variable 'Head'
+! Here we use two different sequences to get the address of a static TLS variable 'Local'
 ! (note - there is no intent to have valid assembler function here,
 !  we just check how TLS relocations are emitted)
 !
-! First sequence uses LE_HIX22/LE_LOX10
+! Sequence for Local Executable model:
+!     LE_HIX22/LE_LOX10
 
 ! OBJDUMP: {{[0-9,a-f]+}}:  31 00 00 00  sethi 0, %i0
-! OBJDUMP: {{[0-9,a-f]+}}:     R_SPARC_TLS_LE_HIX22 Unknown
-! ASM: sethi %tle_hix22(Head), %i0 ! encoding: [0x31,0x00,0x00,0x00]
-! ASM:                                 !   fixup A - offset: 0, value: %tle_hix22(Head), kind: fixup_sparc_tls_le_hix22
-        sethi %tle_hix22(Head), %i0
+! OBJDUMP: {{[0-9,a-f]+}}:     R_SPARC_TLS_LE_HIX22 Local
+! ASM: sethi %tle_hix22(Local), %i0 ! encoding: [0x31,0x00,0x00,0x00]
+! ASM:                             !   fixup A - offset: 0, value: %tle_hix22(Local), kind: fixup_sparc_tls_le_hix22
+        sethi %tle_hix22(Local), %i0
 
 ! OBJDUMP: {{[0-9,a-f]+}}:  b0 1e 20 00  xor %i0, 0, %i0
-! OBJDUMP: {{[0-9,a-f]+}}:     R_SPARC_TLS_LE_LOX10 Unknown
-! ASM: xor %i0, %tle_lox10(Head), %i0 ! encoding: [0xb0,0x1e,0x20,0x00]
-! ASM:                                    !   fixup A - offset: 0, value: %tle_lox10(Head), kind: fixup_sparc_tls_le_lox10
-        xor %i0, %tle_lox10(Head), %i0
+! OBJDUMP: {{[0-9,a-f]+}}:     R_SPARC_TLS_LE_LOX10 Local
+! ASM: xor %i0, %tle_lox10(Local), %i0 ! encoding: [0xb0,0x1e,0x20,0x00]
+! ASM:                                !   fixup A - offset: 0, value: %tle_lox10(Local), kind: fixup_sparc_tls_le_lox10
+        xor %i0, %tle_lox10(Local), %i0
 
 
 ! Second sequence is for PIC, so it is more complicated.
-! It uses LDO_HIX22/LDO_LOX10/LDO_ADD/LDM_HI22/LDM_LO10/LDM_ADD/LDM_CALL
+! Local Dynamic model:
+!     LDO_HIX22/LDO_LOX10/LDO_ADD/LDM_HI22/LDM_LO10/LDM_ADD/LDM_CALL
 
 ! OBJDUMP: {{[0-9,a-f]+}}:  33 00 00 00  sethi 0, %i1
-! OBJDUMP: {{[0-9,a-f]+}}:     R_SPARC_TLS_LDO_HIX22 Unknown
-! ASM: sethi %tldo_hix22(Head), %i1 ! encoding: [0x33,0b00AAAAAA,A,A]
-! ASM:                                  !   fixup A - offset: 0, value: %tldo_hix22(Head), kind: fixup_sparc_tls_ldo_hix22
-        sethi %tldo_hix22(Head), %i1
+! OBJDUMP: {{[0-9,a-f]+}}:     R_SPARC_TLS_LDO_HIX22 Local
+! ASM: sethi %tldo_hix22(Local), %i1 ! encoding: [0x33,0b00AAAAAA,A,A]
+! ASM:                              !   fixup A - offset: 0, value: %tldo_hix22(Local), kind: fixup_sparc_tls_ldo_hix22
+        sethi %tldo_hix22(Local), %i1
 
 ! OBJDUMP: {{[0-9,a-f]+}}:  35 00 00 00  sethi 0, %i2
-! OBJDUMP: {{[0-9,a-f]+}}:     R_SPARC_TLS_LDM_HI22 Unknown
-! ASM: sethi %tldm_hi22(Head), %i2 ! encoding: [0x35,0b00AAAAAA,A,A]
-! ASM:                                 !   fixup A - offset: 0, value: %tldm_hi22(Head), kind: fixup_sparc_tls_ldm_hi22
-        sethi %tldm_hi22(Head), %i2
+! OBJDUMP: {{[0-9,a-f]+}}:     R_SPARC_TLS_LDM_HI22 Local
+! ASM: sethi %tldm_hi22(Local), %i2 ! encoding: [0x35,0b00AAAAAA,A,A]
+! ASM:                             !   fixup A - offset: 0, value: %tldm_hi22(Local), kind: fixup_sparc_tls_ldm_hi22
+        sethi %tldm_hi22(Local), %i2
 
 ! OBJDUMP: {{[0-9,a-f]+}}:  b4 06 a0 00  add %i2, 0, %i2
-! OBJDUMP: {{[0-9,a-f]+}}:     R_SPARC_TLS_LDM_LO10 Unknown
-! ASM: add %i2, %tldm_lo10(Head), %i2 ! encoding: [0xb4,0x06,0b101000AA,A]
-! ASM:                                    !   fixup A - offset: 0, value: %tldm_lo10(Head), kind: fixup_sparc_tls_ldm_lo10
-        add %i2, %tldm_lo10(Head), %i2
+! OBJDUMP: {{[0-9,a-f]+}}:     R_SPARC_TLS_LDM_LO10 Local
+! ASM: add %i2, %tldm_lo10(Local), %i2 ! encoding: [0xb4,0x06,0b101000AA,A]
+! ASM:                                !   fixup A - offset: 0, value: %tldm_lo10(Local), kind: fixup_sparc_tls_ldm_lo10
+        add %i2, %tldm_lo10(Local), %i2
 
-	! ???error from llvm-mc on the next asm line???
-	! add %i0, %i2, %o0, %tldm_add(Head)
+! OBJDUMP: {{[0-9,a-f]+}}:  90 06 00 1a add %i0, %i2, %o0
+! OBJDUMP: {{[0-9,a-f]+}}:     R_SPARC_TLS_LDM_ADD Local
+! ASM: add %i0, %i2, %o0, %tldm_add(Local) ! encoding: [0x90,0x06,0x00,0x1a]
+! ASM:                                    !   fixup A - offset: 0, value: %tldm_add(Local), kind: fixup_sparc_tls_ldm_add
+	add %i0, %i2, %o0, %tldm_add(Local)
 
 ! OBJDUMP: {{[0-9,a-f]+}}:  b0 1e 60 00  xor %i1, 0, %i0
-! OBJDUMP: {{[0-9,a-f]+}}:     R_SPARC_TLS_LDO_LOX10 Unknown
-! ASM: xor %i1, %tldo_lox10(Head), %i0 ! encoding: [0xb0,0x1e,0b011000AA,A]
-! ASM:                                     !   fixup A - offset: 0, value: %tldo_lox10(Head), kind: fixup_sparc_tls_ldo_lox10
-        xor %i1, %tldo_lox10(Head), %i0
+! OBJDUMP: {{[0-9,a-f]+}}:     R_SPARC_TLS_LDO_LOX10 Local
+! ASM: xor %i1, %tldo_lox10(Local), %i0 ! encoding: [0xb0,0x1e,0b011000AA,A]
+! ASM:                                 !   fixup A - offset: 0, value: %tldo_lox10(Local), kind: fixup_sparc_tls_ldo_lox10
+        xor %i1, %tldo_lox10(Local), %i0
+
+! OBJDUMP: {{[0-9,a-f]+}}:  40 00 00 00 call 0
+! OBJDUMP: {{[0-9,a-f]+}}:     R_SPARC_TLS_LDM_CALL Local
+! ASM: call __tls_get_addr, %tldm_call(Local) ! encoding: [0x40,0x00,0x00,0x00]
+! ASM:                                       !   fixup A - offset: 0, value: %tldm_call(Local), kind: fixup_sparc_tls_ldm_call
+        call __tls_get_addr, %tldm_call(Local)
+        nop
+
+! OBJDUMP: {{[0-9,a-f]+}}:  90 02 00 18 add %o0, %i0, %o0
+! OBJDUMP: {{[0-9,a-f]+}}:     R_SPARC_TLS_LDO_ADD Local
+! ASM: add %o0, %i0, %o0, %tldo_add(Local) ! encoding: [0x90,0x02,0x00,0x18]
+! ASM:                                    !   fixup A - offset: 0, value: %tldo_add(Local), kind: fixup_sparc_tls_ldo_add
+        add %o0, %i0, %o0, %tldo_add(Local)
+
+! Next two sequences are for extern symbols.
+! Initial Executable model:
+!     IE_HI22/IE_LO10/IE_LD (or IE_LDX)/IE_ADD
+
+! OBJDUMP: {{[0-9,a-f]+}}:  33 00 00 00  sethi 0, %i1
+! OBJDUMP: {{[0-9,a-f]+}}:     R_SPARC_TLS_IE_HI22 Extern
+! ASM: sethi %tie_hi22(Extern), %i1 ! encoding: [0x33,0b00AAAAAA,A,A]
+! ASM:                                    !   fixup A - offset: 0, value: %tie_hi22(Extern), kind: fixup_sparc_tls_ie_hi22
+	sethi %tie_hi22(Extern), %i1
+
+! OBJDUMP: {{[0-9,a-f]+}}:  b2 06 60 00  add %i1, 0, %i1
+! OBJDUMP: {{[0-9,a-f]+}}:     R_SPARC_TLS_IE_LO10 Extern
+! ASM: add %i1, %tie_lo10(Extern), %i1 ! encoding: [0xb2,0x06,0b011000AA,A]
+! ASM:                                    !   fixup A - offset: 0, value: %tie_lo10(Extern), kind: fixup_sparc_tls_ie_lo10
+        add %i1, %tie_lo10(Extern), %i1
+
+! OBJDUMP: {{[0-9,a-f]+}}:  f0 06 00 19  ld [%i0+%i1], %i0
+! OBJDUMP: {{[0-9,a-f]+}}:     R_SPARC_TLS_IE_LD Extern
+! ASM: ld [%i0+%i1], %i0, %tie_ld(Extern) ! encoding: [0xf0,0x06,0x00,0x19]
+! ASM:                                    !   fixup A - offset: 0, value: %tie_ld(Extern), kind: fixup_sparc_tls_ie_ld
+        ld [%i0+%i1], %i0, %tie_ld(Extern)
 
-        ! ???error from llvm-mc on the next asm line???
-        ! call __tls_get_addr, %tldm_call(Head)
-        ! nop
-        ! ???error from llvm-mc on the next asm line???
-        ! add %o0, %i0, %i0, %tldo_add(Head)
+! OBJDUMP: {{[0-9,a-f]+}}:  f0 5e 00 19  ldx [%i0+%i1], %i0
+! OBJDUMP: {{[0-9,a-f]+}}:     R_SPARC_TLS_IE_LDX Extern
+! ASM: ldx [%i0+%i1], %i0, %tie_ldx(Extern) ! encoding: [0xf0,0x5e,0x00,0x19]
+! ASM:                                      !   fixup A - offset: 0, value: %tie_ldx(Extern), kind: fixup_sparc_tls_ie_ldx
+        ldx [%i0+%i1], %i0, %tie_ldx(Extern)
+
+! OBJDUMP: {{[0-9,a-f]+}}:  90 01 c0 18  add %g7, %i0, %o0
+! OBJDUMP: {{[0-9,a-f]+}}:     R_SPARC_TLS_IE_ADD Extern
+! ASM: add %g7, %i0, %o0, %tie_add(Extern) ! encoding: [0x90,0x01,0xc0,0x18]
+! ASM:                                    !   fixup A - offset: 0, value: %tie_add(Extern), kind: fixup_sparc_tls_ie_add
+        add %g7, %i0, %o0, %tie_add(Extern)
+
+! General Dynamic model
+!     GD_HI22/GD_LO10/GD_ADD/GD_CALL
+
+! OBJDUMP: {{[0-9,a-f]+}}:  33 00 00 00  sethi 0, %i1
+! OBJDUMP: {{[0-9,a-f]+}}:     R_SPARC_TLS_GD_HI22 Extern
+! ASM:  sethi %tgd_hi22(Extern), %i1    ! encoding: [0x33,0b00AAAAAA,A,A]
+! ASM:                                    !   fixup A - offset: 0, value: %tgd_hi22(Extern), kind: fixup_sparc_tls_gd_hi22
+        sethi %tgd_hi22(Extern), %i1
 
-        .type  Head,@object
+! OBJDUMP: {{[0-9,a-f]+}}:  b2 06 60 00  add %i1, 0, %i1
+! OBJDUMP: {{[0-9,a-f]+}}:     R_SPARC_TLS_GD_LO10 Extern
+! ASM: add %i1, %tgd_lo10(Extern), %i1 ! encoding: [0xb2,0x06,0b011000AA,A]
+! ASM:                                 !   fixup A - offset: 0, value: %tgd_lo10(Extern), kind: fixup_sparc_tls_gd_lo10
+        add %i1, %tgd_lo10(Extern), %i1
+
+! OBJDUMP: {{[0-9,a-f]+}}:  90 06 00 19  add %i0, %i1, %o0
+! OBJDUMP: {{[0-9,a-f]+}}:     R_SPARC_TLS_GD_ADD Extern
+! ASM: add %i0, %i1, %o0, %tgd_add(Extern) ! encoding: [0x90,0x06,0x00,0x19]
+! ASM:                                    !   fixup A - offset: 0, value: %tgd_add(Extern), kind: fixup_sparc_tls_gd_add
+        add %i0, %i1, %o0, %tgd_add(Extern)
+
+! OBJDUMP: {{[0-9,a-f]+}}:  40 00 00 00 call 0
+! OBJDUMP: {{[0-9,a-f]+}}:     R_SPARC_TLS_GD_CALL Extern
+! ASM: call __tls_get_addr, %tgd_call(Extern) ! encoding: [0x40,0x00,0x00,0x00]
+! ASM:                                        !   fixup A - offset: 0, value: %tgd_call(Extern), kind: fixup_sparc_tls_gd_call
+        call __tls_get_addr, %tgd_call(Extern)
+
+        .type  Local,@object
         .section      .tbss,#alloc,#write,#tls
-Head:
+Local:
         .word  0
-        .size  Head, 4
+        .size  Local, 4