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

Side by Side Diff: elf/nacl_fixup_ldso.py

Issue 605943003: Whitespace change to bump glibc rev for nacl-gcc va_list ABI change. (Closed) Base URL: http://git.chromium.org/native_client/nacl-glibc.git@master
Patch Set: Created 6 years, 2 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 1
2 # Modifies ld.so's ELF Program Headers to get a version that NaCl's 2 # Modifies ld.so's ELF Program Headers to get a version that NaCl's
3 # sel_ldr will run. 3 # sel_ldr will run.
4 # 4 #
5 # For a discussion, see: 5 # For a discussion, see:
6 # http://code.google.com/p/nativeclient/issues/detail?id=156 6 # http://code.google.com/p/nativeclient/issues/detail?id=156
7 # http://code.google.com/p/nativeclient/issues/detail?id=558 7 # http://code.google.com/p/nativeclient/issues/detail?id=558
8 8
9 import struct 9 import struct
10 import sys 10 import sys
11 11
12 12
13 offset_e_type = 16 13 offset_e_type = 16
14 offset_e_phnum32 = 44 14 offset_e_phnum32 = 44
15 offset_e_phnum64 = 56 15 offset_e_phnum64 = 56
16 16
17 offset_ei_class = 4 17 offset_ei_class = 4
18 elfclass32 = "\001" 18 elfclass32 = "\001"
19 elfclass64 = "\002" 19 elfclass64 = "\002"
20 20
21 ET_EXEC = 2 21 ET_EXEC = 2
22 ET_DYN = 3 22 ET_DYN = 3
23 23
24 24
25 def main(args): 25 def main(args):
26 if len(args) != 1: 26 if len(args) != 1:
27 raise Exception("Usage: fixup <filename>") 27 raise Exception("Usage: fixup <filename>")
28 filename = args[0] 28 filename = args[0]
29 fh = open(filename, "r+") 29 fh = open(filename, "r+")
30 30
Mark Seaborn 2014/10/07 21:58:29 Nit: is there still trailing whitespace here? You
jvoung (off chromium) 2014/10/07 23:04:21 Done
31 def check(ty, offset, expected): 31 def check(ty, offset, expected):
32 fh.seek(offset) 32 fh.seek(offset)
33 data = fh.read(struct.calcsize(ty)) 33 data = fh.read(struct.calcsize(ty))
34 got = struct.unpack(ty, data)[0] 34 got = struct.unpack(ty, data)[0]
35 if got != expected: 35 if got != expected:
36 raise AssertionError("Expected %s, got %s" % (expected, got)) 36 raise AssertionError("Expected %s, got %s" % (expected, got))
37 37
38 def replace(ty, offset, value): 38 def replace(ty, offset, value):
39 fh.seek(offset) 39 fh.seek(offset)
40 fh.write(struct.pack(ty, value)) 40 fh.write(struct.pack(ty, value))
(...skipping 13 matching lines...) Expand all
54 check("H", offset_e_phnum64, 7) 54 check("H", offset_e_phnum64, 7)
55 replace("H", offset_e_phnum64, 3) 55 replace("H", offset_e_phnum64, 3)
56 else: 56 else:
57 raise AssertionError("Unknown ELF class in file %s." % filename) 57 raise AssertionError("Unknown ELF class in file %s." % filename)
58 58
59 fh.close() 59 fh.close()
60 60
61 61
62 if __name__ == "__main__": 62 if __name__ == "__main__":
63 main(sys.argv[1:]) 63 main(sys.argv[1:])
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698