brintos

brintos / llvm-project-archived public Read only

0
0
Text · 8.3 KiB · 860b59f Raw
143 lines · plain
1// REQUIRES: arm2// RUN: llvm-mc -g --triple=armv7a-linux-gnueabihf -arm-add-build-attributes -filetype=obj -o %t.o %s3/// Use --threads=1 to keep emitted warnings across sections sequential.4// RUN: ld.lld %t.o -o %t --threads=1 2>&1 | FileCheck %s --check-prefix=WARN5// RUN: llvm-objdump --no-show-raw-insn -d %t | FileCheck %s6 7.syntax unified8.section .arm_target, "ax", %progbits9.balign 0x100010.arm11arm_func_with_notype:12.type arm_func_with_explicit_notype, %notype13arm_func_with_explicit_notype:14 bx lr15 16.section .thumb_target, "ax", %progbits17.balign 418.thumb19thumb_func_with_notype:20.type thumb_func_with_explicit_notype, %notype21thumb_func_with_explicit_notype:22 bx lr23 24/// All the symbols that are targets of the branch relocations do not have25/// type STT_FUNC. LLD should not insert interworking thunks as non STT_FUNC26/// symbols have no state information, the ABI assumes the user has manually27/// done the interworking. For the BL and BLX instructions LLD should28/// preserve the original instruction instead of writing out the correct one29/// for the assumed state at the target.30/// LLD will warn for the BL and BLX cases where the behavior has changed31/// from LLD 10.032.section .arm_caller, "ax", %progbits33.balign 434.arm35.global _start36_start:37 b .arm_target38 b arm_func_with_notype39 b arm_func_with_explicit_notype40 b .thumb_target41 b thumb_func_with_notype42 b thumb_func_with_explicit_notype43 bl .arm_target44 bl arm_func_with_notype45 bl arm_func_with_explicit_notype46 bl .thumb_target47 bl thumb_func_with_notype48 bl thumb_func_with_explicit_notype49// WARN: {{.*}}.o:(.arm_caller+0x30): branch and link relocation: R_ARM_CALL to STT_SECTION symbol .arm_target ; interworking not performed; {{.*}}.s:[[#@LINE+1]]50 blx .arm_target51// WARN: {{.*}}.o:(.arm_caller+0x34): branch and link relocation: R_ARM_CALL to non STT_FUNC symbol: arm_func_with_notype interworking not performed; consider using directive '.type arm_func_with_notype, %function' to give symbol type STT_FUNC if interworking between ARM and Thumb is required; {{.*}}.s:[[#@LINE+1]]52 blx arm_func_with_notype53// WARN: {{.*}}.o:(.arm_caller+0x38): branch and link relocation: R_ARM_CALL to non STT_FUNC symbol: arm_func_with_explicit_notype interworking not performed; consider using directive '.type arm_func_with_explicit_notype, %function' to give symbol type STT_FUNC if interworking between ARM and Thumb is required; {{.*}}.s:[[#@LINE+1]]54 blx arm_func_with_explicit_notype55// WARN: {{.*}}.o:(.arm_caller+0x3c): branch and link relocation: R_ARM_CALL to STT_SECTION symbol .thumb_target ; interworking not performed; {{.*}}.s:[[#@LINE+1]]56 blx .thumb_target57// WARN: {{.*}}.o:(.arm_caller+0x40): branch and link relocation: R_ARM_CALL to non STT_FUNC symbol: thumb_func_with_notype interworking not performed; consider using directive '.type thumb_func_with_notype, %function' to give symbol type STT_FUNC if interworking between ARM and Thumb is required; {{.*}}.s:[[#@LINE+1]]58 blx thumb_func_with_notype59// WARN: {{.*}}.o:(.arm_caller+0x44): branch and link relocation: R_ARM_CALL to non STT_FUNC symbol: thumb_func_with_explicit_notype interworking not performed; consider using directive '.type thumb_func_with_explicit_notype, %function' to give symbol type STT_FUNC if interworking between ARM and Thumb is required; {{.*}}.s:[[#@LINE+1]]60 blx thumb_func_with_explicit_notype61 62 .section .thumb_caller, "ax", %progbits63 .thumb64 .balign 465 .global thumb_caller66thumb_caller:67 b.w .arm_target68 b.w arm_func_with_notype69 b.w arm_func_with_explicit_notype70 b.w .thumb_target71 b.w thumb_func_with_notype72 b.w thumb_func_with_explicit_notype73 beq.w .arm_target74 beq.w arm_func_with_notype75 beq.w arm_func_with_explicit_notype76 beq.w .thumb_target77 beq.w thumb_func_with_notype78 beq.w thumb_func_with_explicit_notype79// WARN: {{.*}}.o:(.thumb_caller+0x30): branch and link relocation: R_ARM_THM_CALL to STT_SECTION symbol .arm_target ; interworking not performed; {{.*}}.s:[[#@LINE+1]]80 bl .arm_target81// WARN: {{.*}}.o:(.thumb_caller+0x34): branch and link relocation: R_ARM_THM_CALL to non STT_FUNC symbol: arm_func_with_notype interworking not performed; consider using directive '.type arm_func_with_notype, %function' to give symbol type STT_FUNC if interworking between ARM and Thumb is required; {{.*}}.s:[[#@LINE+1]]82 bl arm_func_with_notype83 // WARN: {{.*}}.o:(.thumb_caller+0x38): branch and link relocation: R_ARM_THM_CALL to non STT_FUNC symbol: arm_func_with_explicit_notype interworking not performed; consider using directive '.type arm_func_with_explicit_notype, %function' to give symbol type STT_FUNC if interworking between ARM and Thumb is required; {{.*}}.s:[[#@LINE+1]]84 bl arm_func_with_explicit_notype85// WARN: {{.*}}.o:(.thumb_caller+0x3c): branch and link relocation: R_ARM_THM_CALL to STT_SECTION symbol .thumb_target ; interworking not performed; {{.*}}.s:[[#@LINE+1]]86 bl .thumb_target87// WARN: {{.*}}.o:(.thumb_caller+0x40): branch and link relocation: R_ARM_THM_CALL to non STT_FUNC symbol: thumb_func_with_notype interworking not performed; consider using directive '.type thumb_func_with_notype, %function' to give symbol type STT_FUNC if interworking between ARM and Thumb is required; {{.*}}.s:[[#@LINE+1]]88 bl thumb_func_with_notype89// {{.*}}.o:(.thumb_caller+0x44): branch and link relocation: R_ARM_THM_CALL to non STT_FUNC symbol: thumb_func_with_explicit_notype interworking not performed; consider using directive '.type thumb_func_with_explicit_notype, %function' to give symbol type STT_FUNC if interworking between ARM and Thumb is required; {{.*}}.s:[[#@LINE+1]]90 bl thumb_func_with_explicit_notype91 blx .arm_target92 blx arm_func_with_notype93 blx arm_func_with_explicit_notype94 blx .thumb_target95 blx thumb_func_with_notype96 blx thumb_func_with_explicit_notype97 98// CHECK: 00021008 <_start>:99// CHECK-NEXT: 21008: b       0x21000 <arm_func_with_notype>100// CHECK-NEXT: 2100c: b       0x21000 <arm_func_with_notype>101// CHECK-NEXT: 21010: b       0x21000 <arm_func_with_notype>102// CHECK-NEXT: 21014: b       0x21004 <thumb_func_with_notype>103// CHECK-NEXT: 21018: b       0x21004 <thumb_func_with_notype>104// CHECK-NEXT: 2101c: b       0x21004 <thumb_func_with_notype>105// CHECK-NEXT: 21020: bl      0x21000 <arm_func_with_notype>106// CHECK-NEXT: 21024: bl      0x21000 <arm_func_with_notype>107// CHECK-NEXT: 21028: bl      0x21000 <arm_func_with_notype>108// CHECK-NEXT: 2102c: bl      0x21004 <thumb_func_with_notype>109// CHECK-NEXT: 21030: bl      0x21004 <thumb_func_with_notype>110// CHECK-NEXT: 21034: bl      0x21004 <thumb_func_with_notype>111// CHECK-NEXT: 21038: blx     0x21000 <arm_func_with_notype>112// CHECK-NEXT: 2103c: blx     0x21000 <arm_func_with_notype>113// CHECK-NEXT: 21040: blx     0x21000 <arm_func_with_notype>114// CHECK-NEXT: 21044: blx     0x21004 <thumb_func_with_notype>115// CHECK-NEXT: 21048: blx     0x21004 <thumb_func_with_notype>116// CHECK-NEXT: 2104c: blx     0x21004 <thumb_func_with_notype>117 118// CHECK: 00021050 <thumb_caller>:119// CHECK-NEXT: 21050: b.w     0x21000 <arm_func_with_notype>120// CHECK-NEXT: 21054: b.w     0x21000 <arm_func_with_notype>121// CHECK-NEXT: 21058: b.w     0x21000 <arm_func_with_notype>122// CHECK-NEXT: 2105c: b.w     0x21004 <thumb_func_with_notype>123// CHECK-NEXT: 21060: b.w     0x21004 <thumb_func_with_notype>124// CHECK-NEXT: 21064: b.w     0x21004 <thumb_func_with_notype>125// CHECK-NEXT: 21068: beq.w   0x21000 <arm_func_with_notype>126// CHECK-NEXT: 2106c: beq.w   0x21000 <arm_func_with_notype>127// CHECK-NEXT: 21070: beq.w   0x21000 <arm_func_with_notype>128// CHECK-NEXT: 21074: beq.w   0x21004 <thumb_func_with_notype>129// CHECK-NEXT: 21078: beq.w   0x21004 <thumb_func_with_notype>130// CHECK-NEXT: 2107c: beq.w   0x21004 <thumb_func_with_notype>131// CHECK-NEXT: 21080: bl      0x21000 <arm_func_with_notype>132// CHECK-NEXT: 21084: bl      0x21000 <arm_func_with_notype>133// CHECK-NEXT: 21088: bl      0x21000 <arm_func_with_notype>134// CHECK-NEXT: 2108c: bl      0x21004 <thumb_func_with_notype>135// CHECK-NEXT: 21090: bl      0x21004 <thumb_func_with_notype>136// CHECK-NEXT: 21094: bl      0x21004 <thumb_func_with_notype>137// CHECK-NEXT: 21098: blx     0x21000 <arm_func_with_notype>138// CHECK-NEXT: 2109c: blx     0x21000 <arm_func_with_notype>139// CHECK-NEXT: 210a0: blx     0x21000 <arm_func_with_notype>140// CHECK-NEXT: 210a4: blx     0x21004 <thumb_func_with_notype>141// CHECK-NEXT: 210a8: blx     0x21004 <thumb_func_with_notype>142// CHECK-NEXT: 210ac: blx     0x21004 <thumb_func_with_notype>143