Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1112)

Unified Diff: src/untrusted/irt/nacl.scons

Issue 6839002: Pass -mtls-use-call when building libraries used in IRT. (Closed) Base URL: svn://svn.chromium.org/native_client/trunk/src/native_client
Patch Set: more comments; typo fix; conditionalize irt_tls.c vs bitcode Created 9 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/untrusted/irt/check_tls.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/untrusted/irt/nacl.scons
diff --git a/src/untrusted/irt/nacl.scons b/src/untrusted/irt/nacl.scons
index c50c859e9154c2846bf8717311f1df2dde49a541..82b69aff1a2f812ee74258ae8adbe57f0f9cb851 100644
--- a/src/untrusted/irt/nacl.scons
+++ b/src/untrusted/irt/nacl.scons
@@ -44,13 +44,36 @@ if asm_env.Bit('bitcode'):
asm_helper = asm_env.ComponentObject(
'elf_restart_%s.S' % env['TARGET_FULLARCH'].replace('-', '_'))
-files = ['irt_entry.c', 'irt_sbrk.c', 'irt_elf_utils.c', asm_helper]
-# TLS virtualisation only works on x86-64 currently.
-# TODO(mseaborn): Turn on "-mtls-use-call" for the relevant libraries
-# on x86-32 so that this works there too.
-if env.Bit('build_x86_64'):
+files = ['irt_entry.c',
+ 'irt_sbrk.c',
+ 'irt_elf_utils.c',
+ asm_helper]
+
+# The bitcode build does not yet use -mtls-use-call and so it improperly
+# pollutes user TLS with IRT-private TLS. But until that's fixed,
+# overriding the entry points with the irt_tls.c versions would cause a
+# mismatch where library code using (what should be reserved for) user TLS
+# will crash because it hasn't been initialized.
+if not env.Bit('bitcode'):
files.append('irt_tls.c')
-blob_env.ComponentProgram(
+
+irt_library = blob_env.ComponentProgram(
'irt.nexe', files,
- EXTRA_LIBS=['ppruntime', 'srpc', 'imc', 'platform', 'gio',
- 'pthread', 'm'])
+ EXTRA_LIBS=['ppruntime',
+ 'srpc',
+ 'imc',
+ 'platform',
+ 'gio',
+ 'pthread',
+ 'm'])
+
+if env.Bit('build_x86_32'):
Mark Seaborn 2011/04/13 23:27:34 Actually this is not right: it needs to be "env
+ # Make sure that the linked IRT nexe never uses TLS via %gs access.
+ # All IRT code must avoid direct use of the TLS ABI register, which
+ # is reserved for user TLS. Instead, ensure all TLS accesses use a
+ # call to __nacl_read_tp, which the IRT code overrides to segregate
+ # IRT-private TLS from user TLS.
+ node = env.CommandTest('irt_tls_test.out',
+ ['${PYTHON}', env.File('check_tls.py'),
+ '${OBJDUMP}', irt_library])
+ env.AddNodeToTestSuite(node, ['small_tests'], 'run_irt_tls_test')
« no previous file with comments | « src/untrusted/irt/check_tls.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698