brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.8 KiB · c80464f Raw
56 lines · plain
1# REQUIRES: mips2 3# MIPS TLS variables that are marked as local by a version script were4# previously writing values to the GOT that caused runtime crashes. This5# was happending when linking jemalloc_tsd.c in FreeBSD libc. Check that6# we do the right thing now:7 8# RUN: llvm-mc -filetype=obj -triple=mips64-unknown-freebsd %s -o %t.o9# RUN: echo "{ global: foo; local: *; };" > %t.script10# RUN: echo "SECTIONS { \11# RUN:         . = 0x10000; .text : { *(.text) } \12# RUN:         . = 0x20000; .got  : { *(.got)  } \13# RUN:       }" > %t.script114# RUN: ld.lld --version-script %t.script -script %t.script1 -shared %t.o -o %t.so15# RUN: llvm-objdump --section=.got -s %t.so | FileCheck %s --check-prefix GOT16# RUN: llvm-readobj -r %t.so | FileCheck %s -check-prefix RELOCS17 18# GOT:        Contents of section .got:19# GOT-NEXT:   20000 00000000 00000000 80000000 0000000020# GOT-NEXT:   20010 00000000 00000000 00000000 0000000021# GOT-NEXT:   20020 ffffffff ffff800022 23# RELOCS:      Section ({{.+}}) .rel.dyn {24# RELOCS-NEXT:  0x20018 R_MIPS_TLS_DTPMOD64/R_MIPS_NONE/R_MIPS_NONE25# RELOCS-NEXT: }26 27# Test case generated using:28# clang -mcpu=mips4 -target mips64-unknown-freebsd12.0 \29#       -fpic -O -G0 -EB -mabi=n64 -msoft-float -std=gnu99 -S %s -o %t.s30# from the following source:31#32# _Thread_local int x;33# int foo() { return x; }34#35        .text36        .globl  foo37        .p2align        338        .type   foo,@function39        .ent    foo40foo:41        lui     $1, %hi(%neg(%gp_rel(foo)))42        daddu   $1, $1, $2543        daddiu  $gp, $1, %lo(%neg(%gp_rel(foo)))44        ld      $25, %call16(__tls_get_addr)($gp)45        jalr    $2546        daddiu  $4, $gp, %tlsgd(x)47        .end    foo48 49        .type   x,@object50        .section        .tbss,"awT",@nobits51        .globl  x52        .p2align        253x:54        .4byte  055        .size   x, 456