Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright 2014 The Chromium Authors. All rights reserved. | 2 * Copyright 2014 The Chromium Authors. All rights reserved. |
| 3 * Use of this source code is governed by a BSD-style license that can be | 3 * Use of this source code is governed by a BSD-style license that can be |
| 4 * found in the LICENSE file. | 4 * found in the LICENSE file. |
| 5 */ | 5 */ |
| 6 | 6 |
| 7 /* | 7 /* |
| 8 * This is a minimal NaCl program without libc. It uses NaCl's stable IRT ABI. | 8 * This is a minimal NaCl program without libc. It uses NaCl's stable IRT ABI. |
| 9 */ | 9 */ |
| 10 | 10 |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 203 // Reply back with what we received. | 203 // Reply back with what we received. |
| 204 ppb_messaging->PostMessage(instance, message); | 204 ppb_messaging->PostMessage(instance, message); |
| 205 } else if (!my_strncmp("random", message_string, message_len)) { | 205 } else if (!my_strncmp("random", message_string, message_len)) { |
| 206 TestRandom(instance); | 206 TestRandom(instance); |
| 207 } else { | 207 } else { |
| 208 // Unknown message came. | 208 // Unknown message came. |
| 209 PostStringMessage(instance, "Unknown message type"); | 209 PostStringMessage(instance, "Unknown message type"); |
| 210 } | 210 } |
| 211 } | 211 } |
| 212 | 212 |
| 213 #if defined(__arm__) | |
| 214 // ARM GCC emits references to them. They should not be called unless | |
|
Mark Seaborn
2014/07/21 22:49:33
Hmm, where in the code do the references come from
hamaji
2014/07/22 08:17:23
They are in exidx section. Ah, -funwind-tables is
Mark Seaborn
2014/07/22 15:19:48
Yes, that's what we do for nacl_helper_bootstrap,
| |
| 215 // an exception occurs. We exit with a unique exit code just in case. | |
| 216 static const int kUnwindExitCode = 2; | |
| 217 void __aeabi_unwind_cpp_pr0() { __libnacl_irt_basic.exit(kUnwindExitCode); } | |
|
Mark Seaborn
2014/07/21 22:49:33
Nit: the function body should be on a separate lin
hamaji
2014/07/22 08:17:23
It seems ARM GCC uses abort() to implement __built
| |
| 218 void __aeabi_unwind_cpp_pr1() { __libnacl_irt_basic.exit(kUnwindExitCode); } | |
| 219 #endif | |
| 220 | |
| 213 void _start(uintptr_t info[]) { | 221 void _start(uintptr_t info[]) { |
| 214 Elf_auxv_t* auxv = nacl_startup_auxv(info); | 222 Elf_auxv_t* auxv = nacl_startup_auxv(info); |
| 215 grok_auxv(auxv); | 223 grok_auxv(auxv); |
| 216 DO_QUERY(NACL_IRT_BASIC_v0_1, __libnacl_irt_basic); | 224 DO_QUERY(NACL_IRT_BASIC_v0_1, __libnacl_irt_basic); |
| 217 DO_QUERY(NACL_IRT_RANDOM_v0_1, __libnacl_irt_random); | 225 DO_QUERY(NACL_IRT_RANDOM_v0_1, __libnacl_irt_random); |
| 218 | 226 |
| 219 struct nacl_irt_ppapihook ppapihook; | 227 struct nacl_irt_ppapihook ppapihook; |
| 220 DO_QUERY(NACL_IRT_PPAPIHOOK_v0_1, ppapihook); | 228 DO_QUERY(NACL_IRT_PPAPIHOOK_v0_1, ppapihook); |
| 221 | 229 |
| 222 /* This is local as a workaround to avoid having to apply | 230 /* This is local as a workaround to avoid having to apply |
| 223 * relocations to global variables. */ | 231 * relocations to global variables. */ |
| 224 struct PP_StartFunctions start_funcs; | 232 struct PP_StartFunctions start_funcs; |
| 225 start_funcs.PPP_InitializeModule = MyPPP_InitializeModule; | 233 start_funcs.PPP_InitializeModule = MyPPP_InitializeModule; |
| 226 start_funcs.PPP_ShutdownModule = MyPPP_ShutdownModule; | 234 start_funcs.PPP_ShutdownModule = MyPPP_ShutdownModule; |
| 227 start_funcs.PPP_GetInterface = MyPPP_GetInterface; | 235 start_funcs.PPP_GetInterface = MyPPP_GetInterface; |
| 228 /* Similarly, initialize some global variables, avoiding relocations. */ | 236 /* Similarly, initialize some global variables, avoiding relocations. */ |
| 229 ppp_instance.DidCreate = DidCreate; | 237 ppp_instance.DidCreate = DidCreate; |
| 230 ppp_instance.DidDestroy = DidDestroy; | 238 ppp_instance.DidDestroy = DidDestroy; |
| 231 ppp_instance.DidChangeView = DidChangeView; | 239 ppp_instance.DidChangeView = DidChangeView; |
| 232 ppp_instance.DidChangeFocus = DidChangeFocus; | 240 ppp_instance.DidChangeFocus = DidChangeFocus; |
| 233 ppp_instance.HandleDocumentLoad = HandleDocumentLoad; | 241 ppp_instance.HandleDocumentLoad = HandleDocumentLoad; |
| 234 ppp_messaging.HandleMessage = HandleMessage; | 242 ppp_messaging.HandleMessage = HandleMessage; |
| 235 | 243 |
| 236 ppapihook.ppapi_start(&start_funcs); | 244 ppapihook.ppapi_start(&start_funcs); |
| 237 | 245 |
| 238 __libnacl_irt_basic.exit(0); | 246 __libnacl_irt_basic.exit(0); |
| 239 } | 247 } |
| OLD | NEW |