llvm.org GIT mirror llvm / f385590
dsymutil: support dwarf version mismatches between object and clang module This adds a missing call to maybeUpdateMaxDwarfVersion when visitng a clang module. Failing to do so will cause a failure when emitting DWARF 4 forms into a CU that AsmPrinter believes to be DWARF 2. rdar://problem/33666528 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310392 91177308-0d34-0410-b5e6-96231b3b80d8 Adrian Prantl 2 years ago
3 changed file(s) with 26 addition(s) and 1 deletion(s). Raw diff Collapse all Expand all
0 /* Compile with (using the module from the modules.m teastcase):
1 clang -c -fmodules -fmodule-map-file=modules.modulemap \
2 -gdwarf-2 -gmodules -fmodules-cache-path=. \
3 -Xclang -fdisable-module-hash modules.m -o 1.o
4 */
5
6 // RUN: rm -rf %t.dir
7 // RUN: mkdir %t.dir
8 // RUN: cp %p/../Inputs/modules/Bar.pcm %t.dir
9 // RUN: cp %p/../Inputs/modules-dwarf-version/1.o %t.dir
10 // RUN: llvm-dsymutil -f -oso-prepend-path=%t.dir \
11 // RUN: -y %p/dummy-debug-map.map -o - \
12 // RUN: | llvm-dwarfdump --debug-dump=info - | FileCheck %s
13
14 @import Bar;
15 int main(int argc, char **argv) {
16 struct Bar bar;
17 bar.value = argc;
18 return bar.value;
19 }
20
21 // CHECK: Compile Unit: {{.*}}version = 0x0004
22 // CHECK: Compile Unit: {{.*}}version = 0x0002
33243324 auto DwarfContext = DWARFContext::create(*ErrOrObj);
33253325 RelocationManager RelocMgr(*this);
33263326 for (const auto &CU : DwarfContext->compile_units()) {
3327 maybeUpdateMaxDwarfVersion(CU->getVersion());
3328
3329 // Recursively get all modules imported by this one.
33273330 auto CUDie = CU->getUnitDIE(false);
3328 // Recursively get all modules imported by this one.
33293331 if (!registerModuleReference(CUDie, *CU, ModuleMap, Indent)) {
33303332 if (Unit) {
33313333 errs() << Filename << ": Clang modules are expected to have exactly"