[llvm] Do not replace dead constant references in metadata with undef
[llvm-project.git] / lld / test / ELF / ppc64-local-entry.s
blob00940b7b27f76a41c989a57c866fbb48963dc4b2
1 # REQUIRES: ppc
3 # RUN: llvm-mc -filetype=obj -triple=powerpc64 %s -o %t
4 # RUN: ld.lld -r %t -o %t2
5 # RUN: llvm-objdump -s --section=.symtab %t2 | FileCheck %s
7 .text
8 .abiversion 2
9 .globl _start
10 .p2align 2
11 .type _start,@function
13 _start:
14 .Lfunc_begin0:
15 .Lfunc_gep0:
16 addis 2, 12, .TOC.-.Lfunc_gep0@ha
17 addi 2, 2, .TOC.-.Lfunc_gep0@l
18 .Lfunc_lep0:
19 .localentry _start, .Lfunc_lep0-.Lfunc_gep0
20 # The code below is not important, it just needs to access some
21 # global data or function, in order to use the TOC.
22 # In this case, it performs the following:
23 # g += 10;
24 # Also note that this code is not intended to be run, but only
25 # to check if the linker will preserve the localentry info.
26 addis 3, 2, g@toc@ha
27 addi 3, 3, g@toc@l
28 lwz 4, 0(3)
29 addi 4, 4, 10
30 stw 4, 0(3)
31 blr
32 .long 0
33 .quad 0
34 .Lfunc_end0:
35 .size _start, .Lfunc_end0-.Lfunc_begin0
37 .type g,@object # @g
38 .lcomm g,4,4
40 // We expect the st_other byte to be 0x60:
41 // localentry = 011 (gep + 2 instructions), reserved = 000,
42 // visibility = 00 (STV_DEFAULT)
43 // Currently, llvm-objdump does not support displaying
44 // st_other's PPC64 specific flags, thus we check the
45 // result of the hexdump of .symtab section.
47 // CHECK: 0060 00000003 12600001 00000000 00000000