summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhamaji@chromium.org <hamaji@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-07-11 21:06:15 +0000
committerhamaji@chromium.org <hamaji@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-07-11 21:06:15 +0000
commitc0bf7c29e2b0ca60021249ee7482dc19b4c71258 (patch)
tree25d9ba38896dd81bcda5ccf9cc69e220ddaab5b9
parent7cfd7fd8f2b73e45f115941f6f26697aea9cf7b7 (diff)
downloadchromium_src-c0bf7c29e2b0ca60021249ee7482dc19b4c71258.zip
chromium_src-c0bf7c29e2b0ca60021249ee7482dc19b4c71258.tar.gz
chromium_src-c0bf7c29e2b0ca60021249ee7482dc19b4c71258.tar.bz2
Non-SFI NaCl: Fix browser_tests based on libc_free.c
There were two issues with clang: - Clang emits .data.rel.ro.local for local struct values with an initializer, which lets the linker to emit a few relocation info. - In debug build, clang uses memcpy to copy a structure with five members. Neither -fno-builtin nor -ffreestanding did not prevent this issue. - In release build, clang translates for-loop based zero copy to memset. This patch initializes all structures without initializers or copy. This patch works with GYP_DEFINES=clang=0. To make sure we will not add memcpy or something in future, we will build libc_free.nexe with -Wl,--no-undefined. This also reverts https://codereview.chromium.org/386543002 to enable the disabled tests. BUG=392768 TEST=./out/Debug/browser_tests --gtest_filter='*NonSfi*Messaging*' Review URL: https://codereview.chromium.org/381883002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@282697 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/test/data/nacl/nacl_test_data.gyp9
-rw-r--r--chrome/test/data/nacl/nonsfi/libc_free.c29
-rw-r--r--chrome/test/nacl/nacl_browsertest.cc13
3 files changed, 22 insertions, 29 deletions
diff --git a/chrome/test/data/nacl/nacl_test_data.gyp b/chrome/test/data/nacl/nacl_test_data.gyp
index ea5e198..7127236 100644
--- a/chrome/test/data/nacl/nacl_test_data.gyp
+++ b/chrome/test/data/nacl/nacl_test_data.gyp
@@ -1139,6 +1139,11 @@
# Stack-Smashing protector does not work with libc-free context.
'-fno-stack-protector',
+ # Optimizers may translate the original code to code which
+ # requires builtin functions and/or relocations. Specifically,
+ # the LLVM's optimizer translates for-loop based zero
+ # clear to memset.
+ '-O0',
],
'cflags!': [
# We filter these out because release_extra_cflags or another
@@ -1148,10 +1153,14 @@
'-fstack-protector-all',
'-fprofile-generate',
'-finstrument-functions',
+ '-O2',
],
'ldflags': [
'-nostdlib',
'-shared',
+ # This binary cannot relocate itself, so we should have no
+ # undefined references left.
+ '-Wl,--no-undefined',
],
'ldflags!': [
# Explicitly remove the -pthread flag to avoid a link time warning.
diff --git a/chrome/test/data/nacl/nonsfi/libc_free.c b/chrome/test/data/nacl/nonsfi/libc_free.c
index ff3aef0..cc8eb83 100644
--- a/chrome/test/data/nacl/nonsfi/libc_free.c
+++ b/chrome/test/data/nacl/nonsfi/libc_free.c
@@ -221,24 +221,17 @@ void _start(uintptr_t info[]) {
/* This is local as a workaround to avoid having to apply
* relocations to global variables. */
- struct PP_StartFunctions start_funcs = {
- MyPPP_InitializeModule,
- MyPPP_ShutdownModule,
- MyPPP_GetInterface,
- };
- /* Similarly, initialise some global variables, avoiding relocations. */
- struct PPP_Instance_1_0 local_ppp_instance = {
- DidCreate,
- DidDestroy,
- DidChangeView,
- DidChangeFocus,
- HandleDocumentLoad,
- };
- ppp_instance = local_ppp_instance;
- struct PPP_Messaging_1_0 local_ppp_messaging = {
- HandleMessage,
- };
- ppp_messaging = local_ppp_messaging;
+ struct PP_StartFunctions start_funcs;
+ start_funcs.PPP_InitializeModule = MyPPP_InitializeModule;
+ start_funcs.PPP_ShutdownModule = MyPPP_ShutdownModule;
+ start_funcs.PPP_GetInterface = MyPPP_GetInterface;
+ /* Similarly, initialize some global variables, avoiding relocations. */
+ ppp_instance.DidCreate = DidCreate;
+ ppp_instance.DidDestroy = DidDestroy;
+ ppp_instance.DidChangeView = DidChangeView;
+ ppp_instance.DidChangeFocus = DidChangeFocus;
+ ppp_instance.HandleDocumentLoad = HandleDocumentLoad;
+ ppp_messaging.HandleMessage = HandleMessage;
ppapihook.ppapi_start(&start_funcs);
diff --git a/chrome/test/nacl/nacl_browsertest.cc b/chrome/test/nacl/nacl_browsertest.cc
index 695f967..28debdd 100644
--- a/chrome/test/nacl/nacl_browsertest.cc
+++ b/chrome/test/nacl/nacl_browsertest.cc
@@ -33,24 +33,15 @@ namespace {
# define MAYBE_SysconfNprocessorsOnln SysconfNprocessorsOnln
#endif
-// crbug.com/392768
-#if defined(OS_LINUX)
-# define MAYBE_Messaging DISABLED_Messaging
-# define MAYBE_Irt DISABLED_Irt
-#else
-# define MAYBE_Messaging MAYBE_NONSFI(Messaging)
-# define MAYBE_Irt MAYBE_NONSFI(Irt)
-#endif
-
NACL_BROWSER_TEST_F(NaClBrowserTest, SimpleLoad, {
RunLoadTest(FILE_PATH_LITERAL("nacl_load_test.html"));
})
-IN_PROC_BROWSER_TEST_F(NaClBrowserTestNonSfiMode, MAYBE_Messaging) {
+IN_PROC_BROWSER_TEST_F(NaClBrowserTestNonSfiMode, MAYBE_NONSFI(Messaging)) {
RunLoadTest(FILE_PATH_LITERAL("libc_free.html"));
}
-IN_PROC_BROWSER_TEST_F(NaClBrowserTestNonSfiMode, MAYBE_Irt) {
+IN_PROC_BROWSER_TEST_F(NaClBrowserTestNonSfiMode, MAYBE_NONSFI(Irt)) {
RunNaClIntegrationTest(FILE_PATH_LITERAL("irt_test.html"));
}