OLD | NEW |
1 #!/usr/bin/python | 1 #!/usr/bin/python |
2 # Copyright (c) 2012 The Native Client Authors. All rights reserved. | 2 # Copyright (c) 2012 The Native Client Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 """NEXE building script | 6 """NEXE building script |
7 | 7 |
8 This module will take a set of source files, include paths, library paths, and | 8 This module will take a set of source files, include paths, library paths, and |
9 additional arguments, and use them to build. | 9 additional arguments, and use them to build. |
10 """ | 10 """ |
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
277 return self.GetBinName('ar') | 277 return self.GetBinName('ar') |
278 | 278 |
279 def GetStrip(self): | 279 def GetStrip(self): |
280 """Helper which returns strip path.""" | 280 """Helper which returns strip path.""" |
281 return self.GetBinName('strip') | 281 return self.GetBinName('strip') |
282 | 282 |
283 def GetObjCopy(self): | 283 def GetObjCopy(self): |
284 """Helper which returns objcopy path.""" | 284 """Helper which returns objcopy path.""" |
285 return self.GetBinName('objcopy') | 285 return self.GetBinName('objcopy') |
286 | 286 |
| 287 def GetLe32ObjDump(self): |
| 288 """Helper which returns objdump path.""" |
| 289 return os.path.join(self.toolbin, 'le32-nacl-objdump') |
| 290 |
287 def GetReadElf(self): | 291 def GetReadElf(self): |
288 """Helper which returns readelf path.""" | 292 """Helper which returns readelf path.""" |
289 return self.GetBinName('readelf') | 293 return self.GetBinName('readelf') |
290 | 294 |
291 def GetPnaclFinalize(self): | 295 def GetPnaclFinalize(self): |
292 """Helper which returns pnacl-finalize path.""" | 296 """Helper which returns pnacl-finalize path.""" |
293 assert self.is_pnacl_toolchain | 297 assert self.is_pnacl_toolchain |
294 return self.GetBinName('finalize') | 298 return self.GetBinName('finalize') |
295 | 299 |
296 def BuildAssembleOptions(self, options): | 300 def BuildAssembleOptions(self, options): |
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
598 if self.irt_linker: | 602 if self.irt_linker: |
599 if self.tls_edit is None: | 603 if self.tls_edit is None: |
600 raise Error('Linking the IRT requires tls_edit') | 604 raise Error('Linking the IRT requires tls_edit') |
601 irt_link_cmd = [sys.executable, self.irt_linker, | 605 irt_link_cmd = [sys.executable, self.irt_linker, |
602 '--output=' + out, | 606 '--output=' + out, |
603 '--tls-edit=' + self.tls_edit, | 607 '--tls-edit=' + self.tls_edit, |
604 '--link-cmd=' + bin_name, | 608 '--link-cmd=' + bin_name, |
605 '--readelf-cmd=' + self.GetReadElf()] | 609 '--readelf-cmd=' + self.GetReadElf()] |
606 if self.commands_are_scripts: | 610 if self.commands_are_scripts: |
607 irt_link_cmd += ['--commands-are-scripts'] | 611 irt_link_cmd += ['--commands-are-scripts'] |
| 612 if self.arch == 'x86-64': |
| 613 irt_link_cmd += ['--sandbox-base-hiding-check', |
| 614 '--objdump-cmd=' + self.GetLe32ObjDump()] |
608 irt_link_cmd += srcs_flags | 615 irt_link_cmd += srcs_flags |
609 err = self.Run(irt_link_cmd, normalize_slashes=False) | 616 err = self.Run(irt_link_cmd, normalize_slashes=False) |
610 if err: | 617 if err: |
611 raise Error('FAILED with %d: %s' % (err, ' '.join(irt_link_cmd))) | 618 raise Error('FAILED with %d: %s' % (err, ' '.join(irt_link_cmd))) |
612 return out | 619 return out |
613 | 620 |
614 MakeDir(os.path.dirname(out)) | 621 MakeDir(os.path.dirname(out)) |
615 cmd_line = [bin_name, '-o', out, '-Wl,--as-needed'] | 622 cmd_line = [bin_name, '-o', out, '-Wl,--as-needed'] |
616 cmd_line += srcs_flags | 623 cmd_line += srcs_flags |
617 | 624 |
(...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1020 if build is not None: | 1027 if build is not None: |
1021 build.EmitDeferredLog() | 1028 build.EmitDeferredLog() |
1022 return 1 | 1029 return 1 |
1023 except: | 1030 except: |
1024 if build is not None: | 1031 if build is not None: |
1025 build.EmitDeferredLog() | 1032 build.EmitDeferredLog() |
1026 raise | 1033 raise |
1027 | 1034 |
1028 if __name__ == '__main__': | 1035 if __name__ == '__main__': |
1029 sys.exit(Main(sys.argv)) | 1036 sys.exit(Main(sys.argv)) |
OLD | NEW |