68 lines · plain
1// REQUIRES: x862 3// Test .ctors* and .dtors* are sorted by priority.4 5// RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t16// RUN: rm -rf %t && mkdir -p %t7// RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux \8// RUN: %p/Inputs/ctors_dtors_priority1.s -o %t/crtbegin.o9// RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux \10// RUN: %p/Inputs/ctors_dtors_priority2.s -o %t211// RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux \12// RUN: %p/Inputs/ctors_dtors_priority3.s -o %t/crtend.o13// RUN: ld.lld %t1 %t2 %t/crtend.o %t/crtbegin.o -o %t.exe14// RUN: llvm-objdump -s %t.exe | FileCheck %s15 16// RUN: cp %t/crtbegin.o %t/clang_rt.crtbegin.o17// RUN: cp %t/crtend.o %t/clang_rt.crtend.o18// RUN: ld.lld %t1 %t2 %t/clang_rt.crtend.o %t/clang_rt.crtbegin.o -o %t.clang_rt.exe19// RUN: llvm-objdump -s %t.clang_rt.exe | FileCheck %s20 21// RUN: cp %t/crtbegin.o %t/clang_rt.crtbegin-x86_64.o22// RUN: cp %t/crtend.o %t/clang_rt.crtend-x86_64.o23// RUN: ld.lld %t1 %t2 %t/clang_rt.crtend-x86_64.o %t/clang_rt.crtbegin-x86_64.o -o %t.clang_rt-arch.exe24// RUN: llvm-objdump -s %t.clang_rt-arch.exe | FileCheck %s25 26// RUN: cp %t/crtbegin.o %t/crtbeginS.o27// RUN: cp %t/crtend.o %t/crtendT.o28// RUN: ld.lld %t1 %t2 %t/crtendT.o %t/crtbeginS.o -o %t.ST.exe29// RUN: cmp %t.exe %t.ST.exe30 31.globl _start32_start:33 nop34 35.section .ctors, "aw", @progbits36 .quad 137.section .ctors.100, "aw", @progbits38 .quad 239.section .ctors.005, "aw", @progbits40 .quad 341.section .ctors, "aw", @progbits42 .quad 443.section .ctors, "aw", @progbits44 .quad 545 46.section .dtors, "aw", @progbits47 .quad 0x1148.section .dtors.100, "aw", @progbits49 .quad 0x1250.section .dtors.005, "aw", @progbits51 .quad 0x1352.section .dtors, "aw", @progbits53 .quad 0x1454.section .dtors, "aw", @progbits55 .quad 0x1556 57// CHECK: Contents of section .ctors:58// CHECK-NEXT: a1000000 00000000 01000000 0000000059// CHECK-NEXT: 04000000 00000000 05000000 0000000060// CHECK-NEXT: b1000000 00000000 03000000 0000000061// CHECK-NEXT: 02000000 00000000 c1000000 0000000062 63// CHECK: Contents of section .dtors:64// CHECK-NEXT: a2000000 00000000 11000000 0000000065// CHECK-NEXT: 14000000 00000000 15000000 0000000066// CHECK-NEXT: b2000000 00000000 13000000 0000000067// CHECK-NEXT: 12000000 00000000 c2000000 0000000068