[llvm] r270269 - dsymutil/modules: Reword the warning for static libraries without module caches
Adrian Prantl via llvm-commits
llvm-commits at lists.llvm.org
Fri May 20 13:36:07 PDT 2016
Author: adrian
Date: Fri May 20 15:36:06 2016
New Revision: 270269
URL: http://llvm.org/viewvc/llvm-project?rev=270269&view=rev
Log:
dsymutil/modules: Reword the warning for static libraries without module caches
In addition to clarifying the warning message this contains a minor functional
change in that it now warns if the *immediate* parent directory in which the
missing PCM is expected to be isn't found.
This patch also includes a more comprehensive testcase.
rdar://problem/25860711
Added:
llvm/trunk/test/tools/dsymutil/Inputs/module-warnings/
llvm/trunk/test/tools/dsymutil/Inputs/module-warnings/1.o
llvm/trunk/test/tools/dsymutil/Inputs/module-warnings/Bar.pcm
llvm/trunk/test/tools/dsymutil/Inputs/module-warnings/Foo.pcm
llvm/trunk/test/tools/dsymutil/Inputs/module-warnings/libstatic.a
llvm/trunk/test/tools/dsymutil/X86/module-warnings.test
Removed:
llvm/trunk/test/tools/dsymutil/Inputs/modules/libstatic.a
llvm/trunk/test/tools/dsymutil/X86/modules-warnings.test
Modified:
llvm/trunk/tools/dsymutil/DwarfLinker.cpp
Added: llvm/trunk/test/tools/dsymutil/Inputs/module-warnings/1.o
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/dsymutil/Inputs/module-warnings/1.o?rev=270269&view=auto
==============================================================================
Binary files llvm/trunk/test/tools/dsymutil/Inputs/module-warnings/1.o (added) and llvm/trunk/test/tools/dsymutil/Inputs/module-warnings/1.o Fri May 20 15:36:06 2016 differ
Added: llvm/trunk/test/tools/dsymutil/Inputs/module-warnings/Bar.pcm
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/dsymutil/Inputs/module-warnings/Bar.pcm?rev=270269&view=auto
==============================================================================
Binary files llvm/trunk/test/tools/dsymutil/Inputs/module-warnings/Bar.pcm (added) and llvm/trunk/test/tools/dsymutil/Inputs/module-warnings/Bar.pcm Fri May 20 15:36:06 2016 differ
Added: llvm/trunk/test/tools/dsymutil/Inputs/module-warnings/Foo.pcm
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/dsymutil/Inputs/module-warnings/Foo.pcm?rev=270269&view=auto
==============================================================================
Binary files llvm/trunk/test/tools/dsymutil/Inputs/module-warnings/Foo.pcm (added) and llvm/trunk/test/tools/dsymutil/Inputs/module-warnings/Foo.pcm Fri May 20 15:36:06 2016 differ
Added: llvm/trunk/test/tools/dsymutil/Inputs/module-warnings/libstatic.a
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/dsymutil/Inputs/module-warnings/libstatic.a?rev=270269&view=auto
==============================================================================
Binary files llvm/trunk/test/tools/dsymutil/Inputs/module-warnings/libstatic.a (added) and llvm/trunk/test/tools/dsymutil/Inputs/module-warnings/libstatic.a Fri May 20 15:36:06 2016 differ
Removed: llvm/trunk/test/tools/dsymutil/Inputs/modules/libstatic.a
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/dsymutil/Inputs/modules/libstatic.a?rev=270268&view=auto
==============================================================================
Binary files llvm/trunk/test/tools/dsymutil/Inputs/modules/libstatic.a (original) and llvm/trunk/test/tools/dsymutil/Inputs/modules/libstatic.a (removed) differ
Added: llvm/trunk/test/tools/dsymutil/X86/module-warnings.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/dsymutil/X86/module-warnings.test?rev=270269&view=auto
==============================================================================
--- llvm/trunk/test/tools/dsymutil/X86/module-warnings.test (added)
+++ llvm/trunk/test/tools/dsymutil/X86/module-warnings.test Fri May 20 15:36:06 2016
@@ -0,0 +1,53 @@
+# Compile with:
+# cat >modules.modulemap <<EOF
+# module Foo {
+# header "Foo.h"
+# export *
+# }
+# module Bar {
+# header "Bar.h"
+# export *
+# }
+# EOF
+# echo 'typedef int bar;' >Bar.h
+# echo '@import Bar; typedef bar foo;' >Foo.h
+# echo '@import Foo; foo f() { return 0; }' >module-warnings.m
+# clang -cc1 -emit-obj -fmodules -fmodule-map-file=modules.modulemap \
+# -fmodule-format=obj -debug-info-kind=standalone -dwarf-ext-refs \
+# -fmodules-cache-path=ModuleCache \
+# -fdisable-module-hash module-warnings.m -o 1.o
+#
+# Test for module-related warnings.
+#
+# RUN: rm -rf %t.dir && mkdir %t.dir && mkdir %t.dir/ModuleCache
+# RUN: cp %p/../Inputs/module-warnings/1.o %t.dir
+# RUN: cp %p/../Inputs/module-warnings/Foo.pcm %t.dir/ModuleCache
+#
+# RUN: llvm-dsymutil -f -oso-prepend-path=%t.dir -y \
+# RUN: %p/dummy-debug-map.map -o %t 2>&1 | FileCheck %s
+#
+# Module-not-found should be reported only once.
+# The exact error message depends on the OS so we don't check for it.
+# CHECK: warning: {{.*}}Bar.pcm:
+# CHECK-NOT: warning: {{.*}}Bar.pcm:
+#
+# RUN: cp %p/../Inputs/module-warnings/libstatic.a %t.dir
+# RUN: llvm-dsymutil -f -oso-prepend-path=%t.dir -y %s -o %t 2>&1 | FileCheck %s
+# CHECK: rebuild the module cache
+# CHECK-NOT: static libraries
+#
+# RUN: rm -rf %t.dir/ModuleCache
+# RUN: llvm-dsymutil -f -oso-prepend-path=%t.dir -y %s -o %t 2>&1 \
+# RUN: | FileCheck %s --check-prefix=STATIC
+# STATIC: warning: {{.*}}Bar.pcm:
+# STATIC: note: Linking a static library
+# STATIC: warning: {{.*}}Foo.pcm:
+# STATIC-NOT: note:
+
+---
+triple: 'x86_64-apple-darwin'
+objects:
+ - filename: libstatic.a(1.o)
+ symbols:
+ - { sym: __Z3foov, objAddr: 0x0, binAddr: 0x10000, size: 0x10 }
+...
Removed: llvm/trunk/test/tools/dsymutil/X86/modules-warnings.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/dsymutil/X86/modules-warnings.test?rev=270268&view=auto
==============================================================================
--- llvm/trunk/test/tools/dsymutil/X86/modules-warnings.test (original)
+++ llvm/trunk/test/tools/dsymutil/X86/modules-warnings.test (removed)
@@ -1,26 +0,0 @@
-# Test for module-related warnings.
-# This reuses the inputs from the modules.m testcase.
-#
-# RUN: rm -rf %t.dir && mkdir %t.dir
-# RUN: cp %p/../Inputs/modules/1.o %p/../Inputs/modules/Foo.pcm %t.dir
-#
-# RUN: llvm-dsymutil -f -oso-prepend-path=%t.dir -y \
-# RUN: %p/dummy-debug-map.map -o %t 2>&1 | FileCheck %s
-#
-# Module-not-found should be reported only once.
-# The exact error message depends on the OS so we don't check for it.
-# CHECK: warning: {{.*}}Bar.pcm:
-# CHECK-NOT: warning: {{.*}}Bar.pcm:
-#
-# RUN: cp %p/../Inputs/modules/libstatic.a %t.dir
-# RUN: llvm-dsymutil -f -oso-prepend-path=%t.dir -y %s -o %t 2>&1 | FileCheck %s
-# CHECK: rebuild the module cache
-# CHECK-NOT: static libraries
-
----
-triple: 'x86_64-apple-darwin'
-objects:
- - filename: libstatic.a(1.o)
- symbols:
- - { sym: __Z3foov, objAddr: 0x0, binAddr: 0x10000, size: 0x10 }
-...
Modified: llvm/trunk/tools/dsymutil/DwarfLinker.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/dsymutil/DwarfLinker.cpp?rev=270269&r1=270268&r2=270269&view=diff
==============================================================================
--- llvm/trunk/tools/dsymutil/DwarfLinker.cpp (original)
+++ llvm/trunk/tools/dsymutil/DwarfLinker.cpp Fri May 20 15:36:06 2016
@@ -3302,7 +3302,6 @@ void DwarfLinker::loadClangModule(String
bool isClangModule = sys::path::extension(Filename).equals(".pcm");
bool isArchive = ObjFile.endswith(")");
if (isClangModule) {
- sys::path::remove_filename(Path);
StringRef ModuleCacheDir = sys::path::parent_path(Path);
if (sys::fs::exists(ModuleCacheDir)) {
// If the module's parent directory exists, we assume that the module
@@ -3320,8 +3319,11 @@ void DwarfLinker::loadClangModule(String
// was built on a different machine. We don't want to discourage module
// debugging for convenience libraries within a project though.
if (!ArchiveHintDisplayed) {
- errs() << "note: Module debugging should be disabled when shipping "
- "static libraries.\n";
+ errs() << "note: Linking a static library that was built with "
+ "-gmodules, but the module cache was not found. "
+ "Redistributable static libraries should never be built "
+ "with module debugging enabled. The debug experience will "
+ "be degraded due to incomplete debug information.\n";
ArchiveHintDisplayed = true;
}
}
More information about the llvm-commits
mailing list