Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 #!/usr/bin/python | |
| 2 | |
| 3 """ | |
| 4 Usage: | |
| 5 %s <objdump> <gas> | |
| 6 | |
| 7 Check out appropriate version of binutils, compile it and | |
| 8 copy objdump and gas binaries to specified places. | |
| 9 """ | |
| 10 | |
| 11 import sys | |
| 12 import os | |
| 13 import shutil | |
| 14 | |
| 15 CHECKOUT_DIR = '/dev/shm/binutils' | |
| 16 | |
| 17 BINUTILS_REPO = 'http://git.chromium.org/native_client/nacl-binutils.git' | |
| 18 BINUTILS_REVISION = '6993545d5650fa77e75e9ae4b52c5703a53c53cc' | |
| 19 | |
| 20 # We need specific revision of binutils, and it have to include the | |
| 21 # following patches: | |
| 22 # Add prefetch_modified - non-canonical encoding of prefetch | |
| 23 # | |
| 24 # Add lfence/mfence/sfence - non-canonical encodings. | |
|
khim
2012/08/08 13:40:24
After lond discussion we decided that this is not
Vlad Shcherbina
2012/08/08 13:46:52
Done.
| |
| 25 # | |
| 26 # Properly handle data16+rex.w instructions, such as | |
| 27 # 66 48 68 01 02 03 04 data32 pushq $0x4030201 | |
| 28 # | |
| 29 # We are not using head revision because decoder test depends | |
| 30 # on precise format of objdump output. | |
| 31 | |
| 32 | |
| 33 def Command(cmd): | |
| 34 result = os.system(cmd) | |
| 35 if result != 0: | |
| 36 print 'Command "%s" returned %s' % (cmd, result) | |
| 37 exit(result) | |
| 38 | |
| 39 | |
| 40 def main(): | |
| 41 if len(sys.argv) != 3: | |
| 42 print __doc__ % os.path.split(__file__)[1] | |
| 43 exit(1) | |
| 44 | |
| 45 if os.path.exists(CHECKOUT_DIR): | |
| 46 shutil.rmtree(CHECKOUT_DIR) | |
| 47 | |
| 48 Command('git clone %s %s' % (BINUTILS_REPO, CHECKOUT_DIR)) | |
| 49 | |
| 50 old_dir = os.getcwd() | |
| 51 try: | |
| 52 os.chdir(CHECKOUT_DIR) | |
| 53 Command('git checkout %s' % BINUTILS_REVISION) | |
| 54 | |
| 55 # to please make, set the same modification time | |
| 56 # for all files | |
| 57 Command('find . -print0 | xargs -0 touch -r .') | |
| 58 | |
| 59 # they both are required to make binutils, | |
| 60 # and when they are missing binutils's make | |
| 61 # error messages are cryptic | |
| 62 Command('flex --version') | |
| 63 Command('bison --version') | |
| 64 | |
| 65 Command('./configure') | |
| 66 Command('make') | |
| 67 finally: | |
| 68 os.chdir(old_dir) | |
| 69 | |
| 70 objdump, gas = sys.argv[1:] | |
| 71 shutil.copy(os.path.join(CHECKOUT_DIR, 'binutils', 'objdump'), objdump) | |
| 72 shutil.copy(os.path.join(CHECKOUT_DIR, 'gas', 'as-new'), gas) | |
| 73 | |
| 74 shutil.rmtree(CHECKOUT_DIR) | |
| 75 | |
| 76 print 'ok' | |
| 77 | |
| 78 | |
| 79 if __name__ == '__main__': | |
| 80 main() | |
| OLD | NEW |