summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/BUILD.gn2
-rw-r--r--chrome_elf/BUILD.gn5
-rw-r--r--chrome_elf/blacklist.gypi5
-rw-r--r--chrome_elf/elf_imports_unittest.cc32
4 files changed, 28 insertions, 16 deletions
diff --git a/chrome/BUILD.gn b/chrome/BUILD.gn
index b31d80f..b2ecaf4 100644
--- a/chrome/BUILD.gn
+++ b/chrome/BUILD.gn
@@ -434,7 +434,7 @@ if (is_mac || is_win) {
# full symbols, but does work in other cases, including minimal
# symbols.
configs -= [ "//build/config/win:default_incremental_linking" ]
- configs += [ "//build/config/win:incremental_linking" ]
+ configs += [ "//build/config/win:no_incremental_linking" ]
}
# TODO(GYP) bug 512851: PGO on Windows.
# ['chrome_pgo_phase==1', {
diff --git a/chrome_elf/BUILD.gn b/chrome_elf/BUILD.gn
index 4f9c747..3afa19b 100644
--- a/chrome_elf/BUILD.gn
+++ b/chrome_elf/BUILD.gn
@@ -106,12 +106,9 @@ static_library("blacklist") {
"blacklist/blacklist_interceptions.h",
]
deps = [
- # Depend on base_static, but do NOT take a dependency on base.gyp:base
- # as that would risk pulling in base's link-time dependencies which
- # chrome_elf cannot do.
":breakpad",
":constants",
- "//base:base_static",
+ "//base",
"//sandbox:sandbox",
]
}
diff --git a/chrome_elf/blacklist.gypi b/chrome_elf/blacklist.gypi
index 50d1a26..f552186 100644
--- a/chrome_elf/blacklist.gypi
+++ b/chrome_elf/blacklist.gypi
@@ -17,10 +17,7 @@
'blacklist/blacklist_interceptions.h',
],
'dependencies': [
- # Depend on base_static, but do NOT take a dependency on base.gyp:base
- # as that would risk pulling in base's link-time dependencies which
- # chrome_elf cannot do.
- '../base/base.gyp:base_static',
+ '../base/base.gyp:base',
'../chrome_elf/chrome_elf.gyp:chrome_elf_breakpad',
'../chrome_elf/chrome_elf.gyp:chrome_elf_constants',
'../sandbox/sandbox.gyp:sandbox',
diff --git a/chrome_elf/elf_imports_unittest.cc b/chrome_elf/elf_imports_unittest.cc
index 941c641..87a1f59 100644
--- a/chrome_elf/elf_imports_unittest.cc
+++ b/chrome_elf/elf_imports_unittest.cc
@@ -47,20 +47,35 @@ class ELFImportsTest : public testing::Test {
}
};
+// Run this test only in Release builds.
+//
+// This test makes sure that chrome_elf.dll has only certain types of imports.
+// However, it directly and indirectly depends on base, which has lots more
+// imports than are allowed here.
+//
+// In release builds, the offending imports are all stripped since this
+// depends on a relatively small portion of base. In GYP, this works in debug
+// builds as well because static libraries are used for the sandbox and base
+// targets and the files that use e.g. user32.dll happen to not get brought
+// into the build in the first place (due to the way static libraries are
+// linked where only the required .o files are included). But we don't bother
+// differentiating GYP and GN builds for this purpose.
+//
+// If you break this test, you may have changed base or the Windows sandbox
+// such that more system imports are required to link.
+#ifdef NDEBUG
TEST_F(ELFImportsTest, ChromeElfSanityCheck) {
- std::vector<std::string> elf_imports;
-
base::FilePath dll;
ASSERT_TRUE(PathService::Get(base::DIR_EXE, &dll));
dll = dll.Append(L"chrome_elf.dll");
+
+ std::vector<std::string> elf_imports;
GetImports(dll, &elf_imports);
// Check that ELF has imports.
ASSERT_LT(0u, elf_imports.size()) << "Ensure the chrome_elf_unittests "
"target was built, instead of chrome_elf_unittests.exe";
- std::vector<std::string>::iterator it(elf_imports.begin());
-
static const char* const kValidFilePatterns[] = {
"KERNEL32.dll",
"MSVC*",
@@ -74,15 +89,18 @@ TEST_F(ELFImportsTest, ChromeElfSanityCheck) {
};
// Make sure all of ELF's imports are in the valid imports list.
- for (; it != elf_imports.end(); it++) {
+ for (const std::string& import : elf_imports) {
bool match = false;
for (int i = 0; i < arraysize(kValidFilePatterns); ++i) {
- if (base::MatchPattern(*it, kValidFilePatterns[i]))
+ if (base::MatchPattern(import, kValidFilePatterns[i])) {
match = true;
+ break;
+ }
}
- ASSERT_TRUE(match) << "Illegal import in chrome_elf.dll: " << *it;
+ ASSERT_TRUE(match) << "Illegal import in chrome_elf.dll: " << import;
}
}
+#endif // NDEBUG
TEST_F(ELFImportsTest, ChromeExeSanityCheck) {
std::vector<std::string> exe_imports;