brintos

brintos / llvm-project-archived public Read only

0
0
Text · 4.0 KiB · a7de05a Raw
111 lines · plain
1# REQUIRES: x862# RUN: llvm-mc -filetype=obj -triple=i386 %s -o %t.o3# RUN: llvm-mc -filetype=obj -triple=i386 %p/Inputs/i386-cet1.s -o %t1.o4# RUN: llvm-mc -filetype=obj -triple=i386 %p/Inputs/i386-cet2.s -o %t2.o5# RUN: llvm-mc -filetype=obj -triple=i386 %p/Inputs/i386-cet3.s -o %t3.o6# RUN: llvm-mc -filetype=obj -triple=i386 %p/Inputs/i386-cet4.s -o %t4.o7 8# RUN: ld.lld -e func1 %t.o %t1.o -o %t9# RUN: llvm-readelf -n %t | FileCheck --check-prefix=CET --match-full-lines %s10 11# RUN: ld.lld -e func1 %t.o %t2.o -o %t12# RUN: llvm-readelf -n %t | FileCheck --check-prefix=CET --match-full-lines %s13 14# CET: Properties: x86 feature: IBT, SHSTK15 16# RUN: ld.lld -e func1 %t.o %t3.o -o %t17# RUN: llvm-readelf -S %t | FileCheck --check-prefix=NOCET %s18 19# NOCET:     Section Headers20# NOCET-NOT: .note.gnu.property21 22# RUN: ld.lld -e func1 %t.o %t3.o -o %t -z force-ibt 2>&1 \23# RUN:   | FileCheck --check-prefix=WARN %s24# WARN: {{.*}}.o: -z force-ibt: file does not have GNU_PROPERTY_X86_FEATURE_1_IBT property25 26# RUN: not ld.lld -e func1 %t.o %t3.o -o /dev/null -z cet-report=something 2>&1 \27# RUN:   | FileCheck --check-prefix=REPORT_INVALID %s28# REPORT_INVALID: error: unknown -z cet-report= value: something29# REPORT_INVALID-EMPTY:30 31# RUN: ld.lld -e func1 %t.o %t3.o -o /dev/null -z cet-report=warning 2>&1 \32# RUN:   | FileCheck --check-prefix=CET_REPORT_WARN %s33# CET_REPORT_WARN: {{.*}}.o: -z cet-report: file does not have GNU_PROPERTY_X86_FEATURE_1_IBT property34# CET_REPORT_WARN: {{.*}}.o: -z cet-report: file does not have GNU_PROPERTY_X86_FEATURE_1_SHSTK property35# CET_REPORT_WARN-EMPTY:36 37# RUN: not ld.lld -e func1 %t.o %t3.o -o /dev/null -z cet-report=error 2>&1 \38# RUN:   | FileCheck --check-prefix=CET_REPORT_ERROR %s39# CET_REPORT_ERROR: {{.*}}.o: -z cet-report: file does not have GNU_PROPERTY_X86_FEATURE_1_IBT property40# CET_REPORT_ERROR: {{.*}}.o: -z cet-report: file does not have GNU_PROPERTY_X86_FEATURE_1_SHSTK property41# CET_REPORT_ERROR-EMPTY:42 43# RUN: ld.lld -e func1 %t.o %t4.o -o %t44# RUN: llvm-readelf -n %t | FileCheck --check-prefix=NOSHSTK %s45 46# Check .note.gnu.protery without property SHSTK.47# NOSHSTK: Properties: x86 feature: IBT{{$}}48 49# RUN: ld.lld -shared %t1.o -soname=so -o %t1.so50# RUN: ld.lld -e func1 %t.o %t1.so -o %t51# RUN: llvm-readelf -n %t | FileCheck --check-prefix=CET --match-full-lines %s52# RUN: llvm-readelf -x .got.plt %t | FileCheck --check-prefix=GOTPLT %s53# RUN: llvm-objdump -d --no-show-raw-insn --print-imm-hex %t | FileCheck --check-prefix=DISASM %s54 55# GOTPLT:      Hex dump of section '.got.plt':56# GOTPLT-NEXT: 0x004032d0 50224000 00000000 00000000 2012400057# GOTPLT-NEXT: 0x004032e0 0b12400058 59# DISASM:      Disassembly of section .text:60# DISASM:      00401200 <func1>:61# DISASM-NEXT: 401200:       calll   0x401230 <func2+0x401230>62# DISASM-NEXT: 401205:       calll   0x401240 <ifunc>63# DISASM-NEXT:               retl64 65# DISASM:      Disassembly of section .plt:66# DISASM:      00401210 <.plt>:67# DISASM-NEXT: 401210:       pushl   0x4032d468# DISASM-NEXT:               jmpl    *0x4032d869# DISASM-NEXT:               nop70# DISASM-NEXT:               nop71# DISASM-NEXT:               nop72# DISASM-NEXT:               nop73# DISASM-NEXT:               endbr3274# DISASM-NEXT:               pushl   $0x075# DISASM-NEXT:               jmp     0x401210 <.plt>76# DISASM-NEXT:               nop77 78# DISASM:      Disassembly of section .plt.sec:79# DISASM:      00401230 <.plt.sec>:80# DISASM-NEXT: 401230:       endbr3281# DISASM-NEXT:               jmpl    *0x4032dc82# DISASM-NEXT:               nopw    (%eax,%eax)83 84# DISASM:      Disassembly of section .iplt:85# DISASM:      00401240 <ifunc>:86# DISASM-NEXT: 401240:       endbr3287# DISASM-NEXT:               jmpl    *0x4032e088# DISASM-NEXT:               nopw    (%eax,%eax)89 90.section ".note.gnu.property", "a"91.long 492.long 0xc93.long 0x594.asciz "GNU"95 96.long 0xc0000002 # GNU_PROPERTY_X86_FEATURE_1_AND97.long 498.long 3          # GNU_PROPERTY_X86_FEATURE_1_IBT and SHSTK99 100.text101.globl func1102.type func1,@function103func1:104  call func2105  call ifunc106  ret107 108.type ifunc,@gnu_indirect_function109ifunc:110  ret111