brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.9 KiB · 2ac5815 Raw
59 lines · plain
1# REQUIRES: mips2## Check that we ignore R_MIPS_JALR relocations agains non-function symbols.3## Older versions of clang were erroneously generating them for function pointers4## loaded from any table (not just the GOT) as well as against TLS function5## pointers (when using the local-dynamic model), so we need to ignore these6## relocations to avoid generating binaries that crash when executed.7 8# RUN: llvm-mc -filetype=obj -triple=mips64-unknown-linux %s -o %t.o9## Link in another object file with a .bss as a regression test:10## Previously LLD asserted when skipping over .bss sections when determining the11## location for a warning/error message. By adding another file with a .bss12## section before the actual %t.o we can reproduce this case.13# RUN: llvm-mc -filetype=obj -triple=mips64-unknown-linux %S/Inputs/common.s -o %t-common.o14# RUN: ld.lld -shared %t-common.o %t.o -o %t.so 2>&1 | FileCheck %s -check-prefix WARNING-MESSAGE15# RUN: llvm-objdump --no-show-raw-insn --no-leading-addr -d %t.so | FileCheck %s16 17.set	noreorder18test:19  .reloc .Ltmp1, R_MIPS_JALR, tls_obj20.Ltmp1:21  jr  $t922  nop23# WARNING-MESSAGE: warning: {{.+}}.tmp.o:(.text+0x0): found R_MIPS_JALR relocation against non-function symbol tls_obj. This is invalid and most likely a compiler bug.24 25  .reloc .Ltmp2, R_MIPS_JALR, reg_obj26.Ltmp2:27  jr  $t928  nop29# WARNING-MESSAGE: warning: {{.+}}.tmp.o:(.text+0x8): found R_MIPS_JALR relocation against non-function symbol reg_obj. This is invalid and most likely a compiler bug.30 31  .reloc .Ltmp3, R_MIPS_JALR, untyped32.Ltmp3:33  jr  $t934  nop35 36## However, we do perform the optimization for untyped symbols:37untyped:38  nop39 40  .type  tls_obj,@object41  .section  .tbss,"awT",@nobits42tls_obj:43  .word 044 45  .type  reg_obj,@object46  .data47reg_obj:48  .word 049 50# CHECK-LABEL: Disassembly of section .text:51# CHECK-EMPTY:52# CHECK-NEXT: <test>:53# CHECK-NEXT: jr	$2554# CHECK-NEXT: nop55# CHECK-NEXT: jr	$2556# CHECK-NEXT: nop57# CHECK-NEXT: b	{{.*}} <untyped>58# CHECK-NEXT: nop59