Index: src/untrusted/irt_stub/nacl.scons |
diff --git a/src/untrusted/irt_stub/nacl.scons b/src/untrusted/irt_stub/nacl.scons |
index 4c51fe8f5eb75116f0c9494a9275bd971251d96d..596678c09e0b44139b21f6c71106f2e70cef6521 100644 |
--- a/src/untrusted/irt_stub/nacl.scons |
+++ b/src/untrusted/irt_stub/nacl.scons |
@@ -11,11 +11,7 @@ env.ComponentLibrary('libppapi_stub', [ |
'plugin_main_irt.c', |
'thread_creator.c' |
]) |
-env.AddLibraryToSdk(['libppapi_stub']) |
-env.AddObjectToSdk(['libppapi.a']) |
- |
-if not env.Bit('nacl_disable_shared'): |
- env.AddObjectToSdk(['libppapi.so']) |
+lib = env.AddLibraryToSdk(['libppapi_stub']) |
gap_env = env.Clone() |
gap_env.Append(CPPDEFINES=[ |
@@ -31,4 +27,22 @@ link_segment_gap = gap_env.ComponentObject( |
'link_segment_gap', |
'${SCONSTRUCT_DIR}/src/untrusted/irt/link_segment_gap.S' |
) |
-gap_env.AddObjectToSdk(link_segment_gap, is_platform=True) |
+gap_obj = gap_env.AddObjectToSdk(link_segment_gap, is_platform=True) |
+ |
+static_script = env.AddObjectToSdk(['libppapi.a']) |
+ |
+# Anything that links with -lppapi (i.e. ${PPAPI_LIBS}) needs not just the |
+# libppapi.a or libppapi.so linker script file, but also the object and |
+# library it refers to. By telling scons that libppapi.a depends on these |
+# objects, we ensure that it builds them before something using ${PPAPI_LIBS}. |
+script_deps = [gap_obj, lib] |
+env.Depends(static_script, script_deps) |
+ |
+# The static libppapi.a refers to libpthread.a, and in the non-glibc |
+# build, we are the one providing that too. |
+if not env.Bit('nacl_glibc'): |
+ env.Depends(static_script, env.File('${LIB_DIR}/libpthread.a')) |
+ |
+if not env.Bit('nacl_disable_shared'): |
+ dyn_script = env.AddObjectToSdk(['libppapi.so']) |
+ env.Depends(dyn_script, script_deps) |