llvm.org GIT mirror llvm / f362d3a
Don't verify inputs to the Linker if ODR merging. This fixes pr28072. The point, as Duncan pointed out, is that the file is already partially linked by just reading it. Long term I think the solution is to make metadata owned by the module and then the linker will lazily read it and be in charge of all the linking. Running a verifier in each input will defeat the lazy loading, but will be legal. Right now we are at the unfortunate position that to support odr merging we cannot verify the inputs, which mildly annoying (see test update). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@274148 91177308-0d34-0410-b5e6-96231b3b80d8 Rafael Espindola 3 years ago
4 changed file(s) with 31 addition(s) and 2 deletion(s). Raw diff Collapse all Expand all
0 !llvm.dbg.cu = !{!0}
1 !llvm.module.flags = !{!4}
2
3 !0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, isOptimized: false, runtimeVersion: 0, emissionKind: NoDebug, retainedTypes: !2)
4 !1 = !DIFile(filename: "../../src/core/weakHashTable.cc", directory: "/Users/meister/Development/clasp/wbuild/clasp_boehm_o")
5 !2 = !{!3}
6 !3 = distinct !DICompositeType(tag: DW_TAG_class_type, file: !1, identifier: "zed")
7 !4 = !{i32 2, !"Debug Info Version", i32 3}
None ; RUN: not llvm-link -o /dev/null %s 2>&1 | FileCheck %s
0 ; RUN: not llvm-link -disable-debug-info-type-map -o /dev/null %s 2>&1 | FileCheck %s
11
22 ; CHECK: broken.ll: error: input module is broken!
33 define i32 @foo(i32 %v) {
0 ; Use llvm-as to verify each module
1 ; RUN: llvm-as %s -o %t1.bc
2 ; RUN: llvm-as %p/Inputs/odr.ll -o %t2.bc
3 ; Check that we can link it
4 ; RUN: llvm-link %t1.bc %t2.bc -o %t
5 @bar = global i64 0, align 8
6
7 !llvm.dbg.cu = !{!0}
8 !llvm.module.flags = !{!7}
9
10 !0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, isOptimized: false, runtimeVersion: 0, emissionKind: NoDebug, retainedTypes: !2, globals: !5)
11 !1 = !DIFile(filename: "a", directory: "")
12 !2 = !{!3}
13 !3 = distinct !DICompositeType(tag: DW_TAG_class_type, scope: !4, file: !1, identifier: "zed")
14 !4 = distinct !DISubprogram(name: "b", scope: null, isLocal: false, isDefinition: true, isOptimized: false, unit: !0)
15 !5 = !{!6}
16 !6 = distinct !DIGlobalVariable(name: "c", scope: null, isLocal: false, isDefinition: true, variable: i64* @bar)
17 !7 = !{i32 2, !"Debug Info Version", i32 3}
298298 return false;
299299 }
300300
301 if (verifyModule(*M, &errs())) {
301 // Note that when ODR merging types cannot verify input files in here When
302 // doing that debug metadata in the src module might already be pointing to
303 // the destination.
304 if (DisableDITypeMap && verifyModule(*M, &errs())) {
302305 errs() << argv0 << ": " << File << ": error: input module is broken!\n";
303306 return false;
304307 }