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

Unified Diff: src/untrusted/irt/check_tls.py

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
Index: src/untrusted/irt/check_tls.py
diff --git a/src/untrusted/irt/check_tls.py b/src/untrusted/irt/check_tls.py
new file mode 100644
index 0000000000000000000000000000000000000000..078ae69785e4f9d75777bf41a3b293d3c53c0b25
--- /dev/null
+++ b/src/untrusted/irt/check_tls.py
@@ -0,0 +1,29 @@
+# Copyright (c) 2011 The Native Client Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+# A simple program to run objdump on a file and assert that '%gs'
+# appears nowhere in it. This ensures that the direct register access
+# style of TLS is not being used in the IRT blob.
+
+import subprocess
+import sys
+
+
+def Main(args):
+ objdump = args[0]
+ obj_file = args[1]
+ assert(len(args) == 2)
+ proc = subprocess.Popen([objdump, '-d', obj_file], stdout=subprocess.PIPE)
+ for line in proc.stdout:
+ if '%gs' in line:
+ print '%gs use found: %s' % line
+ print 'This looks like an x86-32 direct TLS use.'
+ print 'Such uses are disallowed by the IRT execution context constraints.'
+ print 'These never happen if -mtls-use-call is used in the compilation.'
+ print 'Check that all libraries used in the IRT were compiled that way.'
+ sys.exit(1)
+
+
+if __name__ == '__main__':
+ Main(sys.argv[1:])

Powered by Google App Engine
This is Rietveld 408576698