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

Side by Side Diff: elf/nacl_fixup_ldso.py

Issue 21636003: Add a PT_NOTE section to mark build_id. (Closed) Base URL: http://git.chromium.org/native_client/nacl-glibc.git@master
Patch Set: fix trybots Created 7 years, 4 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
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
(...skipping 26 matching lines...) Expand all
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))
41 41
42 # sel_ldr only accepts ELF objects with e_type=ET_EXEC. 42 # sel_ldr only accepts ELF objects with e_type=ET_EXEC.
43 check("B", offset_e_type, ET_DYN) 43 check("B", offset_e_type, ET_DYN)
44 replace("B", offset_e_type, ET_EXEC) 44 replace("B", offset_e_type, ET_EXEC)
45 45
46 # sel_ldr rejects ELF Program Headers other than PT_LOAD. 46 # sel_ldr rejects ELF Program Headers other than PT_LOAD.
47 # Drop PT_DYNAMIC, PT_GNU_STACK and PT_TLS. 47 # Drop PT_DYNAMIC, PT_GNU_STACK and PT_TLS.
Mark Seaborn 2013/08/07 16:43:07 We should no longer need to do this. See service_
bradn 2013/08/07 18:30:02 Done.
48 fh.seek(offset_ei_class) 48 fh.seek(offset_ei_class)
49 elfclass = fh.read(1) 49 elfclass = fh.read(1)
50 if elfclass == elfclass32: 50 if elfclass == elfclass32:
51 check("H", offset_e_phnum32, 6) 51 check("H", offset_e_phnum32, 7)
52 replace("H", offset_e_phnum32, 3) 52 replace("H", offset_e_phnum32, 3)
53 elif elfclass == elfclass64: 53 elif elfclass == elfclass64:
54 check("H", offset_e_phnum64, 6) 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 | nacl/dyn-link/ldscripts/elf64_nacl.x » ('j') | nacl/dyn-link/ldscripts/elf64_nacl.x » ('J')

Powered by Google App Engine
This is Rietveld 408576698