brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.7 KiB · 0e914a8 Raw
84 lines · plain
1; RUN: llc -mtriple=x86_64-w64-windows-gnu < %s | FileCheck %s --check-prefix=GNU2; RUN: llc -mtriple=x86_64-pc-cygwin < %s | FileCheck %s --check-prefix=GNU3; RUN: llc -mtriple=x86_64-w64-windows-gnu < %s -filetype=obj | llvm-objdump - --headers | FileCheck %s --check-prefix=GNUOBJ4; RUN: llc -mtriple=x86_64-pc-cygwin < %s -filetype=obj | llvm-objdump - --headers | FileCheck %s --check-prefix=GNUOBJ5 6; When doing GCC style comdats for MinGW, the .xdata sections don't have a normal comdat7; symbol attached, which requires a bit of adjustments for the assembler output.8 9; Generated with this C++ source:10; int bar(int);11; __declspec(selectany) int gv = 42;12; inline int foo(int x) { try { return bar(x) + gv; } catch (...) { return 0; } }13; int main() { return foo(1); }14 15$_Z3fooi = comdat any16 17$gv = comdat any18 19@gv = weak_odr dso_local global i32 42, comdat, align 420 21; Function Attrs: norecurse uwtable22define dso_local i32 @main() #0 {23entry:24  %call = tail call i32 @_Z3fooi(i32 1)25  ret i32 %call26}27 28; GNU: main:29 30; Function Attrs: inlinehint uwtable31define linkonce_odr dso_local i32 @_Z3fooi(i32 %x) #1 comdat personality ptr @__gxx_personality_seh0 {32entry:33  %call = invoke i32 @_Z3bari(i32 %x)34          to label %invoke.cont unwind label %lpad35 36invoke.cont:                                      ; preds = %entry37  %0 = load i32, ptr @gv, align 438  %add = add nsw i32 %0, %call39  br label %return40 41lpad:                                             ; preds = %entry42  %1 = landingpad { ptr, i32 }43          catch ptr null44  %2 = extractvalue { ptr, i32 } %1, 045  %3 = tail call ptr @__cxa_begin_catch(ptr %2) #346  tail call void @__cxa_end_catch()47  br label %return48 49return:                                           ; preds = %lpad, %invoke.cont50  %retval.0 = phi i32 [ %add, %invoke.cont ], [ 0, %lpad ]51  ret i32 %retval.052}53 54; The .xdata section below doesn't have the usual comdat symbol attached, which requires55; a different syntax for the assembly output.56 57; GNU: .section        .text$_Z3fooi,"xr",discard,_Z3fooi58; GNU: _Z3fooi:59; GNU: .section        .xdata$_Z3fooi,"dr"60; GNU: .linkonce       discard61; GNU: GCC_except_table1:62; GNU: .section        .data$gv,"dw",discard,gv63; GNU: gv:64; GNU: .long 4265 66; Make sure the assembler puts the .xdata and .pdata in sections with the right67; names.68; GNUOBJ: .text$_Z3fooi69; GNUOBJ: .xdata$_Z3fooi70; GNUOBJ: .data$gv71; GNUOBJ: .pdata$_Z3fooi72 73declare dso_local i32 @_Z3bari(i32)74 75declare dso_local i32 @__gxx_personality_seh0(...)76 77declare dso_local ptr @__cxa_begin_catch(ptr) local_unnamed_addr78 79declare dso_local void @__cxa_end_catch() local_unnamed_addr80 81attributes #0 = { norecurse uwtable }82attributes #1 = { inlinehint uwtable }83attributes #3 = { nounwind }84