brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.4 KiB · f97eda9 Raw
94 lines · plain
1# REQUIRES: ppc2# RUN: llvm-mc -filetype=obj -triple=ppc64le %s -o %t.o3# RUN: echo 'SECTIONS { \4# RUN:       .text_low 0x2000: { *(.text_low) } \5# RUN:       .text_high 0x2002000 : { *(.text_high) } \6# RUN:       }' > %t.script7# RUN: ld.lld -pie -T %t.script %t.o -o %t8# RUN: llvm-readelf -S %t | FileCheck --check-prefix=SEC-PIE %s9# RUN: llvm-readobj -r %t | FileCheck --check-prefix=RELOC %s10# RUN: llvm-objdump -d --no-show-raw-insn %t | FileCheck %s11 12## RELATIVE relocs relocating NOBITS .branch_lt do not cause --check-dynamic-relocations errors.13# RUN: ld.lld -shared -T %t.script %t.o -o %t.so --apply-dynamic-relocs --check-dynamic-relocations14# RUN: llvm-readelf -S %t.so | FileCheck --check-prefix=SEC-SHARED %s15# RUN: llvm-objdump -d --no-show-raw-insn %t.so | FileCheck %s16 17# SEC-PIE:    Name       Type     Address          Off     Size   ES Flg Lk Inf Al18# SEC-PIE:    .got       PROGBITS 0000000002002120 2012120 000010 00  WA  0   0  819# SEC-PIE:    .branch_lt NOBITS   0000000002002138 2012138 000020 00  WA  0   0  820 21# SEC-SHARED: Name       Type     Address          Off     Size   ES Flg Lk Inf Al22# SEC-SHARED: .got       PROGBITS 0000000002002100 2012100 000010 00  WA  0   0  823# SEC-SHARED: .branch_lt NOBITS   0000000002002118 2012118 000020 00  WA  0   0  824 25# RELOC:      .rela.dyn {26# RELOC-NEXT:   0x2002128 R_PPC64_RELATIVE - 0x200200027# RELOC-NEXT:   0x2002130 R_PPC64_RELATIVE - 0x201212028# RELOC-NEXT:   0x2002138 R_PPC64_RELATIVE - 0x200200029# RELOC-NEXT:   0x2002140 R_PPC64_RELATIVE - 0x200200830# RELOC-NEXT:   0x2002148 R_PPC64_RELATIVE - 0x200200C31# RELOC-NEXT:   0x2002150 R_PPC64_RELATIVE - 0x200032# RELOC-NEXT: }33 34# CHECK:      <_start>:35# CHECK-NEXT:     2000:       bl 0x201036# CHECK-NEXT:                 bl 0x200200037# CHECK-NEXT:                 bl 0x203038# CHECK-NEXT:                 bl 0x205039 40## &.branch_lt[0] - .TOC. = .branch_lt - (.got+0x8000) = -3274441# CHECK:      <__long_branch_>:42# CHECK-NEXT:     2010:       addis 12, 2, 043# CHECK-NEXT:                 ld 12, -32744(12)44# CHECK-NEXT:                 mtctr 1245# CHECK-NEXT:                 bctr46 47## &.branch_lt[1] - .TOC. = .branch_lt - (.got+0x8000) = -3273648# CHECK:      <__long_branch_>:49# CHECK-NEXT:     2030:       addis 12, 2, 050# CHECK-NEXT:                 ld 12, -32736(12)51# CHECK-NEXT:                 mtctr 1252# CHECK-NEXT:                 bctr53 54## &.branch_lt[2] - .TOC. = .branch_lt - (.got+0x8000) = -3272855# CHECK:      <__long_branch_>:56# CHECK-NEXT:     2050:       addis 12, 2, 057# CHECK-NEXT:                 ld 12, -32728(12)58# CHECK-NEXT:                 mtctr 1259# CHECK-NEXT:                 bctr60 61.section .text_low, "ax", %progbits62.globl _start63_start:64bl .text_high     # Need a thunk65bl .text_high66bl .text_high+8   # Need a thunk67bl .text_high+0xc # Need a thunk68 69# CHECK:      <high_target>:70# CHECK-NEXT:  2002000:   bl 0x200471# CHECK-NEXT:             bl 0x200472# CHECK-NEXT:             bl 0x200202073 74## &.branch_lt[3] - .TOC. = .branch_lt - (.got+0x8000) = -3272075# CHECK:      <__long_branch_>:76# CHECK-NEXT:  2002020:       addis 12, 2, 077# CHECK-NEXT:                 ld 12, -32720(12)78# CHECK-NEXT:                 mtctr 1279# CHECK-NEXT:                 bctr80 81.section .text_high, "ax", %progbits82high_target:83bl .text_low+484bl .text_low+485bl .text_low      # Need a thunk86blr87 88## Force creation of .got89addis 3, 2, .text_high@got@ha90 91## The R_PPC64_RELATIVE makes sure .rela.dyn survives removeUnusedSyntheticSections.92.section .data93.quad .TOC.@tocbase94