94 lines · plain
1; REQUIRES: x862; RUN: rm -rf %t; split-file %s %t3 4;; Verify that we map symbols to their original bitcode input files, not the5;; intermediate object files. Also verify that we don't emit these intermediate6;; object files if no symbol needs to reference them. (Intermediate object files7;; may still be referenced if they contain compiler-synthesized symbols, such8;; as outlined functions. TODO: Test this case.)9 10; RUN: opt -module-summary %t/foo.ll -o %t/foo.thinlto.o11; RUN: opt -module-summary %t/bar.ll -o %t/bar.thinlto.o12 13; RUN: %lld -dylib %t/foo.thinlto.o %t/bar.thinlto.o -o %t/foobar.thinlto -map \14; RUN: %t/foobar.thinlto.map15; RUN: FileCheck %s --check-prefix=FOOBAR < %t/foobar.thinlto.map16 17; RUN: %lld -dylib %t/bar.thinlto.o %t/foo.thinlto.o -o %t/barfoo.thinlto -map \18; RUN: %t/barfoo.thinlto.map19; RUN: FileCheck %s --check-prefix=BARFOO < %t/barfoo.thinlto.map20 21; RUN: llvm-as %t/foo.ll -o %t/foo.o22; RUN: llvm-as %t/bar.ll -o %t/bar.o23; RUN: %lld -dylib %t/foo.o %t/bar.o -o %t/foobar -map %t/foobar.map24; RUN: FileCheck %s --check-prefix=LTO < %t/foobar.map25 26; FOOBAR: # Path: {{.*}}{{/|\\}}map-file.ll.tmp/foobar.thinlto27; FOOBAR-NEXT: # Arch: x86_6428; FOOBAR-NEXT: # Object files:29; FOOBAR-NEXT: [ 0] linker synthesized30; 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 Name36; FOOBAR-NEXT: 0x{{[0-9A-F]+}} 0x{{[0-9A-F]+}} [ 2] _foo37; FOOBAR-NEXT: 0x{{[0-9A-F]+}} 0x{{[0-9A-F]+}} [ 3] _bar38; FOOBAR-NEXT: 0x{{[0-9A-F]+}} 0x{{[0-9A-F]+}} [ 3] _maybe_weak39 40; BARFOO: # Path: {{.*}}{{/|\\}}map-file.ll.tmp/barfoo.thinlto41; BARFOO-NEXT: # Arch: x86_6442; BARFOO-NEXT: # Object files:43; BARFOO-NEXT: [ 0] linker synthesized44; BARFOO-NEXT: [ 1] {{.*}}{{/|\\}}usr/lib{{/|\\}}libSystem.tbd45; BARFOO-NEXT: [ 2] {{.*}}{{/|\\}}map-file.ll.tmp/bar.thinlto.o46; BARFOO-NEXT: [ 3] {{.*}}{{/|\\}}map-file.ll.tmp/foo.thinlto.o47; BARFOO-NEXT: # Sections:48; BARFOO: # Symbols:49; BARFOO-NEXT: # Address Size File Name50; BARFOO-NEXT: 0x{{[0-9A-F]+}} 0x{{[0-9A-F]+}} [ 2] _bar51; BARFOO-NEXT: 0x{{[0-9A-F]+}} 0x{{[0-9A-F]+}} [ 2] _maybe_weak52; BARFOO-NEXT: 0x{{[0-9A-F]+}} 0x{{[0-9A-F]+}} [ 3] _foo53 54; LTO: # Path: {{.*}}{{/|\\}}map-file.ll.tmp/foobar55; LTO-NEXT: # Arch: x86_6456; LTO-NEXT: # Object files:57; LTO-NEXT: [ 0] linker synthesized58; LTO-NEXT: [ 1] {{.*}}{{/|\\}}usr/lib{{/|\\}}libSystem.tbd59; LTO-NEXT: [ 2] {{.*}}{{/|\\}}map-file.ll.tmp/foo.o60; LTO-NEXT: [ 3] {{.*}}{{/|\\}}map-file.ll.tmp/bar.o61; LTO-NEXT: # Sections:62; LTO: # Symbols:63; LTO-NEXT: # Address Size File Name64; LTO-NEXT: 0x{{[0-9A-F]+}} 0x{{[0-9A-F]+}} [ 2] _foo65; LTO-NEXT: 0x{{[0-9A-F]+}} 0x{{[0-9A-F]+}} [ 3] _bar66; LTO-NEXT: 0x{{[0-9A-F]+}} 0x{{[0-9A-F]+}} [ 3] _maybe_weak67 68;--- foo.ll69target 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 void74}75 76;; This is weak in foo.ll but non-weak in bar.ll, so the definition in bar.ll77;; will always prevail. Check that the map file maps `maybe_weak` to bar.ll78;; regardless of the object file input order.79define weak_odr void @maybe_weak() {80 ret void81}82 83;--- bar.ll84target 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 void89}90 91define void @maybe_weak() {92 ret void93}94