brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.5 KiB · e2d4e27 Raw
99 lines · plain
1// REQUIRES: x862// RUN: llvm-mc -filetype=obj -triple=i686-pc-linux %S/Inputs/shared2-x86-64.s -o %t1.o3// RUN: ld.lld %t1.o --shared --soname=t.so -o %t.so4// RUN: llvm-mc -filetype=obj -triple=i686-pc-linux %s -o %t.o5// RUN: ld.lld --hash-style=sysv %t.so %t.o -o %tout6// RUN: llvm-objdump -d --no-show-raw-insn --print-imm-hex %tout | FileCheck %s --check-prefix=DISASM7// RUN: llvm-objdump -s %tout | FileCheck %s --check-prefix=GOTPLT8// RUN: llvm-readobj -r --dynamic-table %tout | FileCheck %s9 10/// Check that the PLTRELSZ tag does not include the IRELATIVE relocations11// CHECK: DynamicSection [12// CHECK:  0x00000012 RELSZ                24 (bytes)13// CHECK:  0x00000002 PLTRELSZ             16 (bytes)14 15/// Check that the IRELATIVE relocations are placed to the .rel.dyn section after16/// other regular relocations (e.g. GLOB_DAT).17// CHECK: Relocations [18// CHECK-NEXT:   Section (4) .rel.dyn {19// CHECK-NEXT:     0x4022C8 R_386_GLOB_DAT bar320// CHECK-NEXT:     0x4032E0 R_386_IRELATIVE -21// CHECK-NEXT:     0x4032E4 R_386_IRELATIVE -22// CHECK-NEXT:   }23// CHECK-NEXT:   Section (5) .rel.plt {24// CHECK-NEXT:     0x4032D8 R_386_JUMP_SLOT bar225// CHECK-NEXT:     0x4032DC R_386_JUMP_SLOT zed226// CHECK-NEXT:   }27 28// Check that IRELATIVE .got.plt entries point to ifunc resolver and not29// back to the plt entry + 6.30// GOTPLT: Contents of section .got.plt:31// GOTPLT:       4032cc 50224000 00000000 00000000 1612400032// GOTPLT-NEXT:  4032dc 26124000 dc114000 dd11400033//                                  ^        ^-- <bar> (0x4011dd)34//                                  -- <foo> (0x4011dcd)35 36/// Check that we have 2 PLT sections: one regular .plt section and one37/// .iplt section for ifunc entries.38// DISASM: Disassembly of section .text:39// DISASM-EMPTY:40// DISASM-NEXT: <foo>:41// DISASM-NEXT:    4011dc:       retl42// DISASM:      <bar>:43// DISASM-NEXT:    4011dd:       retl44// DISASM:      <_start>:45// DISASM-NEXT:    4011de:       calll   0x40123046// DISASM-NEXT:                  calll   0x40124047// DISASM-NEXT:                  calll   0x401210 <bar2@plt>48// DISASM-NEXT:                  calll   0x401220 <zed2@plt>49// DISASM-NEXT:                  movl    -0x1004(%eax), %eax50// DISASM-EMPTY:51// DISASM-NEXT: Disassembly of section .plt:52// DISASM-EMPTY:53// DISASM-NEXT: <.plt>:54// DISASM-NEXT:    401200:       pushl   0x4032d055// DISASM-NEXT:                  jmpl    *0x4032d456// DISASM-NEXT:                  nop57// DISASM-NEXT:                  nop58// DISASM-NEXT:                  nop59// DISASM-NEXT:                  nop60// DISASM-EMPTY:61// DISASM-NEXT:   <bar2@plt>:62// DISASM-NEXT:    401210:       jmpl    *0x4032d863// DISASM-NEXT:                  pushl   $0x064// DISASM-NEXT:                  jmp     0x401200 <.plt>65// DISASM-EMPTY:66// DISASM-NEXT:   <zed2@plt>:67// DISASM-NEXT:    401220:       jmpl    *0x4032dc68// DISASM-NEXT:                  pushl   $0x869// DISASM-NEXT:                  jmp     0x401200 <.plt>70// DISASM-EMPTY:71// DISASM-NEXT: Disassembly of section .iplt:72// DISASM-EMPTY:73// DISASM-NEXT: <.iplt>:74// DISASM-NEXT:                  jmpl    *0x4032e075// DISASM-NEXT:                  pushl   $0x076// DISASM-NEXT:                  jmp     0x401200 <.plt>77// DISASM-NEXT:                  jmpl    *0x4032e478// DISASM-NEXT:                  pushl   $0x879// DISASM-NEXT:                  jmp     0x401200 <.plt>80 81.text82.type foo STT_GNU_IFUNC83.globl foo84foo:85 ret86 87.type bar STT_GNU_IFUNC88.globl bar89bar:90 ret91 92.globl _start93_start:94 call foo@plt95 call bar@plt96 call bar2@plt97 call zed2@plt98 movl bar3@GOT(%eax), %eax99