mirror of
https://github.com/Gericom/teak-llvm.git
synced 2025-06-19 19:45:40 -04:00

As the extern_weak target might be missing, resolving to the absolute
address zero, we can't use the normal direct PC-relative branch
instructions (as that would result in relocations out of range).
Instead check the shouldAssumeDSOLocal method and load the address
from a COFF stub.
This matches what was done for X86 in 6bf108d77a
.
Differential Revision: https://reviews.llvm.org/D71720
22 lines
634 B
LLVM
22 lines
634 B
LLVM
; RUN: llc -mtriple thumbv7-windows-coff -filetype asm -o - %s | FileCheck %s -check-prefix CHECK-COFF
|
|
; RUN: llc -mtriple thumbv7-elf -filetype asm -o - %s | FileCheck %s -check-prefix CHECK-OTHER
|
|
; RUN: llc -mtriple thumbv7-macho -filetype asm -o - %s | FileCheck %s -check-prefix CHECK-OTHER
|
|
|
|
declare i8* @f()
|
|
declare extern_weak i8* @g(i8*)
|
|
|
|
define void @test() {
|
|
%call = tail call i8* @f()
|
|
%call1 = tail call i8* @g(i8* %call)
|
|
ret void
|
|
}
|
|
|
|
; CHECK-COFF: movw r0, :lower16:.refptr.g
|
|
; CHECK-COFF: movt r0, :upper16:.refptr.g
|
|
; CHECK-COFF: ldr r4, [r0]
|
|
; CHECK-COFF: mov r1, r4
|
|
; CHECK-COFF: bx r1
|
|
|
|
; CHECK-OTHER: bl {{_?}}g
|
|
|