Commit 2557970c authored by mmenke@chromium.org's avatar mmenke@chromium.org

Revert 282697 "Non-SFI NaCl: Fix browser_tests based on libc_free.c"

This broke LSAN.

http://build.chromium.org/p/chromium.memory/builders/Linux%20ASan%20LSan%20Builder/builds/9737/steps/compile/logs/stdio


> 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

TBR=hamaji@chromium.org

Review URL: https://codereview.chromium.org/385073010

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@282702 0039d316-1c4b-4281-b951-d872f2087c98
parent 37b64c55
...@@ -1139,11 +1139,6 @@ ...@@ -1139,11 +1139,6 @@
# Stack-Smashing protector does not work with libc-free context. # Stack-Smashing protector does not work with libc-free context.
'-fno-stack-protector', '-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!': [ 'cflags!': [
# We filter these out because release_extra_cflags or another # We filter these out because release_extra_cflags or another
...@@ -1153,14 +1148,10 @@ ...@@ -1153,14 +1148,10 @@
'-fstack-protector-all', '-fstack-protector-all',
'-fprofile-generate', '-fprofile-generate',
'-finstrument-functions', '-finstrument-functions',
'-O2',
], ],
'ldflags': [ 'ldflags': [
'-nostdlib', '-nostdlib',
'-shared', '-shared',
# This binary cannot relocate itself, so we should have no
# undefined references left.
'-Wl,--no-undefined',
], ],
'ldflags!': [ 'ldflags!': [
# Explicitly remove the -pthread flag to avoid a link time warning. # Explicitly remove the -pthread flag to avoid a link time warning.
......
...@@ -221,17 +221,24 @@ void _start(uintptr_t info[]) { ...@@ -221,17 +221,24 @@ void _start(uintptr_t info[]) {
/* This is local as a workaround to avoid having to apply /* This is local as a workaround to avoid having to apply
* relocations to global variables. */ * relocations to global variables. */
struct PP_StartFunctions start_funcs; struct PP_StartFunctions start_funcs = {
start_funcs.PPP_InitializeModule = MyPPP_InitializeModule; MyPPP_InitializeModule,
start_funcs.PPP_ShutdownModule = MyPPP_ShutdownModule; MyPPP_ShutdownModule,
start_funcs.PPP_GetInterface = MyPPP_GetInterface; MyPPP_GetInterface,
/* Similarly, initialize some global variables, avoiding relocations. */ };
ppp_instance.DidCreate = DidCreate; /* Similarly, initialise some global variables, avoiding relocations. */
ppp_instance.DidDestroy = DidDestroy; struct PPP_Instance_1_0 local_ppp_instance = {
ppp_instance.DidChangeView = DidChangeView; DidCreate,
ppp_instance.DidChangeFocus = DidChangeFocus; DidDestroy,
ppp_instance.HandleDocumentLoad = HandleDocumentLoad; DidChangeView,
ppp_messaging.HandleMessage = HandleMessage; DidChangeFocus,
HandleDocumentLoad,
};
ppp_instance = local_ppp_instance;
struct PPP_Messaging_1_0 local_ppp_messaging = {
HandleMessage,
};
ppp_messaging = local_ppp_messaging;
ppapihook.ppapi_start(&start_funcs); ppapihook.ppapi_start(&start_funcs);
......
...@@ -33,15 +33,24 @@ namespace { ...@@ -33,15 +33,24 @@ namespace {
# define MAYBE_SysconfNprocessorsOnln SysconfNprocessorsOnln # define MAYBE_SysconfNprocessorsOnln SysconfNprocessorsOnln
#endif #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, { NACL_BROWSER_TEST_F(NaClBrowserTest, SimpleLoad, {
RunLoadTest(FILE_PATH_LITERAL("nacl_load_test.html")); RunLoadTest(FILE_PATH_LITERAL("nacl_load_test.html"));
}) })
IN_PROC_BROWSER_TEST_F(NaClBrowserTestNonSfiMode, MAYBE_NONSFI(Messaging)) { IN_PROC_BROWSER_TEST_F(NaClBrowserTestNonSfiMode, MAYBE_Messaging) {
RunLoadTest(FILE_PATH_LITERAL("libc_free.html")); RunLoadTest(FILE_PATH_LITERAL("libc_free.html"));
} }
IN_PROC_BROWSER_TEST_F(NaClBrowserTestNonSfiMode, MAYBE_NONSFI(Irt)) { IN_PROC_BROWSER_TEST_F(NaClBrowserTestNonSfiMode, MAYBE_Irt) {
RunNaClIntegrationTest(FILE_PATH_LITERAL("irt_test.html")); RunNaClIntegrationTest(FILE_PATH_LITERAL("irt_test.html"));
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment