1; REQUIRES: x86 2; RUN: rm -rf %t; split-file %s %t 3 4;; Verify that we map symbols to their original bitcode input files, not the 5;; intermediate object files. Also verify that we don't emit these intermediate 6;; object files if no symbol needs to reference them. (Intermediate object files 7;; may still be referenced if they contain compiler-synthesized symbols, such 8;; as outlined functions. TODO: Test this case.) 9 10; RUN: opt -module-summary %t/foo.ll -o %t/foo.thinlto.o 11; RUN: opt -module-summary %t/bar.ll -o %t/bar.thinlto.o 12 13; RUN: %lld -dylib %t/foo.thinlto.o %t/bar.thinlto.o -o %t/foobar.thinlto -map \ 14; RUN: %t/foobar.thinlto.map 15; RUN: FileCheck %s --check-prefix=FOOBAR < %t/foobar.thinlto.map 16 17; RUN: %lld -dylib %t/bar.thinlto.o %t/foo.thinlto.o -o %t/barfoo.thinlto -map \ 18; RUN: %t/barfoo.thinlto.map 19; RUN: FileCheck %s --check-prefix=BARFOO < %t/barfoo.thinlto.map 20 21; RUN: llvm-as %t/foo.ll -o %t/foo.o 22; RUN: llvm-as %t/bar.ll -o %t/bar.o 23; RUN: %lld -dylib %t/foo.o %t/bar.o -o %t/foobar -map %t/foobar.map 24; RUN: FileCheck %s --check-prefix=LTO < %t/foobar.map 25 26; FOOBAR: # Path: {{.*}}{{/|\\}}map-file.ll.tmp/foobar.thinlto 27; FOOBAR-NEXT: # Arch: x86_64 28; FOOBAR-NEXT: # Object files: 29; FOOBAR-NEXT: [ 0] linker synthesized 30; FOOBAR-NEXT: [ 1] {{.*}}{{/|\\}}usr/lib{{/|\\}}libSystem.tbd{{$}} 31; FOOBAR-NEXT: [ 2] {{.*}}{{/|\\}}map-file.ll.tmp/foo.thinlto.o{{$}} 32; FOOBAR-NEXT: [ 3] {{.*}}{{/|\\}}map-file.ll.tmp/bar.thinlto.o{{$}} 33; FOOBAR-NEXT: # Sections: 34; FOOBAR: # Symbols: 35; FOOBAR-NEXT: # Address Size File Name 36; FOOBAR-NEXT: 0x{{[0-9A-F]+}} 0x{{[0-9A-F]+}} [ 2] _foo 37; FOOBAR-NEXT: 0x{{[0-9A-F]+}} 0x{{[0-9A-F]+}} [ 3] _bar 38; FOOBAR-NEXT: 0x{{[0-9A-F]+}} 0x{{[0-9A-F]+}} [ 3] _maybe_weak 39 40; BARFOO: # Path: {{.*}}{{/|\\}}map-file.ll.tmp/barfoo.thinlto 41; BARFOO-NEXT: # Arch: x86_64 42; BARFOO-NEXT: # Object files: 43; BARFOO-NEXT: [ 0] linker synthesized 44; BARFOO-NEXT: [ 1] {{.*}}{{/|\\}}usr/lib{{/|\\}}libSystem.tbd 45; BARFOO-NEXT: [ 2] {{.*}}{{/|\\}}map-file.ll.tmp/bar.thinlto.o 46; BARFOO-NEXT: [ 3] {{.*}}{{/|\\}}map-file.ll.tmp/foo.thinlto.o 47; BARFOO-NEXT: # Sections: 48; BARFOO: # Symbols: 49; BARFOO-NEXT: # Address Size File Name 50; BARFOO-NEXT: 0x{{[0-9A-F]+}} 0x{{[0-9A-F]+}} [ 2] _bar 51; BARFOO-NEXT: 0x{{[0-9A-F]+}} 0x{{[0-9A-F]+}} [ 2] _maybe_weak 52; BARFOO-NEXT: 0x{{[0-9A-F]+}} 0x{{[0-9A-F]+}} [ 3] _foo 53 54; LTO: # Path: {{.*}}{{/|\\}}map-file.ll.tmp/foobar 55; LTO-NEXT: # Arch: x86_64 56; LTO-NEXT: # Object files: 57; LTO-NEXT: [ 0] linker synthesized 58; LTO-NEXT: [ 1] {{.*}}{{/|\\}}usr/lib{{/|\\}}libSystem.tbd 59; LTO-NEXT: [ 2] {{.*}}{{/|\\}}map-file.ll.tmp/foo.o 60; LTO-NEXT: [ 3] {{.*}}{{/|\\}}map-file.ll.tmp/bar.o 61; LTO-NEXT: # Sections: 62; LTO: # Symbols: 63; LTO-NEXT: # Address Size File Name 64; LTO-NEXT: 0x{{[0-9A-F]+}} 0x{{[0-9A-F]+}} [ 2] _foo 65; LTO-NEXT: 0x{{[0-9A-F]+}} 0x{{[0-9A-F]+}} [ 3] _bar 66; LTO-NEXT: 0x{{[0-9A-F]+}} 0x{{[0-9A-F]+}} [ 3] _maybe_weak 67 68;--- foo.ll 69target triple = "x86_64-apple-darwin" 70target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" 71 72define void @foo() { 73 ret void 74} 75 76;; This is weak in foo.ll but non-weak in bar.ll, so the definition in bar.ll 77;; will always prevail. Check that the map file maps `maybe_weak` to bar.ll 78;; regardless of the object file input order. 79define weak_odr void @maybe_weak() { 80 ret void 81} 82 83;--- bar.ll 84target triple = "x86_64-apple-darwin" 85target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" 86 87define void @bar() { 88 ret void 89} 90 91define void @maybe_weak() { 92 ret void 93} 94