1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-31 07:52:55 +01:00
llvm-mirror/test/MC/COFF/weak-symbol.ll
Nico Rieck 53e36aaed9 Use proper section suffix for COFF weak symbols
32-bit symbols have "_" as global prefix, but when forming the name of
COMDAT sections this prefix is ignored. The current behavior assumes that
this prefix is always present which is not the case for 64-bit and names
are truncated.

llvm-svn: 187356
2013-07-29 13:58:39 +00:00

45 lines
1.2 KiB
LLVM

; Test that weak functions and globals are placed into selectany COMDAT
; sections with the mangled name as suffix. Ensure that the weak linkage
; type is not ignored by the backend if the section was specialized.
;
; RUN: llc -mtriple=i686-pc-win32 %s -o - | FileCheck %s --check-prefix=X86
; RUN: llc -mtriple=i686-pc-mingw32 %s -o - | FileCheck %s --check-prefix=X86
; RUN: llc -mtriple=x86_64-pc-win32 %s -o - | FileCheck %s --check-prefix=X64
; RUN: llc -mtriple=x86_64-pc-mingw32 %s -o - | FileCheck %s --check-prefix=X64
; Mangled function
; X86: .section .text$_Z3foo
; X86: .linkonce discard
; X86: .globl __Z3foo
;
; X64: .section .text$_Z3foo
; X64: .linkonce discard
; X64: .globl _Z3foo
define weak void @_Z3foo() {
ret void
}
; Unmangled function
; X86: .section .sect$f
; X86: .linkonce discard
; X86: .globl _f
;
; X64: .section .sect$f
; X64: .linkonce discard
; X64: .globl f
define weak void @f() section ".sect" {
ret void
}
; Weak global
; X86: .section .data$a
; X86: .linkonce discard
; X86: .globl _a
; X86: .zero 12
;
; X64: .section .data$a
; X64: .linkonce discard
; X64: .globl a
; X64: .zero 12
@a = weak unnamed_addr constant { i32, i32, i32 } { i32 0, i32 0, i32 0}, section ".data"