1# REQUIRES: x86 2 3# RUN: llvm-mc -filetype=obj -triple=x86_64 %s -o %t1.o 4# RUN: llvm-mc -filetype=obj -triple=x86_64 %p/Inputs/map-file2.s -o %t2.o 5# RUN: echo '.global bah; bah:' | llvm-mc -filetype=obj -triple=x86_64 - -o %t3.o 6# RUN: echo '.global baz; baz: ret' | llvm-mc -filetype=obj -triple=x86_64 - -o %t4.o 7# RUN: llvm-mc -filetype=obj -triple=x86_64 %p/Inputs/map-file5.s -o %t5.o 8# RUN: ld.lld -shared %t5.o -o %t5.so -soname dso 9# RUN: rm -f %t4.a 10# RUN: llvm-ar rc %t4.a %t4.o 11# RUN: ld.lld %t1.o %t2.o %t3.o %t4.a %t5.so -o %t -M | FileCheck --match-full-lines --strict-whitespace %s 12# RUN: ld.lld %t1.o %t2.o %t3.o %t4.a %t5.so -o %t --print-map | FileCheck --match-full-lines -strict-whitespace %s 13# RUN: ld.lld %t1.o %t2.o %t3.o %t4.a %t5.so -o %t -Map=%t.map 14# RUN: FileCheck -match-full-lines -strict-whitespace %s < %t.map 15 16.global _start 17_start: 18.cfi_startproc 19.cfi_endproc 20 .quad sharedFoo 21 .quad sharedBar 22 .byte 0xe8 23 .long sharedFunc1 - . 24 .byte 0xe8 25 .long sharedFunc2 - . 26 .byte 0xe8 27 .long baz - . 28.global _Z1fi 29_Z1fi: 30.cfi_startproc 31nop 32.cfi_endproc 33.weak bar 34bar: 35.long bar - . 36.long zed - . 37local: 38.comm common,4,16 39.global abs 40abs = 0xAB5 41labs = 0x1AB5 42 43## 0123456789abcdef 0123456789abcdef 44# CHECK: VMA LMA Size Align Out In Symbol 45# CHECK-NEXT: 200200 200200 78 8 .dynsym 46# CHECK-NEXT: 200200 200200 78 8 <internal>:(.dynsym) 47# CHECK-NEXT: 200278 200278 2c 8 .gnu.hash 48# CHECK-NEXT: 200278 200278 2c 8 <internal>:(.gnu.hash) 49# CHECK-NEXT: 2002a4 2002a4 30 4 .hash 50# CHECK-NEXT: 2002a4 2002a4 30 4 <internal>:(.hash) 51# CHECK-NEXT: 2002d4 2002d4 31 1 .dynstr 52# CHECK-NEXT: 2002d4 2002d4 31 1 <internal>:(.dynstr) 53# CHECK-NEXT: 200308 200308 30 8 .rela.dyn 54# CHECK-NEXT: 200308 200308 30 8 <internal>:(.rela.dyn) 55# CHECK-NEXT: 200338 200338 30 8 .rela.plt 56# CHECK-NEXT: 200338 200338 30 8 <internal>:(.rela.plt) 57# CHECK-NEXT: 200368 200368 64 8 .eh_frame 58# CHECK-NEXT: 200368 200368 2c 1 {{.*}}{{/|\\}}map-file.s.tmp1.o:(.eh_frame+0x0) 59# CHECK-NEXT: 200398 200398 14 1 {{.*}}{{/|\\}}map-file.s.tmp1.o:(.eh_frame+0x2c) 60# CHECK-NEXT: 2003b0 2003b0 18 1 {{.*}}{{/|\\}}map-file.s.tmp2.o:(.eh_frame+0x18) 61# CHECK-NEXT: 2013cc 2013cc 2d 4 .text 62# CHECK-NEXT: 2013cc 2013cc 28 4 {{.*}}{{/|\\}}map-file.s.tmp1.o:(.text) 63# CHECK-NEXT: 2013cc 2013cc 0 1 _start 64# CHECK-NEXT: 2013eb 2013eb 0 1 f(int) 65# CHECK-NEXT: 2013f4 2013f4 0 1 local 66# CHECK-NEXT: 2013f4 2013f4 2 4 {{.*}}{{/|\\}}map-file.s.tmp2.o:(.text) 67# CHECK-NEXT: 2013f4 2013f4 0 1 foo 68# CHECK-NEXT: 2013f5 2013f5 0 1 bar 69# CHECK-NEXT: 2013f6 2013f6 0 1 {{.*}}{{/|\\}}map-file.s.tmp2.o:(.text.zed) 70# CHECK-NEXT: 2013f6 2013f6 0 1 zed 71# CHECK-NEXT: 2013f8 2013f8 0 4 {{.*}}{{/|\\}}map-file.s.tmp3.o:(.text) 72# CHECK-NEXT: 2013f8 2013f8 0 1 bah 73# CHECK-NEXT: 2013f8 2013f8 1 4 {{.*}}{{/|\\}}map-file.s.tmp4.a(map-file.s.tmp4.o):(.text) 74# CHECK-NEXT: 2013f8 2013f8 0 1 baz 75# CHECK-NEXT: 201400 201400 30 16 .plt 76# CHECK-NEXT: 201400 201400 30 16 <internal>:(.plt) 77# CHECK-NEXT: 201410 201410 0 1 sharedFunc1 78# CHECK-NEXT: 201420 201420 0 1 sharedFunc2 79# CHECK-NEXT: 202430 202430 100 8 .dynamic 80# CHECK-NEXT: 202430 202430 100 8 <internal>:(.dynamic) 81# CHECK-NEXT: 203530 203530 28 8 .got.plt 82# CHECK-NEXT: 203530 203530 28 8 <internal>:(.got.plt) 83# CHECK-NEXT: 203560 203560 10 16 .bss 84# CHECK-NEXT: 203560 203560 4 16 {{.*}}{{/|\\}}map-file.s.tmp1.o:(COMMON) 85# CHECK-NEXT: 203560 203560 4 1 common 86# CHECK-NEXT: 203564 203564 4 1 <internal>:(.bss) 87# CHECK-NEXT: 203564 203564 4 1 sharedFoo 88# CHECK-NEXT: 203568 203568 8 1 <internal>:(.bss) 89# CHECK-NEXT: 203568 203568 8 1 sharedBar 90# CHECK-NEXT: 0 0 8 1 .comment 91# CHECK-NEXT: 0 0 8 1 <internal>:(.comment) 92# CHECK-NEXT: 0 0 198 8 .symtab 93# CHECK-NEXT: 0 0 198 8 <internal>:(.symtab) 94# CHECK-NEXT: 0 0 84 1 .shstrtab 95# CHECK-NEXT: 0 0 84 1 <internal>:(.shstrtab) 96# CHECK-NEXT: 0 0 6d 1 .strtab 97# CHECK-NEXT: 0 0 6d 1 <internal>:(.strtab) 98 99# RUN: not ld.lld %t1.o %t2.o %t3.o %t4.a -o /dev/null -Map=/ 2>&1 \ 100# RUN: | FileCheck --check-prefix=FAIL %s 101# FAIL: cannot open map file / 102