97 lines · plain
1;; -ffunction-sections previously resulted in call relocations against the2;; .text.foo section symbol instead of the actual function symbol.3;; However, that results in a relocation against a symbol without the LSB set,4;; so the linker thinks it is not linking against a Thumb symbol.5;; Check that we use a relocation against the symbol for calls to functions6;; marked as dso_local (foo$local)7;; NB: Right now only R_ARM_PREL31 and R_ARM_ABS32 are converted to section8;; plus offset, so this test can't use a call.9; RUN: llc -mtriple=armv7a-none-linux-gnueabi --function-sections -o - --relocation-model=pic %s | FileCheck %s10; RUN: llc -mtriple=armv7a-none-linux-gnueabi --function-sections --filetype=obj -o %t --relocation-model=pic %s11; RUN: llvm-readobj -r --symbols %t | FileCheck %s --check-prefix=RELOCS12;; Do not autogen (we check directives that are normally filtered out):13; UTC-ARGS: --disable14 15; RELOCS-LABEL: Relocations [16; RELOCS-NEXT: Section (5) .rel.ARM.exidx.text._ZdlPv {17; RELOCS-NEXT: 0x0 R_ARM_PREL31 .text._ZdlPv18; RELOCS-NEXT: }19; RELOCS-NEXT: Section (7) .rel.text.test {20; RELOCS-NEXT: 0x4 R_ARM_CALL .L_ZdlPv$local21; RELOCS-NEXT: 0xC R_ARM_ABS32 .L_ZdlPv$local22; RELOCS-NEXT: 0x10 R_ARM_ABS32 .L_ZdlPv$local23; RELOCS-NEXT: 0x1C R_ARM_REL32 .L_ZdlPv$local24; RELOCS-NEXT: }25; RELOCS-NEXT: Section (9) .rel.ARM.exidx.text.test {26; RELOCS-NEXT: 0x0 R_ARM_PREL31 .text.test27; RELOCS-NEXT: }28; RELOCS-NEXT: Section (11) .rel.data {29; RELOCS-NEXT: 0x0 R_ARM_ABS32 _ZdlPv30; RELOCS-NEXT: }31; RELOCS-NEXT: ]32 33; RELOCS-LABEL: Symbols [34; RELOCS: Symbol {35; RELOCS: Name: .L_ZdlPv$local36; RELOCS-NEXT: Value: 0x137; RELOCS-NEXT: Size: 238; RELOCS-NEXT: Binding: Local (0x0)39; RELOCS-NEXT: Type: Function (0x2)40; RELOCS-NEXT: Other: 041; RELOCS-NEXT: Section: .text._ZdlPv (42; RELOCS-NEXT: }43 44define dso_local void @_ZdlPv(ptr %ptr) local_unnamed_addr nounwind "target-features"="+armv7-a,+thumb-mode" {45; CHECK-LABEL: .section .text._ZdlPv,"ax",%progbits46; CHECK-NEXT: .globl _ZdlPv @ -- Begin function _ZdlPv47; CHECK-NEXT: .p2align 148; CHECK-NEXT: .type _ZdlPv,%function49; CHECK-NEXT: .code 1650; CHECK-NEXT: .thumb_func51; CHECK-NEXT: _ZdlPv: @ @_ZdlPv52; CHECK-NEXT: .L_ZdlPv$local:53; CHECK-NEXT: .type .L_ZdlPv$local,%function54; CHECK-NEXT: .fnstart55; CHECK-NEXT: @ %bb.0:56; CHECK-NEXT: bx lr57; CHECK-NEXT: .Lfunc_end0:58; CHECK-NEXT: .size _ZdlPv, .Lfunc_end0-_ZdlPv59; CHECK-NEXT: .size .L_ZdlPv$local, .Lfunc_end0-_ZdlPv60; CHECK-NEXT: .cantunwind61; CHECK-NEXT: .fnend62 ret void63}64 65define ptr @test(ptr %ptr) nounwind {66; CHECK-LABEL: test:67; CHECK: @ %bb.0: @ %entry68; CHECK-NEXT: .save {r11, lr}69; CHECK-NEXT: push {r11, lr}70; CHECK-NEXT: bl .L_ZdlPv$local71; CHECK-NEXT: ldr r0, .LCPI1_072; CHECK-NEXT: @APP73; CHECK-NEXT: .long .L_ZdlPv$local74; CHECK-NEXT: @NO_APP75; CHECK-NEXT: @APP76; CHECK-NEXT: .Ltmp0:77; CHECK-NEXT: .reloc .Ltmp0, R_ARM_ABS32, .L_ZdlPv$local78; CHECK-NEXT: .long 079; CHECK-NEXT: @NO_APP80; CHECK-NEXT: .LPC1_0:81; CHECK-NEXT: add r0, pc, r082; CHECK-NEXT: pop {r11, pc}83; CHECK-NEXT: .p2align 284; CHECK-NEXT: @ %bb.1:85; CHECK-NEXT: .LCPI1_0:86; CHECK-NEXT: .long .L_ZdlPv$local-(.LPC1_0+8)87entry:88 call void @_ZdlPv(ptr %ptr)89 ; This inline assembly is needed to highlight the missing Thumb LSB since90 ; only R_ARM_ABS32 is converted to section+offset91 tail call void asm sideeffect ".4byte .L_ZdlPv$$local", ""()92 tail call void asm sideeffect ".reloc ., R_ARM_ABS32, .L_ZdlPv$$local\0A.4byte 0", ""()93 ret ptr @_ZdlPv94}95 96@fnptr = hidden local_unnamed_addr global ptr @_ZdlPv97