Skip to content

Commit ca6398c

Browse files
authored
[COFF][Mips] Set PrivateGlobalPrefix to .L (#140033)
When calling external functions which start with `L`, would generate error: assembler label 'LeaveFoo' can not be undefined. This pr would fix this issue. Fix #134914.
1 parent dc9171a commit ca6398c

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

llvm/lib/Target/Mips/MCTargetDesc/MipsMCAsmInfo.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,5 +53,7 @@ MipsCOFFMCAsmInfo::MipsCOFFMCAsmInfo() {
5353

5454
ExceptionsType = ExceptionHandling::WinEH;
5555

56+
PrivateGlobalPrefix = ".L";
57+
PrivateLabelPrefix = ".L";
5658
AllowAtInName = true;
5759
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
; RUN: llc -mtriple=mipsel-w64-windows-gnu < %s | FileCheck %s -check-prefix=MIPSEL
2+
3+
define void @f() {
4+
; MIPSEL-LABEL: f:
5+
; MIPSEL: # %bb.0: # %entry
6+
; MIPSEL-NEXT: addiu $sp, $sp, -24
7+
; MIPSEL-NEXT: sw $ra, 20($sp)
8+
; MIPSEL-NEXT: jal LeaveFoo
9+
; MIPSEL-NEXT: nop
10+
; MIPSEL-NEXT: jal LocalBar
11+
; MIPSEL-NEXT: nop
12+
; MIPSEL-NEXT: lw $ra, 20($sp)
13+
; MIPSEL-NEXT: jr $ra
14+
; MIPSEL-NEXT: addiu $sp, $sp, 24
15+
16+
entry:
17+
call void @LeaveFoo()
18+
call void @LocalBar()
19+
ret void
20+
}
21+
22+
declare void @LeaveFoo()
23+
declare void @LocalBar()
24+

0 commit comments

Comments
 (0)