| OLD | NEW |
| 1 #!/usr/bin/env python2 | 1 #!/usr/bin/env python2 |
| 2 | 2 |
| 3 import argparse | 3 import argparse |
| 4 import os | 4 import os |
| 5 import subprocess | 5 import subprocess |
| 6 import sys | 6 import sys |
| 7 import tempfile | 7 import tempfile |
| 8 | 8 |
| 9 import targets | 9 import targets |
| 10 from szbuild import LinkNonsfi | 10 from szbuild import LinkNonsfi |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 '-o=' + obj_sz, | 158 '-o=' + obj_sz, |
| 159 asm_sz]) | 159 asm_sz]) |
| 160 | 160 |
| 161 # Each separately translated Subzero object file contains its own | 161 # Each separately translated Subzero object file contains its own |
| 162 # definition of the __Sz_block_profile_info profiling symbol. Avoid | 162 # definition of the __Sz_block_profile_info profiling symbol. Avoid |
| 163 # linker errors (multiply defined symbol) by making all copies weak. | 163 # linker errors (multiply defined symbol) by making all copies weak. |
| 164 # (This could also be done by Subzero if it supported weak symbol | 164 # (This could also be done by Subzero if it supported weak symbol |
| 165 # definitions.) This approach should be OK because cross tests are | 165 # definitions.) This approach should be OK because cross tests are |
| 166 # currently the only situation where multiple translated files are | 166 # currently the only situation where multiple translated files are |
| 167 # linked into the executable, but when PNaCl supports shared nexe | 167 # linked into the executable, but when PNaCl supports shared nexe |
| 168 # libraries, this would need to change. | 168 # libraries, this would need to change. (Note: the same issue applies |
| 169 # to the __Sz_revision symbol.) |
| 169 shellcmd(['{bin}/{objcopy}'.format(bin=bindir, objcopy=GetObjcopyCmd()), | 170 shellcmd(['{bin}/{objcopy}'.format(bin=bindir, objcopy=GetObjcopyCmd()), |
| 170 '--weaken-symbol=__Sz_block_profile_info', | 171 '--weaken-symbol=__Sz_block_profile_info', |
| 172 '--weaken-symbol=__Sz_revision', |
| 171 '--strip-symbol=nacl_tp_tdb_offset', | 173 '--strip-symbol=nacl_tp_tdb_offset', |
| 172 '--strip-symbol=nacl_tp_tls_offset', | 174 '--strip-symbol=nacl_tp_tls_offset', |
| 173 obj_sz]) | 175 obj_sz]) |
| 174 objs.append(obj_sz) | 176 objs.append(obj_sz) |
| 175 shellcmd(['{bin}/pnacl-llc'.format(bin=bindir), | 177 shellcmd(['{bin}/pnacl-llc'.format(bin=bindir), |
| 176 '-arm-enable-dwarf-eh=1', | 178 '-arm-enable-dwarf-eh=1', |
| 177 '-mtriple=' + triple, | 179 '-mtriple=' + triple, |
| 178 '-externalize', | 180 '-externalize', |
| 179 '-filetype=obj', | 181 '-filetype=obj', |
| 180 '-bitcode-format=llvm', | 182 '-bitcode-format=llvm', |
| 181 '-o=' + obj_llc, | 183 '-o=' + obj_llc, |
| 182 bitcode] + llc_flags) | 184 bitcode] + llc_flags) |
| 183 shellcmd(['{bin}/{objcopy}'.format(bin=bindir, objcopy=GetObjcopyCmd()), | 185 shellcmd(['{bin}/{objcopy}'.format(bin=bindir, objcopy=GetObjcopyCmd()), |
| 184 '--weaken-symbol=__Sz_block_profile_info', | |
| 185 '--strip-symbol=nacl_tp_tdb_offset', | 186 '--strip-symbol=nacl_tp_tdb_offset', |
| 186 '--strip-symbol=nacl_tp_tls_offset', | 187 '--strip-symbol=nacl_tp_tls_offset', |
| 187 obj_llc]) | 188 obj_llc]) |
| 188 objs.append(obj_llc) | 189 objs.append(obj_llc) |
| 189 | 190 |
| 190 # Add szrt_sb_${target}.o or szrt_native_${target}.o. | 191 # Add szrt_sb_${target}.o or szrt_native_${target}.o. |
| 191 if not args.nonsfi: | 192 if not args.nonsfi: |
| 192 objs.append(( | 193 objs.append(( |
| 193 '{root}/toolchain_build/src/subzero/build/runtime/' + | 194 '{root}/toolchain_build/src/subzero/build/runtime/' + |
| 194 'szrt_{sb}_' + args.target + '.o' | 195 'szrt_{sb}_' + args.target + '.o' |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 259 objs.append(obj_llc) | 260 objs.append(obj_llc) |
| 260 if args.nonsfi: | 261 if args.nonsfi: |
| 261 LinkNonsfi(objs, os.path.join(args.dir, args.output), args.target) | 262 LinkNonsfi(objs, os.path.join(args.dir, args.output), args.target) |
| 262 elif args.sandbox: | 263 elif args.sandbox: |
| 263 LinkSandbox(objs, os.path.join(args.dir, args.output), args.target) | 264 LinkSandbox(objs, os.path.join(args.dir, args.output), args.target) |
| 264 else: | 265 else: |
| 265 LinkNative(objs, os.path.join(args.dir, args.output), args.target) | 266 LinkNative(objs, os.path.join(args.dir, args.output), args.target) |
| 266 | 267 |
| 267 if __name__ == '__main__': | 268 if __name__ == '__main__': |
| 268 main() | 269 main() |
| OLD | NEW |