brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.7 KiB · 800d2f9 Raw
147 lines · plain
1// REQUIRES: x862// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t3// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %p/Inputs/shared.s -o %t24// RUN: ld.lld %t2 -soname fixed-length-string.so -o %t2.so -shared5// RUN: ld.lld --hash-style=sysv %t %t2.so -o %t36// RUN: llvm-readobj -S  %t3 | FileCheck --check-prefix=SEC %s7// RUN: llvm-objdump --no-print-imm-hex -s -d %t3 | FileCheck %s8 9// SEC:      Name: .plt10// SEC-NEXT: Type: SHT_PROGBITS11// SEC-NEXT: Flags [12// SEC-NEXT:   SHF_ALLOC13// SEC-NEXT:   SHF_EXECINSTR14// SEC-NEXT: ]15// SEC-NEXT: Address: 0x20134016// SEC-NEXT: Offset: 0x34017// SEC-NEXT: Size: 4818 19// SEC:         Name: .got20// SEC-NEXT:   Type: SHT_PROGBITS21// SEC-NEXT:   Flags [22// SEC-NEXT:     SHF_ALLOC23// SEC-NEXT:     SHF_WRITE24// SEC-NEXT:   ]25// SEC-NEXT:   Address: 0x20246026// SEC-NEXT:   Offset:27// SEC-NEXT:   Size: 828// SEC-NEXT:   Link: 029// SEC-NEXT:   Info: 030// SEC-NEXT:   AddressAlignment: 831// SEC-NEXT:   EntrySize: 032// SEC-NEXT: }33 34// SEC:        Name: .got.plt35// SEC-NEXT:   Type: SHT_PROGBITS36// SEC-NEXT:   Flags [37// SEC-NEXT:     SHF_ALLOC38// SEC-NEXT:     SHF_WRITE39// SEC-NEXT:   ]40// SEC-NEXT:   Address: 0x20346841// SEC-NEXT:   Offset: 0x46842// SEC-NEXT:   Size: 4043// SEC-NEXT:   Link: 044// SEC-NEXT:   Info: 045// SEC-NEXT:   AddressAlignment: 846// SEC-NEXT:   EntrySize: 047// SEC-NEXT:   }48 49.section .R_X86_64_64,"a",@progbits50.global R_X86_64_6451R_X86_64_64:52 .quad R_X86_64_6453 54// CHECK:      Contents of section .R_X86_64_64:55// CHECK-NEXT:   2002f8 f8022000 0000000056 57.section .R_X86_64_GOTPCREL,"a",@progbits58.global R_X86_64_GOTPCREL59R_X86_64_GOTPCREL:60 .long zed@gotpcrel61 62// 0x202460(.got) - 0x200300(.R_X86_64_GOTPCREL) = 0x216063// CHECK:      Contents of section .R_X86_64_GOTPCREL64// CHECK-NEXT:   200300 6021000065 66.section .R_X86_64_GOT32,"a",@progbits67.global R_X86_64_GOT3268R_X86_64_GOT32:69        .long zed@got70 71// CHECK: Contents of section .R_X86_64_GOT32:72// CHECK-NEXT: f8efffff73 74 75// CHECK: Contents of section .R_X86_64_GOT64:76// CHECK-NEXT: f8efffff ffffffff77.section .R_X86_64_GOT64,"a",@progbits78.global R_X86_64_GOT6479R_X86_64_GOT64:80        .quad zed@got81 82.section       .text,"ax",@progbits,unique,183.global _start84_start:85  call lulz86 87.section       .text,"ax",@progbits,unique,288.zero 489.global lulz90lulz:91  nop92 93// CHECK: Disassembly of section .text:94// CHECK-EMPTY:95// CHECK-NEXT: <_start>:96// CHECK-NEXT:   201310:  e8 04 00 00 00   callq 0x20131997// CHECK-NEXT:   201315:98 99// CHECK:      <lulz>:100// CHECK-NEXT:   201319:  90  nop101 102 103.section       .text2,"ax",@progbits104.global R_X86_64_32105R_X86_64_32:106  movl $R_X86_64_32, %edx107 108// FIXME: this would be far more self evident if llvm-objdump printed109// constants in hex.110// CHECK: Disassembly of section .text2:111// CHECK-EMPTY:112// CHECK-NEXT: <R_X86_64_32>:113// CHECK-NEXT:  20131a: {{.*}} movl $2102042, %edx114 115.section .R_X86_64_32S,"ax",@progbits116.global R_X86_64_32S117R_X86_64_32S:118  movq lulz - 0x100000, %rdx119 120// CHECK: Disassembly of section .R_X86_64_32S:121// CHECK-EMPTY:122// CHECK-NEXT: <R_X86_64_32S>:123// CHECK-NEXT:  {{.*}}: {{.*}} movq 1053465, %rdx124 125.section .R_X86_64_PC32,"ax",@progbits126.global R_X86_64_PC32127R_X86_64_PC32:128 call bar129 movl $bar, %eax130//16 is a size of PLT[0]131// 0x201340 + 16 - (0x201327 + 5) = 36132// CHECK:      Disassembly of section .R_X86_64_PC32:133// CHECK-EMPTY:134// CHECK-NEXT: <R_X86_64_PC32>:135// CHECK-NEXT:  201327:   {{.*}}  callq  0x201350136// CHECK-NEXT:  20132c:   {{.*}}  movl $2102096, %eax137 138.section .R_X86_64_32S_2,"ax",@progbits139.global R_X86_64_32S_2140R_X86_64_32S_2:141  mov bar2, %eax142// plt is  at 0x201340. The second plt entry is at 0x201360 == 2102112143// CHECK:      Disassembly of section .R_X86_64_32S_2:144// CHECK-EMPTY:145// CHECK-NEXT: <R_X86_64_32S_2>:146// CHECK-NEXT: 201331: {{.*}}  movl    2102112, %eax147